Handling of structure dereferencing

Daniel Jacobowitz drow@mvista.com
Thu Dec 6 09:07:00 GMT 2001


Right now, and historically, gdb has accepted things like:
  struct foo {char a} *b, **c, ***d;

(gdb) print b.a
(gdb) print d->a

This is tied to a collection of very messy values handling, where we will
dereference pointers "as far as possible" in a lot of cases (like when
looking for members).  It makes printing structs somewhat "easier", but in
my opinion, also rather more confusing.

So, straw poll: how would people feel about:
 - not letting this happen; only explicit dereferencing

[random thought]
 - and maybe, a print flag or something to allow us to print both the
  value of a pointer and the dereferenced type by default.  I spend a lot
  of time doing "print longthing" up arrow "print longthing[0]" up arrow
  "print longthing[0].otherfield" to walk down things like "struct type";
  it would be nice if there were a way to do the first two steps at the same
  time, since they are so very often associated.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer



More information about the Gdb mailing list