binutils-gdb/gdb/syscalls
John Baldwin e6cdd38e8f Add support for catching system calls to native FreeBSD targets.
All platforms on FreeBSD use a shared system call table, so use a
single XML file to describe the system calls available on each FreeBSD
platform.

Recent versions of FreeBSD include the identifier of the current
system call when reporting a system call entry or exit event in the
ptrace_lwpinfo structure obtained via PT_LWPINFO in fbsd_wait.  As
such, FreeBSD native targets do not use the gdbarch method to fetch
the system call code.  In addition, FreeBSD register sets fetched via
ptrace do not include an equivalent of 'orig_rax' (on amd64 for
example), so the system call code cannot be extracted from the
available registers during a system call exit.  However, GDB assumes
that system call catch points are not supported if the gdbarch method
is not present.  As a workaround, FreeBSD ABIs install a dummy gdbarch
method that throws an internal_error if it is ever invoked.

gdb/ChangeLog:

	* configure.ac: Check for support for system call LWP fields on
	FreeBSD.
	* config.in, configure: Rebuild.
	* data-directory/Makefile.in (SYSCALLS_FILES): Add freebsd.xml.
	* fbsd-nat.c (fbsd_wait) [HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE]:
	Report system call events.
	[HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE]
	(fbsd_set_syscall_catchpoint): New function.
	(fbsd_nat_add_target) [HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE]:
	Set "to_set_syscall_catchpoint" to "fbsd_set_syscall_catchpoint".
	* fbsd-tdep.c: Include xml-syscall.h
	(fbsd_get_syscall_number): New function.
	(fbsd_init_abi): Set XML system call file name.
	Add "get_syscall_number" gdbarch method.
	* syscalls/freebsd.xml: New file.
2016-06-24 10:46:03 -07:00
..
aarch64-linux.xml GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
amd64-linux.xml GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
arm-linux.py GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
arm-linux.xml GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
bfin-linux.xml GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
freebsd.xml Add support for catching system calls to native FreeBSD targets. 2016-06-24 10:46:03 -07:00
gdb-syscalls.dtd GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
i386-linux.xml GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mips-n32-linux.xml GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mips-n64-linux.xml GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mips-o32-linux.xml GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
ppc-linux.xml GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
ppc64-linux.xml GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
s390-linux.xml S390: Add syscall info for syscalls up to 374 2016-03-17 10:55:55 +01:00
s390x-linux.xml S390: Add syscall info for syscalls up to 374 2016-03-17 10:55:55 +01:00
sparc-linux.xml GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
sparc64-linux.xml GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00