btrace, gdbserver: use exceptions to convey btrace enable/disable errors
authorMarkus Metzger <markus.t.metzger@intel.com>
Fri, 19 Jan 2018 08:41:42 +0000 (09:41 +0100)
committerMarkus Metzger <markus.t.metzger@intel.com>
Fri, 9 Feb 2018 13:03:19 +0000 (14:03 +0100)
commit9ee23a853c18da3c83530c7957464bc6b6e9fb16
treecc521ddfe1933136fba498948eb2729ee48a9f55
parent5c3284c1ec2edc28b0697532fd094d93d5ecf31b
btrace, gdbserver: use exceptions to convey btrace enable/disable errors

Change error reporting to use exceptions and be prepared to catch them in
gdbserver.  We use the exception message in our error reply to GDB.

This may remove some detail from the error message in the native case since
errno is no longer printed.  Later patches will improve that.

We're still using error strings on the RSP level.  This patch does not affect
the interoperability of older/newer GDB/gdbserver.

gdbserver/
* server.c (handle_btrace_enable_bts, handle_btrace_enable_pt)
(handle_btrace_disable): Change return type to void.  Use exceptions
to report errors.
(handle_btrace_general_set): Catch exception and copy message to
return message.

gdb/
* nat/linux-btrace.c (linux_enable_btrace): Throw exception if enabling
btrace failed.
* x86-linux-nat.c (x86_linux_enable_btrace): Catch btrace enabling
exception and use message in own exception.
gdb/ChangeLog
gdb/gdbserver/ChangeLog
gdb/gdbserver/server.c
gdb/nat/linux-btrace.c
gdb/x86-linux-nat.c
This page took 0.02734 seconds and 4 git commands to generate.