public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@arm.com>
To: Andrew Burgess <aburgess@redhat.com>, Tom Tromey <tom@tromey.com>,
	Luis Machado via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix crash with "maintenance print arc"
Date: Fri, 29 Apr 2022 11:39:17 +0100	[thread overview]
Message-ID: <f671f58f-325a-09e4-a254-67235f436137@arm.com> (raw)
In-Reply-To: <87mtg4nqfv.fsf@redhat.com>

On 4/29/22 11:18, Andrew Burgess wrote:
> Luis Machado via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
>> 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.
>>
>> Ah, you're right. It did look odd why we were feeding maint commands to
>> code that is supposed to handle show commands.
>>
>>>
>>> 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.
>>
>> Should we prevent further situations like this by asserting that we
>> don't have a class_maintenance prefix being registered as a show
>> prefix?
> 
> Would this not trigger for all the existing 'maint show ...' commands?
> 

Ah, we have a "maint show" command. I wasn't aware of it until now.

Isn't this particular behavior a bit strange though? "maintenance" will 
always output the maintenance prefix, except for "maintenance show", 
which removes the show part.

It might be historical.

  reply	other threads:[~2022-04-29 10:39 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 [this message]
2022-04-29 11:25         ` Pedro Alves
2022-05-05  9:31   ` Luis Machado
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=f671f58f-325a-09e4-a254-67235f436137@arm.com \
    --to=luis.machado@arm.com \
    --cc=aburgess@redhat.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).