Re: gdb, c++ & namespaces

Michael Elizabeth Chastain
2004-01-14T14:17:17Z

Hi Marcel,

The two debugging formats are: dwarf-2 and stabs+ (not dwarf and stabs).
dwarf-2 is supported much better than stabs+ now, so try building
your program with -gdwarf-2.

> (netsilicon-gdb) print *dp
> warning: can't find class named `tnos::net::DatagramPacket', as given by
> C++ RTTI
> $2 = {_vptr.DatagramPacket = 0xeffb0, ia = 0x206548, isa = 0x206690,
> buffer = 0x206558 "", bufferLength = 0xff, length = 0xff}

Try playing with the "set print object" flag:

(gdb) set print object off
(gdb) print *dp
(gdb) set print object on
(gdb) print *dp

When "set print object" is off, gdb will print an object of the type
of the pointer (we call this the "static type"). When "set print object"
is on, gdb will print the type of the object in memory (we call this
the "dynamic type".

That warning is sometimes harmless if the data fields are what you
expect. Are they?

Michael C
GDB QA Guy