* [PATCH] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
@ 2015-10-22 16:04 Antoine Tremblay
2015-10-22 16:11 ` Pedro Alves
0 siblings, 1 reply; 14+ messages in thread
From: Antoine Tremblay @ 2015-10-22 16:04 UTC (permalink / raw)
To: gdb-patches; +Cc: Antoine Tremblay
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 removing the default 0 breakpoint kind and
implementing all the targets breakpoint_kind_from_pc functions on linux.
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}
Compilation was tested on: aarch64,bfin,cris,crisv32,m32r,m68k,mips,nios2,ppc,
s390,sparc,tic6x,tile,x86,xtensa.
Not tested: sh
gdb/gdbserver/ChangeLog:
* linux-aarch64-low.c (aarch64_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-bfin-low.c (bfin_breakpoint_kind_from_pc) New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-cris-low.c (cris_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-crisv32-low.c (cris_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-low.c (linux_breakpoint_kind_from_pc): Remove default return
value.
* linux-m32r-low.c (m32r_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-m68k-low.c (m68k_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-mips-low.c (mips_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-nios2-low.c (nios2_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-ppc-low.c (ppc_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-s390-low.c (s390_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-sh-low.c (sh_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-sparc-low.c (sparc_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-tic6x-low.c (tic6x_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-tile-low.c (tile_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-x86-low.c (x86_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
* linux-xtensa-low.c (xtensa_breakpoint_kind_from_pc): New function.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
---
gdb/gdbserver/linux-aarch64-low.c | 10 +++++++++-
gdb/gdbserver/linux-bfin-low.c | 10 +++++++++-
gdb/gdbserver/linux-cris-low.c | 10 +++++++++-
gdb/gdbserver/linux-crisv32-low.c | 10 +++++++++-
gdb/gdbserver/linux-low.c | 8 +++-----
gdb/gdbserver/linux-m32r-low.c | 10 +++++++++-
gdb/gdbserver/linux-m68k-low.c | 10 +++++++++-
gdb/gdbserver/linux-mips-low.c | 10 +++++++++-
gdb/gdbserver/linux-nios2-low.c | 10 +++++++++-
gdb/gdbserver/linux-ppc-low.c | 10 +++++++++-
gdb/gdbserver/linux-s390-low.c | 10 +++++++++-
gdb/gdbserver/linux-sh-low.c | 10 +++++++++-
gdb/gdbserver/linux-sparc-low.c | 10 +++++++++-
gdb/gdbserver/linux-tic6x-low.c | 10 +++++++++-
gdb/gdbserver/linux-tile-low.c | 10 +++++++++-
gdb/gdbserver/linux-x86-low.c | 11 ++++++++++-
gdb/gdbserver/linux-xtensa-low.c | 10 +++++++++-
17 files changed, 148 insertions(+), 21 deletions(-)
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index cb49a04..fc6757e 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -2931,6 +2931,14 @@ aarch64_supports_range_stepping (void)
return 1;
}
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+aarch64_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return aarch64_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -2949,7 +2957,7 @@ struct linux_target_ops the_low_target =
NULL, /* fetch_register */
aarch64_get_pc,
aarch64_set_pc,
- NULL, /* breakpoint_kind_from_pc */
+ aarch64_breakpoint_kind_from_pc,
aarch64_sw_breakpoint_from_kind,
NULL, /* breakpoint_reinsert_addr */
0, /* decr_pc_after_break */
diff --git a/gdb/gdbserver/linux-bfin-low.c b/gdb/gdbserver/linux-bfin-low.c
index d3b83fc..e48674f 100644
--- a/gdb/gdbserver/linux-bfin-low.c
+++ b/gdb/gdbserver/linux-bfin-low.c
@@ -75,6 +75,14 @@ bfin_set_pc (struct regcache *regcache, CORE_ADDR pc)
#define bfin_breakpoint_len 2
static const gdb_byte bfin_breakpoint[bfin_breakpoint_len] = {0xa1, 0x00};
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+bfin_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return bfin_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -131,7 +139,7 @@ struct linux_target_ops the_low_target = {
NULL, /* fetch_register */
bfin_get_pc,
bfin_set_pc,
- NULL, /* breakpoint_kind_from_pc */
+ bfin_breakpoint_kind_from_pc,
bfin_sw_breakpoint_from_kind,
NULL, /* breakpoint_reinsert_addr */
2,
diff --git a/gdb/gdbserver/linux-cris-low.c b/gdb/gdbserver/linux-cris-low.c
index d7b70e3..4754ea3 100644
--- a/gdb/gdbserver/linux-cris-low.c
+++ b/gdb/gdbserver/linux-cris-low.c
@@ -81,6 +81,14 @@ cris_set_pc (struct regcache *regcache, CORE_ADDR pc)
static const unsigned short cris_breakpoint = 0xe938;
#define cris_breakpoint_len 2
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+cris_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return cris_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -149,7 +157,7 @@ struct linux_target_ops the_low_target = {
NULL, /* fetch_register */
cris_get_pc,
cris_set_pc,
- NULL, /* breakpoint_kind_from_pc */
+ cris_breakpoint_kind_from_pc,
cris_sw_breakpoint_from_kind,
cris_reinsert_addr,
0,
diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
index f97122e..0c59181 100644
--- a/gdb/gdbserver/linux-crisv32-low.c
+++ b/gdb/gdbserver/linux-crisv32-low.c
@@ -77,6 +77,14 @@ cris_set_pc (struct regcache *regcache, CORE_ADDR pc)
static const unsigned short cris_breakpoint = 0xe938;
#define cris_breakpoint_len 2
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+cris_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return cris_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -429,7 +437,7 @@ struct linux_target_ops the_low_target = {
NULL, /* fetch_register */
cris_get_pc,
cris_set_pc,
- NULL, /* breakpoint_kind_from_pc */
+ cris_breakpoint_kind_from_pc,
cris_sw_breakpoint_from_kind,
cris_reinsert_addr,
0,
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index c20e257..ec568a9 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -6942,11 +6942,9 @@ current_lwp_ptid (void)
static int
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;
+ gdb_assert (the_low_target.breakpoint_kind_from_pc != NULL);
+
+ return (*the_low_target.breakpoint_kind_from_pc) (pcptr);
}
/* Implementation of the target_ops method "sw_breakpoint_from_kind". */
diff --git a/gdb/gdbserver/linux-m32r-low.c b/gdb/gdbserver/linux-m32r-low.c
index bb1002f..269fc09 100644
--- a/gdb/gdbserver/linux-m32r-low.c
+++ b/gdb/gdbserver/linux-m32r-low.c
@@ -73,6 +73,14 @@ m32r_set_pc (struct regcache *regcache, CORE_ADDR pc)
static const unsigned short m32r_breakpoint = 0x10f1;
#define m32r_breakpoint_len 2
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+m32r_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return m32r_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -129,7 +137,7 @@ struct linux_target_ops the_low_target = {
NULL, /* fetch_register */
m32r_get_pc,
m32r_set_pc,
- NULL, /* breakpoint_from_pc */
+ m32r_breakpoint_kind_from_pc,
m32r_sw_breakpoint_from_kind,
NULL,
0,
diff --git a/gdb/gdbserver/linux-m68k-low.c b/gdb/gdbserver/linux-m68k-low.c
index ba8e5e9..2f65414 100644
--- a/gdb/gdbserver/linux-m68k-low.c
+++ b/gdb/gdbserver/linux-m68k-low.c
@@ -125,6 +125,14 @@ static struct regset_info m68k_regsets[] = {
static const gdb_byte m68k_breakpoint[] = { 0x4E, 0x4F };
#define m68k_breakpoint_len 2
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+m68k_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return m68k_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -224,7 +232,7 @@ struct linux_target_ops the_low_target = {
NULL, /* fetch_register */
m68k_get_pc,
m68k_set_pc,
- NULL, /* breakpoint_kind_from_pc */
+ m68k_breakpoint_kind_from_pc,
m68k_sw_breakpoint_from_kind,
NULL,
2,
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index 344d7a5..964c90f 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -266,6 +266,14 @@ mips_set_pc (struct regcache *regcache, CORE_ADDR pc)
static const unsigned int mips_breakpoint = 0x0005000d;
#define mips_breakpoint_len 4
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+mips_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return mips_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -890,7 +898,7 @@ struct linux_target_ops the_low_target = {
NULL, /* fetch_register */
mips_get_pc,
mips_set_pc,
- NULL, /* breakpoint_kind_from_pc */
+ mips_breakpoint_kind_from_pc,
mips_sw_breakpoint_from_kind,
mips_reinsert_addr,
0,
diff --git a/gdb/gdbserver/linux-nios2-low.c b/gdb/gdbserver/linux-nios2-low.c
index 95a2d9e..25b5da3 100644
--- a/gdb/gdbserver/linux-nios2-low.c
+++ b/gdb/gdbserver/linux-nios2-low.c
@@ -135,6 +135,14 @@ nios2_set_pc (struct regcache *regcache, CORE_ADDR pc)
static const unsigned int nios2_breakpoint = NIOS2_BREAKPOINT;
#define nios2_breakpoint_len 4
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+nios2_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return nios2_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -277,7 +285,7 @@ struct linux_target_ops the_low_target =
NULL,
nios2_get_pc,
nios2_set_pc,
- NULL, /* breakpoint_kind_from_pc */
+ nios2_breakpoint_kind_from_pc,
nios2_sw_breakpoint_from_kind,
nios2_reinsert_addr,
0,
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
index 6e6a936..b114d0c 100644
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -486,6 +486,14 @@ ppc_arch_setup (void)
static const unsigned int ppc_breakpoint = 0x7d821008;
#define ppc_breakpoint_len 4
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+ppc_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return ppc_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -694,7 +702,7 @@ struct linux_target_ops the_low_target = {
NULL, /* fetch_register */
ppc_get_pc,
ppc_set_pc,
- NULL, /* breakpoint_kind_from_pc */
+ ppc_breakpoint_kind_from_pc,
ppc_sw_breakpoint_from_kind,
NULL,
0,
diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c
index 2ba1221..1172f22 100644
--- a/gdb/gdbserver/linux-s390-low.c
+++ b/gdb/gdbserver/linux-s390-low.c
@@ -397,6 +397,14 @@ static struct regset_info s390_regsets[] = {
static const gdb_byte s390_breakpoint[] = { 0, 1 };
#define s390_breakpoint_len 2
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+s390_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return s390_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -674,7 +682,7 @@ struct linux_target_ops the_low_target = {
NULL, /* fetch_register */
s390_get_pc,
s390_set_pc,
- NULL, /* breakpoint_kind_from_pc */
+ s390_breakpoint_kind_from_pc,
s390_sw_breakpoint_from_kind,
NULL,
s390_breakpoint_len,
diff --git a/gdb/gdbserver/linux-sh-low.c b/gdb/gdbserver/linux-sh-low.c
index f7f3239..948738d 100644
--- a/gdb/gdbserver/linux-sh-low.c
+++ b/gdb/gdbserver/linux-sh-low.c
@@ -77,6 +77,14 @@ sh_set_pc (struct regcache *regcache, CORE_ADDR pc)
static const unsigned short sh_breakpoint = 0xc3c3;
#define sh_breakpoint_len 2
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+sh_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return sh_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -157,7 +165,7 @@ struct linux_target_ops the_low_target = {
NULL, /* fetch_register */
sh_get_pc,
sh_set_pc,
- NULL, /* breakpoint_kind_from_pc */
+ sh_breakpoint_kind_from_pc,
sh_sw_breakpoint_from_kind,
NULL,
0,
diff --git a/gdb/gdbserver/linux-sparc-low.c b/gdb/gdbserver/linux-sparc-low.c
index 0691867..e320651 100644
--- a/gdb/gdbserver/linux-sparc-low.c
+++ b/gdb/gdbserver/linux-sparc-low.c
@@ -240,6 +240,14 @@ static const gdb_byte sparc_breakpoint[INSN_SIZE] = {
};
#define sparc_breakpoint_len INSN_SIZE
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+sparc_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return sparc_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const unsigned char *
@@ -331,7 +339,7 @@ struct linux_target_ops the_low_target = {
sparc_get_pc,
/* No sparc_set_pc is needed. */
NULL,
- NULL, /* breakpoint_kind_from_pc */
+ sparc_breakpoint_kind_from_pc,
sparc_sw_breakpoint_from_kind,
sparc_reinsert_addr,
0,
diff --git a/gdb/gdbserver/linux-tic6x-low.c b/gdb/gdbserver/linux-tic6x-low.c
index d9476fd..e662eca 100644
--- a/gdb/gdbserver/linux-tic6x-low.c
+++ b/gdb/gdbserver/linux-tic6x-low.c
@@ -173,6 +173,14 @@ static int *tic6x_regmap;
static unsigned int tic6x_breakpoint;
#define tic6x_breakpoint_len 4
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+tic6x_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return tic6x_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -375,7 +383,7 @@ struct linux_target_ops the_low_target = {
NULL, /* fetch_register */
tic6x_get_pc,
tic6x_set_pc,
- NULL, /* breakpoint_kind_from_pc */
+ tic6x_breakpoint_kind_from_pc,
tic6x_sw_breakpoint_from_kind,
NULL,
0,
diff --git a/gdb/gdbserver/linux-tile-low.c b/gdb/gdbserver/linux-tile-low.c
index e31a620..c93b07c 100644
--- a/gdb/gdbserver/linux-tile-low.c
+++ b/gdb/gdbserver/linux-tile-low.c
@@ -88,6 +88,14 @@ tile_set_pc (struct regcache *regcache, CORE_ADDR pc)
static uint64_t tile_breakpoint = 0x400b3cae70166000ULL;
#define tile_breakpoint_len 8
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+tile_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return tile_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -191,7 +199,7 @@ struct linux_target_ops the_low_target =
NULL,
tile_get_pc,
tile_set_pc,
- NULL, /* breakpoint_kind_from_pc */
+ tile_breakpoint_kind_from_pc,
tile_sw_breakpoint_from_kind,
NULL,
0,
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 406d552..22bd5b0 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -3243,6 +3243,15 @@ x86_emit_ops (void)
return &i386_emit_ops;
}
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+x86_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return x86_breakpoint_len;
+}
+
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -3270,7 +3279,7 @@ struct linux_target_ops the_low_target =
NULL, /* fetch_register */
x86_get_pc,
x86_set_pc,
- NULL, /* breakpoint_kind_from_pc */
+ x86_breakpoint_kind_from_pc,
x86_sw_breakpoint_from_kind,
NULL,
1,
diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c
index fa6f418..17813b1 100644
--- a/gdb/gdbserver/linux-xtensa-low.c
+++ b/gdb/gdbserver/linux-xtensa-low.c
@@ -154,6 +154,14 @@ static struct regset_info xtensa_regsets[] = {
static const gdb_byte xtensa_breakpoint[] = XTENSA_BREAKPOINT;
#define xtensa_breakpoint_len 2
+/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+
+static int
+xtensa_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return xtensa_breakpoint_len;
+}
+
/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
@@ -243,7 +251,7 @@ struct linux_target_ops the_low_target = {
NULL, /* fetch_register */
xtensa_get_pc,
xtensa_set_pc,
- NULL, /* breakpoint_kind_from_pc */
+ xtensa_breakpoint_kind_from_pc,
xtensa_sw_breakpoint_from_kind,
NULL,
0,
--
1.9.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
2015-10-22 16:04 [PATCH] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer Antoine Tremblay
@ 2015-10-22 16:11 ` Pedro Alves
2015-10-22 16:14 ` Antoine Tremblay
2015-10-22 16:23 ` [PATCH v2] " Antoine Tremblay
0 siblings, 2 replies; 14+ messages in thread
From: Pedro Alves @ 2015-10-22 16:11 UTC (permalink / raw)
To: Antoine Tremblay, gdb-patches
On 10/22/2015 04:06 PM, Antoine Tremblay wrote:
> 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.
Bummer. :-/ But, wouldn't it work to make the default be instead:
int
default_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
{
int size;
target_sw_breakpoint_from_kind (0, &size);
return size;
}
?
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
2015-10-22 16:11 ` Pedro Alves
@ 2015-10-22 16:14 ` Antoine Tremblay
2015-10-22 16:23 ` [PATCH v2] " Antoine Tremblay
1 sibling, 0 replies; 14+ messages in thread
From: Antoine Tremblay @ 2015-10-22 16:14 UTC (permalink / raw)
To: Pedro Alves, gdb-patches
On 10/22/2015 11:17 AM, Pedro Alves wrote:
> On 10/22/2015 04:06 PM, Antoine Tremblay wrote:
>> 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.
>
> Bummer. :-/ But, wouldn't it work to make the default be instead:
>
> int
> default_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
> {
> int size;
>
> target_sw_breakpoint_from_kind (0, &size);
> return size;
> }
>
> ?
>
Indeed it would fixing.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
2015-10-22 16:11 ` Pedro Alves
2015-10-22 16:14 ` Antoine Tremblay
@ 2015-10-22 16:23 ` Antoine Tremblay
2015-10-22 16:26 ` Pedro Alves
1 sibling, 1 reply; 14+ messages in thread
From: Antoine Tremblay @ 2015-10-22 16:23 UTC (permalink / raw)
To: gdb-patches, palves; +Cc: Antoine Tremblay
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.
---
gdb/gdbserver/linux-low.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index c20e257..8d1730b 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. */
+
+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". */
--
1.9.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
2015-10-22 16:23 ` [PATCH v2] " Antoine Tremblay
@ 2015-10-22 16:26 ` Pedro Alves
2015-10-22 17:42 ` Antoine Tremblay
0 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2015-10-22 16:26 UTC (permalink / raw)
To: Antoine Tremblay, gdb-patches
On 10/22/2015 04:56 PM, Antoine Tremblay wrote:
> 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.
OK.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
2015-10-22 16:26 ` Pedro Alves
@ 2015-10-22 17:42 ` Antoine Tremblay
2015-10-22 19:58 ` Pedro Alves
0 siblings, 1 reply; 14+ messages in thread
From: Antoine Tremblay @ 2015-10-22 17:42 UTC (permalink / raw)
To: Pedro Alves; +Cc: GDB
On 10/22/2015 11:58 AM, Pedro Alves wrote:
> On 10/22/2015 04:56 PM, Antoine Tremblay wrote:
>> 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.
>
> OK.
>
I forgot to set the function default_breakpoint_kind_from_pc static, ok
with that change ?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
2015-10-22 17:42 ` Antoine Tremblay
@ 2015-10-22 19:58 ` Pedro Alves
2015-10-22 19:58 ` Antoine Tremblay
0 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2015-10-22 19:58 UTC (permalink / raw)
To: Antoine Tremblay; +Cc: GDB
On 10/22/2015 05:03 PM, Antoine Tremblay wrote:
>
>
> On 10/22/2015 11:58 AM, Pedro Alves wrote:
>> On 10/22/2015 04:56 PM, Antoine Tremblay wrote:
>>> 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.
>>
>> OK.
>>
>
> I forgot to set the function default_breakpoint_kind_from_pc static, ok
> with that change ?
Sure.
(I think you'll need to move the function to target.c to
fix !Linux ports, but I'm OK with doing that as a separate step.)
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
2015-10-22 19:58 ` Pedro Alves
@ 2015-10-22 19:58 ` Antoine Tremblay
2015-10-22 19:58 ` Pedro Alves
2015-10-23 16:48 ` Antoine Tremblay
0 siblings, 2 replies; 14+ messages in thread
From: Antoine Tremblay @ 2015-10-22 19:58 UTC (permalink / raw)
To: Pedro Alves; +Cc: GDB
On 10/22/2015 12:04 PM, Pedro Alves wrote:
> On 10/22/2015 05:03 PM, Antoine Tremblay wrote:
>>
>>
>> On 10/22/2015 11:58 AM, Pedro Alves wrote:
>>> On 10/22/2015 04:56 PM, Antoine Tremblay wrote:
>>>> 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.
>>>
>>> OK.
>>>
>>
>> I forgot to set the function default_breakpoint_kind_from_pc static, ok
>> with that change ?
>
> Sure.
>
> (I think you'll need to move the function to target.c to
> fix !Linux ports, but I'm OK with doing that as a separate step.)
>
I don't think so since I fix !linux ports like so :
/* Implementation of the target_ops method "breakpoint_kind_from_pc". */
static int
win32_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
{
return the_low_target.breakpoint_len;
}
/* Implementation of the target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
win32_sw_breakpoint_from_kind (int kind, int *size)
{
*size = the_low_target.breakpoint_len;
return the_low_target.breakpoint;
}
?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
2015-10-22 19:58 ` Antoine Tremblay
@ 2015-10-22 19:58 ` Pedro Alves
2015-10-23 1:42 ` Antoine Tremblay
2015-10-23 16:48 ` Antoine Tremblay
1 sibling, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2015-10-22 19:58 UTC (permalink / raw)
To: Antoine Tremblay; +Cc: GDB
On 10/22/2015 05:06 PM, Antoine Tremblay wrote:
> On 10/22/2015 12:04 PM, Pedro Alves wrote:
>> (I think you'll need to move the function to target.c to
>> fix !Linux ports, but I'm OK with doing that as a separate step.)
>>
>
> I don't think so since I fix !linux ports like so :
>
> /* Implementation of the target_ops method "breakpoint_kind_from_pc". */
>
> static int
> win32_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
> {
> return the_low_target.breakpoint_len;
> }
>
You don't need this one nor the equivalent in other ports if you
add this to target.h:
#define target_breakpoint_kind_from_pc(PCPTR) \
(the_target->breakpoint_kind_from_pc \
? (*the_target->breakpoint_kind_from_pc) (PCPTR) \
: default_breakpoint_kind_from_pc ())
(see the other similar macros there)
You'll need to adjust callers to call target_breakpoint_kind_from_pc
instead, of course.
Thanks,
Pedro Alves
> /* Implementation of the target_ops method "sw_breakpoint_from_kind". */
>
> static const gdb_byte *
> win32_sw_breakpoint_from_kind (int kind, int *size)
> {
> *size = the_low_target.breakpoint_len;
> return the_low_target.breakpoint;
> }
>
> ?
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
2015-10-22 19:58 ` Pedro Alves
@ 2015-10-23 1:42 ` Antoine Tremblay
2015-10-23 8:18 ` Antoine Tremblay
0 siblings, 1 reply; 14+ messages in thread
From: Antoine Tremblay @ 2015-10-23 1:42 UTC (permalink / raw)
To: Pedro Alves; +Cc: GDB
On 10/22/2015 12:11 PM, Pedro Alves wrote:
> On 10/22/2015 05:06 PM, Antoine Tremblay wrote:
>> On 10/22/2015 12:04 PM, Pedro Alves wrote:
>
>>> (I think you'll need to move the function to target.c to
>>> fix !Linux ports, but I'm OK with doing that as a separate step.)
>>>
>>
>> I don't think so since I fix !linux ports like so :
>>
>> /* Implementation of the target_ops method "breakpoint_kind_from_pc". */
>>
>> static int
>> win32_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
>> {
>> return the_low_target.breakpoint_len;
>> }
>>
>
> You don't need this one nor the equivalent in other ports if you
> add this to target.h:
>
> #define target_breakpoint_kind_from_pc(PCPTR) \
> (the_target->breakpoint_kind_from_pc \
> ? (*the_target->breakpoint_kind_from_pc) (PCPTR) \
> : default_breakpoint_kind_from_pc ())
>
> (see the other similar macros there)
>
> You'll need to adjust callers to call target_breakpoint_kind_from_pc
> instead, of course.
>
Yes but then I would need a os_arch_sw_breakpoint_from_kind operation in
all the arch that this os supports (and that I can't test), you think
it's still better that way ?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
2015-10-23 1:42 ` Antoine Tremblay
@ 2015-10-23 8:18 ` Antoine Tremblay
2015-10-23 8:52 ` Pedro Alves
0 siblings, 1 reply; 14+ messages in thread
From: Antoine Tremblay @ 2015-10-23 8:18 UTC (permalink / raw)
To: Pedro Alves; +Cc: GDB
On 10/22/2015 12:16 PM, Antoine Tremblay wrote:
>
>
> On 10/22/2015 12:11 PM, Pedro Alves wrote:
>> On 10/22/2015 05:06 PM, Antoine Tremblay wrote:
>>> On 10/22/2015 12:04 PM, Pedro Alves wrote:
>>
>>>> (I think you'll need to move the function to target.c to
>>>> fix !Linux ports, but I'm OK with doing that as a separate step.)
>>>>
>>>
>>> I don't think so since I fix !linux ports like so :
>>>
>>> /* Implementation of the target_ops method
>>> "breakpoint_kind_from_pc". */
>>>
>>> static int
>>> win32_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
>>> {
>>> return the_low_target.breakpoint_len;
>>> }
>>>
>>
>> You don't need this one nor the equivalent in other ports if you
>> add this to target.h:
>>
>> #define target_breakpoint_kind_from_pc(PCPTR) \
>> (the_target->breakpoint_kind_from_pc \
>> ? (*the_target->breakpoint_kind_from_pc) (PCPTR) \
>> : default_breakpoint_kind_from_pc ())
>>
>> (see the other similar macros there)
>>
>> You'll need to adjust callers to call target_breakpoint_kind_from_pc
>> instead, of course.
>>
>
> Yes but then I would need a os_arch_sw_breakpoint_from_kind operation in
> all the arch that this os supports (and that I can't test), you think
> it's still better that way ?
>
Unless I have another macro that checks for the sw_breakpoint_from_kind
and if abscent returns breakpoint_len... I could do that I guess..
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
2015-10-23 8:18 ` Antoine Tremblay
@ 2015-10-23 8:52 ` Pedro Alves
2015-10-23 15:05 ` Antoine Tremblay
0 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2015-10-23 8:52 UTC (permalink / raw)
To: Antoine Tremblay; +Cc: GDB
On 10/22/2015 05:18 PM, Antoine Tremblay wrote:
>
>
> On 10/22/2015 12:16 PM, Antoine Tremblay wrote:
>>
>>
>> On 10/22/2015 12:11 PM, Pedro Alves wrote:
>>> You don't need this one nor the equivalent in other ports if you
>>> add this to target.h:
>>>
>>> #define target_breakpoint_kind_from_pc(PCPTR) \
>>> (the_target->breakpoint_kind_from_pc \
>>> ? (*the_target->breakpoint_kind_from_pc) (PCPTR) \
>>> : default_breakpoint_kind_from_pc ())
>>>
>>> (see the other similar macros there)
>>>
>>> You'll need to adjust callers to call target_breakpoint_kind_from_pc
>>> instead, of course.
>>>
>>
>> Yes but then I would need a os_arch_sw_breakpoint_from_kind operation in
>> all the arch that this os supports (and that I can't test), you think
>> it's still better that way ?
>>
>
> Unless I have another macro that checks for the sw_breakpoint_from_kind
> and if abscent returns breakpoint_len... I could do that I guess..
I guess I'm confused. Why doesn't what you already had, like
below, work as is?
static const gdb_byte *
win32_sw_breakpoint_from_kind (int kind, int *size)
{
*size = the_low_target.breakpoint_len;
return the_low_target.breakpoint;
}
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
2015-10-23 8:52 ` Pedro Alves
@ 2015-10-23 15:05 ` Antoine Tremblay
0 siblings, 0 replies; 14+ messages in thread
From: Antoine Tremblay @ 2015-10-23 15:05 UTC (permalink / raw)
To: Pedro Alves; +Cc: GDB
On 10/22/2015 12:23 PM, Pedro Alves wrote:
> On 10/22/2015 05:18 PM, Antoine Tremblay wrote:
>>
>>
>> On 10/22/2015 12:16 PM, Antoine Tremblay wrote:
>>>
>>>
>>> On 10/22/2015 12:11 PM, Pedro Alves wrote:
>
>>>> You don't need this one nor the equivalent in other ports if you
>>>> add this to target.h:
>>>>
>>>> #define target_breakpoint_kind_from_pc(PCPTR) \
>>>> (the_target->breakpoint_kind_from_pc \
>>>> ? (*the_target->breakpoint_kind_from_pc) (PCPTR) \
>>>> : default_breakpoint_kind_from_pc ())
>>>>
>>>> (see the other similar macros there)
>>>>
>>>> You'll need to adjust callers to call target_breakpoint_kind_from_pc
>>>> instead, of course.
>>>>
>>>
>
>>> Yes but then I would need a os_arch_sw_breakpoint_from_kind operation in
>>> all the arch that this os supports (and that I can't test), you think
>>> it's still better that way ?
>>>
>>
>> Unless I have another macro that checks for the sw_breakpoint_from_kind
>> and if abscent returns breakpoint_len... I could do that I guess..
>
> I guess I'm confused. Why doesn't what you already had, like
> below, work as is?
>
> static const gdb_byte *
> win32_sw_breakpoint_from_kind (int kind, int *size)
> {
> *size = the_low_target.breakpoint_len;
> return the_low_target.breakpoint;
> }
>
Ho yes it would, sorry I was confused I though you meant remove both
win32_breakpoint_kind_from_pc and win32_sw_breakpoint_from_kind before.
Removing only win32_breakpoint_kind_from_pc and adding the default macro
works.
Thanks,
Antoine
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
2015-10-22 19:58 ` Antoine Tremblay
2015-10-22 19:58 ` Pedro Alves
@ 2015-10-23 16:48 ` Antoine Tremblay
1 sibling, 0 replies; 14+ messages in thread
From: Antoine Tremblay @ 2015-10-23 16:48 UTC (permalink / raw)
To: Pedro Alves; +Cc: GDB
On 10/22/2015 12:06 PM, Antoine Tremblay wrote:
>
>
> On 10/22/2015 12:04 PM, Pedro Alves wrote:
>> On 10/22/2015 05:03 PM, Antoine Tremblay wrote:
>>>
>>>
>>> On 10/22/2015 11:58 AM, Pedro Alves wrote:
>>>> On 10/22/2015 04:56 PM, Antoine Tremblay wrote:
>>>>> 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.
>>>>
>>>> OK.
>>>>
>>>
>>> I forgot to set the function default_breakpoint_kind_from_pc static, ok
>>> with that change ?
>>
>> Sure.
>>
Pushed.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2015-10-22 17:42 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22 16:04 [PATCH] Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer Antoine Tremblay
2015-10-22 16:11 ` Pedro Alves
2015-10-22 16:14 ` Antoine Tremblay
2015-10-22 16:23 ` [PATCH v2] " Antoine Tremblay
2015-10-22 16:26 ` Pedro Alves
2015-10-22 17:42 ` Antoine Tremblay
2015-10-22 19:58 ` Pedro Alves
2015-10-22 19:58 ` Antoine Tremblay
2015-10-22 19:58 ` Pedro Alves
2015-10-23 1:42 ` Antoine Tremblay
2015-10-23 8:18 ` Antoine Tremblay
2015-10-23 8:52 ` Pedro Alves
2015-10-23 15:05 ` Antoine Tremblay
2015-10-23 16:48 ` Antoine Tremblay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox