public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Permanent breakpoints degrade to normal breakpoints on enable
@ 2013-10-18 14:48 Andrew Burgess
  2013-10-18 14:53 ` Luis Machado
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andrew Burgess @ 2013-10-18 14:48 UTC (permalink / raw)
  To: gdb-patches; +Cc: lgustavo

This patch:
   https://sourceware.org/ml/gdb-patches/2012-01/msg00964.html

introduced what I believe is a stray line that causes permanent
breakpoints to become normal breakpoints if the user ever tries
to "enable" the permanent breakpoint.

I've removed the extra line and written a test to cover this case.

OK to apply?

Andrew

gdb/ChangeLog

2013-10-18  Andrew Burgess  <aburgess@broadcom.com>

	* breakpoint.c (enable_breakpoint_disp): Remove setting of
	enabled_state for permanent breakpoints.

gdb/testsuite/ChangeLog

2013-10-18  Andrew Burgess  <aburgess@broadcom.com>

	* gdb.arch/i386-permbkpt.exp: Extend the existing tests, and add
	more tests.

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 911f7b5..53ece71 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -14666,8 +14666,6 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
   if (bpt->enable_state != bp_permanent)
     bpt->enable_state = bp_enabled;
 
-  bpt->enable_state = bp_enabled;
-
   /* Mark breakpoint locations modified.  */
   mark_breakpoint_modified (bpt);
 
diff --git a/gdb/testsuite/gdb.arch/i386-permbkpt.exp b/gdb/testsuite/gdb.arch/i386-permbkpt.exp
index 88bfff3..52c2ee1 100644
--- a/gdb/testsuite/gdb.arch/i386-permbkpt.exp
+++ b/gdb/testsuite/gdb.arch/i386-permbkpt.exp
@@ -18,6 +18,9 @@
 
 # Test inserting breakpoints over permanent breakpoints on i386 and amd64.
 
+global hex
+global decimal
+
 if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then {
     verbose "Skipping i386 test for multi break at permanent breakpoint location."
     return
@@ -35,5 +38,28 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list
 
 clean_restart ${binfile}
 
-gdb_test "break main" "" "First permanent break"
-gdb_test "break main" "" "Second permanent break"
+gdb_test "break main" \
+    "Breakpoint $decimal at $hex: .*" \
+    "First permanent break"
+gdb_test_no_output "set \$bp1 = \$bpnum"
+
+# Place a second breakpoint at the same place as the first, check
+# that the first is called a "permanent" breakpoint.
+gdb_test "break main" \
+    "Note: breakpoint $decimal \\(permanent\\) also set at pc $hex\.\[\n\r\]+Breakpoint $decimal at $hex: .*" \
+    "Second permanent break"
+gdb_test_no_output "set \$bp2 = \$bpnum"
+
+# Now, delete the last breakpoint placed.
+gdb_test_no_output "delete \$bp2"
+
+# Now 'enable' the first breakpoint, this should have no impact as the
+# breakpoint is already enabled, however, we've had bugs in this code
+# before now.
+gdb_test_no_output "enable \$bp1"
+
+# Check that placing (another) second breakpoint at the same location as
+# the first still reports the first as a permanent breakpoint.
+gdb_test "break main" \
+    "Note: breakpoint $decimal \\(permanent\\) also set at pc $hex\.\[\n\r\]+Breakpoint $decimal at $hex: .*" \
+    "Third permanent break"

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-05 18:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-18 14:48 [PATCH] Permanent breakpoints degrade to normal breakpoints on enable Andrew Burgess
2013-10-18 14:53 ` Luis Machado
2013-10-18 16:15 ` Pedro Alves
2013-10-18 16:17 ` I think permanent breakpoints are fundamentally broken as is (was: Re: [PATCH] Permanent breakpoints degrade to normal breakpoints on enable) Pedro Alves
2013-10-29 17:52   ` I think permanent breakpoints are fundamentally broken as is Andrew Burgess
2013-11-05 18:23     ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).