Add support for catching exec events on FreeBSD.
authorJohn Baldwin <jhb@FreeBSD.org>
Sat, 18 Apr 2015 05:00:06 +0000 (01:00 -0400)
committerJohn Baldwin <jhb@FreeBSD.org>
Mon, 27 Apr 2015 23:27:04 +0000 (19:27 -0400)
commitd2b41ca0f9c5641a6b8f42c8013ba042cf5ba120
treee4ec6214fd0de8bd6da6e22dccc084f07dbc6161
parente58e05d677d33da3646721bdd225ec6e90424000
Add support for catching exec events on FreeBSD.

FreeBSD kernels that support fork tracing always stop a process to
report events for exec.  Such a process will have the PL_FLAG_EXEC
flag set in the pl_flags field of the ptrace_lwpinfo struct returned
by PT_LWPINFO.  The structure does not include the pathname passed to
exec, so use fbsd_pid_to_exec_file to query the pathname of the
process' executable.

gdb/ChangeLog:

* fbsd-nat.c: (fbsd_wait) [PL_FLAG_EXEC]: Report TARGET_WAITKIND_EXECD
event if PL_FLAG_EXEC is set.
[PL_FLAG_EXEC] (fbsd_insert_exec_catchpoint): New function.
[PL_FLAG_EXEC] (fbsd_remove_exec_catchpoint): New function.
(fbsd_nat_add_target) [PL_FLAG_EXEC]: Set
"to_insert_exec_catchpoint" to "fbsd_insert_exec_catchpoint".
Set "to_remove_exec_catchpoint" to "fbsd_remove_exec_catchpoint".
gdb/ChangeLog
gdb/fbsd-nat.c