[Coco] C-Source-level debugging for a gcc6809/lwasm project

Mathieu Bouchard matju at artengine.ca
Sun Dec 6 14:19:20 EST 2015


Le 2015-12-06 à 06:37:00, Michael R. Furman a écrit :

> I have a gcc6809 based project to port a library to the Coco that has a 
> nasty bug where it simply crashes. I have in the past run this program 
> in MESS and gotten the stream of instructions that the CPU actually ran 
> but it is really hard to translate that back to a particular line of C 
> code, it’s also really hard to understand where all the stack frames are 
> let alone what is in them.

Is that with or without optimisations ? Use the "nm" command to get a list 
of global labels in the program (addresses of variables and functions). 
However, if a particular function is very long, or if the bug happens 
while optimising code (inlining/unrolling), it can get much more difficult 
to track down where that piece of code came from (especially as the 
compiled function you read can become very long).

If you do "gcc -S" to produce the asm code, it can be easier to deal with 
than if you decompile the machine code, because the compiler could 
be inserting some comments helping you find you way (e.g. line numbers), 
but I haven't tried it myself.

I suppose GCC has some options that could either put more useful comments 
in the asm code, or dump some pre-asm code (internal compiler data), which 
is probably key to finding how the 6809-specific part of the code is 
generating the bug.

I don't know anything about gcc's internals, though.

Did you try -fdump-final-insns ?

  ______________________________________________________________________
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC


More information about the Coco mailing list