GDB (xrefs)
|
#include "defs.h"
#include <dlfcn.h>
#include "gdb_proc_service.h"
#include "nat/gdb_thread_db.h"
#include "gdbsupport/gdb_vecs.h"
#include "bfd.h"
#include "command.h"
#include "gdbcmd.h"
#include "gdbthread.h"
#include "inferior.h"
#include "infrun.h"
#include "symfile.h"
#include "objfiles.h"
#include "target.h"
#include "regcache.h"
#include "solib.h"
#include "solib-svr4.h"
#include "gdbcore.h"
#include "observable.h"
#include "linux-nat.h"
#include "nat/linux-procfs.h"
#include "nat/linux-ptrace.h"
#include "nat/linux-osdata.h"
#include "auto-load.h"
#include "cli/cli-utils.h"
#include <signal.h>
#include <ctype.h>
#include "nat/linux-namespaces.h"
#include <algorithm>
#include "gdbsupport/pathstuff.h"
#include "valprint.h"
#include "cli/cli-style.h"
Go to the source code of this file.
Classes | |
class | thread_db_target |
struct | thread_db_info |
struct | thread_db_thread_info |
struct | check_thread_db_info |
struct | callback_data |
Macros | |
#define | LOG(fmt, args...) |
#define | CHECK_1(expr, args...) |
#define | CHECK(expr) CHECK_1 (expr, "(%s) == false", #expr) |
#define | CALL_UNCHECKED(func, args...) |
#define | CHECK_CALL() |
#define | CALL(func, args...) |
#define | TDB_VERBOSE_DLSYM(info, func) info->func ## _p = (func ## _ftype *) verbose_dlsym (info->handle, #func) |
#define | TDB_DLSYM(info, func) info->func ## _p = (func ## _ftype *) dlsym (info->handle, #func) |
#define | CHK(a) |
Functions | |
static void | show_auto_load_thread_db (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) |
static void | set_libthread_db_search_path (const char *ignored, int from_tty, struct cmd_list_element *c) |
static void | show_libthread_db_debug (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) |
static void | thread_db_find_new_threads_1 (thread_info *stopped) |
static void | thread_db_find_new_threads_2 (thread_info *stopped, bool until_no_new) |
static void | check_thread_signals (void) |
static struct thread_info * | record_thread (struct thread_db_info *info, struct thread_info *tp, ptid_t ptid, const td_thrhandle_t *th_p, const td_thrinfo_t *ti_p) |
static struct thread_db_info * | add_thread_db_info (void *handle) |
static struct thread_db_info * | get_thread_db_info (process_stratum_target *targ, int pid) |
static const char * | thread_db_err_str (td_err_e err) |
static void | delete_thread_db_info (process_stratum_target *targ, int pid) |
static thread_db_thread_info * | get_thread_db_thread_info (thread_info *thread) |
static struct thread_info * | thread_from_lwp (thread_info *stopped, ptid_t ptid) |
int | thread_db_notice_clone (ptid_t parent, ptid_t child) |
static void * | verbose_dlsym (void *handle, const char *name) |
static int | inferior_has_bug (const char *ver_symbol, int ver_major_min, int ver_minor_min) |
static int | thread_db_find_new_threads_silently (thread_info *stopped) |
static const char * | dladdr_to_soname (const void *addr) |
static int | check_thread_db_callback (const td_thrhandle_t *th, void *arg) |
static bool | check_thread_db (struct thread_db_info *info, bool log_progress) |
static bool | libpthread_objfile_p (objfile *obj) |
static bool | try_thread_db_load_1 (struct thread_db_info *info) |
static bool | try_thread_db_load (const char *library, bool check_auto_load_safe) |
static bool | try_thread_db_load_from_pdir_1 (struct objfile *obj, const char *subdir) |
static bool | try_thread_db_load_from_pdir (const char *subdir) |
static bool | try_thread_db_load_from_sdir (void) |
static bool | try_thread_db_load_from_dir (const char *dir, size_t dir_len) |
static bool | thread_db_load_search (void) |
static bool | has_libpthread (void) |
static bool | thread_db_load (void) |
static void | check_for_thread_db (void) |
static void | thread_db_new_objfile (struct objfile *objfile) |
static void | check_pid_namespace_match (inferior *inf) |
static void | thread_db_inferior_created (inferior *inf) |
static void | update_thread_state (thread_db_thread_info *priv, const td_thrinfo_t *ti_p) |
static int | find_new_threads_callback (const td_thrhandle_t *th_p, void *data) |
static int | find_new_threads_once (struct thread_db_info *info, int iteration, td_err_e *errp) |
static bool | info_auto_load_libthread_db_compare (const struct thread_db_info *a, const struct thread_db_info *b) |
static void | info_auto_load_libthread_db (const char *args, int from_tty) |
static void | maintenance_check_libthread_db (const char *args, int from_tty) |
void | _initialize_thread_db () |
Variables | |
static const target_info | thread_db_target_info |
static std::string | libthread_db_search_path = LIBTHREAD_DB_SEARCH_PATH |
static bool | auto_load_thread_db = true |
static bool | check_thread_db_on_load = false |
static unsigned int | libthread_db_debug |
static thread_db_target | the_thread_db_target |
static int | thread_signals |
static thread_db_info * | thread_db_list |
static struct check_thread_db_info * | tdb_testinfo |
#define CALL | ( | func, | |
args... ) |
#define CALL_UNCHECKED | ( | func, | |
args... ) |
#define CHECK | ( | expr | ) | CHECK_1 (expr, "(%s) == false", #expr) |
#define CHECK_1 | ( | expr, | |
args... ) |
#define CHECK_CALL | ( | ) |
#define CHK | ( | a | ) |
#define LOG | ( | fmt, | |
args... ) |
#define TDB_VERBOSE_DLSYM | ( | info, | |
func ) info->func ## _p = (func ## _ftype *) verbose_dlsym (info->handle, #func) |
void _initialize_thread_db | ( | ) |
Definition at line 1990 of file linux-thread-db.c.
Referenced by initialize_all_files().
|
static |
Definition at line 226 of file linux-thread-db.c.
References current_inferior(), thread_db_info::handle, inferior_ptid, inferior::process_target(), target_has_execution(), and thread_db_list.
Referenced by try_thread_db_load().
|
static |
Definition at line 1266 of file linux-thread-db.c.
References thread_db_load().
Referenced by thread_db_inferior_created(), and thread_db_new_objfile().
|
static |
Definition at line 1301 of file linux-thread-db.c.
References LINUX_NS_PID, linux_ns_same(), inf::pid, and target_can_run().
Referenced by thread_db_inferior_created().
|
static |
Definition at line 728 of file linux-thread-db.c.
References check_thread_db_callback(), err, exception_fprintf(), gdb_puts(), gdb_stderr, check_thread_db_info::info, linux_stop_and_wait_all_lwps(), linux_unstop_all_lwps(), check_thread_db_info::log_progress, TD_OK, TD_SIGNO_MASK, TD_THR_ANY_STATE, TD_THR_ANY_USER_FLAGS, TD_THR_LOWEST_PRIORITY, tdb_testinfo, thread_db_info::thread_agent, thread_db_err_str(), check_thread_db_info::threads_seen, verbose_dlsym(), and warning_pre_print.
Referenced by maintenance_check_libthread_db(), and try_thread_db_load_1().
|
static |
Definition at line 582 of file linux-thread-db.c.
References CALL, CALL_UNCHECKED, CHECK, CHECK_CALL, process_stratum_target::find_thread(), gdb_stdlog, get_user_print_options(), check_thread_db_info::info, check_thread_db_info::last_result, linux_target, LOG, check_thread_db_info::log_progress, parse_expression(), thread_db_info::pid, thread_info::priv, switch_to_thread(), target_has_execution(), TD_ERR, td_ta_map_lwp2thr(), td_thr_get_info(), tdb_testinfo, td_thrhandle::th_ta_p, td_thrhandle::th_unique, thread_db_info::thread_agent, check_thread_db_info::threads_seen, td_thrinfo::ti_lid, td_thrinfo::ti_ta_p, td_thrinfo::ti_tid, and value_print().
Referenced by check_thread_db().
|
static |
Definition at line 1245 of file linux-thread-db.c.
References lin_thread_get_thread_signal(), lin_thread_get_thread_signal_num(), signal_print_update(), signal_stop_update(), and thread_signals.
Referenced by record_thread().
|
static |
Definition at line 268 of file linux-thread-db.c.
References err, thread_db_info::next, pid, TD_OK, thread_db_err_str(), thread_db_list, and xfree().
Referenced by thread_db_target::detach(), thread_db_target::follow_exec(), thread_db_target::mourn_inferior(), and try_thread_db_load().
|
static |
Definition at line 548 of file linux-thread-db.c.
Referenced by try_thread_db_load(), and try_thread_db_load_1().
|
static |
Definition at line 1460 of file linux-thread-db.c.
References err, gdb_printf(), gdb_stdlog, callback_data::info, libthread_db_debug, linux_proc_get_tgid(), thread_info::priv, record_thread(), TD_OK, thread_db_err_str(), td_thrinfo::ti_lid, and td_thrinfo::ti_tid.
Referenced by find_new_threads_once().
|
static |
Definition at line 1526 of file linux-thread-db.c.
References err, exception_fprintf(), find_new_threads_callback(), gdb_printf(), gdb_stdlog, callback_data::info, libthread_db_debug, TD_ERR, TD_SIGNO_MASK, thread_db_info::td_ta_thr_iter_p, TD_THR_ANY_STATE, TD_THR_ANY_USER_FLAGS, TD_THR_LOWEST_PRIORITY, and thread_db_info::thread_agent.
Referenced by thread_db_find_new_threads_2().
|
static |
Definition at line 249 of file linux-thread-db.c.
References pid, and thread_db_list.
Referenced by thread_db_target::get_thread_local_address(), maintenance_check_libthread_db(), thread_db_target::resume(), thread_db_find_new_threads_2(), thread_db_load(), thread_db_notice_clone(), thread_from_lwp(), thread_db_target::update_thread_list(), and thread_db_target::wait().
|
static |
Definition at line 319 of file linux-thread-db.c.
References thread_info::priv.
Referenced by thread_db_target::extra_thread_info(), thread_db_target::get_thread_local_address(), thread_db_target::pid_to_str(), thread_db_target::thread_handle_to_thread_info(), and thread_db_target::thread_info_to_thread_handle().
|
static |
Definition at line 1189 of file linux-thread-db.c.
References current_program_space, libpthread_objfile_p(), and program_space::objfiles().
Referenced by thread_db_load().
|
static |
Definition at line 468 of file linux-thread-db.c.
References lookup_minimal_symbol(), bound_minimal_symbol::minsym, target_read_string(), bound_minimal_symbol::value_address(), and version.
Referenced by thread_db_find_new_threads_silently().
|
static |
Definition at line 1876 of file linux-thread-db.c.
References auto_load_info_scripts_pattern_nl, current_uiout, ui_out::field_string(), file_name_style, thread_db_info::filename, info_auto_load_libthread_db_compare(), ui_out::message(), pid, pids, cli_style_option::style(), ui_out::table_body(), ui_out::table_header(), ui_out::text(), thread_db_list, and ui_left.
|
static |
Definition at line 1861 of file linux-thread-db.c.
References thread_db_info::filename, and thread_db_info::pid.
Referenced by info_auto_load_libthread_db().
|
static |
Definition at line 810 of file linux-thread-db.c.
References libpthread_name_p(), lookup_minimal_symbol(), and objfile_name().
Referenced by has_libpthread(), thread_db_new_objfile(), and try_thread_db_load_from_pdir().
|
static |
Definition at line 1972 of file linux-thread-db.c.
References check_thread_db(), current_inferior(), get_thread_db_info(), inferior_ptid, and thread_db_info::process_target.
|
static |
Definition at line 1347 of file linux-thread-db.c.
References add_thread_with_info(), check_thread_signals(), thread_info::priv, thread_info::state, target_has_execution(), thread_db_thread_info::th, THREAD_EXITED, td_thrinfo::ti_tid, thread_db_thread_info::tid, and update_thread_state().
Referenced by find_new_threads_callback(), and thread_from_lwp().
|
static |
Definition at line 135 of file linux-thread-db.c.
References libthread_db_search_path, and LIBTHREAD_DB_SEARCH_PATH.
|
static |
Definition at line 126 of file linux-thread-db.c.
References gdb_printf().
|
static |
Definition at line 147 of file linux-thread-db.c.
References gdb_printf().
|
static |
Definition at line 325 of file linux-thread-db.c.
References err, TD_BADKEY, TD_BADPH, TD_BADSH, TD_BADTA, TD_BADTH, TD_DBERR, TD_ERR, TD_MALLOC, TD_NOAPLIC, TD_NOCAPAB, TD_NOEVENT, TD_NOFPREGS, TD_NOLIBTHREAD, TD_NOLWP, TD_NOMSG, TD_NOSV, TD_NOTALLOC, TD_NOTHR, TD_NOTLS, TD_NOTSD, TD_NOXREGS, TD_OK, TD_PARTIALREG, and TD_VERSION.
Referenced by check_thread_db(), delete_thread_db_info(), find_new_threads_callback(), thread_db_target::get_thread_local_address(), thread_db_find_new_threads_2(), thread_from_lwp(), and try_thread_db_load_1().
|
static |
Definition at line 1609 of file linux-thread-db.c.
References thread_db_find_new_threads_2().
Referenced by thread_db_target::update_thread_list().
|
static |
Definition at line 1576 of file linux-thread-db.c.
References err, find_new_threads_once(), get_thread_db_info(), thread_info::inf, inferior::process_target(), thread_info::ptid, TD_OK, and thread_db_err_str().
Referenced by thread_db_find_new_threads_1(), and thread_db_find_new_threads_silently().
|
static |
Definition at line 501 of file linux-thread-db.c.
References exception_fprintf(), gdb_stderr, gdb_stdlog, inferior_has_bug(), libthread_db_debug, target_has_execution(), and thread_db_find_new_threads_2().
Referenced by try_thread_db_load_1().
|
static |
Definition at line 1325 of file linux-thread-db.c.
References check_for_thread_db(), and check_pid_namespace_match().
|
static |
Definition at line 1202 of file linux-thread-db.c.
References core_bfd, current_inferior(), get_thread_db_info(), has_libpthread(), inferior_ptid, inf::pid, target_can_run(), target_has_registers(), and thread_db_load_search().
Referenced by check_for_thread_db().
|
static |
Definition at line 1131 of file linux-thread-db.c.
References gdb_printf(), gdb_stdlog, libthread_db_debug, libthread_db_search_path, try_thread_db_load_from_dir(), try_thread_db_load_from_pdir(), and try_thread_db_load_from_sdir().
Referenced by thread_db_load().
|
static |
Definition at line 1276 of file linux-thread-db.c.
References check_for_thread_db(), objfile::flags, libpthread_objfile_p(), OBJF_MAINLINE, and objfile::separate_debug_objfile_backlink.
int thread_db_notice_clone | ( | ptid_t | parent, |
ptid_t | child ) |
Definition at line 434 of file linux-thread-db.c.
References process_stratum_target::find_thread(), get_thread_db_info(), linux_target, and thread_from_lwp().
Referenced by linux_handle_extended_wait().
|
static |
Definition at line 395 of file linux-thread-db.c.
References err, process_stratum_target::find_thread(), get_thread_db_info(), thread_info::inf, inferior::process_target(), record_thread(), TD_OK, td_thrhandle::th_unique, and thread_db_err_str().
Referenced by thread_db_target::get_thread_local_address(), thread_db_notice_clone(), try_thread_db_load_1(), and thread_db_target::wait().
|
static |
Definition at line 964 of file linux-thread-db.c.
References add_thread_db_info(), auto_load_debug_printf, current_inferior(), delete_thread_db_info(), dladdr_to_soname(), exception_fprintf(), file_is_auto_load_safe(), gdb_printf(), gdb_stdlog, thread_db_info::handle, inferior_ptid, libthread_db_debug, thread_db_info::process_target, td_init(), and try_thread_db_load_1().
Referenced by try_thread_db_load_from_dir(), try_thread_db_load_from_pdir_1(), and try_thread_db_load_from_sdir().
|
static |
Definition at line 825 of file linux-thread-db.c.
References all_lwps(), check_thread_db(), check_thread_db_on_load, CHK, current_inferior(), dladdr_to_soname(), err, file_name_style, gdb_printf(), gdb_stdlog, inferior_ptid, inferior_thread(), check_thread_db_info::info, libthread_db_debug, libthread_db_search_path, LIBTHREAD_DB_SO, linux_proc_task_list_dir_exists(), linux_stop_and_wait_all_lwps(), linux_unstop_all_lwps(), pid, thread_db_info::proc_handle, thread_info::ptid, inferior::push_target(), cli_style_option::style(), styled_string(), target_has_execution(), td_init(), thread_db_info::td_init_p, TD_NOLIBTHREAD, TD_OK, td_ta_delete(), td_ta_map_lwp2thr(), td_ta_new(), thread_db_info::td_ta_new_p, td_ta_thr_iter(), thread_db_info::td_ta_thr_iter_p, td_thr_get_info(), td_thr_tls_get_addr(), td_thr_tlsbase(), TD_VERSION, TDB_DLSYM, TDB_VERBOSE_DLSYM, the_thread_db_target, ps_prochandle::thread, thread_db_info::thread_agent, thread_db_err_str(), thread_db_find_new_threads_silently(), and thread_from_lwp().
Referenced by try_thread_db_load().
|
static |
Definition at line 1116 of file linux-thread-db.c.
References auto_load_thread_db, LIBTHREAD_DB_SO, and try_thread_db_load().
Referenced by thread_db_load_search().
|
static |
Definition at line 1077 of file linux-thread-db.c.
References auto_load_thread_db, current_program_space, libpthread_objfile_p(), program_space::objfiles(), and try_thread_db_load_from_pdir_1().
Referenced by thread_db_load_search().
|
static |
Definition at line 1047 of file linux-thread-db.c.
References file_name_style, LIBTHREAD_DB_SO, objfile_name(), cli_style_option::style(), styled_string(), and try_thread_db_load().
Referenced by try_thread_db_load_from_pdir().
|
static |
Definition at line 1107 of file linux-thread-db.c.
References LIBTHREAD_DB_SO, and try_thread_db_load().
Referenced by thread_db_load_search().
|
static |
Definition at line 1335 of file linux-thread-db.c.
References thread_db_thread_info::dying, TD_THR_UNKNOWN, TD_THR_ZOMBIE, and td_thrinfo::ti_state.
Referenced by record_thread().
|
static |
Definition at line 454 of file linux-thread-db.c.
References thread_db_info::handle, and name.
Referenced by check_thread_db().
|
static |
Definition at line 117 of file linux-thread-db.c.
Referenced by try_thread_db_load_from_dir(), and try_thread_db_load_from_pdir().
|
static |
Definition at line 121 of file linux-thread-db.c.
Referenced by try_thread_db_load_1().
|
static |
Definition at line 144 of file linux-thread-db.c.
Referenced by find_new_threads_callback(), find_new_threads_once(), thread_db_find_new_threads_silently(), thread_db_load_search(), try_thread_db_load(), and try_thread_db_load_1().
|
static |
Definition at line 113 of file linux-thread-db.c.
Referenced by set_libthread_db_search_path(), thread_db_load_search(), and try_thread_db_load_1().
|
static |
Definition at line 577 of file linux-thread-db.c.
Referenced by check_thread_db(), and check_thread_db_callback().
|
static |
Definition at line 157 of file linux-thread-db.c.
Referenced by try_thread_db_load_1().
|
static |
Definition at line 208 of file linux-thread-db.c.
Referenced by add_thread_db_info(), delete_thread_db_info(), get_thread_db_info(), and info_auto_load_libthread_db().
|
static |
Definition at line 80 of file linux-thread-db.c.
Referenced by thread_db_target::info().
|
static |
Definition at line 161 of file linux-thread-db.c.
Referenced by check_thread_signals().