nesdev.com
http://forums.nesdev.com/

Loading CA65's DBG files
http://forums.nesdev.com/viewtopic.php?f=3&t=15155
Page 1 of 1

Author:  Sour [ Thu Nov 24, 2016 10:22 pm ]
Post subject:  Loading CA65's DBG files

I'm finishing up implementing symbols/labels + comments in Mesen's debugger and am currently working on importing labels/comments from the DBG files generated by CC65/CA65.

This is what it looks like at the moment:
Image

I'm currently testing with the example project posted by rainwarrior here (thanks for that, been incredibly helpful so far!). The screenshot above is the result of importing that project's DBG file into Mesen.

However, if at all possible I'd like to test the import's code with other projects (e.g: projects coded in C or ASM, more complex ones that use bank switching, or extra work ram, etc.).
Does anyone have any NES+DBG+Source packages that they'd be willing to share with me, or know where I could find them?
I guess what I'm looking for would be CA65/CC65 open source projects I can easily compile into a NES+DBG. Though it'd be nice to get the DBG/NES files prebuilt as I have little idea what I'm doing when it comes to compiling CC65/CA65 projects. :)

Thanks!

Author:  calima [ Fri Nov 25, 2016 4:16 am ]
Post subject:  Re: Loading CA65's DBG files

Russian Roulette is open source and C:
http://www.romhacking.net/homebrew/88

Lots of CHR bank switching, and it uses save RAM.

Author:  tepples [ Fri Nov 25, 2016 6:30 am ]
Post subject:  Re: Loading CA65's DBG files

Sour wrote:
I guess what I'm looking for would be CA65/CC65 open source projects I can easily compile into a NES+DBG. Though it'd be nice to get the DBG/NES files prebuilt as I have little idea what I'm doing when it comes to compiling CC65/CA65 projects. :)

My NES projects on GitHub and my cousin's are open source, but they don't have DBG files. (Yet.)

I'm not a regular user of Mesen because of its stated dependency on Windows and my lack of time to see if I can get it up in Mono. So I was planning to look at what else DBG files can do, and I thought first I'd need to know how to parse them. I looked for format documentation but instead noticed the warning in the description of the --dbgfile option:
Quote:
Please note that debug information generation is currently being developed, so the format of the file and its contents are subject to change without further notice.

So is the only documentation "read dbgfile.c and dbgsyms.c, and read them again every time you update ld65 using Git"?

Author:  thefox [ Fri Nov 25, 2016 6:35 am ]
Post subject:  Re: Loading CA65's DBG files

tepples wrote:
So I was planning to look at what DBG files can do, and I thought first I'd need to know how to parse them. I looked for format documentation but instead noticed the warning in the description of the --dbgfile option:
Quote:
Please note that debug information generation is currently being developed, so the format of the file and its contents are subject to change without further notice.

So is the only documentation "read dbgfile.c and dbgsyms.c, and read them again every time you update ld65 using Git"?

You can parse the debug files with the dbginfo library provided with cc65: https://github.com/cc65/cc65/tree/master/src/dbginfo

The format itself hasn't changed for many years now, but it's somewhat complicated so it's a good idea to use the library.

Author:  Sour [ Fri Nov 25, 2016 7:33 pm ]
Post subject:  Re: Loading CA65's DBG files

Thanks for the help!

After a fair bit of trial and error, I managed to compile thwaite, nova the squirrel and russian roulette and generate working DBG files for them.

It helped me fix some bugs, and the feature is working relatively well for now. (Although it doesn't support work/save ram yet)
Some limitations remain because the labels in Mesen aren't "scoped", so memory addresses that are shared as temporary variables in the code can't be assigned a different label based on where they are used, etc.

For C projects, I set it to display the C code as a comment, it's not perfect, but it's mostly readable.
Image

The import is a GUI-side feature in C#, so I didn't use CC65's code. I was lazy and just solved all of the parsing with regexes - it's certainly not the fastest way to parse it, but the code is a lot easier to understand (in my opinion)

@tepples
Mesen doesn't run under Mono (nor WINE) at the moment (both due to my use of DirectX11)
I had a SDL build that worked under Mono & Ubuntu about half a year ago, but never finished it.
I could probably redo the work in a day or two, so I will most likely get that done in the near-ish future.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/