BlitzMax Debugger

BlitzMax Forums/BlitzMax Programming/BlitzMax Debugger

Eikon(Posted 2006) [#1]
I am working on an IDE for BlitzMax that is soon to enter the testing phase. One of the aspects of the project that I have continually put off is getting the debugger to work correctly.

As I have it now, I am capturing the output from bmk.exe and showing it in my output text area. This is fine for normal compiling and error catching, but when you get an unhandled memory exception, you need to turn to debug mode. With debug enabled, instead of a memory exception being returned, I am getting a stream of "~>" characters until I halt execution.

If anyone can shed some light on returning proper debug error messages, please help if you can. I am especially interested in the advice of those who have written Max IDEs (simon, ziggy)


klepto2(Posted 2006) [#2]
Sorry, but I haven't much time yet, but will go further in detail tomorrow.
Here is a small example on how to read debugdata, I have done this for the german comunity as part of a "manual debugging" tutorial.
It is mostly a extern Debugger, which allows you to get enhanced errormessages from your developed BMax Application.





The first code is the extern debugger, the 2nd is a test app, which forces an error. The 2nd code has to be build in debugmode.


Eikon(Posted 2006) [#3]
Thanks for that. The IDE is written in VB, but I'm sure I'll be able to sort out the code for it. Any other code/advice is still welcome, I need all I can get.


ziggy(Posted 2006) [#4]
To be honst, I can't remember right now how the debug information was called (it was sending a command throug the standard input stream of the running app). the best advice I can give is, run a BlitxMax debug application from the command prompt, to see all the 'debuging protocol' in details (how it works, how the data is presented, etc.)


Matthew Smith(Posted 2006) [#5]
Eikon,

Having taken a look myself, the best starting place is the Max IDE source - it will give you a good basis for writing one.

The biggest problem is updating the debugger tree as everything comes through the output, which you then need to process. You will also need to send through your own commands to get the detailed trace information. You need to also consider how much of the trace to output because a fairly large project may take a while to parse (talking seconds to process) - this part I'm still working with.

Good luck!


Eikon(Posted 2006) [#6]
Thanks for all the help, guys. I thought I had it figured out, but have run into another brick wall. I am now able to communicate with bmk.exe and send it a 't', which I think is supposed to return the error information
(VB6 Code)            
If InStr(1, sOutput$, "Unhandled Exception") And frmMain.mnuDebug.Checked = True And DebugOn = False Then  ' Debug
     WriteFile hWritePipe2, "t", 1, tmpLen, CLng(0)
End If
After sending it the char, I now get more output:
~>Unhandled Exception:Attempt to access field or method of Null object
~>
that's the proper error msg, the only problem is that the output stops coming after this. From the examples, it appears that you should be able to get the line number and col for the error, etc. after you send the 't'. What do I need to do next to continue receiving data?


klepto2(Posted 2006) [#7]
Hi, again. Check your mails, I have send you a VB 2005 snippet, about how I'm managing debug in my IDE.
But check for the following in your code:
Use WriteLine instead of Writefile or add a Chr(13) & Chr(10) after the t.


Eikon(Posted 2006) [#8]
I got your mail, Klepto. Thanks for that.

Since I could never successfully send a message to bmk from StdIn in VB6, I decided to modify your BlitzMax source to create an external debugger that outputs the error information for me. It gets called behind the scenes from VB, then I capture the output and return the error information, file name, and line/col info.

I don't have full debug support yet (stop, step, etc), but hopefully this will be enough for the initial release of the IDE for testing.