Dumping structure using dbx
I'm debugging my C program using dbx on Solaris, and I'd like to be able t开发者_StackOverflowo see the contents of a data structure.
It's a local data structure in the function that's in scope, so typing "dump" shows a pointer to the structure. However, I'd like to look at the contents of various fields within it. How can I do that?
Generally the 'print' command offers the best functionality for this kind of thing. If your local pointer variable is called 'p', then use "print *p". The argument to print can be any language expression, for example "print p->buf" or "print p->buf[3]"
Assuming your structure pointer variable is called struct_ptr
, does this work?
dump *struct_ptr
精彩评论