GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
linux-thread-db.c File Reference
#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_inforecord_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_infoadd_thread_db_info (void *handle)
 
static struct thread_db_infoget_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_infoget_thread_db_thread_info (thread_info *thread)
 
static struct thread_infothread_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_infothread_db_list
 
static struct check_thread_db_infotdb_testinfo
 

Macro Definition Documentation

◆ CALL

#define CALL ( func,
args... )
Value:
do \
{ \
CALL_UNCHECKED (func, args); \
CHECK_CALL (); \
} \
while (0)
void(* func)(remote_target *remote, char *)

◆ CALL_UNCHECKED

#define CALL_UNCHECKED ( func,
args... )
Value:
do \
{ \
= tdb_testinfo->info->func ## _p (args); \
} \
while (0)
static struct check_thread_db_info * tdb_testinfo
struct thread_db_info * info

◆ CHECK

#define CHECK ( expr)     CHECK_1 (expr, "(%s) == false", #expr)

◆ CHECK_1

#define CHECK_1 ( expr,
args... )
Value:
do \
{ \
if (!(expr)) \
{ \
LOG (" ... FAIL!\n"); \
error (args); \
} \
} \
while (0)
Definition ada-exp.h:87

◆ CHECK_CALL

#define CHECK_CALL ( )
Value:
_("%s failed: %s"), \
@ TD_OK
static const char * thread_db_err_str(td_err_e err)
#define CHECK_1(expr, args...)

◆ CHK

#define CHK ( a)
Value:
do \
{ \
if ((a) == NULL) \
return false; \
} while (0)

◆ LOG

#define LOG ( fmt,
args... )
Value:
do \
{ \
{ \
debug_printf (fmt, ## args); \
gdb_flush (gdb_stdlog); \
} \
} \
while (0)
#define gdb_stdlog
Definition utils.h:190

◆ TDB_DLSYM

#define TDB_DLSYM ( info,
func )    info->func ## _p = (func ## _ftype *) dlsym (info->handle, #func)

◆ TDB_VERBOSE_DLSYM

#define TDB_VERBOSE_DLSYM ( info,
func )    info->func ## _p = (func ## _ftype *) verbose_dlsym (info->handle, #func)

Function Documentation

◆ _initialize_thread_db()

void _initialize_thread_db ( )

Definition at line 1990 of file linux-thread-db.c.

Referenced by initialize_all_files().

◆ add_thread_db_info()

static struct thread_db_info * add_thread_db_info ( void * handle)
static

◆ check_for_thread_db()

static void check_for_thread_db ( void )
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().

◆ check_pid_namespace_match()

static void check_pid_namespace_match ( inferior * inf)
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().

◆ check_thread_db()

static bool check_thread_db ( struct thread_db_info * info,
bool log_progress )
static

◆ check_thread_db_callback()

static int check_thread_db_callback ( const td_thrhandle_t * th,
void * arg )
static

◆ check_thread_signals()

static void check_thread_signals ( void )
static

◆ delete_thread_db_info()

static void delete_thread_db_info ( process_stratum_target * targ,
int pid )
static

◆ dladdr_to_soname()

static const char * dladdr_to_soname ( const void * addr)
static

Definition at line 548 of file linux-thread-db.c.

Referenced by try_thread_db_load(), and try_thread_db_load_1().

◆ find_new_threads_callback()

static int find_new_threads_callback ( const td_thrhandle_t * th_p,
void * data )
static

◆ find_new_threads_once()

static int find_new_threads_once ( struct thread_db_info * info,
int iteration,
td_err_e * errp )
static

◆ get_thread_db_info()

static struct thread_db_info * get_thread_db_info ( process_stratum_target * targ,
int pid )
static

◆ get_thread_db_thread_info()

static thread_db_thread_info * get_thread_db_thread_info ( thread_info * thread)
static

◆ has_libpthread()

static bool has_libpthread ( void )
static

◆ inferior_has_bug()

static int inferior_has_bug ( const char * ver_symbol,
int ver_major_min,
int ver_minor_min )
static

◆ info_auto_load_libthread_db()

static void info_auto_load_libthread_db ( const char * args,
int from_tty )
static

◆ info_auto_load_libthread_db_compare()

static bool info_auto_load_libthread_db_compare ( const struct thread_db_info * a,
const struct thread_db_info * b )
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().

◆ libpthread_objfile_p()

static bool libpthread_objfile_p ( objfile * obj)
static

◆ maintenance_check_libthread_db()

