Blame SOURCES/gdb-save-breakpoints-fix.patch

7760c3
gdb/
7760c3
2014-10-03  Miroslav Franc  <mfranc@redhat.com>
7760c3
	    Jan Kratochvil  <jan.kratochvil@redhat.com>
7760c3
7760c3
	Fix "save breakpoints" for "catch" command.
7760c3
	* break-catch-sig.c (signal_catchpoint_print_recreate): Add trailing
7760c3
	newline.
7760c3
7760c3
gdb/testsuite/
7760c3
2014-10-03  Jan Kratochvil  <jan.kratochvil@redhat.com>
7760c3
7760c3
	Fix "save breakpoints" for "catch" command.
7760c3
	* gdb.base/catch-signal.exp: Add gdb_breakpoint "main".
7760c3
	Remove -nonewline.  Match also the added "main" line.
7760c3
7760c3
diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c
7760c3
index c41bf33..579fb78 100644
7760c3
--- a/gdb/break-catch-sig.c
7760c3
+++ b/gdb/break-catch-sig.c
7760c3
@@ -346,6 +346,7 @@ signal_catchpoint_print_recreate (struct breakpoint *b, struct ui_file *fp)
7760c3
     }
7760c3
   else if (c->catch_all)
7760c3
     fprintf_unfiltered (fp, " all");
7760c3
+  fputc_unfiltered ('\n', fp);
7760c3
 }
7760c3
 
7760c3
 /* Implement the "explains_signal" breakpoint_ops method for signal
7760c3
diff --git a/gdb/testsuite/gdb.base/catch-signal.exp b/gdb/testsuite/gdb.base/catch-signal.exp
7760c3
index 22caf40..7002f84 100644
7760c3
--- a/gdb/testsuite/gdb.base/catch-signal.exp
7760c3
+++ b/gdb/testsuite/gdb.base/catch-signal.exp
7760c3
@@ -117,6 +117,7 @@ foreach {arg desc} {"" "standard signals" \
7760c3
 	"set catchpoint '$arg' for printing"
7760c3
     gdb_test "info break" "$decimal.*catchpoint.*signal.*$desc.*" \
7760c3
 	"info break for '$arg'"
7760c3
+    gdb_breakpoint "main"
7760c3
     gdb_test "save breakpoints [standard_output_file bps.$i]" \
7760c3
 	"Saved to file .*bps.$i.*" \
7760c3
 	"save breakpoints for '$arg'"
7760c3
@@ -124,15 +125,17 @@ foreach {arg desc} {"" "standard signals" \
7760c3
     set filename [remote_upload host [standard_output_file bps.$i] \
7760c3
 		      [standard_output_file bps-local.$i]]
7760c3
     set fd [open $filename]
7760c3
-    set contents [read -nonewline $fd]
7760c3
+    set contents [read $fd]
7760c3
     close $fd
7760c3
 
7760c3
+    set nl "\r?\n"
7760c3
     if {$arg == ""} {
7760c3
-	set pattern "catch signal"
7760c3
+	set pattern "catch signal$nl"
7760c3
     } else {
7760c3
-	set pattern "catch signal $arg"
7760c3
+	set pattern "catch signal $arg$nl"
7760c3
     }
7760c3
-    if {[string match $pattern $contents]} {
7760c3
+    set pattern "${pattern}break main$nl"
7760c3
+    if {[regexp "$pattern" $contents]} {
7760c3
 	pass "results of save breakpoints for '$arg'"
7760c3
     } else {
7760c3
 	fail "results of save breakpoints for '$arg'"
7760c3
gdb/
7760c3
2014-10-03  Miroslav Franc  <mfranc@redhat.com>
7760c3
7760c3
	Fix "save breakpoints" for "disable $bpnum" command.
7760c3
	* breakpoint.c (save_breakpoints): Add $bpnum for disable.
7760c3
7760c3
gdb/testsuite/
7760c3
2014-10-03  Jan Kratochvil  <jan.kratochvil@redhat.com>
7760c3
7760c3
	Fix "save breakpoints" for "disable $bpnum" command.
7760c3
	* gdb.base/save-bp.c (main): Add label.
7760c3
	* gdb.base/save-bp.exp: Add 8th disabled breakpoint.  Match it.
7760c3
7760c3
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
7760c3
index e2170b4..0a438d1 100644
7760c3
--- a/gdb/breakpoint.c
7760c3
+++ b/gdb/breakpoint.c
7760c3
@@ -16131,7 +16131,7 @@ save_breakpoints (char *filename, int from_tty,
7760c3
       }
7760c3
 
7760c3
     if (tp->enable_state == bp_disabled)
7760c3
-      fprintf_unfiltered (fp, "disable\n");
7760c3
+      fprintf_unfiltered (fp, "disable $bpnum\n");
7760c3
 
7760c3
     /* If this is a multi-location breakpoint, check if the locations
7760c3
        should be individually disabled.  Watchpoint locations are
7760c3
diff --git a/gdb/testsuite/gdb.base/save-bp.c b/gdb/testsuite/gdb.base/save-bp.c
7760c3
index 9a72fe8..f01f031 100644
7760c3
--- a/gdb/testsuite/gdb.base/save-bp.c
7760c3
+++ b/gdb/testsuite/gdb.base/save-bp.c
7760c3
@@ -31,6 +31,6 @@ main (void)
7760c3
     break_me (); /* Try a condition-specific breakpoint.  */
