aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2018-01-19 09:41:42 +0100
committerMarkus Metzger <markus.t.metzger@intel.com>2018-02-09 14:03:19 +0100
commit9ee23a853c18da3c83530c7957464bc6b6e9fb16 (patch)
treecc521ddfe1933136fba498948eb2729ee48a9f55 /gdb/nat
parent5c3284c1ec2edc28b0697532fd094d93d5ecf31b (diff)
downloadgdb-9ee23a853c18da3c83530c7957464bc6b6e9fb16.zip
gdb-9ee23a853c18da3c83530c7957464bc6b6e9fb16.tar.gz
gdb-9ee23a853c18da3c83530c7957464bc6b6e9fb16.tar.bz2
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.
Diffstat (limited to 'gdb/nat')
-rw-r--r--gdb/nat/linux-btrace.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index 354094f..2b37e41 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -909,6 +909,9 @@ linux_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
break;
}
+ if (tinfo == NULL)
+ error (_("Unknown error."));
+
return tinfo;
}