FCEUX and Mesen conflict over the .dbg extension

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

FCEUX and Mesen conflict over the .dbg extension

Post by tepples »

The full-featured debugger of Mesen-X expects ld65 debug symbols to be named the same as the NES program, with .nes replaced with .dbg. This file contains a list of all symbols in the program. Mesen takes a few seconds to start under Mono 6.8.0.105 on Ubuntu on a ThinkCentre with a Core i3 4130 CPU, and opening Mesen's debugger with a .dbg file containing a full 512 KiB program's worth of debug symbols took about 10 seconds last I checked. Mesen can reload the ROM, which saves some but not all time and incurs an increased risk of either an exception in C# code or a SIGSEGV in native code.

For faster iteration, I often use FCEUX Qt instead of Mesen for quick tests of changes to game logic, where FCEUX's reduced accuracy in timing corner cases is acceptable. However, FCEUX writes its own unrelated debugging information, a list of breakpoints that the user has set. This file is also named the same as the NES program, with .nes replaced with .dbg. Because this is the same name as the conventional name for the ld65 debug file, setting a breakpoint in FCEUX causes FCEUX to overwrite the file, which causes the next run in Mesen to go without debugging symbols. In addition, I can't keep breakpoints from one build to the next because rebuilding the ROM overwrites FCEUX's breakpoint file with the ld65 debug file.

Is there a way to resolve this conflict other than not using FCEUX or not using Mesen?
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: FCEUX and Mesen conflict over the .dbg extension

Post by tokumaru »

Have your build script make a copy of the output .nes file with a slightly different name for use with FCEUX? One ROM for each emulator, basically.
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: FCEUX and Mesen conflict over the .dbg extension

Post by rainwarrior »

I thought FCEUX always used ".deb" as its debug extension? When did this change? I think this would be worth filing an issue over... especially since FCEUX creates its own file and it's not supplied by the user, it should not be difficult to change back.

Edit: the FCEUX 264 release seems to still use DEB for me, and I am having trouble finding any reference to a DBG extension in the code?

Edit: Hmm, it seems to the the QT version only that does this, the regular version does not have this problem.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: FCEUX and Mesen conflict over the .dbg extension

Post by tepples »

You guessed right that FCEUX Win32 uses .nes.deb and FCEUX Qt uses .dbg.

Speculation: The difference may have something to do with dpkg used on Debian and Ubuntu, which also uses .deb.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: FCEUX and Mesen conflict over the .dbg extension

Post by Drag »

A combination of what tokumaru said, plus using a script or a batch file to launch the respective emulators (so the emulator automatically loads the correct rom file) seems like a safe way to go.

To get fancier, you could set up a script which does something like this:
  1. Find "xxx-fceux.dbg" and rename to "xxx.dbg"
  2. Run fceux with xxx.nes
  3. Wait until fceux closes
  4. Find "xxx.dbg" and rename to "xxx-fceux.dbg"
(and a similar one for Mesen)
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: FCEUX and Mesen conflict over the .dbg extension

Post by rainwarrior »

I'd still suggest it in an issue. I think this naming conflict is a valid problem. Not just for Mesen but this is very common cc65 usage at this point. (Maybe would affect Nintendulatordx users as well?)

Since the file is not user-selected to begin with, changing the extension should be easy for qfceux. Maybe "fdb" or "qfd" or something would be suitable?
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: FCEUX and Mesen conflict over the .dbg extension

Post by Dwedit »

How about just ".fceuxdebug", might be a tad long, but extensions aren't limited to 3 characters anymore.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: FCEUX and Mesen conflict over the .dbg extension

Post by calima »

tepples wrote: Thu Dec 29, 2022 9:18 am opening Mesen's debugger with a .dbg file containing a full 512 KiB program's worth of debug symbols took about 10 seconds last I checked. Mesen can reload the ROM, which saves some but not all time and incurs an increased risk of either an exception in C# code or a SIGSEGV in native code.
This is just hilarious. I didn't expect Mesen's code to be that terrible.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: FCEUX and Mesen conflict over the .dbg extension

Post by Dwedit »

Well... what is the C# exception?
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: FCEUX and Mesen conflict over the .dbg extension

Post by rainwarrior »

IIRC, Mesen had a bug that crashed if you put a breakpoint on a line that had a multi-line comment attached. That seemed to be the one crash cause that I ran into most frequently. Unfortunately this cause wasn't discovered until long after Sour hit pause on the project.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: FCEUX and Mesen conflict over the .dbg extension

Post by Dwedit »

I think Mkwong and novasquirrel currently maintain the emulator? (Though there is no link from the author's frozen github page)
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: FCEUX and Mesen conflict over the .dbg extension

Post by rainwarrior »

This is NovaSquirrel's fork: https://github.com/NovaSquirrel/Mesen-X

Sour hasn't abandoned the project, but current development progress is private with no ETA... so with that in mind, the forks are probably somewhat of a temporary, provisional thing.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: FCEUX and Mesen conflict over the .dbg extension

Post by tepples »

I'll try to remember to report a Mesen exception here next time I get one, in order to gauge whether it's worth reporting to Nova as an issue.
Mjbudd77
Posts: 35
Joined: Fri Oct 16, 2020 3:22 pm
Location: Tampa

Re: FCEUX and Mesen conflict over the .dbg extension

Post by Mjbudd77 »

The Qt version of fceux uses the .dbg extension because I arbitrarily chose it. The .deb extension was already used by Debian/Ubuntu so I wanted something different. I also changed the format of that debug file to be human readable text instead of the binary format previously used by the win32 fceux. I wanted to keep the extensions separate because I would routinely run the win32 and Qt/SDL versions side by side to compare behaviors when I was developing. There is no reason that extension identifier can’t be changed. I like the .fdb suggestion. I’m sure if someone creates an issue on the GitHub site, that someone will fix it.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: FCEUX and Mesen conflict over the .dbg extension

Post by tepples »

Post Reply