diff options
Diffstat (limited to 'gdb/amd64-linux-tdep.c')
-rw-r--r-- | gdb/amd64-linux-tdep.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index 791e2c4..f527b7e 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -35,6 +35,10 @@ #include "amd64-tdep.h" #include "solib-svr4.h" +#include "xml-syscall.h" + +/* The syscall's XML filename for i386. */ +#define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml" #include "record.h" #include "linux-record.h" @@ -174,6 +178,28 @@ amd64_linux_sigcontext_addr (struct frame_info *this_frame) } +static LONGEST +amd64_linux_get_syscall_number (struct gdbarch *gdbarch, + ptid_t ptid) +{ + struct regcache *regcache = get_thread_regcache (ptid); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + /* The content of a register. */ + gdb_byte buf[8]; + /* The result. */ + LONGEST ret; + + /* Getting the system call number from the register. + When dealing with x86_64 architecture, this information + is stored at %rax register. */ + regcache_cooked_read (regcache, AMD64_LINUX_ORIG_RAX_REGNUM, buf); + + ret = extract_signed_integer (buf, 8, byte_order); + + return ret; +} + + /* From <asm/sigcontext.h>. */ static int amd64_linux_sc_reg_offset[] = { @@ -1168,6 +1194,11 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_register_type (gdbarch, amd64_linux_register_type); set_gdbarch_register_reggroup_p (gdbarch, amd64_linux_register_reggroup_p); + /* Functions for 'catch syscall'. */ + set_xml_syscall_file_name (XML_SYSCALL_FILENAME_AMD64); + set_gdbarch_get_syscall_number (gdbarch, + amd64_linux_get_syscall_number); + /* Enable TLS support. */ set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); |