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: Tue, 07 May 2013 03:39:00 -0000 [thread overview]
Message-ID: <m3li7rqwzt.fsf@redhat.com> (raw)
In-Reply-To: <51881BCD.7070009@redhat.com> (Pedro Alves's message of "Mon, 06 May 2013 22:08:29 +0100")
On Monday, May 06 2013, Pedro Alves wrote:
> On 05/06/2013 09:57 PM, Sergio Durigan Junior wrote:
>
>> 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.
>
> Yes. The patch to do that should be quite trivial,
> mostly just removing/simplifying code, and it should fix the
> segfault too as consequence, so I'd prefer focusing on a patch
> that did that first (over trying to fix the existing bogus
> multi-location code),
>
>> [OTOH, I guess it would make more sense if the condition were a location
>> property.]
>
> and leave this for a separate discussion. The patch should then
> be quite safe for 7.6 backporting too.
Sure enough, I wasn't planning to address this whole issue now.
Here is the updated patch. I created a new test on
gdb.linespec/linespec.exp because it seemed like the best place to test
the "condition" for multiple locations.
OK?
--
Sergio
gdb/
2013-05-07 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/15413:
* breakpoint.c (condition_completer): Simplify the code to
disconsider multiple locations of breakpoints when completing the
"condition" command.
gdb/testsuite
2013-05-07 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/15413:
* gdb.base/pending.exp: Add test for completion of the "condition"
command for pending breakpoints.
* gdb.linespec/linespec.ex: Add test for completion of the
"condition" command when dealing with multiple locations.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index ef9c23c..b1488dc 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1012,27 +1012,14 @@ condition_completer (struct cmd_list_element *cmd,
len = strlen (text);
ALL_BREAKPOINTS (b)
- {
- int single = b->loc->next == NULL;
- struct bp_location *loc;
- int count = 1;
-
- for (loc = b->loc; loc; loc = loc->next)
- {
- char location[50];
-
- if (single)
- xsnprintf (location, sizeof (location), "%d", b->number);
- else
- xsnprintf (location, sizeof (location), "%d.%d", b->number,
- count);
+ {
+ char location[50];
- if (strncmp (location, text, len) == 0)
- VEC_safe_push (char_ptr, result, xstrdup (location));
+ xsnprintf (location, sizeof (location), "%d", b->number);
- ++count;
- }
- }
+ if (strncmp (location, text, len) == 0)
+ VEC_safe_push (char_ptr, result, xstrdup (location));
+ }
return result;
}
diff --git a/gdb/testsuite/gdb.base/pending.exp b/gdb/testsuite/gdb.base/pending.exp
index 68322f5..a8dbef5 100644
--- a/gdb/testsuite/gdb.base/pending.exp
+++ b/gdb/testsuite/gdb.base/pending.exp
@@ -55,6 +55,13 @@ gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
}
}
+# Complete the condition (PR 15413).
+# This test must come right after we set the first pending breakpoint, and
+# before we set any other breakpoint, since we are testing if the "condition"
+# command can properly complete its argument. The PR only fails if there
+# is only one pending breakpoint set (without anything else).
+gdb_test "complete condition " "condition 1"
+
gdb_test "info break" \
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*" \
diff --git a/gdb/testsuite/gdb.linespec/linespec.exp b/gdb/testsuite/gdb.linespec/linespec.exp
index 741ada0..fe02365 100644
--- a/gdb/testsuite/gdb.linespec/linespec.exp
+++ b/gdb/testsuite/gdb.linespec/linespec.exp
@@ -69,6 +69,10 @@ gdb_test "break dupname:label" \
"Breakpoint $decimal at $hex: dupname:label. \[(\]2 locations\[)\]" \
"multi-location break using duplicate function name and label"
+# Testing if the "condition" command completes only the breakpoints,
+# not the locations.
+gdb_test "complete condition " "condition $decimal\r\ncondition $decimal\r\ncondition $decimal"
+
gdb_test_no_output "set breakpoint pending off" \
"disable pending breakpoints for linespec tests"
next prev parent reply other threads:[~2013-05-07 3:39 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
2013-05-06 21:08 ` Pedro Alves
2013-05-07 3:39 ` Sergio Durigan Junior [this message]
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=m3li7rqwzt.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