[Crash-utility] [PATCH] Fix for 'struct -o' option to display the offsets of struct fields
HAGIO KAZUHITO(萩尾 一仁)
k-hagio-ab at nec.com
Tue May 31 08:15:19 UTC 2022
On 2022/05/31 15:18, lijiang wrote:
> So I will post the following patch later to do the same thing in gdb-10.2.
>
> --- gdb-10.2/gdb/c-typeprint.c.orig 2022-05-31 13:15:39.099537173 +0900
> +++ gdb-10.2/gdb/c-typeprint.c 2022-05-31 13:17:02.076909579 +0900
> @@ -1202,6 +1202,9 @@ c_type_print_base_struct_union (struct t
> = podata->end_bitpos
> - TYPE_LENGTH (type->field (i).type ()) * TARGET_CHAR_BIT;
> }
> + else if (strlen(TYPE_FIELD_NAME (type, i)) == 0)
> + /* crash: Print details for unnamed struct and union. */
> + newshow = show;
>
> c_print_type_1 (type->field (i).type (),
> TYPE_FIELD_NAME (type, i),
>
>
> This looks good, it can keep the same behavior as gdb-7.6.
Thanks. The patch tested OK, I've posted.
Kazu
More information about the Crash-utility
mailing list