From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: GDB Patches <gdb-patches@sourceware.org>,
"Dr. David Alan Gilbert" <dave@treblig.org>
Subject: Re: [PATCH] Fix for PR 15413 (segfault when completing "condition" for pending bp)
Date: Mon, 06 May 2013 20:57:00 -0000 [thread overview]
Message-ID: <m3li7rsu6m.fsf@redhat.com> (raw)
In-Reply-To: <5187ED3A.8000108@redhat.com> (Pedro Alves's message of "Mon, 06 May 2013 18:49:46 +0100")
Thanks for the review.
On Monday, May 06 2013, Pedro Alves wrote:
> On 05/06/2013 03:58 AM, Sergio Durigan Junior wrote:
>> + xsnprintf (location, sizeof (location), "%d", b->number);
>> + }
>> else
>> - xsnprintf (location, sizeof (location), "%d.%d", b->number,
>> - count);
>> + {
>> + if (b->loc->next == NULL)
>> + xsnprintf (location, sizeof (location), "%d", b->number);
>> + else
>> + xsnprintf (location, sizeof (location), "%d.%d", b->number,
>> + count);
>> +
>> + loc = b->loc->next;
>
> This is always picking the same loc over and over? I guess this means
> the test should be extended. :-)
Ops, you're right, I will fix it right away, thanks for the catch.
>> + }
>>
>> if (strncmp (location, text, len) == 0)
>> VEC_safe_push (char_ptr, result, xstrdup (location));
>>
>> ++count;
>> }
>> + while (loc != NULL);
>> }
>>
>
> I notice the condition completer is more broken than this, btw:
>
> $ ./gdb ./testsuite/gdb.cp/mb-ctor
> GNU gdb (GDB) 7.6.50.20130430-cvs
> (gdb) b Derived::Derived
> Breakpoint 1 at 0x400811: Derived::Derived. (2 locations)
> (gdb) info breakpoints
> Num Type Disp Enb Address What
> 1 breakpoint keep y <MULTIPLE>
> 1.1 y 0x0000000000400811 in Derived::Derived(int) at ../../../src/gdb/testsuite/gdb.cp/mb-ctor.cc:34
> 1.2 y 0x0000000000400867 in Derived::Derived(int) at ../../../src/gdb/testsuite/gdb.cp/mb-ctor.cc:34
> (gdb) complete condition
> condition 1.1
> condition 1.2
> (gdb) complete condition 1
> condition 1.1
> condition 1.2
> (gdb) complete condition 1.
> condition 1.1.1
> condition 1.1.2
> (gdb) complete condition 1.1
> condition 1.1.1
> (gdb) complete condition 1.1
> condition 1.1.1
> (gdb) complete condition 1.1.1
> (gdb)
>
> Or:
>
> (gdb) condition<tab>
> (gdb) condition <tab>1.<tab>1.
> (gdb) condition 1.
> (gdb) condition 1.<tab>
> (gdb) condition 1.1.<tab>
> (gdb) condition 1.1.<enter>
> Bad breakpoint argument: '1.1.'
>
>
> BTW2, I'm thinking it'd make sense to always include the
> breakpoint-number-only ("%d", b->number) completion option, even if there
> are multiple locations? That is, with breakpoint 1 having two locations,
> this would happen:
>
> (gdb) condition 1<tab>
> 1 1.1 1.2
>
> instead of:
> (gdb) condition 1<tab>
> (gdb) condition 1.
> (gdb) condition 1.<tab>
> 1.1 1.2
>
> Oh, wait, wait, wait... The condition is a breakpoint property,
> not a location property, so what's with the completer suggesting
> location numbers at all?
>
> (gdb) info breakpoints
> Num Type Disp Enb Address What
> 1 breakpoint keep y <MULTIPLE>
> 1.1 y 0x0000000000400811 in Derived::Derived(int) at ../../../src/gdb/testsuite/gdb.cp/mb-ctor.cc:34
> 1.2 y 0x0000000000400867 in Derived::Derived(int) at ../../../src/gdb/testsuite/gdb.cp/mb-ctor.cc:34
> (gdb) condition 1 0
> (gdb)
> (gdb) condition 1.2 0
> Bad breakpoint argument: '1.2 0'
So, if I understood your brain dump correctly, you're suggesting that
the "condition" command shouldn't complete multiple locations at all,
since the condition is inherent to the breakpoint, not to the
location(s). Is that right? I will submit a patch soon.
[OTOH, I guess it would make more sense if the condition were a location
property.]
Thanks,
--
Sergio
next prev parent reply other threads:[~2013-05-06 20:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-06 2:59 Sergio Durigan Junior
2013-05-06 17:49 ` Pedro Alves
2013-05-06 20:57 ` Sergio Durigan Junior [this message]
2013-05-06 21:08 ` Pedro Alves
2013-05-07 3:39 ` Sergio Durigan Junior
2013-05-07 16:16 ` Pedro Alves
2013-05-07 17:06 ` Sergio Durigan Junior
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=m3li7rsu6m.fsf@redhat.com \
--to=sergiodj@redhat.com \
--cc=dave@treblig.org \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.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