I can't debug C++ constructors with AVR studio

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

I am using GCC version 3.4.1 with dwarf-2 output and AVR Sstudio 4.10. When I run the code using the Studio simulator for the Mega169, I can't debug the C++ constructors. Breakpoints never hit, and if I try to "step into" it actually does a "step over".

There is an easy workaround though. If I put the code in another function that is called by the constructor, I can debug that.

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

Could it have happened that GCC did actually inline your constructor?
You should be able to verify that in the generated assembler code.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

I don't think it's inline. I'm not an expert with this assembler. When I look at the .lst file I see a call instruction for each class I construct.

Also when I debug and look at the disassembly I see a call instruction there. When it does the call, I see assembler code only. There is "No Source" displayed. When I encounter a function call, then I can see C source for the function.

Strangely enough there is one and only one C++ class constructor that is debugged with C++ source. I don't see anything different with that class than any other.

In my main idle loop I construct nine classes. Only one can be debugged with C++ source. It happens to be the last one I wrote but I don't know the significance of that. It's not the last one instantiated at run time. It's not the last one in the list of SRC files in the makefile either. It used to be, but I moved it up the list to see if it would make a difference. It didn't.

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

The elf/dwarf parser does not yet support debugging of c++ code.
I have added support for some c++ constructs, but this is far from complete.
and not tested at all.

I am sorry that this is not mentioned in the online help.

Regards,

Torleif Sandnes
Atmel AVR Software Team

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

No problem. C++ works surprisingly well considering the tiny computer the code runs on.