Debug app stuck in processes list

BlitzMax Forums/BlitzMax Programming/Debug app stuck in processes list

Grey Alien(Posted 2008) [#1]
Is there some reason why a debug app stays in the Task Manager processes list when an error occurs? (when you run it externally from the IDE) Is it because it's looking for the IDE or something?

This is a shame as I'd like to be able to send people a debug app to get more meaningful error messages (this works already with some code I have), but if it doesn't shut down automatically they'll have to manually kill it themselves when it freezes.

try this compiled as a debug app and compare to a non-debug app:

Graphics 400,300

Local divisor = 0
Local result = 10/divisor


While Not KeyHit(Key_ESCAPE)
	Cls
	DrawText result,0,0
	Flip
Wend



If anyone knows, prey tell. Thanks!


Brucey(Posted 2008) [#2]
It's waiting for console input - which, if you've run it from anywhere other than a console window it's going to be waiting a while ;-)

I dunno if you can override the "wait for input" functionality programmatically, but your other option might be to create a small app which runs your game, acting like an IDE, catching the failure and dying gracefully - or even extracting variable details and whatnot...


Grey Alien(Posted 2008) [#3]
I see. Does console equate to "Command Prompt" or not? Maybe there's a way I can launch it via a batch file somehow? Would be easier than making another app to launch it (maybe). Already I can capture and display proper debug error messages but the app won't ever shut down.

It's not a big issue for me now, I'm just curious.


Brucey(Posted 2008) [#4]
Yep... run a breaking debug app from the command line and see what happens :-)


Grey Alien(Posted 2008) [#5]
Just tested running from command line (the code from above). It still stays running so that doesn't work.


Brucey(Posted 2008) [#6]
Interesting :-)

On Mac that example nukes with Floating Point Exception, which isn't a normal debugger exception. I guess it bypassed the usual "catchall".


Grey Alien(Posted 2008) [#7]
That is strange as it should be a divide be zero error!


Scaremonger(Posted 2008) [#8]
Even in the IDE it remains in process, but if you put it in a Try-Catch it doesn't.

Graphics 400 , 300
Local divisor = 0
Local result

  Try
    result = 10 / divisor
  Catch o:Object
    Notify "It failed~n" + o.tostring() 
    End
  EndTry

While Not KeyHit(Key_ESCAPE)
  cls
  DrawText result , 0 , 0
  Flip
Wend


But it's odd that it's an Exception, and not a Divide by Zero...


Grey Alien(Posted 2008) [#9]
Ah yes, I forgot that I'm using Try Catch anyway in my final releases...


Dreamora(Posted 2008) [#10]
Perhaps it is some kind of IDE problem and not one of the debug mode or the like ... so far I haven't seen any case where that didn't bomb out with the exceptions, in debug as in release but I am always on blide which itself catches the debug output ...

and we all know that MaxIDEs treeview tends to break from time to time during debug ... wouldn't be the first time that it is actually the IDE that is just blocking it by not passing through the exception.


Grey Alien(Posted 2008) [#11]
The problem is that when the debug app is run outside of the IDE it doesn't shut down, it keeps on running.


Dreamora(Posted 2008) [#12]
when you run it outside the IDE, did you make sure you build a console app and not a GUI one?


ziggy(Posted 2008) [#13]
I would seriously recomend a MaxGui app, that launches your debug one, and uses the Process class to deal with debug messages due standardIO pipes. It may sound more complicated than it really is, and you would have the control to manually halt the offending application if needed, or send a Q (CR) command to shut it down if requested. anyway, creating a console build, and running it shouldn't leave the application running when the debug session is properly ended from the console


klepto2(Posted 2008) [#14]
As Ziggy mentioned, the best is to have an external starter.

Here is a sample code:
http://www.blitzforum.de/upload/file.php?id=2210

There are 2 files one of it is the real app and the other one is the external debugger. At first you have to build the real app in debug mode. In this version the exe is incbined in the exdebugger and extracted in runtime.
Build the exdebugger in release mode and instead of the real exe start the Exdebugger.exe and you will see the errormessage.

I hope this helps you a bit :)


Grey Alien(Posted 2008) [#15]
when you run it outside the IDE, did you make sure you build a console app and not a GUI one?
Ah good point, I'm running it as a GUI app.

ziggy and klepto2: Thanks for the other info about external starters!