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/doc | |
parent | 94309df7aa9ab48bec7fb58fdc1deb26e24fc4c1 (diff) | |
download | binutils-gdb-6e9567fe2ab39d1de89ecc5105c17443b66c9b48.tar.gz |
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/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 59a8e0acabd..990f2ec2563 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2016-01-19 John Baldwin <jhb@FreeBSD.org> + + * gdb.texinfo (Debugging Output): Document "set/show debug fbsd-lwp". + 2016-01-18 Pedro Alves <palves@redhat.com> * gdb.texinfo (Threads): Mention that GDB displays the ID and name diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index f996c8d1915..cd311db5240 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -23608,6 +23608,11 @@ expression parsing. The default is off. @item show debug expression Displays the current state of displaying debugging info about @value{GDBN} expression parsing. +@item set debug fbsd-lwp +@cindex FreeBSD LWP debug messages +Turns on or off debugging messages from the FreeBSD LWP debug support. +@item show debug fbsd-lwp +Show the current state of FreeBSD LWP debugging messages. @item set debug frame @cindex frame debugging info Turns on or off display of @value{GDBN} frame debugging info. The |