/* Target-dependent code for FreeBSD, architecture-independent.
- Copyright (C) 2002-2016 Free Software Foundation, Inc.
+ Copyright (C) 2002-2017 Free Software Foundation, Inc.
This file is part of GDB.
#include "regcache.h"
#include "regset.h"
#include "gdbthread.h"
+#include "xml-syscall.h"
#include "elf-bfd.h"
#include "fbsd-tdep.h"
/* This is how we want PTIDs from core files to be printed. */
-static char *
+static const char *
fbsd_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
{
static char buf[80];
fbsd_corefile_thread (struct thread_info *info,
struct fbsd_corefile_thread_data *args)
{
- struct cleanup *old_chain;
struct regcache *regcache;
regcache = get_thread_arch_regcache (info->ptid, args->gdbarch);
- old_chain = save_inferior_ptid ();
- inferior_ptid = info->ptid;
target_fetch_registers (regcache, -1);
- do_cleanups (old_chain);
args->note_data = fbsd_collect_thread_registers
(regcache, info->ptid, args->obfd, args->note_data,
fprint_auxv_entry (file, name, description, format, type, val);
}
-/* To be called from GDB_OSABI_FREEBSD_ELF handlers. */
+/* Implement the "get_syscall_number" gdbarch method. */
+
+static LONGEST
+fbsd_get_syscall_number (struct gdbarch *gdbarch,
+ ptid_t ptid)
+{
+
+ /* FreeBSD doesn't use gdbarch_get_syscall_number since FreeBSD
+ native targets fetch the system call number from the
+ 'pl_syscall_code' member of struct ptrace_lwpinfo in fbsd_wait.
+ However, system call catching requires this function to be
+ set. */
+
+ internal_error (__FILE__, __LINE__, _("fbsd_get_sycall_number called"));
+}
+
+/* To be called from GDB_OSABI_FREEBSD handlers. */
void
fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_core_thread_name (gdbarch, fbsd_core_thread_name);
set_gdbarch_make_corefile_notes (gdbarch, fbsd_make_corefile_notes);
set_gdbarch_print_auxv_entry (gdbarch, fbsd_print_auxv_entry);
+
+ /* `catch syscall' */
+ set_xml_syscall_file_name (gdbarch, "syscalls/freebsd.xml");
+ set_gdbarch_get_syscall_number (gdbarch, fbsd_get_syscall_number);
}