asar icon indicating copy to clipboard operation
asar copied to clipboard

debug asar's intepretation of ASM files?

Open GhbSmwc opened this issue 5 years ago • 7 comments

No, not debugging the codes to be assembled into the ROM, I mean how the interpreter reads the codes written in the ASM file before compiling to the ROM, akin to using the inspect element feature on most browsers when debugging the javascript code. This would be really helpful for making instructions and macros for asar to understand how something gone wrong, especially complex macros.

GhbSmwc avatar Feb 26 '19 01:02 GhbSmwc

If you have to ask for such a thing, you are most likely overcomplicating something, and should rewrite and simplify your code.

In the unlikely case that there is no better solution, I've been able to solve all issues I've encountered with liberal application of print "!whatever", print pc, and disassembling the output rom.

But if you (or RPG Hacker or whoever) want to improve the debug tools, sure, that would be an improvement. Not often needed, but quite valuable when it is needed.

Alcaro avatar Feb 26 '19 02:02 Alcaro

I'm not quite sure if I understand what you're looking for. Just to clarify: you're not just looking for source-level debugging of ASM files, right? If that IS what you want: someone recently added an option to Asar which allows you to generate debug symbols that can be used with certain debuggers. Don't quite remember which debuggers, but it might be easy to find out by looking through some of the recent commits.

If that's not what you're looking for, though, could you give an example of what you want?

RPGHacker avatar Feb 26 '19 09:02 RPGHacker

If you are using google chrome, go to inspect element (right-click and inspect), sources tab, click on a javascript code to bring a breakpoint and you will see variables of how things are interpreted. This only works if the HTML have javascript. Here is an example: https://github.com/GhbSmwc/SMW-Graphical-bar-display/blob/master/readme_files/JS_GraphicalBarCalculator.html

GhbSmwc avatar Mar 15 '19 00:03 GhbSmwc

I don't use Chrome, so I can't test that, but it does sound pretty much just like source-level debugging, doesn't it?

RPGHacker avatar Mar 15 '19 12:03 RPGHacker

It is source-level debugging. also literally any browser that has a market share has some form of JS debugging.

It's difficult to implement conventional source-level debugging in asar because of the whole 3-pass thing. But even if we worked around that somehow, it'd still be a lot of work for very little gain, since as alcaro said, 99% of issues you may have can be debugged with print statements or output disassembly.

randomdude999 avatar Mar 15 '19 12:03 randomdude999

Correct me if I'm wrong, but wasn't address to line mapping added specifically for the purpose of source-level debugging? I thought that was the entire point of it. Sure, the debugging itself isn't inside Asar, but I'm guessing the mapping generated by Asar should be usable by WLA for that purpose?

RPGHacker avatar Mar 15 '19 12:03 RPGHacker

yeah that feature works quite well, but it doesn't do what GHB wants (it doesn't show what defines expand to or whether if statements were executed). i'm not even sure what to call that tbh

also wla is just another assembler that outputs the same symbols file format, i know of only 1 emulator that can make use of that format (a fork of bsnes-plus)

randomdude999 avatar Mar 15 '19 12:03 randomdude999