10 Replies - 1396 Views - Last Post: 07 March 2013 - 08:56 PM

#1 Norman_Bates  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 26-February 13

Force Crash

Posted 05 March 2013 - 05:53 PM

Hi guys,

I was wondering if anyone would be able to create me a simple application that will crash on start up?

I don't want it to do anything other than crash itself and report back to Task Manager that it isn't responding.

The reason I ask for this is because I am making an application that monitors a given process (the user chooses that) and if the application stops responding it kills the process then re-starts it for them.

I have the restarting bit all good and well, I just need to test the crash detection because I'm using the process' responding state and i want to make sure I have my logic structures in right to detect a crash.

Ta muchly :)

Is This A Good Question/Topic? 0
  • +

Replies To: Force Crash

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5476
  • View blog
  • Posts: 11,762
  • Joined: 02-June 10

Re: Force Crash

Posted 05 March 2013 - 06:15 PM

If you want a crash, just make a little app that throws an exception.
If you want a 'not responding' just make a little app that is stuck in an infinite loop.
Was This Post Helpful? 0
  • +
  • -

#3 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,279
  • Joined: 28-March 11

Re: Force Crash

Posted 05 March 2013 - 08:14 PM

www.gunnerinc.com/files/Crash.zip
Was This Post Helpful? 0
  • +
  • -

#4 Norman_Bates  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 26-February 13

Re: Force Crash

Posted 06 March 2013 - 01:29 AM

View PosttlhIn`toq, on 05 March 2013 - 06:15 PM, said:

If you want a crash, just make a little app that throws an exception.
If you want a 'not responding' just make a little app that is stuck in an infinite loop.



So something like this?

[CODE]
Dim myVar as Integer
Dim myVar1 as integer

myVar = myVar1

While myVar = myVar1
myVar += 1
myVar1 +=1
While myVar1 = myVar
myVar +=1
myVar1 += 1
Loop
Loop
Was This Post Helpful? 0
  • +
  • -

#5 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 1949
  • View blog
  • Posts: 4,049
  • Joined: 11-December 07

Re: Force Crash

Posted 06 March 2013 - 05:11 AM

What's wrong with

while true
loop

Was This Post Helpful? 1
  • +
  • -

#6 Norman_Bates  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 26-February 13

Re: Force Crash

Posted 06 March 2013 - 05:53 AM

View Postcfoley, on 06 March 2013 - 05:11 AM, said:

What's wrong with

while true
loop


I didn't think of that! Brilliant thanks!
Was This Post Helpful? 0
  • +
  • -

#7 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5800
  • View blog
  • Posts: 12,636
  • Joined: 16-October 07

Re: Force Crash

Posted 06 March 2013 - 08:23 AM

An infinite loop isn't quite a crash. Now, if you keep asking for resources, then you're on your way. Two quickies.

int main() {
	char allocateSomething[2000];
	main();
	return 0;
}



That will probably fry your stack before your heap, but it will die with gusto.

Another kind of death:
int main() {
	char *foo = "666";
	foo[0] = 7;
	return 0;
}



That should get a security violation.

Have fun.
Was This Post Helpful? 0
  • +
  • -

#8 Norman_Bates  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 26-February 13

Re: Force Crash

Posted 06 March 2013 - 08:39 AM

Thanks baavgai, but if I were to code it I would need VB code. However, the infinite loop does cause it to stop responding and report that to task manager so I am gonna go with cfoley's suggestion. Thanks anyway guys, if I knew how to mark this as resolved I would.

Ta muchly :)
Was This Post Helpful? 0
  • +
  • -

#9 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5800
  • View blog
  • Posts: 12,636
  • Joined: 16-October 07

Re: Force Crash

Posted 06 March 2013 - 08:53 AM

If it's VB.NET then it's a incomplete test. Anything in the .NET framework would be. Managed apps can only do so much damage. Unmanaged would also be needed.

If it's VB6 then it's time to move into this century.
Was This Post Helpful? 1
  • +
  • -

#10 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3549
  • View blog
  • Posts: 10,989
  • Joined: 05-May 12

Re: Force Crash

Posted 06 March 2013 - 08:55 PM

LOL! You don't need to write a custom app. Just launch Visual Studio 2008. On it's own it either just crashes or stops responding. :)
Was This Post Helpful? 0
  • +
  • -

#11 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Force Crash

Posted 07 March 2013 - 08:56 PM

A very simple way to crash:
Sub Crash()
Crash()
End Sub

This post has been edited by BobRodes: 07 March 2013 - 08:57 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1