This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
- From: Antoine Tremblay <hexa at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 22 Oct 2015 16:24:21 -0000
- Subject: [binutils-gdb] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1652a98612a20443c0e17fd90e7f6941b7bc3ad8
commit 1652a98612a20443c0e17fd90e7f6941b7bc3ad8
Author: Antoine Tremblay <antoine.tremblay@ericsson.com>
Date: Thu Oct 22 12:21:51 2015 -0400
Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
This patch fixes a regression introduced by :
https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html
Tests : gdb.trace/trace-break.exp and gdb.trace/trace-mt.exp would fail on x86
with gdbserver-{native,extended}.
Before this patch, the breakpoint kind set by GDB with a Z packet and the one
set in the case of a tracepoint would be inconsistent on targets that did not
implement breakpoint_kind_from_pc. On x86 for example a breakpoint set by GDB
would have a kind of 1 but a breakpoint set by a tracepoint would have a kind of
0.
This created a missmatch when trying to insert a tracepoint and a breakpoint at
the same location. One of the two breakpoints would be removed with debug
message : "Inconsistent breakpoint kind".
This patch fixes the issue by changing the default 0 breakpoint kind to be
the size of the breakpoint according to sw_breakpoint_from_kind.
The default breakpoint kind must be the breakpoint length to keep consistency
between breakpoints set via GDB and the ones set internally by GDBServer.
No regression on Ubuntu 14.04 x86-64 with gdbserver-{native-extended}
gdb/gdbserver/ChangeLog:
* linux-low.c (default_breakpoint_kind_from_pc): New function.
(linux_breakpoint_kind_from_pc): Use default_breakpoint_kind_from_pc for
the default breakpoint kind.
Diff:
---
gdb/gdbserver/ChangeLog | 6 ++++++
gdb/gdbserver/linux-low.c | 16 ++++++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index ceb8c4d..9519ed7 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,9 @@
+2015-10-22 Antoine Tremblay <antoine.tremblay@ericsson.com>
+
+ * linux-low.c (default_breakpoint_kind_from_pc): New function.
+ (linux_breakpoint_kind_from_pc): Use default_breakpoint_kind_from_pc for
+ the default breakpoint kind.
+
2015-10-21 Antoine Tremblay <antoine.tremblay@ericsson.com>
* linux-arm-low.c (arm_supports_z_point_type): Add software
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index c20e257..ac8fae3 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -6937,6 +6937,19 @@ current_lwp_ptid (void)
return ptid_of (current_thread);
}
+/* Return the default breakpoint kind as the size of the breakpoint. */
+
+static int
+default_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ int size = 0;
+
+ gdb_assert (the_low_target.sw_breakpoint_from_kind != NULL);
+
+ (*the_low_target.sw_breakpoint_from_kind) (0, &size);
+ return size;
+}
+
/* Implementation of the target_ops method "breakpoint_kind_from_pc". */
static int
@@ -6945,8 +6958,7 @@ linux_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
if (the_low_target.breakpoint_kind_from_pc != NULL)
return (*the_low_target.breakpoint_kind_from_pc) (pcptr);
else
- /* Default breakpoint kind value. */
- return 0;
+ return default_breakpoint_kind_from_pc (pcptr);
}
/* Implementation of the target_ops method "sw_breakpoint_from_kind". */