7760c3
 
7760c3
   break_me (); /* Finally, try a breakpoint with commands.  */
7760c3
-  return 0;
7760c3
+  return 0; /* Return line. */
7760c3
 }
7760c3
 
7760c3
diff --git a/gdb/testsuite/gdb.base/save-bp.exp b/gdb/testsuite/gdb.base/save-bp.exp
7760c3
index ba98633..7bc8ab6 100644
7760c3
--- a/gdb/testsuite/gdb.base/save-bp.exp
7760c3
+++ b/gdb/testsuite/gdb.base/save-bp.exp
7760c3
@@ -47,6 +47,10 @@ gdb_test "commands\nsilent\nend" "End with.*" "add breakpoint commands"
7760c3
 
7760c3
 gdb_test "dprintf ${srcfile}:${loc_bp5},\"At foo entry\\n\"" "Dprintf .*"
7760c3
 
7760c3
+set loc_bp8 [gdb_get_line_number "Return line"]
7760c3
+gdb_breakpoint "${srcfile}:${loc_bp8}"
7760c3
+gdb_test_no_output {disable $bpnum}
7760c3
+
7760c3
 # Now, save the breakpoints into a file...
7760c3
 if {[is_remote host]} {
7760c3
     set bps bps
7760c3
@@ -71,6 +75,7 @@ gdb_test "source $bps" "" "source bps"
7760c3
 
7760c3
 # Now, verify that all breakpoints have been created correctly...
7760c3
 set bp_row_start "\[0-9\]+ +breakpoint +keep +y +0x\[0-9a-f\]+ +in"
7760c3
+set disabled_row_start "\[0-9\]+ +breakpoint +keep +n +0x\[0-9a-f\]+ +in"
7760c3
 set dprintf_row_start "\[0-9\]+ +dprintf +keep +y +0x\[0-9a-f\]+ +in"
7760c3
 gdb_test "info break" \
7760c3
-  " *Num +Type +Disp +Enb +Address +What\r\n$bp_row_start break_me at .*$srcfile:\[0-9\]+\r\n$bp_row_start main at .*$srcfile:$loc_bp2\r\n$bp_row_start main at .*$srcfile:$loc_bp3 +thread 1\r\n\[ \t]+stop only in thread 1\r\n$bp_row_start main at .*$srcfile:$loc_bp4\r\n\[ \t\]+stop only if i == 1( \\((host|target) evals\\))?\r\n$bp_row_start main at .*$srcfile:$loc_bp5\r\n\[ \t\]+silent\r\n$dprintf_row_start main at .*$srcfile:$loc_bp5\r\n\[ \t\]+printf.*"
7760c3
+  " *Num +Type +Disp +Enb +Address +What\r\n$bp_row_start break_me at .*$srcfile:\[0-9\]+\r\n$bp_row_start main at .*$srcfile:$loc_bp2\r\n$bp_row_start main at .*$srcfile:$loc_bp3 +thread 1\r\n\[ \t]+stop only in thread 1\r\n$bp_row_start main at .*$srcfile:$loc_bp4\r\n\[ \t\]+stop only if i == 1( \\((host|target) evals\\))?\r\n$bp_row_start main at .*$srcfile:$loc_bp5\r\n\[ \t\]+silent\r\n$dprintf_row_start main at .*$srcfile:$loc_bp5\r\n\[ \t\]+printf\[^\r\n\]+\r\n$disabled_row_start main at .*$srcfile:$loc_bp8"