avr-gcc Feature: Better debugging info

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

F'up of avr-gcc: New Features?

Levenkay wrote:
It would be wonderful if values of variables could be inspected during a debugging session. In my experience, this works less than half the time. I don't know whether AStudio's debugger or gcc's debug output is to blame, but from the fact that this situation didn't seem to improve going from AStudio4 to AStudio6, I tend to suspect that the compiler output files don't contain enough supplimental debugging information to let a debugger work.

And, yes, I'm talking about debugging optimized code (you know; the kind you MUST build if you want _delayXs() and perhaps other features to work). I know this is pretty arrogant of me, especially as I haven't the time to construct my own tools, but it seems to me that if *I* can figure out what's in the 16-bit variable gleemFleeble by "simply" opening a Disassembler window and reverse-engineering the code to deduce which register pair got assigned, then maybe the compiler that decided which registers to use should have mentioned that to the debugger.

I can imagine that better symbolic debug hints are probably hugely difficult to generate, but I think they'd be hugely appreciated, too.

This feature is already there.

For example, it you compile a module like

void f (void)
{
    int iiiii = 12345;
}

with -g3 then the variable and its value are present in the debuging information "” with

    -gdwarf2 -gstrict-dwarf
and consequently also with higher debug versions like DWARF-3.

There is a DWARF browser written by Tom Tromey that works as Emacs extension. In the rare case you don't like Emacs, it's still easier than writing your own DWARF browser...

Compiling

void f (void)
{
    int iiiii = 12345; 
}

with

    avr-gcc -c -Os -g3
and reading the DWARF-3 dump you'll find, amongst many, many more information (the complete dump has more than 600 lines)
 <2><3c>: Abbrev Number: 3 (DW_TAG_variable)
    <3d>   DW_AT_name        : (indirect string, offset: 0x7c): iiiii	
    <41>   DW_AT_decl_file   : 1	
    <42>   DW_AT_decl_line   : 3	
    <43>   DW_AT_type        : <0x4a>	
    <47>   DW_AT_const_value : 12345	
 <2><49>: Abbrev Number: 0
 <1><4a>: Abbrev Number: 4 (DW_TAG_base_type)
    <4b>   DW_AT_byte_size   : 2	
    <4c>   DW_AT_encoding    : 5	(signed)
    <4d>   DW_AT_name        : int	

Conclusion:

Use a contemporary debugger that makes use of this information and does not hide it from you.

avrfreaks does not support Opera. Profile inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Use a contemporary debugger that makes use of this information and does not hide it from you.

Or to put it another way - looks like the AS6 debugger has some catching up to do.
Quote:

I don't know whether AStudio's debugger or gcc's debug output is to blame

So that looks like being AS6 then.