* gdb.base/break.c (multi_line_if_conditional): New function.
authorJeff Law <law@redhat.com>
Mon, 7 Jan 2002 19:21:27 +0000 (19:21 +0000)
committerJeff Law <law@redhat.com>
Mon, 7 Jan 2002 19:21:27 +0000 (19:21 +0000)
        (multi_ilne_while_conditional): Likewise.
        * gdb.base/break.exp: Verify that a breakpoint on a multi-line
        IF or WHILE condition puts the breakpoint at the start of
        the condition.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/break.c
gdb/testsuite/gdb.base/break.exp

index 61310d002eb79b16d05707b445456bdba1376afb..b4b8cd0c998afa48cdca37d16ee5ea42e52f5bb3 100644 (file)
@@ -1,5 +1,11 @@
 Mon Jan  7 12:22:18 2002  Jeffrey A Law  (law@redhat.com)
 
+       * gdb.base/break.c (multi_line_if_conditional): New function.
+       (multi_ilne_while_conditional): Likewise.
+       * gdb.base/break.exp: Verify that a breakpoint on a multi-line
+       IF or WHILE condition puts the breakpoint at the start of
+       the condition.
+
        * gdb.base/selftest.exp (backtrace through signal handler): Remove
        hppa*-*-hpux* expected failure.
        * gdb.base/structs.exp (do_function_calls): Similarly.
index e7e6af645d8094c5f1bd24adbd9affe6f66c64da..9e458b316bb8e2d1649d3f5183d3d9a94bd87b6f 100644 (file)
@@ -99,3 +99,33 @@ int value;
     return (value);
 }
 
+#ifdef PROTOTYPES
+int multi_line_if_conditional (int a, int b, int c)
+#else
+int multi_line_if_conditional (a, b, c)
+  int a, b, c;
+#endif
+{
+  if (a
+      && b
+      && c)
+    return 0;
+  else
+    return 1;
+}
+
+#ifdef PROTOTYPES
+int multi_line_while_conditional (int a, int b, int c)
+#else
+int multi_line_while_conditional (a, b, c)
+  int a, b, c;
+#endif
+{
+  while (a
+      && b
+      && c)
+    {
+      a--, b--, c--;
+    }
+  return 0;
+}
index 798e0c24fd68c0b2a85dcf94b3a170b11830038f..166f097eb576c3c9444b720f078170838b0a09d2 100644 (file)
@@ -121,6 +121,18 @@ gdb_test "break $srcfile:85" \
     "breakpoint line number in file"
 
 
+#
+# Test putting a break at the start of a multi-line if conditional.
+# Verify the breakpoint was put at the start of the conditional.
+#
+gdb_test "break multi_line_if_conditional" \
+    "Breakpoint.*at.* file .*$srcfile, line 109\\." \
+    "breakpoint at start of multi line if conditional"
+
+gdb_test "break multi_line_while_conditional" \
+    "Breakpoint.*at.* file .*$srcfile, line 124\\." \
+    "breakpoint at start of multi line while conditional"
+
 #
 # check to see what breakpoints are set
 #
@@ -141,7 +153,9 @@ gdb_test "info break" \
 \[0-9\]+\[\t \]+breakpoint     keep y.* in factorial$proto at .*$srcfile:96.*
 \[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:79.*
 \[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:79.*
-\[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:85" \
+\[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:85.*
+\[0-9\]+\[\t \]+breakpoint     keep y.* in multi_line_if_conditional at .*$srcfile:109.*
+\[0-9\]+\[\t \]+breakpoint     keep y.* in multi_line_while_conditional at .*$srcfile:124" \
     "breakpoint info"
 
 
This page took 0.032321 seconds and 4 git commands to generate.