[Crash-utility] Faster iteration on list of struct.field

Dominique Martinet asmadeus at codewreck.org
Wed Feb 5 16:55:38 UTC 2020


Hi,

I often find myself dumping a bunch of addresses to files to iterate
with 'struct_name.field < file_with_addresses', but that is horribly
slow for large number of iterations.

`help list` comment for -S vs. -s made me try to use `rd` instead,
e.g. get offset manually from `struct -o` then use rd instead like
`rd -o xx < addr_list | awk '{ print $2 }' > value_list` -- and that is
infinitely better.


Would it make sense to add a similar option to 'struct' instead so one
could do e.g. `struct -S struct_name.field addr` instead of the dance I
was doing?
(That would require to cache field offset in crash and not query it
again everytime, from a quick look at the code, but we could only cache
one and still gain a lot for such iterations...)


Am I missing another more practical way of doing this?
(I guess it's not so bad now I came up with using 'rd', but that was
non-obvious to me. My use case here involved following a couple of
pointers from a list so I dumped the first pointer to follow from list
with -S struct1.field1, but then the following iteration just wouldn't
end naively)



Thanks,
-- 
Dominique





More information about the Crash-utility mailing list