]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/
authorSergio Durigan Junior <sergiodj@redhat.com>
Tue, 7 May 2013 17:04:57 +0000 (17:04 +0000)
committerSergio Durigan Junior <sergiodj@redhat.com>
Tue, 7 May 2013 17:04:57 +0000 (17:04 +0000)
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.

gdb/ChangeLog
gdb/breakpoint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/pending.exp
gdb/testsuite/gdb.linespec/linespec.exp

index f57597379317fca2a8dcafeaf5a9315c41562c86..60a4454ac5245fe621735031e582087fe31332fd 100644 (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-04-26  Joel Brobecker  <brobecker@adacore.com>
 
        * version.in: Set version to 7.6.0.20130426-cvs.
index abcaf0ffc362c077abdc8b68e23a6bdec7be56eb..8998167cb38bfd591cc1457b8402ad1d22f5db5c 100644 (file)
@@ -1015,27 +1015,14 @@ condition_completer (struct cmd_list_element *cmd, char *text, char *word)
       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 number[50];
 
-           if (strncmp (location, text, len) == 0)
-             VEC_safe_push (char_ptr, result, xstrdup (location));
+         xsnprintf (number, sizeof (number), "%d", b->number);
 
-           ++count;
-         }
-      }
+         if (strncmp (number, text, len) == 0)
+           VEC_safe_push (char_ptr, result, xstrdup (number));
+       }
 
       return result;
     }
index d0076154bddc5aab8f18d5d8abebf91100d8222b..83d876f802d00e44a96da49e2af8c85e80afe54e 100644 (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-03  Hafiz Abid Qadeer  <abidh@codesourcery.com>
 
        * status-stop.exp (test_tstart_tstart): Check for error
index 68322f59e4adfcc14d39d2d63f8f729a10ea0518..1ab896abb027e2ee70d7cfa8299a7281a1aa74ba 100644 (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" \
     "Num     Type\[ \]+Disp Enb Address\[ \]+What.*
 \[0-9\]+\[\t \]+breakpoint     keep y.*PENDING.*pendfunc1.*" \
index 0b703466d0e4d6238832caffd415300143637626..a04d36e5bfdc10154c8ab74debddd47cad791927 100644 (file)
@@ -63,6 +63,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"