diff options
author | Kamil Rytarowski <n54@gmx.com> | 2020-04-29 01:57:38 +0200 |
---|---|---|
committer | Kamil Rytarowski <n54@gmx.com> | 2020-04-29 20:02:35 +0200 |
commit | f94b2e038757eeefd7351e8122160715d6e3ce3c (patch) | |
tree | 9143a58e046373060e481ea9b4ff24b430cca76d /gdb/nbsd-tdep.c | |
parent | cb4c35cfbe460c51fa13df42a56a4f811082f7eb (diff) | |
download | gdb-f94b2e038757eeefd7351e8122160715d6e3ce3c.zip gdb-f94b2e038757eeefd7351e8122160715d6e3ce3c.tar.gz gdb-f94b2e038757eeefd7351e8122160715d6e3ce3c.tar.bz2 |
Add basic event handling in the NetBSD target
Implement the following events:
- single step (TRAP_TRACE)
- software breakpoint (TRAP_DBREG)
- exec() (TRAP_EXEC)
- syscall entry/exit (TRAP_SCE / TRAP_SCX)
Add support for NetBSD specific ::wait () and ::resume ().
Instruct the generic code that exec and syscall events are supported.
Define an empty nbsd_get_syscall_number as it is prerequisite for
catching syscall entry and exit events, even if it is unused.
This function is used to detect whether the gdbarch supports the
'catch syscall' feature.
gdb/ChangeLog:
* nbsd-nat.c: Include "sys/wait.h".
(nbsd_resume, nbsd_nat_target::resume, nbsd_wait)
(nbsd_nat_target::wait, nbsd_nat_target::insert_exec_catchpoint)
(nbsd_nat_target::remove_exec_catchpoint)
(nbsd_nat_target::set_syscall_catchpoint): Add.
* nbsd-nat.h (nbsd_nat_target::resume, nbsd_nat_target::wait)
(nbsd_nat_target::insert_exec_catchpoint)
(nbsd_nat_target::remove_exec_catchpoint)
(nbsd_nat_target::set_syscall_catchpoint): Add.
* nbsd-tdep.c (nbsd_get_syscall_number): Add.
(nbsd_init_abi): Call `set_gdbarch_get_syscall_number' and pass
`nbsd_get_syscall_number'.
Diffstat (limited to 'gdb/nbsd-tdep.c')
-rw-r--r-- | gdb/nbsd-tdep.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/nbsd-tdep.c b/gdb/nbsd-tdep.c index 52e0640..2ed16f6 100644 --- a/gdb/nbsd-tdep.c +++ b/gdb/nbsd-tdep.c @@ -444,6 +444,21 @@ nbsd_info_proc_mappings_entry (int addr_bit, ULONGEST kve_start, } } +/* Implement the "get_syscall_number" gdbarch method. */ + +static LONGEST +nbsd_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread) +{ + + /* NetBSD doesn't use gdbarch_get_syscall_number since NetBSD + native targets fetch the system call number from the + 'si_sysnum' member of siginfo_t in nbsd_nat_target::wait. + However, system call catching requires this function to be + set. */ + + internal_error (__FILE__, __LINE__, _("nbsd_get_sycall_number called")); +} + /* See nbsd-tdep.h. */ void @@ -453,4 +468,7 @@ nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_gdb_signal_to_target (gdbarch, nbsd_gdb_signal_to_target); set_gdbarch_skip_solib_resolver (gdbarch, nbsd_skip_solib_resolver); set_gdbarch_auxv_parse (gdbarch, svr4_auxv_parse); + + /* `catch syscall' */ + set_gdbarch_get_syscall_number (gdbarch, nbsd_get_syscall_number); } |