Jump to content
Sign in to follow this  
Gazoo

How about a Debugger tutorial?

Recommended Posts

I posted this in a different thread, but no one responded, so I'll try it in a thread of it's own.



Something that would be nice to have is some sort of tutorial on using a debugger. I've never been able to figure out how they work after numerous attempts over the years. I've always relied on seeing the results of the code I've written to determine where an error might be, then going back to look at the code where the program went astray and altering it until I got the results I was looking for. I know some of you guys here know how to use a debugger, so how about a tutorial?



Gazoo


Share this post


Link to post
Share on other sites

Dunno if a general tutorial on a debugger would make a lot of sense.

 

To use a debugger you have to get used to its actual implementation (e.g. using classic99's debugger or MG explorer).

Nothing really magical about a debugger.

 

Nonetheless all implementations basically concentrate on the below:

  • Possible to single-step through code (=run a single instruction at a time) or run up to a previously set breakpoint
  • Looking at (or changing) register values
  • Looking at (or changing) memory locations

 

The rest basically are just more advanced variants based on the above concepts:

  • Break at a specific breakpoint only if a certain condition is met (e.g. register value equals XYZ)
  • Watch variables
  • Trace code as it runs
  • Use of symbol table to see label/variable names instead of memory addresses
  • Map source code lines to assembly instructions
  • ...

Probably forgot to mention some stuff, but I'm sure others will chime in ;)

 

 

EDIT: Having said all the above, I really appreciate classic99's debugger, it's a lifesaver! I would not have been able to write/debug my assembly code without it. So thank you Tursi ;)

Edited by retroclouds
  • Like 2

Share this post


Link to post
Share on other sites

Unless of course you mean how to use a debugger on real hardware :) Don't know if anybody these days does that, but I still do on occasion, primarily for hardware projects where the code cannot be tested under emulation. My favorite remains Super Bug II. User friendly it is not, but it does work quite well once you get used to its commands.

I could create a short YouTube video on it if there is a demand.

Share this post


Link to post
Share on other sites

Unless of course you mean how to use a debugger on real hardware :) Don't know if anybody these days does that, but I still do on occasion, primarily for hardware projects where the code cannot be tested under emulation. My favorite remains Super Bug II. User friendly it is not, but it does work quite well once you get used to its commands.

I could create a short YouTube video on it if there is a demand.

 

Any sort of help would be appreciated. Classic99 or MESS implementation would be fine. About the only thing I've managed to figure out is how to get a memory dump in Classic99, which isn't always a whole lot of help.

 

Thanks,

 

Gazoo

Share this post


Link to post
Share on other sites

The most important thing to know about the Classic99 debugger is that you must activate Scroll Lock on you keyboard before any breakpoints will work.

  • Like 1

Share this post


Link to post
Share on other sites

The most important thing to know about the Classic99 debugger is that you must activate Scroll Lock on you keyboard before any breakpoints will work.

 

Ohhhhhh....

post-27864-0-76115800-1423421790_thumb.jpg

Share this post


Link to post
Share on other sites

The most important thing to know about the Classic99 debugger is that you must activate Scroll Lock on you keyboard before any breakpoints will work.

Yeah, why is that? Somehow I always need a bit to recall that. Especially if I haven't used the Debugger for a while :-)

Share this post


Link to post
Share on other sites

Indeed. TurboForth would not have been written without it!

 

Same here with fbForth 1.0 and 2.0—especially, 2.0. The mapping to ALC (“disasm” mode) was particularly helpful for probing the parts written in ALC. Troubleshooting high-level Forth has another layer of difficulty with the Forth address interpreter thrown into the mix; but, the Classic99 debugger was still invaluable—just a slower process than with pure ALC.

 

...lee

Share this post


Link to post
Share on other sites

Yeah, why is that? Somehow I always need a bit to recall that. Especially if I haven't used the Debugger for a while :-)

 

Legacy code, originally scroll lock enabled/disabled debug functionality, before the debug dialog was well-formed. I liked the behavior so I kept it. (It also changes the FCTN keys from ALT+number to emulator/debugger commands.) I talked about changing it at some point to using the presence of the debug dialog instead, but never did it.

Share this post


Link to post
Share on other sites

Gazoo, while it's not a debugger tutorial per sae, if you browse my Youtube page there are a couple of relevant videos - one showing how to use the debugger to hack Alpiner, and another just showing Classic99 tricks in general (read the description and you can skip to the debugger parts). Maybe that will help.

 

https://www.youtube.com/user/tursilion/videos?sort=dd&view=0&shelf_id=2

Share this post


Link to post
Share on other sites

 

Legacy code, originally scroll lock enabled/disabled debug functionality, before the debug dialog was well-formed. I liked the behavior so I kept it. (It also changes the FCTN keys from ALT+number to emulator/debugger commands.) I talked about changing it at some point to using the presence of the debug dialog instead, but never did it.

 

Actually, I see the utility of it. While I was debugging my sound test cartridge I needed to debug the sound player and sprite motion which are both IRQ-based. (Is that a proper term in 9900-land?) Anyway, having a breaking point in the ISR meant the program stopped every interrupt which was way too often for what I was trying to watch. Being able to turn break-points on and off at whim is very useful, especially with a single keystroke.

  • Like 1

Share this post


Link to post
Share on other sites

Is there a way to see the VDP ram and registers in M.E.S.S. in addition to the CPU?
I read something about that in the release notes.

I also highly vote for debugging tutorials. Will come up with something if nobody wants to start off.

Share this post


Link to post
Share on other sites

Hi Klaus,

 

You can see VDP RAM when you open a memory viewer window (Ctrl-m) and select the video memory in the drop-down list.

 

BTW, I'm currently on vacation in Austria (Bad Hofgastein), that is, I'm away from my PC, so I cannot be more precise.

Edited by mizapf
  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...