Mail Archives: djgpp/2001/04/11/08:16:58
Dennis Yelle <dennis51 AT jps DOT net> wrote:
[...]
> I compile it with
> gxx -gstabs -Os -Wall test.cpp -o test.exe
Tried any other option than -Os? -O1 or -O2, e.g.? -Os is a rather new
optimization option, so it's possible there are bugs in its
implementation.
> Now I do exactly this:
> gdb test.exe
> break main
> run
> n
> I expect it to 'step over' the call to car7, but instead, it
> now, with -gstabs, steps into the car7 function (or method,
> whatever you want to call it) and shows this line:
> 8 for( i=0; i<10; i++) {
That may not be a problem in the debugger at all. Note that car7 is,
actually, not a function. It's not an ordinary method, either: it's an
*inline* method. This means that gcc is bound to expand its content at
the place it's being called, rather than call a function.
I.e. you're observing correct behaviour here, I think.
You can verify that by looking into the assembly generated by gcc (add
-save-temps to your gxx command line, and look into the file test.s
that creates, among others).
> Before, with '-g' it just gave no response of any kind for more than
> 20 seconds.
This method having been inlined, it seems, this may be due to another
shortcoming of COFF debugging information.
So, lesson learned: to debug C++ programs, always use stabs debugging,
not COFF.
> I got it last Sunday.
> How can I tell if I got a bad one?
By looking into the debugging symbols in the assembly, for very short
programs. Andris Pavenis announced a new port of gcc-2.95.3 a few days
ago. If you got that, you should be safe from this problem.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -