B20: g++ / gdb problem

Mats Bergstrøm mbe@flexim.no
Thu Apr 8 07:49:00 GMT 1999


The combination g++/gdb in b18 worked fine. But in b20, gdb (4.17.1)
behaves so badly on g++ (egcs-2.91.57) compiled code that it has
become rather useless. For example:

---
main.cpp:
class C
{
public:
  C(){}
  virtual ~C(){}
  void foo() const {bar();}
  void bar() const {}
  void quux() const {}
};

void main()
{
  C c;
  c.foo();
  c.quux();
}
eof (main.cpp)

compiling:
>g++ -g -c main.cpp
>g++ -g -o main.exe main.o

debugging:
>gdb main.exe
GNU gdb 4.17.1
Copyright 1998 Free Software Foundation, Inc.
[...]
(gdb) break main
Breakpoint 1 at 0x40105a: file main.cpp, line 15.
(gdb) run
Starting program: /projects/ProtoFlow/apps/test/main.exe
[...]
Breakpoint 1, main () at main.cpp:15
15        C c;
(gdb) step
0x406ae6 in LM17 ()
(gdb) step
Single stepping until exit from function __1C,
which has no line number information.
main () at main.cpp:16
16        c.foo();
(gdb) step
LM11 () at main.cpp:8
8         void foo() const {bar();}
(gdb) step
LM21 () at main.cpp:9
9         void bar() const {}
(gdb) step

Program exited normally.
(gdb) q
---

The debugger correctly enters C::foo, then C::bar (also correct), but
from here it
never returns to C::foo nor main. It simply continues to the end of
program. This strange behaviour becomes quite unpredictable when using
external libraries, especially template libraries.

Do someone have any solution to this?

Mats Bergstrom



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list