What's new

Debugging techniques

blueshogun96

A lowdown dirty shame
Haven't been here in months, so I guess it's time to post again :)

Anyway, I was hoping to have a little disscussion on debugging your emulator. I noticed that many emu authors write disassemblers with a Win32 GUI for it too along side of using log files. I've been trying to do the same for my emulator (using a list box), but my problem is how can I fit the whole 4GB address space without it taking hours for it to load? Or am I just better off just including only the executable memory/sections in the disassembly? My Win32 skills are a bit rusty (more than they should) and is there a better alternative to the list box? Thanks.
 

smcd

Active member
One option is definitely only loading code sections for disassembly. Another is using something memory-mapped file I/O and disassembling on-the-fly by grabbing a couple of "pages" at a time or perhaps some combination of the two. I'm no guru on the subject though :) As for list box replacement... not sure. You can always learn more than most people care to and make a custom control :D

I'd suggest reviewing a couple emulators with debuggers if the source is available to see how they do it.
 

Exophase

Emulator Developer
If I were you I'd just disassemble what's to be shown in the window in real time. That shouldn't take any real amount of time to do.

Personally, I've only done text/command based disassemblers and although visual ones have their benefits so do command based ones.
 

Cyberman

Moderator
Moderator
Some how I missed this. What I have done is to use a monster draw grid with a custom draw method. You may wish to have the Address then hex then disassembly then any comments the disassembler can make to help with the code being dumped. As both the other people have said you can disassemble in real time (very useful that). You may also wish to switch to a hex data view etc. The advantage of a draw grid is you can choose the number of rows you want. Even grow the count as needed. You may wish to keep a linked list of disassembled information. Using a has of the current row etc. When you grow you can 'rehash' all your references as needed. Have fun :D Cyb
 

Top