It is currently Fri Dec 15, 2017 6:41 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Feb 16, 2017 8:46 am 
Offline
User avatar

Joined: Sun Nov 09, 2008 9:18 pm
Posts: 1013
Location: Pennsylvania, USA
Does anyone fully understand the data output in ca65's (might actually be the linker that outputs the full file, actually), exhaustive debug file? I was successfully able to write a python script to translate this file into source-level debugging information for FCEUX, however, I encountered an odd situation which I haven't yet been able to explain.

Code:
                    #Actual line of code.
                    line_number = line["line"] - 1
                    if 0 <= line_number < len(source_file_lines[file_name]):
                        line_of_code = source_file_lines[file_name][line_number].rstrip().replace("#", "")


In order to get the nl comments in FCEUX to show up as expected above the first instruction associated with the line of code, I had to add this - 1 calculation before grabbing the line of code from the source file. What concerns me is that some of these "line" objects report 0 as the line number, so this doesn't seem correct (i.e., it's not a case of counting from 0 in one case versus counting from 1 in another, I have arrays of source code lines that start from 0 and the debug output also appears to start from 0 for these "line" objects). Yet, most of the time I'm getting correct and expected output in the FCEUX debugger. (i.e., I see my line of code, followed by all the instructions assembled for that line of code, exactly as expected).

Just wondering if anyone out there understands the debug output in more detail and can help me explain why I had to put that - 1 there.


Top
 Profile  
 
PostPosted: Thu Feb 16, 2017 9:57 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2983
Location: Tampere, Finland
Why not use the dbginfo library (https://github.com/cc65/cc65/tree/master/src/dbginfo)? I really don't understand why many people seem to insist on parsing the format manually.

Whatever you do, the library might help you figure out what you're doing wrong.

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
PostPosted: Thu Feb 16, 2017 10:01 am 
Offline
User avatar

Joined: Sun Nov 09, 2008 9:18 pm
Posts: 1013
Location: Pennsylvania, USA
Haha, interesting. I didn't even know this existed. That'd be my guess why people parse it themselves. Plus its fun to write little tools in python :D So is this dbginfo library meant to be compiled and used with a standard C compiler outside of cc65 and then just run a debug file through it or...?


Top
 Profile  
 
PostPosted: Thu Feb 16, 2017 11:00 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2983
Location: Tampere, Finland
Yes. dbginfo.c / dbginfo.h make up the library. dbgsh.c is a sample program that uses the library.

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group