[Crash-utility] [PATCH] displaying anonymous members of struct/union
Dave Anderson
anderson at redhat.com
Mon Mar 5 16:25:31 UTC 2012
----- Original Message -----
> Hello Dave,
>
> I have realized the function to display anonymous members of
> struct/union. There are three changes, which are listed below, and I
> will take "struct page" for example.
>
> 1. anonymous members will be showed when using "struct page"
That's nice...
> 2. anonymous member, "struct page.private", will be showed together with
> its offset
Sorry -- but doing that redefines the "struct" command output for both named
members and anonymous members. The "struct -o" option should be used to prepend
the offset. Can you re-work the patch so that it behaves the same way
as it currently does?
> 3. anonymous member with the address of the structure, "struct
> page.private xxx", will be showed.
>
> About the implementation, gdb code is changed, which is used to change
> the output of the gdb command, "ptype ...". And function
> "arg_to_datatype" is also modified to analyze anonymous member.
I'm presuming (but not sure) that the change to anon_member_offset() to use
open_tmpfile2() is because your patch introduces a new potential path to
anon_member_offset() that would be inside a open_tmpfile()/close_tmpfile()
region? Is that correct?
The change to gdb's c_type_print_base() function is interesting -- do
you consider that a bug in gdb, or do you think they have a reason
for doing it the way it's done now? I ask because gdb has several
structure-printing optional variables, so I'm kind of surprised that
it's hard-wired to behave the way it does.
Thanks,
Dave
More information about the Crash-utility
mailing list