From: Luis Machado <luis.machado@arm.com>
To: Tom Tromey <tom@tromey.com>,
Luis Machado via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix crash with "maintenance print arc"
Date: Thu, 5 May 2022 10:31:09 +0100 [thread overview]
Message-ID: <06f43b22-c740-860b-1c75-9a00dcff12da@arm.com> (raw)
In-Reply-To: <87h76dmdp9.fsf@tromey.com>
Hi Tom,
On 4/28/22 16:26, Tom Tromey wrote:
>>>>>> "Luis" == Luis Machado via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Luis> While doing something else, I noticed GDB crashed with
> Luis> "maintenance print arc".
>
> I think the bug here is that this uses add_show_prefix_cmd and not
> add_basic_prefix_cmd. See the appended, which also fixes the crash.
>
> Luis> This happens because the code expects to find a "show" string pattern
> Luis> within "maintenance print arc", since "arc" here is a prefix, and skip it.
> Luis> In this case though, it won't find it, and we will have a bad pointer
> Luis> getting dereferenced.
>
> This looks reasonable to me.
>
> Tom
>
> diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
> index 98bd1c4bc0a..3edfd466f3b 100644
> --- a/gdb/arc-tdep.c
> +++ b/gdb/arc-tdep.c
> @@ -2474,11 +2474,11 @@ _initialize_arc_tdep ()
> /* Register ARC-specific commands with gdb. */
>
> /* Add root prefix command for "maintenance print arc" commands. */
> - add_show_prefix_cmd ("arc", class_maintenance,
> - _("ARC-specific maintenance commands for printing GDB "
> - "internal state."),
> - &maintenance_print_arc_list,
> - 0, &maintenanceprintlist);
> + add_basic_prefix_cmd ("arc", class_maintenance,
> + _("ARC-specific maintenance commands for printing GDB "
> + "internal state."),
> + &maintenance_print_arc_list,
> + 0, &maintenanceprintlist);
>
> add_cmd ("arc-instruction", class_maintenance,
> dump_arc_instruction_command,
FTR, I'm happy to go with your patch for this one.
next prev parent reply other threads:[~2022-05-05 9:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 10:07 Luis Machado
2022-04-27 10:43 ` Andrew Burgess
2022-04-27 11:00 ` Luis Machado
2022-04-28 15:27 ` Tom Tromey
2022-04-29 10:20 ` Andrew Burgess
2022-04-28 15:26 ` Tom Tromey
2022-04-29 8:58 ` Luis Machado
2022-04-29 10:18 ` Andrew Burgess
2022-04-29 10:39 ` Luis Machado
2022-04-29 11:25 ` Pedro Alves
2022-05-05 9:31 ` Luis Machado [this message]
2022-05-27 13:34 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=06f43b22-c740-860b-1c75-9a00dcff12da@arm.com \
--to=luis.machado@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).