diff options
author | John Baldwin <jhb@FreeBSD.org> | 2015-04-29 11:53:43 -0400 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2016-01-19 08:19:00 -0800 |
commit | 6e9567fe2ab39d1de89ecc5105c17443b66c9b48 (patch) | |
tree | 0fce92274a2a5701778dea1b022534ca0b444df8 /gdb/hppanbsd-tdep.c | |
parent | 94309df7aa9ab48bec7fb58fdc1deb26e24fc4c1 (diff) | |
download | gdb-6e9567fe2ab39d1de89ecc5105c17443b66c9b48.zip gdb-6e9567fe2ab39d1de89ecc5105c17443b66c9b48.tar.gz gdb-6e9567fe2ab39d1de89ecc5105c17443b66c9b48.tar.bz2 |
Add support for LWP-based threads on FreeBSD.
Older versions of FreeBSD supported userland threading via a pure
user-space threading library (N threads scheduled on 1 process) and
a N:M model (N threads scheduled on M LWPs). However, modern FreeBSD
versions only support a M:M threading model where each user thread is
backed by a dedicated LWP. This thread target only supports this
threading model. It also uses ptrace to query and alter LWP state
directly rather than using libthread_db to simplify the implementation.
FreeBSD recently gained support for reporting LWP events (birth and death
of LWPs). GDB will use LWP events when present. For older systems it
fetches the list of LWPs in the to_update_thread_list target op to update
the list of threads on each stop.
This target supports scheduler locking by using ptrace to suspend
individual LWPs as necessary before resuming a process.
gdb/ChangeLog:
* configure.ac: Check for support for LWP names on FreeBSD.
* fbsd-nat.c [PT_LWPINFO] New variable debug_fbsd_lwp.
[TDP_RFPPWAIT || HAVE_STRUCT_PTRACE_LWPINFO_PL_TDNAME]
(fbsd_fetch_kinfo_proc): Move function earlier.
[PT_LWPINFO] (fbsd_thread_alive): New function.
[PT_LWPINFO] (fbsd_pid_to_str): New function.
[HAVE_STRUCT_PTRACE_LWPINFO_PL_TDNAME] (fbsd_thread_name): New function.
[PT_LWP_EVENTS] (fbsd_enable_lwp_events): New function.
[PT_LWPINFO] (fbsd_add_threads): New function.
[PT_LWPINFO] (fbsd_update_thread_list): New function.
[PT_LWPINFO] New variable super_resume.
[PT_LWPINFO] (resume_one_thread_cb): New function.
[PT_LWPINFO] (resume_all_threads_cb): New function.
[PT_LWPINFO] (fbsd_resume): New function.
(fbsd_remember_child): Save full ptid instead of plain pid.
(fbsd_is_child_pending): Return ptid of saved child process.
(fbsd_wait): Include lwp in returned ptid and switch to LWP ptid on
first stop.
[PT_LWP_EVENTS] Handle LWP events.
[TDP_RFPPWAIT] Include LWP in child ptid.
(fbsd_post_startup_inferior) [PT_LWP_EVENTS]: Enable LWP events.
(fbsd_post_attach) [PT_LWP_EVENTS]: Enable LWP events.
Add threads for existing processes.
(fbsd_nat_add_target) [PT_LWPINFO]: Set "to_thread_alive" to
"fbsd_thread_alive".
Set "to_pid_to_str" to "fbsd_pid_to_str".
[HAVE_STRUCT_PTRACE_LWPINFO_PL_TDNAME]: Set "to_thread_name" to
"fbsd_thread_name".
[PT_LWPINFO]: Set "to_update_thread_list" to "fbsd_update_thread_list".
Set "to_has_thread_control" to "tc_schedlock".
Set "to_resume" to "fbsd_resume".
(_initialize_fbsd_nat): New function.
* configure: Regenerate.
* config.in: Regenerate.
gdb/doc/ChangeLog:
* gdb.texinfo (Debugging Output): Document "set/show debug fbsd-lwp".
Diffstat (limited to 'gdb/hppanbsd-tdep.c')
0 files changed, 0 insertions, 0 deletions