Previously, the array count was ignored with the "-o" option. While I admit that repeating code is not "good style", the goto from the middle of a loop was not nice either, and this variant removes a dependency of the main loop on the "aflag" variable. Signed-off-by: Petr Tesarik <ptesarik@xxxxxxx> --- symbols.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-)
[PATCH 9/11] Fix struct -o with an address and array count Previously, the array count was ignored with the "-o" option. While I admit that repeating code is not "good style", the goto from the middle of a loop was not nice either, and this variant removes a dependency of the main loop on the "aflag" variable. Signed-off-by: Petr Tesarik <ptesarik@xxxxxxx> --- symbols.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) --- a/symbols.c +++ b/symbols.c @@ -5901,6 +5901,21 @@ cmd_datatype_common(ulong flags) error(FATAL, "-o option not valid with multiple member format\n"); + /* + * No address was passed -- dump the structure/member declaration. + */ + if (!aflag) { + set_temporary_radix(radix, &restore_radix); + if (argc_members && + !member_to_datatype(memberlist[0], dm, + ANON_MEMBER_QUERY)) + error(FATAL, "invalid data structure reference: %s.%s\n", + dm->name, memberlist[0]); + do_datatype_declaration(dm, flags | (dm->flags & TYPEDEF)); + restore_current_radix(restore_radix); + goto freebuf; + } + len = dm->size; if (count < 0) { @@ -5927,22 +5942,15 @@ cmd_datatype_common(ulong flags) "member-specific output not allowed with -r\n"); } - /* - * No address was passed -- dump the structure/member declaration. - */ - if (!aflag || (aflag && (flags & SHOW_OFFSET))) { - if (aflag) - dm->vaddr = addr; + /* + * Display member addresses or data + */ + if (flags & SHOW_OFFSET) { + dm->vaddr = addr; set_temporary_radix(radix, &restore_radix); do_datatype_declaration(dm, flags | (dm->flags & TYPEDEF)); restore_current_radix(restore_radix); - goto freebuf; - } - - /* - * Display data. - */ - if (flags & SHOW_RAW_DATA) + } else if (flags & SHOW_RAW_DATA) raw_data_dump(addr, len, flags & STRUCT_VERBOSE); else if ((flags & DEREF_POINTERS) && !dm->member) { set_temporary_radix(radix, &restore_radix);
-- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility