This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] save breakpoints does not save signal catchpoints correctly
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Miroslav Franc <mfranc at redhat dot com>
- Date: Fri, 3 Oct 2014 22:32:19 +0200
- Subject: [patch] save breakpoints does not save signal catchpoints correctly
- Authentication-results: sourceware.org; auth=none
Hi,
Miroslav Franc submitted a fix
https://bugzilla.redhat.com/show_bug.cgi?id=1146170#c0
so posting it with a testcase.
No regressions on {x86_64,x86_64-m32,i686}-fedora21pre-linux-gnu.
Jan
gdb/
2014-10-03 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/
2014-10-03 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix "save breakpoints" for "catch" command.
* gdb.base/catch-signal.exp: Add gdb_breakpoint "main".
Remove -nonewline. Match also the added "main" line.
diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c
index c41bf33..579fb78 100644
--- a/gdb/break-catch-sig.c
+++ b/gdb/break-catch-sig.c
@@ -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
diff --git a/gdb/testsuite/gdb.base/catch-signal.exp b/gdb/testsuite/gdb.base/catch-signal.exp
index 22caf40..7002f84 100644
--- a/gdb/testsuite/gdb.base/catch-signal.exp
+++ b/gdb/testsuite/gdb.base/catch-signal.exp
@@ -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,15 +125,17 @@ 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 contents [read $fd]
close $fd
+ set nl "\r?\n"
if {$arg == ""} {
- set pattern "catch signal"
+ set pattern "catch signal$nl"
} else {
- set pattern "catch signal $arg"
+ set pattern "catch signal $arg$nl"
}
- if {[string match $pattern $contents]} {
+ set pattern "${pattern}break main$nl"
+ if {[regexp "$pattern" $contents]} {
pass "results of save breakpoints for '$arg'"
} else {
fail "results of save breakpoints for '$arg'"