diff options
author | Markus Metzger <markus.t.metzger@intel.com> | 2014-01-17 13:29:19 +0100 |
---|---|---|
committer | Markus Metzger <markus.t.metzger@intel.com> | 2015-02-09 09:31:14 +0100 |
commit | 043c35779713a14e0916a1b3e31e006cd1270ee4 (patch) | |
tree | 78cc293d4bfbd43ae860a32373ab7721542fe5ea /gdb/gdbserver | |
parent | 734b0e4bda4c56d0003182cdc3f5137d4bea00d4 (diff) | |
download | gdb-043c35779713a14e0916a1b3e31e006cd1270ee4.zip gdb-043c35779713a14e0916a1b3e31e006cd1270ee4.tar.gz gdb-043c35779713a14e0916a1b3e31e006cd1270ee4.tar.bz2 |
btrace: add format argument to supports_btrace
Add a format argument to the various supports_btrace functions to check
for support of a specific btrace format. This is to prepare for a new
format.
Removed two redundant calls. The check will be made in the subsequent
btrace_enable call.
2015-02-09 Markus Metzger <markus.t.metzger@intel.com>
* btrace.c (btrace_enable): Pass BTRACE_FORMAT_BTS.
* record-btrace.c (record_btrace_open): Remove call to
target_supports_btrace.
* remote.c (remote_supports_btrace): Update parameters.
* target.c (target_supports_btrace): Update parameters.
* target.h (to_supports_btrace, target_supports_btrace): Update
parameters.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_btrace_format): New.
* nat/linux-btrace.c
(kernel_supports_btrace): Rename into ...
(kernel_supports_bts): ... this. Update users. Update warning text.
(intel_supports_btrace): Rename into ...
(intel_supports_bts): ... this. Update users.
(cpu_supports_btrace): Rename into ...
(cpu_supports_bts): ... this. Update users.
(linux_supports_btrace): Update parameters. Split into this and ...
(linux_supports_bts): ... this.
* nat/linux-btrace.h (linux_supports_btrace): Update parameters.
gdbserver/
* server.c (handle_btrace_general_set): Remove call to
target_supports_btrace.
(supported_btrace_packets): New.
(handle_query): Call supported_btrace_packets.
* target.h: include btrace-common.h.
(btrace_target_info): Removed.
(supports_btrace, target_supports_btrace): Update parameters.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/gdbserver/server.c | 27 | ||||
-rw-r--r-- | gdb/gdbserver/target.h | 8 |
3 files changed, 29 insertions, 16 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index fd8402e..636ad2e 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,15 @@ 2015-02-09 Markus Metzger <markus.t.metzger@intel.com> + * server.c (handle_btrace_general_set): Remove call to + target_supports_btrace. + (supported_btrace_packets): New. + (handle_query): Call supported_btrace_packets. + * target.h: include btrace-common.h. + (btrace_target_info): Removed. + (supports_btrace, target_supports_btrace): Update parameters. + +2015-02-09 Markus Metzger <markus.t.metzger@intel.com> + * Makefile.in (SFILES): Add common/btrace-common.c. (OBS): Add common/btrace-common.o. (btrace-common.o): Add build rules. diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 0e72cf1..1756a1f 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -426,12 +426,6 @@ handle_btrace_general_set (char *own_buf) op = own_buf + strlen ("Qbtrace:"); - if (!target_supports_btrace ()) - { - strcpy (own_buf, "E.Target does not support branch tracing."); - return -1; - } - if (ptid_equal (general_thread, null_ptid) || ptid_equal (general_thread, minus_one_ptid)) { @@ -1692,6 +1686,20 @@ crc32 (CORE_ADDR base, int len, unsigned int crc) return (unsigned long long) crc; } +/* Add supported btrace packets to BUF. */ + +static void +supported_btrace_packets (char *buf) +{ + if (target_supports_btrace (BTRACE_FORMAT_BTS)) + strcat (buf, ";Qbtrace:bts+"); + else + return; + + strcat (buf, ";Qbtrace:off+"); + strcat (buf, ";qXfer:btrace:read+"); +} + /* Handle all of the extended 'q' packets. */ void @@ -1923,12 +1931,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) if (target_supports_agent ()) strcat (own_buf, ";QAgent+"); - if (target_supports_btrace ()) - { - strcat (own_buf, ";Qbtrace:bts+"); - strcat (own_buf, ";Qbtrace:off+"); - strcat (own_buf, ";qXfer:btrace:read+"); - } + supported_btrace_packets (own_buf); return; } diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h index bbb0567..ed57886 100644 --- a/gdb/gdbserver/target.h +++ b/gdb/gdbserver/target.h @@ -26,9 +26,9 @@ #include "target/wait.h" #include "target/waitstatus.h" #include "mem-break.h" +#include "btrace-common.h" struct emit_ops; -struct btrace_target_info; struct buffer; struct process_info; @@ -355,7 +355,7 @@ struct target_ops int (*supports_agent) (void); /* Check whether the target supports branch tracing. */ - int (*supports_btrace) (struct target_ops *); + int (*supports_btrace) (struct target_ops *, enum btrace_format); /* Enable branch tracing for @ptid and allocate a branch trace target information struct for reading and for disabling branch trace. */ @@ -489,9 +489,9 @@ int kill_inferior (int); (the_target->supports_agent ? \ (*the_target->supports_agent) () : 0) -#define target_supports_btrace() \ +#define target_supports_btrace(format) \ (the_target->supports_btrace \ - ? (*the_target->supports_btrace) (the_target) : 0) + ? (*the_target->supports_btrace) (the_target, format) : 0) #define target_enable_btrace(ptid) \ (*the_target->enable_btrace) (ptid) |