aboutsummaryrefslogtreecommitdiff
path: root/gdb/aarch64-linux-tdep.c
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2015-03-18 10:47:45 +0000
committerYao Qi <yao.qi@linaro.org>2015-03-18 10:47:45 +0000
commitf68f11b76de09dcb0d399814127fbf5227fe8245 (patch)
tree0967c5bcb646c93eb79564e57004403bdbbf38d2 /gdb/aarch64-linux-tdep.c
parentb3862264bc6009a993685ee5e9dd2879a503e36a (diff)
downloadgdb-f68f11b76de09dcb0d399814127fbf5227fe8245.zip
gdb-f68f11b76de09dcb0d399814127fbf5227fe8245.tar.gz
gdb-f68f11b76de09dcb0d399814127fbf5227fe8245.tar.bz2
Support catch syscall on aarch64 linux
Hi, This patch is to support catch syscall on aarch64 linux. We implement gdbarch method get_syscall_number for aarch64-linux, and add aarch64-linux.xml file, which looks straightforward, however the changes to test case doesn't. First of all, we enable catch-syscall.exp on aarch64-linux target, but skip the multi_arch testing on current stage. I plan to touch multi arch debugging on aarch64-linux later. Then, when I run catch-syscall.exp on aarch64-linux, gcc errors that SYS_pipe isn't defined. We find that aarch64 kernel only has pipe2 syscall and libc already convert pipe to pipe2. As a result, I change catch-syscall.c to use SYS_pipe if it is defined, otherwise use SYS_pipe2 instead. The vector all_syscalls in catch-syscall.exp can't be pre-determined, so I add a new proc setup_all_syscalls to fill it, according to the availability of SYS_pipe. Regression tested on {x86_64, aarch64}-linux x {native, gdbserver}. gdb: 2015-03-18 Yao Qi <yao.qi@linaro.org> PR tdep/18107 * aarch64-linux-tdep.c: Include xml-syscall.h (aarch64_linux_get_syscall_number): New function. (aarch64_linux_init_abi): Call set_gdbarch_get_syscall_number. * syscalls/aarch64-linux.xml: New file. gdb/testsuite: 2015-03-18 Yao Qi <yao.qi@linaro.org> PR tdep/18107 * gdb.base/catch-syscall.c [!SYS_pipe] (pipe2_syscall): New variable. * gdb.base/catch-syscall.exp: Don't skip it on aarch64*-*-linux* target. Remove elements in all_syscalls. (test_catch_syscall_multi_arch): Skip it on aarch64*-linux* target. (setup_all_syscalls): New proc.
Diffstat (limited to 'gdb/aarch64-linux-tdep.c')
-rw-r--r--gdb/aarch64-linux-tdep.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 1e1ca36..0ee5ecb 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -39,6 +39,7 @@
#include "stap-probe.h"
#include "parser-defs.h"
#include "user-regs.h"
+#include "xml-syscall.h"
#include <ctype.h>
/* Signal frame handling.
@@ -341,6 +342,28 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
return 1;
}
+/* Implement the "get_syscall_number" gdbarch method. */
+
+static LONGEST
+aarch64_linux_get_syscall_number (struct gdbarch *gdbarch,
+ ptid_t ptid)
+{
+ struct regcache *regs = get_thread_regcache (ptid);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+
+ /* The content of register x8. */
+ gdb_byte buf[X_REGISTER_SIZE];
+ /* The result. */
+ LONGEST ret;
+
+ /* Getting the system call number from the register x8. */
+ regcache_cooked_read (regs, AARCH64_DWARF_X0 + 8, buf);
+
+ ret = extract_signed_integer (buf, X_REGISTER_SIZE, byte_order);
+
+ return ret;
+}
+
static void
aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -385,6 +408,10 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_stap_is_single_operand (gdbarch, aarch64_stap_is_single_operand);
set_gdbarch_stap_parse_special_token (gdbarch,
aarch64_stap_parse_special_token);
+
+ /* `catch syscall' */
+ set_xml_syscall_file_name (gdbarch, "syscalls/aarch64-linux.xml");
+ set_gdbarch_get_syscall_number (gdbarch, aarch64_linux_get_syscall_number);
}
/* Provide a prototype to silence -Wmissing-prototypes. */