avr-gdb DDD "Function "xy" not defined"

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

Hi,

as I changed from Windows to Linux some years ago I missed the possibility to debug my ATMEGA with AVR-Studio :-(

Now I tried AVARICE with DDD and a AVR-DRAGON. Actually I am able to debug expect one problem. I can' t see the values for any peripheral registers like PORTA which are defined in <avr/io.h>. This information seems to be lost during preprocessing and the gdb has no access to this. Another ugly consequence is that I cant set a breakpoint via the graphical interface of DDD on a line like this: PORTA &= ~_BV(PORTA0). The DDD issues something like:

 

(gdb) break PORTA

Function "PORTA" not defined.

Breakpoint 4 (PORTA) pending.

 

Setting the breakpoint via the gdb command break LINEx works.

 

 

Does anybody know how link this information?

 

 

Thanks a lot

 

Butze

 

avr-gcc -c -mmcu=atmega32 -I. -gstabs -DF_CPU=16000000UL -O1 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./toggleLED.lst  -std=gnu99 -Wundef -MMD -MP -MF .dep/toggleLED.o.d toggleLED.c -o toggleLED.o

Last Edited: Wed. Dec 27, 2017 - 06:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Ah ha! It was exactly for this reason I developed this...

 

http://www.avrfreaks.net/forum/b...

 

In fact see the picture here...

 

http://www.avrfreaks.net/comment...

 

The whole point being that "PORTA" etc. are not C cymbols but simply preprocessor macros (that don't make it through to the debugger).

 

Having said that, because the debugger here is avr-gdb you could try -g with one if the higher levels if DWARF which might carry #define's through to the debugger. 

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

clawson wrote:
"PORTA" etc. are not C cymbols but simply preprocessor macros (that don't make it through to the debugger).

They don't, in fact, even make it as far as the compiler - see: http://www.avrfreaks.net/comment...

 

clawson wrote:
 you could try -g with one if the higher levels if DWARF which might carry #define's through to the debugger.

See: http://www.avrfreaks.net/comment...

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

(gdb) break PORTA

You need to break on a line number, not on a 'function symbol' as PORTA is not a function...

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

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

Maybe (s)he want to break on an access to (read/write) PORTA ?

 

Does GDB support that ... ?

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

hmh... Maybe? Compile with -g3 to get the used macro definitions into the symbol table, and 'watch &PORTA' ? This all depends on the gdb server supporting data breakpoints and watches...

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

Last Edited: Wed. Dec 27, 2017 - 05:50 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

meolsen wrote:

hmh... Maybe? Compile with -g3 to get the used macro definitions into the symbol table, and 'watch &PORTA' ? This all depends on the gdb server supporting data breakpoints and watches...

 

 

I tried several -g options but the symbols for the peripheries wont be listed in the elf file.

 

In the meantime I came to the (perhaps wrong?) conviction that for professional debuggers the reference to the memory mapped peripheries is always done by an separate memory description file which is not supported by DDD(?).

 

Thank  you clawson for the idea with the structure pointer! I did not trie yet but it looks really promising.

 

Butze