This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Best debugger?

Best debugger?
by on (#177776)
It seems like there's a small handful of NES emulators that have debugging capabilities in them. I'm curious which people think are "the best" these days?

I'm looking for the best debugging tools more than I'm concerned (right now) with tiny differences in accuracy. Some things I'd love, despite thinking these probably aren't all available in any one debugger:

- automatically loading my map file so that symbol names are available in the debugger
- name table/bg viewer that includes a frame to show the current scroll position (like fceux does), as well as letting me click a cell and it shows me what address maps to it
- easy viewing/editing of RAM
- a "step by one frame" button (like the Atari Stella emulator has)
- runs in Linux (or at least wine)

That all being said, what emulators' debuggers are best right now?

(And are there other super-helpful features that are not obvious in your favorite debugger?)
Re: Best debugger?
by on (#177779)
As far as I know, the current NES debuggers are:
• FCEUX (only the windows build). Works fine in wine.
• Nintendulator (windows). Newest builds work fine in wine. Slightly older ones with older builds of wine have a problem¹ in the keyboard configuration dialog.
• Thefox's NintendulatorDX fork, which added a lot of useful things for dev. Based on a slightly older build of Nintendulator, so is more likely to tickle the above bug. What I'd recommend.
• MAME/MESS's debugger (cross platform)
• Mednafen's debugger (cross platform)
• cpow's NESicIDE (cross platform)
• NO$NES (windows). Almost always works fine in wine.

¹: See viewtopic.php?p=172275#p172275 . Otherwise see viewtopic.php?p=127814#p127814 .
Re: Best debugger?
by on (#177780)
What's your opinion of no$nes? It has a few of the things I was looking for (particularly a pretty solid vram PPU viewer).

Nothing I've seen yet uses my symbols/names from my source or mapfile :-/
Re: Best debugger?
by on (#177781)
I use FCEUX's debugger on a daily basis, and it's my favourite of them. (Sometimes I use Nintendulator instead, for specific tasks.)

You can create label files that will show up in the debugger. There's a python script in an ca65 code example I wrote a while back that shows how to translate ca65 outputs into FCEUX's label files. (The file format is documented.)

I think NESICIDE has something that will do integrated source debugging, but I've never used it.
Re: Best debugger?
by on (#177782)
rainwarrior wrote:
You can create label files that will show up in the debugger. There's a python script in an ca65 code example I wrote a while back that shows how to translate ca65 outputs into FCEUX's label files. (The file format is documented.)


Ok, that's awesome, and sounds like exactly what I'm looking for. I'll take a look and see if I can get it integrated into what I'm doing. Thanks!
Re: Best debugger?
by on (#177783)
I took a look at No$nes' debugger. It doesn't seem great to me.

It has a lot of strange names for instructions (e.g. "MOV" or "JNZ"), which is confusing to me. Is it adapting some other CPU's terminology to the 6502?

The VRAM viewer is alright. There's nothing here that Nintendulator doesn't have AFAIK, and the only thing FCEUX doesn't have is the OAM viewer (that's one of the things that I use Nintendulator for sometimes). I don't like that it's tabbed, though; in FCEUX or Nintendulator you can view all of these simultaneously, but No$nes it's only one at a time. (In Nintendulator you can only view 1/4 of nametable space at a time, though, which is a disadvantage for it.)

Lastly there is a loud constant high frequency tone playing when any game is running in No$nes. I don't know if this happens to anybody else, but it's very irritating to me.
Re: Best debugger?
by on (#177786)
Another thing I think is missing in Nintendulator is the ability to pick the time at which to sample the PPU for the debug information. Many games use raster effects, CHR switching and whatnot, that end up showing just garbage or even nothing at all when debugged in Nintendulator.

In FCEUX you can pick the scanline where the PPU data is sampled, and that makes all the difference. Unfortunately, FCEUX is missing an OAM viewer, but other than that it has everything I ever needed to debug NES games. It's not a particularly accurate emulator though, so fine timing adjustments for PPU stuff is definitely something you don't want to use it for.
Re: Best debugger?
by on (#177787)
rainwarrior wrote:
It has a lot of strange names for instructions (e.g. "MOV" or "JNZ"), which is confusing to me. Is it adapting some other CPU's terminology to the 6502?

Yeah, for some reason the creator dislikes the official 6502 syntax so apparently he always uses his own, based off one from some other CPU. If I'm not mistaken, he even wrote a full game using that syntax, his "Magic Floor" game, which AFAIK is the only PRG-ROM-only game, using the internal VRAM for patterns as well as name tables.
Re: Best debugger?
by on (#177790)
tokumaru wrote:
he always uses his own, based off one from some other CPU.

That other CPU would be x86.

At least NO$SNS (and I think NO$PSX, and probably others) have a setting for using the "native" syntax. It's not just 6502 that got the treatment. :)
Re: Best debugger?
by on (#177792)
rainwarrior wrote:
I took a look at No$nes' debugger. It doesn't seem great to me.

It has a lot of strange names for instructions (e.g. "MOV" or "JNZ"), which is confusing to me. Is it adapting some other CPU's terminology to the 6502?

I don't have No$nes installed, instead using FCEUX, but in No$sns you can turn off the x86 drag in it's Options > Debugger Setup > Disassembler Syntax.
Re: Best debugger?
by on (#178096)
tepples wrote:
I don't have No$nes installed, instead using FCEUX, but in No$sns you can turn off the x86 drag in it's Options > Debugger Setup > Disassembler Syntax.


You can do that in No$nes as well, although it just shows the normal syntax next to his janky syntax, so it's still confusing....
Re: Best debugger?
by on (#178104)
Mednafen does not have
  • automatically loading my map file so that symbol names are available in the debugger
  • name table/bg viewer that includes a frame to show the current scroll position (like fceux does), as well as letting me click a cell and it shows me what address maps to it

Mednafen has
  • easy viewing/editing of RAM
  • a "step by one frame" button (like the Atari Stella emulator has)
  • runs in Linux (or at least wine)

Quote:
(And are there other super-helpful features that are not obvious in your favorite debugger?)

  • Breakpoints on write, read, execute.
  • Shows and allows editing of all registers, mapper regs included.
  • Allows editing of ROM.
    • load/dump range feature.
  • Shows current scanline in debugger.
  • in the disassembly, computes branches and indirect addresses, showing you the results

Two problems are that the frame advance key is not usable from the debugger view, and that the debugger view has a bug where it doesn't update the graphics.
Re: Best debugger?
by on (#178114)
Mednafen's debugger also gets cut off at any zoom less than 3.
Re: Best debugger?
by on (#178180)
tokumaru wrote:
Another thing I think is missing in Nintendulator is the ability to pick the time at which to sample the PPU for the debug information. Many games use raster effects, CHR switching and whatnot, that end up showing just garbage or even nothing at all when debugged in Nintendulator.

If you're stepping one frame at a time, I think it always samples it during VBlank - if you use breakpoints and/or step past the CHR switches, you can get it to show what you want.
Re: Best debugger?
by on (#178182)
Quietust wrote:
If you're stepping one frame at a time, I think it always samples it during VBlank - if you use breakpoints and/or step past the CHR switches, you can get it to show what you want.

I see, so you can in fact see the state of the PPU at different points in the frame... But what if I'm not stepping or using breakpoints at all, because I want to see the PPU stuff changing as I play, without interruptions? It's there a way to do that?
Re: Best debugger?
by on (#178188)
tokumaru wrote:
Quietust wrote:
If you're stepping one frame at a time, I think it always samples it during VBlank - if you use breakpoints and/or step past the CHR switches, you can get it to show what you want.

I see, so you can in fact see the state of the PPU at different points in the frame... But what if I'm not stepping or using breakpoints at all, because I want to see the PPU stuff changing as I play, without interruptions? It's there a way to do that?

I don't think so. The "display on scanline X" option in FCEUX is indeed quite useful.
Re: Best debugger?
by on (#178381)
The very first fork of Nintendulator, by rveach has a lot of nice features for NES ROM hacking as well as for working on your homebrew games. Some of the features were implemented in the official version by Quietust. I have used Unofficial Nintendulator a lot and was helping to spot bugs and such.

http://rveach.romhack.org/Nintendulator/
Re: Best debugger?
by on (#178445)
lidnariq wrote:
As far as I know, the current NES debuggers are:

Just to add to this, Mesen also has a debugger: Screenshot 1 2 3

As far as debugging execution, it's pretty complete:
-View CPU/PPU state
-Run 1 cpu instruction, 1 PPU cycle, 1 scanline or 1 full frame at a time (+ step in/step over features)
-Conditional breakpoints on anything (CPU/PPU read/write/exec) that support complex expressions. (e.g: A+X>10 && scanline>=240)
-PPU viewer (nametables, chr rom/ram, sprite ram, palette ram)
-RAM viewer (for everything: CPU, PPU, Palette, Sprite, PRG ROM, CHR ROM)
-"Set next statement" action
-Option to display the PPU's output as it is being built, instead of after a full frame

I still have a lot of features I want to add to it (e.g: labels/symbols, editing of ram/ppu/cpu state, displaying the cpu/ppu's memory maps, etc.), so it's still very much a work in progress.

Also, it doesn't (yet) run under Linux (whether in Mono or Wine).
I had a working Linux build a while ago, but had some issues with input and ended up working on other features instead.
Re: Best debugger?
by on (#178471)
Sour wrote:
lidnariq wrote:
As far as I know, the current NES debuggers are:

Just to add to this, Mesen also has a debugger: Screenshot 1 2 3

Looks pretty nice judging from the screenshots! Probably will be giving it a try.
Re: Best debugger?
by on (#178508)
thefox wrote:
Looks pretty nice judging from the screenshots! Probably will be giving it a try.

If you do test it out, let me know what you think!
I never got any feedback on the debugging tools yet, so it'd be nice to have another person's opinion.
Re: Best debugger?
by on (#178521)
I like the call stack with the actual ROM addr. That is useful. For the CHR viewer is there a way for it to be in 8x16 (large sprite) mode. I belive the FCEux debugger just added that.


Ahh I just noticed one thing that is super useful in FCEUX that I don't see a way to do in MESEN. Can you edit the rom contents on the fly? Does MESEN highlight the area's of the rom that have been executed/read from?

How is the netplay non MESEN? Is it an improvement over nestopia's netplay via peer to peer kailerra?
Re: Best debugger?
by on (#178580)
Thanks for the comments and the 8x16 sprite suggestion - I just added that since it was pretty easy to implement.

Currently all of the debugger is pretty much read-only, you can't modify the data. I do plan on adding those kinds of feature in the future, though.
I do use CDL files to keep track of what is code and data (shown at the bottom of the debugger window), but there is nothing highlighting the data segments.
Mesen only disassembles code that has actually been executed, though, so anything that is shown as code is something that has been executed (could be from a previous debugging session because CDL files are automatically reloaded).

As for Netplay, I haven't ever used Nestopia's, so I can't compare. But here's what Mesen does support though:
-Clients automatically load the same game as the host (assuming the game is found). The host can change game, pause the game, or load save states and the clients will stay in sync
-There is no way to lose sync between host & client (aside from potential bugs) - the host will never get any lag, but clients may get input lag based on their ping.
-The host's settings are applied on the client side during netplay (controllers, cheats, any option that can have an impact on emulation, etc.) and cannot be changed by the client while netplay is running.
-All players are free to select their controller - so the host isn't forced to be player 1, etc. It's also possible to have both controllers set as zappers and play 2-player zapper games (probably only "Chiller"). You can also decide to "spectate" the game, instead of selecting a controller. Technically you could have 1 host with 2-3 players, and say 30 people watching on top of that.
-It supports UPnP, so it will try to automatically enable port forwarding if the router supports it.

I haven't really gotten any feedback on netplay either - I have played some NES games with my brother quite a few times with it though, and it was pretty stable. (Haven't tested it much in the past months, however)
Re: Best debugger?
by on (#178582)
Sour wrote:
-All players are free to select their controller - so the host isn't forced to be player 1, etc. It's also possible to have both controllers set as zappers and play 2-player zapper games (probably only "Chiller").

ZapPing in Zap Ruder also supports two guns. In fact, that's why Podge and Daffle are dressed in gray and red: those are the barrel colors of the two versions of the Zapper.

Quote:
You can also decide to "spectate" the game, instead of selecting a controller. Technically you could have 1 host with 2-3 players, and say 30 people watching on top of that.

Can you have a spectator record an input movie?

Quote:
-It supports UPnP, so it will try to automatically enable port forwarding if the router supports it.

Unfortunately, a lot of ISPs are putting subscribers behind carrier-grade network address translation (CGNAT), and UPnP might not help there.
Re: Best debugger?
by on (#178587)
tepples wrote:
Can you have a spectator record an input movie?

Yep, any client can record a movie.
And I just noticed I half-broke netplay in 0.4.2 and it will crash when trying to switch games to match the host's, whoops.
(Edit: Netplay crash fixed in 0.4.3)

Quote:
Unfortunately, a lot of ISPs are putting subscribers behind carrier-grade network address translation (CGNAT), and UPnP might not help there.

Besides switching the code to UDP and using UDP hole punching, there is not much that can be done here, I think, unfortunately.
Re: Best debugger?
by on (#183004)
rainwarrior wrote:
You can create label files that will show up in the debugger. There's a python script in an ca65 code example I wrote a while back that shows how to translate ca65 outputs into FCEUX's label files. (The file format is documented.)


Resurrecting this....I've done some searching through ca65's manual and couldn't find and answer to this, so thought I'd ask here.

As far as I can tell, ca65/ld65 doesn't put private/non-global symbols into the map or label file. (which makes sense, as it would be confusing to have symbol name conflicts in there). That being said, it would sure be nice to have my non-global procedures listed in there, to make debugging easier. I haven't thought of any good solutions (other than temporarily marking a routine as global when I want to debug it, so I can easily find the address for it). Are there other simple solutions I'm missing for this?
Re: Best debugger?
by on (#183008)
gauauu wrote:
As far as I can tell, ca65/ld65 doesn't put private/non-global symbols into the map or label file.

Are you not using the -g flag when compiling/assembling? Without it I think only exported symbols are generated for an object. (In C anything global that's not static. In assembly, anything that has .export.)
Re: Best debugger?
by on (#183010)
rainwarrior wrote:
Are you not using the -g flag when compiling/assembling? Without it I think only exported symbols are generated for an object.


Aha, that did it! Thanks much!