aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2018-01-19 14:32:09 +0100
committerMarkus Metzger <markus.t.metzger@intel.com>2018-02-09 14:03:20 +0100
commitde6242d3075700ec4b73bdee583dc216f3a0b046 (patch)
tree1ec1bfd7c1cc4fc218cc6c3efcb66db3b6164c73 /gdb/gdbserver
parent9ee23a853c18da3c83530c7957464bc6b6e9fb16 (diff)
downloadgdb-de6242d3075700ec4b73bdee583dc216f3a0b046.zip
gdb-de6242d3075700ec4b73bdee583dc216f3a0b046.tar.gz
gdb-de6242d3075700ec4b73bdee583dc216f3a0b046.tar.bz2
btrace, gdbserver: remove the to_supports_btrace target method
Remove the to_supports_btrace target method and instead rely on detecting errors when trying to enable recording. This will also provide a suitable error message explaining why recording is not possible. For remote debugging, gdbserver will now always advertise branch tracing related packets. When talking to an older GDB, this will cause GDB to try to enable branch tracing and gdbserver to report a suitable error message every time. An older gdbserver will not advertise branch tracing related packets if the one-time check failed, so a newer GDB with this patch will fail to enable branch tracing at remote_enable_btrace() rather than at btrace_enable(). The error message is the same in both cases so there should be no user-visible change. gdb/ * btrace.c (btrace_enable): Remove target_supports_btrace call. * nat/linux-btrace.c (perf_event_pt_event_type): Move. (kernel_supports_bts, kernel_supports_pt, linux_supports_bts) (linux_supports_pt, linux_supports_btrace): Remove. (linux_enable_bts): Call cpu_supports_bts. * nat/linux-btrace.h (linux_supports_btrace): Remove. * remote.c (remote_supports_btrace): Remove. (init_remote_ops): Remove remote_supports_btrace. * target-delegates.c: Regenerated. * target.c (target_supports_btrace): Remove. * target.h (target_ops) <to_supports_btrace>: Remove (target_supports_btrace): Remove. * x86-linux-nat.c (x86_linux_create_target): Remove linux_supports_btrace. gdbserver/ * linux-low.c (linux_target_ops): Remove linux_supports_btrace. * nto-low.c (nto_target_ops): Remove NULL for supports_btrace. * spu-low.c (spu_target_ops): Likewise. * win32-low.c (win32_target_ops): Likewise. * server.c (supported_btrace_packets): Report packets unconditionally. * target.h (target_ops) <supports_btrace>: Remove. (target_supports_btrace): Remove.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog10
-rw-r--r--gdb/gdbserver/linux-low.c2
-rw-r--r--gdb/gdbserver/nto-low.c1
-rw-r--r--gdb/gdbserver/server.c25
-rw-r--r--gdb/gdbserver/spu-low.c1
-rw-r--r--gdb/gdbserver/target.h7
-rw-r--r--gdb/gdbserver/win32-low.c1
7 files changed, 14 insertions, 33 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 1b8d6f6..0ff5af7 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,15 @@
2018-02-09 Markus Metzger <markus.t.metzger@intel.com>
+ * linux-low.c (linux_target_ops): Remove linux_supports_btrace.
+ * nto-low.c (nto_target_ops): Remove NULL for supports_btrace.
+ * spu-low.c (spu_target_ops): Likewise.
+ * win32-low.c (win32_target_ops): Likewise.
+ * server.c (supported_btrace_packets): Report packets unconditionally.
+ * target.h (target_ops) <supports_btrace>: Remove.
+ (target_supports_btrace): Remove.
+
+2018-02-09 Markus Metzger <markus.t.metzger@intel.com>
+
* server.c (handle_btrace_enable_bts, handle_btrace_enable_pt)
(handle_btrace_disable): Change return type to void. Use exceptions
to report errors.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index b6b660e..00385ce 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -7531,7 +7531,6 @@ static struct target_ops linux_target_ops = {
linux_qxfer_libraries_svr4,
linux_supports_agent,
#ifdef HAVE_LINUX_BTRACE
- linux_supports_btrace,
linux_enable_btrace,
linux_low_disable_btrace,
linux_low_read_btrace,
@@ -7541,7 +7540,6 @@ static struct target_ops linux_target_ops = {
NULL,
NULL,
NULL,
- NULL,
#endif
linux_supports_range_stepping,
linux_proc_pid_to_exec_file,
diff --git a/gdb/gdbserver/nto-low.c b/gdb/gdbserver/nto-low.c
index a570ca9..b68b811 100644
--- a/gdb/gdbserver/nto-low.c
+++ b/gdb/gdbserver/nto-low.c
@@ -991,7 +991,6 @@ static struct target_ops nto_target_ops = {
NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* qxfer_libraries_svr4 */
NULL, /* support_agent */
- NULL, /* support_btrace */
NULL, /* enable_btrace */
NULL, /* disable_btrace */
NULL, /* read_btrace */
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 5ce6281..cb02b58 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -2104,27 +2104,10 @@ crc32 (CORE_ADDR base, int len, unsigned int crc)
static void
supported_btrace_packets (char *buf)
{
- int btrace_supported = 0;
-
- if (target_supports_btrace (BTRACE_FORMAT_BTS))
- {
- strcat (buf, ";Qbtrace:bts+");
- strcat (buf, ";Qbtrace-conf:bts:size+");
-
- btrace_supported = 1;
- }
-
- if (target_supports_btrace (BTRACE_FORMAT_PT))
- {
- strcat (buf, ";Qbtrace:pt+");
- strcat (buf, ";Qbtrace-conf:pt:size+");
-
- btrace_supported = 1;
- }
-
- if (!btrace_supported)
- return;
-
+ strcat (buf, ";Qbtrace:bts+");
+ strcat (buf, ";Qbtrace-conf:bts:size+");
+ strcat (buf, ";Qbtrace:pt+");
+ strcat (buf, ";Qbtrace-conf:pt:size+");
strcat (buf, ";Qbtrace:off+");
strcat (buf, ";qXfer:btrace:read+");
strcat (buf, ";qXfer:btrace-conf:read+");
diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c
index fd1f8d6..5b880d2 100644
--- a/gdb/gdbserver/spu-low.c
+++ b/gdb/gdbserver/spu-low.c
@@ -717,7 +717,6 @@ static struct target_ops spu_target_ops = {
NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* qxfer_libraries_svr4 */
NULL, /* support_agent */
- NULL, /* support_btrace */
NULL, /* enable_btrace */
NULL, /* disable_btrace */
NULL, /* read_btrace */
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index 295e64d..dcefe1a 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -391,9 +391,6 @@ struct target_ops
/* Return true if target supports debugging agent. */
int (*supports_agent) (void);
- /* Check whether the target supports branch tracing. */
- int (*supports_btrace) (struct target_ops *, enum btrace_format);
-
/* Enable branch tracing for PTID based on CONF and allocate a branch trace
target information struct for reading and for disabling branch trace. */
struct btrace_target_info *(*enable_btrace)
@@ -623,10 +620,6 @@ int kill_inferior (int);
(the_target->supports_agent ? \
(*the_target->supports_agent) () : 0)
-#define target_supports_btrace(format) \
- (the_target->supports_btrace \
- ? (*the_target->supports_btrace) (the_target, format) : 0)
-
#define target_enable_btrace(ptid, conf) \
(*the_target->enable_btrace) (ptid, conf)
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index b1d9b51..9f0c4e4 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -1842,7 +1842,6 @@ static struct target_ops win32_target_ops = {
NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* qxfer_libraries_svr4 */
NULL, /* support_agent */
- NULL, /* support_btrace */
NULL, /* enable_btrace */
NULL, /* disable_btrace */
NULL, /* read_btrace */