[Crash-utility] Faster iteration on list of struct.field
Dominique Martinet
asmadeus at codewreck.org
Wed Feb 5 21:45:09 UTC 2020
Dave Anderson wrote on Wed, Feb 05, 2020:
> > What might make sense is to use the "struct -r" option, which does a raw
> > memory dump of a data structure. But for a reason I do not recall, it
> > prevents that option from being used with a "struct_name.field" argument.
> > (see line 6628 of symbols.c). But I don't see why that couldn't be made
> > to work, though, since the end result is simply a call to raw_data_dump().
I'll give this a try tomorrow, probably just needs to add
dm->member_offset to addr and dump dm->member_size long value, that
looks straightforward enough.
> ...and then if you get "struct -r" to work with a "struct_name.field"
> argument, the next challenge would be the caching aspect of your request.
>
> Currently there's no manner in which command-specific information is
> cached beyond the execution of a single command. With "< file", the
> command gets executed from scratch each time.
That does look more challenging... Or rather more a matter of taste? a
kludge probably wouldn't be so bad to put in, but it's probably better
to have something more generic than making 'datatype_member' static in
cmd_datatype_common (well, it needs a bit more than that as the argument
strings won't be useable from one call to the next...)
I assume the slow part in this will be the member_to_datatype call in
do_datatype_addr? I'll first confirm that's the only slow bit, if there
is only one spot to optimize away it might not be so bad.
But yeah, without caching I don't think it's realistic; and making the
'< file' construct iterate within the function looks more work than
trying to make struct cache some info.
Thanks!
--
Dominique
More information about the Crash-utility
mailing list