How to debug a nes crash?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

User avatar
GradualGames
Posts: 1107
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: How to debug a nes crash?

Post by GradualGames » Fri Feb 05, 2016 8:20 am

I'm curious to see the simplest possible example of a C routine that cc65 will generate incorrect code for in the case you are examining. I'm not using C anymore but maybe it'd help others avoid the same issue until someone fixes the bug.

calima
Posts: 1126
Joined: Tue Oct 06, 2015 10:16 am

Re: How to debug a nes crash?

Post by calima » Fri Feb 05, 2016 8:37 am

https://github.com/cc65/cc65/issues/263

It happens to both pointers and 16-bit variables, but nobody's made a minimal example yet. A workaround is to disable optimizations.

User avatar
heardtheword
Posts: 20
Joined: Mon Feb 08, 2016 1:22 pm
Contact:

Re: How to debug a nes crash?

Post by heardtheword » Tue Feb 09, 2016 9:30 am

Thanks to this thread, I learned about mednafen, and my current strategy of gdb-on-the-host is working great so far.
Same here. I was using Nestopia to visually "debug" and tried fceux in wine but was annoyed by the multitude of windows and input focus issues. Since I prefer using my Mac for development, mednafen seems to be the best solution.

Version control has also saved me a lot of headaches. I make frequent commits, using git, so that if I break something I can roll back to a previous version and test it. That usually means I only have to look at a small portion of code instead of making guesses.

User avatar
darryl.revok
Posts: 520
Joined: Sat Jul 25, 2015 1:22 pm

Re: How to debug a nes crash?

Post by darryl.revok » Tue Feb 09, 2016 10:54 am

heardtheword wrote:Since I prefer using my Mac for development
Yay, someone else! We're few and far between. :)

User avatar
Myask
Posts: 965
Joined: Sat Jul 12, 2014 3:04 pm

Re: How to debug a nes crash?

Post by Myask » Tue Feb 09, 2016 4:14 pm

As mentioned. Mednafen works, though it's a bit pre-GUI in how it works. (Also nota bene that you need about x3 minimum zoom for there to be sufficient resolution to display the entire CPU debug screen!)
Rahsennor wrote:I know I'm being completely unhelpful here, but I find it depressing that the answer to "how to debug a NES game on Linux" is "use Windows".

Seriously though, why is the Linux port of FCEUX so pathetic?
To my knowledge (from being on TASvideos forums for a long time), the Windows version's memory-watch dialogue (etc.) was ported from Gens.

Gens's dialogue is Windows-only.

calima
Posts: 1126
Joined: Tue Oct 06, 2015 10:16 am

Re: How to debug a nes crash?

Post by calima » Fri Feb 26, 2016 2:27 am

After further research, the 16-bit pointer bug (that caused my crash) is a bug in neslib, not cc65. Further, half of neslib is buggy. I will make a new topic about it.

calima
Posts: 1126
Joined: Tue Oct 06, 2015 10:16 am

Re: How to debug a nes crash?

Post by calima » Fri Feb 26, 2016 4:55 am

It's *both* a neslib and a cc65 bug. Whee this is fun.

Post Reply