static void maintenance_check_libthread_db ( const char * args,
int from_tty )
static

◆ record_thread()

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

◆ set_libthread_db_search_path()

static void set_libthread_db_search_path ( const char * ignored,
int from_tty,
struct cmd_list_element * c )
static

Definition at line 135 of file linux-thread-db.c.

References libthread_db_search_path, and LIBTHREAD_DB_SEARCH_PATH.

◆ show_auto_load_thread_db()

static void show_auto_load_thread_db ( struct ui_file * file,
int from_tty,
struct cmd_list_element * c,
const char * value )
static

Definition at line 126 of file linux-thread-db.c.

References gdb_printf().

◆ show_libthread_db_debug()

static void show_libthread_db_debug ( struct ui_file * file,
int from_tty,
struct cmd_list_element * c,
const char * value )
static

Definition at line 147 of file linux-thread-db.c.

References gdb_printf().

◆ thread_db_err_str()

static const char * thread_db_err_str ( td_err_e err)
static

◆ thread_db_find_new_threads_1()

static void thread_db_find_new_threads_1 ( thread_info * stopped)
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().

◆ thread_db_find_new_threads_2()

static void thread_db_find_new_threads_2 ( thread_info * stopped,
bool until_no_new )
static

◆ thread_db_find_new_threads_silently()

static int thread_db_find_new_threads_silently ( thread_info * stopped)
static

◆ thread_db_inferior_created()

static void thread_db_inferior_created ( inferior * inf)
static

Definition at line 1325 of file linux-thread-db.c.

References check_for_thread_db(), and check_pid_namespace_match().

◆ thread_db_load()

static bool thread_db_load ( void )
static

◆ thread_db_load_search()

static bool thread_db_load_search ( void )
static

◆ thread_db_new_objfile()

static void thread_db_new_objfile ( struct objfile * objfile)
static

◆ thread_db_notice_clone()

int thread_db_notice_clone ( ptid_t parent,
ptid_t child )

◆ thread_from_lwp()

static struct thread_info * thread_from_lwp ( thread_info * stopped,
ptid_t ptid )
static

◆ try_thread_db_load()

static bool try_thread_db_load ( const char * library,
bool check_auto_load_safe )
static

◆ try_thread_db_load_1()

static bool try_thread_db_load_1 ( struct thread_db_info * info)
static

◆ try_thread_db_load_from_dir()

static bool try_thread_db_load_from_dir ( const char * dir,
size_t dir_len )
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().

◆ try_thread_db_load_from_pdir()

static bool try_thread_db_load_from_pdir ( const char * subdir)
static

◆ try_thread_db_load_from_pdir_1()

static bool try_thread_db_load_from_pdir_1 ( struct objfile * obj,
const char * subdir )
static

◆ try_thread_db_load_from_sdir()

static bool try_thread_db_load_from_sdir ( void )
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().

◆ update_thread_state()

static void update_thread_state ( thread_db_thread_info * priv,
const td_thrinfo_t * ti_p )
static

◆ verbose_dlsym()

static void * verbose_dlsym ( void * handle,
const char * name )
static

Definition at line 454 of file linux-thread-db.c.

References thread_db_info::handle, and name.

Referenced by check_thread_db().

Variable Documentation

◆ auto_load_thread_db

bool auto_load_thread_db = true
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().

◆ check_thread_db_on_load

bool check_thread_db_on_load = false
static

Definition at line 121 of file linux-thread-db.c.

Referenced by try_thread_db_load_1().

◆ libthread_db_debug

unsigned int libthread_db_debug
static

◆ libthread_db_search_path

std::string libthread_db_search_path = LIBTHREAD_DB_SEARCH_PATH
static

◆ tdb_testinfo

struct check_thread_db_info* tdb_testinfo
static

Definition at line 577 of file linux-thread-db.c.

Referenced by check_thread_db(), and check_thread_db_callback().

◆ the_thread_db_target

thread_db_target the_thread_db_target
static

Definition at line 157 of file linux-thread-db.c.

Referenced by try_thread_db_load_1().

◆ thread_db_list

thread_db_info* thread_db_list
static

◆ thread_db_target_info

const target_info thread_db_target_info
static
Initial value:
= {
"multi-thread",
N_("multi-threaded child process."),
}

Definition at line 80 of file linux-thread-db.c.

Referenced by thread_db_target::info().

◆ thread_signals

int thread_signals
static

Definition at line 161 of file linux-thread-db.c.

Referenced by check_thread_signals().