Re: [PATCH V2] AArch64 pauth: Indicate unmasked addresses in backtrace

Pedro Alves
2019-08-08T10:33:52Z

On 8/8/19 9:55 AM, Alan Hayward wrote:

> gdb/doc/ChangeLog:
>
> 2019-08-08 Alan Hayward <alan.hayward@arm.com>
>
> * gdb.texinfo (AArch64 Pointer Authentication): Fix typo.

Please merge this part as obvious.

> I hadn’t realised the implications doing that would have, and had assumed
> you couldn’t add to a field that had already been used.
>
> I had (prematurely) pushed the patch. Is this additional fix ok?

I don't think so,

> diff --git a/gdb/stack.c b/gdb/stack.c
> index 0859815baf..c599caf51c 100644
> --- a/gdb/stack.c
> +++ b/gdb/stack.c
> @@ -1301,7 +1301,7 @@ print_frame (const frame_print_options &fp_opts,
> {
> uiout->field_core_addr ("addr", gdbarch, pc);
> if (get_frame_pc_masked (frame))
> - uiout->field_string ("pac", " [PAC]");
> + uiout->field_string ("addr", " [PAC]");
> }
> else
> uiout->field_string ("addr", "<unavailable>",
>

... because I think that this results in MI printing two different "addr" attributes.

Instead, you'll need to build a string, with e.g., string_printf,
and use uiout->field_string with ui_out_style_kind::ADDRESS style,
so that MI outputs one single "addr" attribute.

Please try "gdb -i=mi". You can still type CLI commands, so just "(gdb) start"
and running to main, so that GDB prints the frame in the *stop event should
be sufficient to trigger this.

BTW, there are two other places where we output the "addr" field
in the file. Do you want to include "[PAC]" in those? If so,
then factoring out the "addr" printing to a separate function
would be appropriate.

Thanks,
Pedro Alves