btrace, gdbserver: check btrace target pointers
authorMarkus Metzger <markus.t.metzger@intel.com>
Mon, 26 Feb 2018 10:59:43 +0000 (11:59 +0100)
committerMarkus Metzger <markus.t.metzger@intel.com>
Thu, 1 Mar 2018 11:25:24 +0000 (12:25 +0100)
commitb1223e789040e9e8cdc6869a8a1fd1fd7acc109d
treea78818f6114510019848a9479b8eaf5172868984
parentca8e0133c4a99d9828beab2fc95699e9fb73815c
btrace, gdbserver: check btrace target pointers

By removing the supports_btrace gdbserver target method we relied on GDB
trying to enable branch tracing and failing on the attempt.

For targets that do not provide the btrace methods, however, an initial
request from GDB for the branch trace configuration to detect whether
gdbserver is already recording resulted in a protocol error.

Have the btrace target methods throw a "Target does not suppor branch
tracing" error and be prepared to handle exceptions in all functions that
call btrace target methods.  We therefore turn the target_* macros into
static inline functions.

Also remove the additional btrace target method checks that resulted in
the above protocol error.

Thanks to Maciej W. Rozycki <macro@mips.com> for reporting this.

gdbserver/
* target.h (target_enable_btrace, target_disable_btrace)
(target_read_btrace, target_read_btrace_conf): Turn macro into
inline function.  Throw error if target method is not defined.
* server.c (handle_qxfer_btrace, handle_qxfer_btrace_conf): Remove
check for btrace target method.  Be prepared to handle exceptions
from btrace target methods.
gdb/gdbserver/ChangeLog
gdb/gdbserver/server.c
gdb/gdbserver/target.h
This page took 0.02814 seconds and 4 git commands to generate.