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.
This commit is contained in:
Sergio Durigan Junior 2013-05-07 17:04:29 +00:00
parent 7b70956dc8
commit 58ce7251e8
5 changed files with 28 additions and 19 deletions

View file

@ -1,3 +1,10 @@
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.
2013-05-07 Pierre Muller <muller@sourceware.org> 2013-05-07 Pierre Muller <muller@sourceware.org>
* common/linux-btrace.c: ARI fix: Include "gdb_wait.h" * common/linux-btrace.c: ARI fix: Include "gdb_wait.h"

View file

@ -1012,27 +1012,14 @@ condition_completer (struct cmd_list_element *cmd,
len = strlen (text); len = strlen (text);
ALL_BREAKPOINTS (b) ALL_BREAKPOINTS (b)
{ {
int single = b->loc->next == NULL; char number[50];
struct bp_location *loc;
int count = 1;
for (loc = b->loc; loc; loc = loc->next) xsnprintf (number, sizeof (number), "%d", b->number);
{
char location[50];
if (single) if (strncmp (number, text, len) == 0)
xsnprintf (location, sizeof (location), "%d", b->number); VEC_safe_push (char_ptr, result, xstrdup (number));
else }
xsnprintf (location, sizeof (location), "%d.%d", b->number,
count);
if (strncmp (location, text, len) == 0)
VEC_safe_push (char_ptr, result, xstrdup (location));
++count;
}
}
return result; return result;
} }

View file

@ -1,3 +1,11 @@
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.
2013-05-07 Luis Machado <lgustavo@codesourcery.com> 2013-05-07 Luis Machado <lgustavo@codesourcery.com>
* gdb.threads/wp-replication.c: New file. * gdb.threads/wp-replication.c: New file.

View file

@ -55,6 +55,9 @@ gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
} }
} }
# Complete the condition (PR 15413).
gdb_test "complete condition " "condition 1"
gdb_test "info break" \ gdb_test "info break" \
"Num Type\[ \]+Disp Enb Address\[ \]+What.* "Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*" \ \[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*" \

View file

@ -69,6 +69,10 @@ gdb_test "break dupname:label" \
"Breakpoint $decimal at $hex: dupname:label. \[(\]2 locations\[)\]" \ "Breakpoint $decimal at $hex: dupname:label. \[(\]2 locations\[)\]" \
"multi-location break using duplicate function name and label" "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" \ gdb_test_no_output "set breakpoint pending off" \
"disable pending breakpoints for linespec tests" "disable pending breakpoints for linespec tests"