This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ and "no data fields" when printing objects


Hi all,

It often occurrs to me to find such situatons when debugging:

(gdb) p ptr
$8 = {
  <> = {<No data fields>}, <No data fields>}

and everytime I wonder why the object is not represented meanignfully.

I previously made many researches on the subject, maybe I also already
asked on this list, and came out with the following man of the road
wisdom notions:

1) the problem shows up when you use inlined functions (but the
problem here seems to be related to printing *objects* rather than
step over functions).

2) in order to avoid that you need to use -ggdb -O0

3) it depends on some compiler magic which you really can't
understand

I'm quite sure that even using code compiled with gcc and -ggdb -O0
the abovementioned problem shows anyway.

I'd happily spend months studying the objcode structure and the gdb
internals, but unfortunately I can't, so I'm here to just ask if you
can reply to this questions:

1) which are the conditions under which the abovementioned problem
occurrs (e.g. with shared/static lib, with some arch, only with some
compiler+flags/binary format)?

2) how can I do to be sure not to encounter this problem when
debugging, i.e. which magic do I need to add to the compilation
command, even affecting code size/speed?

Thanks in advance, and thanks for the great tool.

Cheers.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]