Page 1 of 3

new bsnes-plus debugging features

Posted: Wed Oct 25, 2017 11:12 pm
by Benny
Hi everyone,

a few days ago I finished some debugging feature plans I had for bsnes-plus in order to debug some games I work on.

As it would be nice to maybe create a pull request to maybe merge it into the original bsnes-plus version I'd like to have some people to test the new feature.

You can download and compile it from this page:
https://github.com/BenjaminSchulte/bsnes-plus

Image

New features of the debugger are:
  • The disassembler and debugger are now merged into one window.
  • The disassembler has some simple syntax highlighting
  • The disassembler supports WLA symbol files (located as .sym file in the same directory as the ROM)
  • The disassembler displays the address names instead of the addresses, if known
  • You can follow JMP and BRA addresses by clicking on them
  • You can toggle breakpoints by clicking on the address
  • You can name addresses by right clicking on the line
  • There is an index of all names (=Symbol) which can be filtered
  • You can add comments to disassembled lines
  • There is a feature to break on BRK opcodes
  • You can pass --break-immediately to the disassembler to debug from the very beginning
  • A new debug port which allows you the log static messages directly from your ROM
  • The disassembler tries to figure out the upfollowing code, even if its the first time you disassemble it
  • Displays some simple loops
  • If activated, all names and comments will be stored in a .sym file when closing the emulator for next time
However, as I only work with a few original ROMs, I didn't really test the new emulator very well, so I'd like you to test the new features and let me know:
  • Does this actually work on Mac and Windows? (I only work using Linux)
  • Did I accidentally remove an important feature?
  • Is there a must-have-feature you really, really would miss here?
  • I only tested the main CPU, the other processors should still work but have very limited features. Does this still work?
  • Are there some new bugs I missed? (If so, please let me know which game and how to reproduce)
Have a great day!

Re: new bsnes-plus debugging features

Posted: Thu Oct 26, 2017 4:42 am
by dougeff
Looks great

It would be easier to test if there were a windows binary exe. I personally don't have QT installed, for one thing. So, I don't really want to try to make my own.

Re: new bsnes-plus debugging features

Posted: Thu Oct 26, 2017 5:10 am
by HihiDanni
This looks quite comprehensive! The ability to load symbols from a file is something I'd find very useful, but I use CA65 as my assembler instead of WLA, so the symbol files probably won't be compatible.

Re: new bsnes-plus debugging features

Posted: Thu Oct 26, 2017 7:46 am
by Revenant
I've been following your work on this since I saw it pop up on GitHub, very nice work!

I haven't personally tried using it yet, but revamping the disassembler/tracer has been high on my to-do list for a long time. I think after the next upcoming (hopefully soon) release of bsnes-plus I'd love to consider integrating this into a future release as well.
HihiDanni wrote:This looks quite comprehensive! The ability to load symbols from a file is something I'd find very useful, but I use CA65 as my assembler instead of WLA, so the symbol files probably won't be compatible.
ca65 symbol file support was a to-do item for me as well, since it's what I've been using for my recent SNES work as well. I don't think it should be too difficult to support both.

Re: new bsnes-plus debugging features

Posted: Thu Oct 26, 2017 7:37 pm
by nicklausw
HihiDanni wrote:This looks quite comprehensive! The ability to load symbols from a file is something I'd find very useful, but I use CA65 as my assembler instead of WLA, so the symbol files probably won't be compatible.
Depending on the structure of ca65's symbol files, you could do what I did and have a lua script convert to WLA format for you.

Re: new bsnes-plus debugging features

Posted: Fri Oct 27, 2017 8:37 am
by adam_smasher
This looks amazing!

Re: new bsnes-plus debugging features

Posted: Wed Nov 01, 2017 1:55 am
by Reaper_Man
I would try it, but I got an exception error when I tried to run mingw trying to get it to compile on win10 x64. Unfortunately it doesn't really give me much else to work with, and I should go to bed. :/

Re: new bsnes-plus debugging features

Posted: Fri Nov 03, 2017 8:33 pm
by Revenant
http://revenant1.net/bsnes-plus-benny-win64.zip

Note: building out of the box fails on Windows because "ERROR" is already defined in wingdi.h, which conflicts with the DebugPrintCommand::Level enum. I suggest using mixed-case names for enum values instead.

Either way, this looks really great so far! I haven't tested it extensively to make sure everything behaves as it should but I'm excited about this nonetheless.

Re: new bsnes-plus debugging features

Posted: Fri Nov 03, 2017 8:51 pm
by tepples
If wingdi.h is Windows Graphics Device Interface, then what's the header for Windows Graphics Device Interface Next Generation Subsystem?

Re: new bsnes-plus debugging features

Posted: Wed Nov 08, 2017 1:05 am
by Benny
Thank you for the feedback (and for compiling it on Windows). :)

I was quite a little busy with my main job and other current SNES project so I didn't check here for a while. I think I'll try to fix the windows version by the end of the next week and also check out the CA65 assembler in order to also support their symbol files later.

Re: new bsnes-plus debugging features

Posted: Mon Nov 13, 2017 12:30 pm
by Reaper_Man
Got to try it, and the layout is great, I just wish there was a simple dump feature so I can save say a subroutine to a file.

Re: new bsnes-plus debugging features

Posted: Tue Nov 14, 2017 2:09 am
by nitro2k01
tepples wrote:If wingdi.h is Windows Graphics Device Interface, then what's the header for Windows Graphics Device Interface Next Generation Subsystem?
Image

Re: new bsnes-plus debugging features

Posted: Tue Nov 14, 2017 6:44 am
by Benny
Today I implemented a basic support for symbol files generated by the ca65 -Ln parameter.

Because no symbol file currently supports comments (Well, surely because it's actually no "symbol") the .sym file will be replaced by a different file format if bsnes is closed (if not deactivated in the debuggers options). Maybe someday this could go into a separate file or so.

I also added "exporting a dump" to my personal ToDo list, but I don't have that much time currently, due to two other big projects :)

Re: new bsnes-plus debugging features

Posted: Wed Nov 15, 2017 10:53 am
by Benny
Today I implemented a simple measurement tool. I did not test it very well and already know a lot of stuff which need to be implemented, until you can really use this in your daily life.

Image

Currently you can measure values from memory or from VCounter and do calculations between each measurement.

What's still missing:
- There are no labels/numbers on the preview graph, so you don't really know what value it is.
- The configuration is not saved, so you will always have to reconfigure everything
- Graphs can not be compared
- It's not tested very well
- Did not test it on windows
- Should be configurable/triggerable using the debug-port $420E, which currently only allowed to print debug messages.
- Would be great to have breakpoints configurable if some calculations exceeded some limits
- There is no documentation :D

Re: new bsnes-plus debugging features

Posted: Wed Nov 15, 2017 6:29 pm
by psycopathicteen
Does this work with SA-1 games? I want to see if I can hack KSS and SMRPG to work without a SA-1 chip.