]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix "save breakpoints" for "catch" command
authorJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 13 Oct 2014 11:39:48 +0000 (13:39 +0200)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 13 Oct 2014 11:39:48 +0000 (13:39 +0200)
gdb/ChangeLog
2014-10-13  Miroslav Franc  <mfranc@redhat.com>
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Fix "save breakpoints" for "catch" command.
* break-catch-sig.c (signal_catchpoint_print_recreate): Add trailing
newline.

gdb/testsuite/ChangeLog
2014-10-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
    Yao Qi  <yao@codesourcery.com>

Fix "save breakpoints" for "catch" command.
* gdb.base/catch-signal.exp: Add gdb_breakpoint "main".
Remove -nonewline.  Match also the added "main" line.

gdb/ChangeLog
gdb/break-catch-sig.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/catch-signal.exp

index 724a97181f70ed33f8d9391797fc7cfb939ad20f..97bc9bd64c87c76b9a82bc0bd652bb5688fe7d9b 100644 (file)
@@ -1,3 +1,10 @@
+2014-10-13  Miroslav Franc  <mfranc@redhat.com>
+           Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Fix "save breakpoints" for "catch" command.
+       * break-catch-sig.c (signal_catchpoint_print_recreate): Add trailing
+       newline.
+
 2014-10-12  Miroslav Franc  <mfranc@redhat.com>
 
        Fix "save breakpoints" for "disable $bpnum" command.
index c41bf331499a88ccb93b537293efd749d2a20ae7..579fb78989fbad3da6f4c39a2d76a3df086a03a2 100644 (file)
@@ -346,6 +346,7 @@ signal_catchpoint_print_recreate (struct breakpoint *b, struct ui_file *fp)
     }
   else if (c->catch_all)
     fprintf_unfiltered (fp, " all");
+  fputc_unfiltered ('\n', fp);
 }
 
 /* Implement the "explains_signal" breakpoint_ops method for signal
index bb362dcaebaf139ba3f649ead2febfd2fcc7a7df..0b2f653ff1b04895dc7b742e13f35162730a0f3d 100644 (file)
@@ -1,3 +1,10 @@
+2014-10-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
+           Yao Qi  <yao@codesourcery.com>
+
+       Fix "save breakpoints" for "catch" command.
+       * gdb.base/catch-signal.exp: Add gdb_breakpoint "main".
+       Remove -nonewline.  Match also the added "main" line.
+
 2014-10-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Fix "save breakpoints" for "disable $bpnum" command.
index 22caf401b3e19150f940cfdcebb45dbba5f7e268..3045b8c09fd3929f3720da8023a93c71d2d183fd 100644 (file)
@@ -117,6 +117,7 @@ foreach {arg desc} {"" "standard signals" \
        "set catchpoint '$arg' for printing"
     gdb_test "info break" "$decimal.*catchpoint.*signal.*$desc.*" \
        "info break for '$arg'"
+    gdb_breakpoint "main"
     gdb_test "save breakpoints [standard_output_file bps.$i]" \
        "Saved to file .*bps.$i.*" \
        "save breakpoints for '$arg'"
@@ -124,7 +125,8 @@ foreach {arg desc} {"" "standard signals" \
     set filename [remote_upload host [standard_output_file bps.$i] \
                      [standard_output_file bps-local.$i]]
     set fd [open $filename]
-    set contents [read -nonewline $fd]
+    set file_data [read $fd]
+    set data [split $file_data "\n"]
     close $fd
 
     if {$arg == ""} {
@@ -132,11 +134,17 @@ foreach {arg desc} {"" "standard signals" \
     } else {
        set pattern "catch signal $arg"
     }
-    if {[string match $pattern $contents]} {
-       pass "results of save breakpoints for '$arg'"
-    } else {
-       fail "results of save breakpoints for '$arg'"
-    }
+    gdb_assert {[expr [llength $data] == 3]} \
+       "Number of lines of save breakpoints for '$arg'"
+    # Check the first line.
+    gdb_assert {[string match $pattern [lindex $data 0]]} \
+       "1st line of save breakpoints for '$arg'"
+    # Check the second line.
+    gdb_assert {[string match "break main" [lindex $data 1]]} \
+        "2nd line of save breakpoints for '$arg'"
+    # Check the trailing newline.
+    gdb_assert {[string match "" [lindex $data 2]]} \
+        "Trailing newline of save breakpoints for '$arg'"
 
     incr i
 }