Fix "save breakpoints" for signal catchpoints and disabled breakpoints

(BZ 1146170, Miroslav Franc).
This commit is contained in:
Jan Kratochvil 2014-10-03 22:58:23 +02:00
parent 77c099e703
commit 58638f8971
2 changed files with 133 additions and 1 deletions

View File

@ -0,0 +1,123 @@
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'"
gdb/
2014-10-03 Miroslav Franc <mfranc@redhat.com>
Fix "save breakpoints" for "disable $bpnum" command.
* breakpoint.c (save_breakpoints): Add $bpnum for disable.
gdb/testsuite/
2014-10-03 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix "save breakpoints" for "disable $bpnum" command.
* gdb.base/save-bp.c (main): Add label.
* gdb.base/save-bp.exp: Add 8th disabled breakpoint. Match it.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index e2170b4..0a438d1 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -16131,7 +16131,7 @@ save_breakpoints (char *filename, int from_tty,
}
if (tp->enable_state == bp_disabled)
- fprintf_unfiltered (fp, "disable\n");
+ fprintf_unfiltered (fp, "disable $bpnum\n");
/* If this is a multi-location breakpoint, check if the locations
should be individually disabled. Watchpoint locations are
diff --git a/gdb/testsuite/gdb.base/save-bp.c b/gdb/testsuite/gdb.base/save-bp.c
index 9a72fe8..f01f031 100644
--- a/gdb/testsuite/gdb.base/save-bp.c
+++ b/gdb/testsuite/gdb.base/save-bp.c
@@ -31,6 +31,6 @@ main (void)
break_me (); /* Try a condition-specific breakpoint. */
break_me (); /* Finally, try a breakpoint with commands. */
- return 0;
+ return 0; /* Return line. */
}
diff --git a/gdb/testsuite/gdb.base/save-bp.exp b/gdb/testsuite/gdb.base/save-bp.exp
index ba98633..7bc8ab6 100644
--- a/gdb/testsuite/gdb.base/save-bp.exp
+++ b/gdb/testsuite/gdb.base/save-bp.exp
@@ -47,6 +47,10 @@ gdb_test "commands\nsilent\nend" "End with.*" "add breakpoint commands"
gdb_test "dprintf ${srcfile}:${loc_bp5},\"At foo entry\\n\"" "Dprintf .*"
+set loc_bp8 [gdb_get_line_number "Return line"]
+gdb_breakpoint "${srcfile}:${loc_bp8}"
+gdb_test_no_output {disable $bpnum}
+
# Now, save the breakpoints into a file...
if {[is_remote host]} {
set bps bps
@@ -71,6 +75,7 @@ gdb_test "source $bps" "" "source bps"
# Now, verify that all breakpoints have been created correctly...
set bp_row_start "\[0-9\]+ +breakpoint +keep +y +0x\[0-9a-f\]+ +in"
+set disabled_row_start "\[0-9\]+ +breakpoint +keep +n +0x\[0-9a-f\]+ +in"
set dprintf_row_start "\[0-9\]+ +dprintf +keep +y +0x\[0-9a-f\]+ +in"
gdb_test "info break" \
- " *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.*"
+ " *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"

View File

@ -26,7 +26,7 @@ Version: 7.8
# The release always contains a leading reserved number, start it at 1. # The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 23%{?dist} Release: 24%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL
Group: Development/Debuggers Group: Development/Debuggers
@ -540,6 +540,10 @@ Patch930: gdb-async-stopped-on-pid-arg-1of2.patch
Patch931: gdb-async-stopped-on-pid-arg-2of2.patch Patch931: gdb-async-stopped-on-pid-arg-2of2.patch
Patch970: gdb-async-stopped-on-pid-arg-testsuite.patch Patch970: gdb-async-stopped-on-pid-arg-testsuite.patch
# Fix "save breakpoints" for signal catchpoints and disabled breakpoints
# (BZ 1146170, Miroslav Franc).
Patch971: gdb-save-breakpoints-fix.patch
%if 0%{!?rhel:1} || 0%{?rhel} > 6 %if 0%{!?rhel:1} || 0%{?rhel} > 6
# RL_STATE_FEDORA_GDB would not be found for: # RL_STATE_FEDORA_GDB would not be found for:
# Patch642: gdb-readline62-ask-more-rh.patch # Patch642: gdb-readline62-ask-more-rh.patch
@ -830,6 +834,7 @@ find -name "*.info*"|xargs rm -f
%patch930 -p1 %patch930 -p1
%patch931 -p1 %patch931 -p1
%patch970 -p1 %patch970 -p1
%patch971 -p1
%patch848 -p1 %patch848 -p1
%if 0%{!?el6:1} %if 0%{!?el6:1}
@ -1330,6 +1335,10 @@ then
fi fi
%changelog %changelog
* Fri Oct 3 2014 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.8-24.fc21
- Fix "save breakpoints" for signal catchpoints and disabled breakpoints
(BZ 1146170, Miroslav Franc).
* Mon Sep 15 2014 Sergio Durigan Junior <sergiodj@redhat.com> - 7.8-23.fc21 * Mon Sep 15 2014 Sergio Durigan Junior <sergiodj@redhat.com> - 7.8-23.fc21
- Install gdb/jit-reader.h on include directory (BZ 1141968). - Install gdb/jit-reader.h on include directory (BZ 1141968).