GDBserver
Classes | Macros | Functions | Variables
thread-db.c File Reference
#include "server.h"
#include "linux-low.h"
#include "gdb_proc_service.h"
#include "nat/gdb_thread_db.h"
#include "gdb_vecs.h"
#include "nat/linux-procfs.h"
#include "common/scoped_restore.h"
#include <dlfcn.h>
#include <limits.h>
#include <ctype.h>

Go to the source code of this file.

Classes

struct  thread_db
 

Macros

#define CHK(required, a)
 
#define TDB_DLSYM(tdb, func)   tdb->func ## _p = (func ## _ftype *) dlsym (tdb->handle, #func)
 

Functions

static int find_one_thread (ptid_t)
 
static int find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
 
static const char * thread_db_err_str (td_err_e err)
 
static int attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
 
static int maybe_attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p, int *counter)
 
static void thread_db_find_new_threads (void)
 
static void thread_db_look_up_symbols (void)
 
int thread_db_look_up_one_symbol (const char *name, CORE_ADDR *addrp)
 
int thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset, CORE_ADDR load_module, CORE_ADDR *address)
 
bool thread_db_thread_handle (ptid_t ptid, gdb_byte **handle, int *handle_len)
 
static int try_thread_db_load_1 (void *handle)
 
static int try_thread_db_load (const char *library)
 
static int try_thread_db_load_from_sdir (void)
 
static int try_thread_db_load_from_dir (const char *dir, size_t dir_len)
 
static int thread_db_load_search (void)
 
int thread_db_init (void)
 
static void switch_to_process (struct process_info *proc)
 
static void disable_thread_event_reporting (struct process_info *proc)
 
void thread_db_detach (struct process_info *proc)
 
void thread_db_mourn (struct process_info *proc)
 
int thread_db_handle_monitor_command (char *mon)
 
void thread_db_notice_clone (struct thread_info *parent_thr, ptid_t child_ptid)
 

Variables

int debug_threads
 
static char * libthread_db_search_path
 

Macro Definition Documentation

◆ CHK

#define CHK (   required,
 
)
Value:
do \
{ \
if ((a) == NULL) \
{ \
debug_printf ("dlsym: %s\n", dlerror ()); \
if (required) \
{ \
free (tdb); \
proc->priv->thread_db = NULL; \
return 0; \
} \
} \
} \
while (0)
int debug_threads
Definition: debug.c:24

Referenced by try_thread_db_load_1().

◆ TDB_DLSYM

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

Referenced by try_thread_db_load_1().

Function Documentation

◆ attach_thread()

static int attach_thread ( const td_thrhandle_t th_p,
td_thrinfo_t ti_p 
)
static

◆ disable_thread_event_reporting()

static void disable_thread_event_reporting ( struct process_info proc)
static

◆ find_new_threads_callback()

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

◆ find_one_thread()

static int find_one_thread ( ptid_t  ptid)
static

◆ maybe_attach_thread()

static int maybe_attach_thread ( const td_thrhandle_t th_p,
td_thrinfo_t ti_p,
int *  counter 
)
static

Definition at line 248 of file thread-db.c.

References attach_thread(), find_lwp_pid(), pid_to_ptid(), and td_thrinfo::ti_lid.

Referenced by find_new_threads_callback().

◆ switch_to_process()

static void switch_to_process ( struct process_info proc)
static

◆ thread_db_detach()

void thread_db_detach ( struct process_info proc)

◆ thread_db_err_str()

static const char* thread_db_err_str ( td_err_e  err)
static

◆ thread_db_find_new_threads()

static void thread_db_find_new_threads ( void  )
static

◆ thread_db_get_tls_address()

int thread_db_get_tls_address ( struct thread_info thread,
CORE_ADDR  offset,
CORE_ADDR  load_module,
CORE_ADDR address 
)

◆ thread_db_handle_monitor_command()

int thread_db_handle_monitor_command ( char *  mon)

◆ thread_db_init()

int thread_db_init ( void  )

◆ thread_db_load_search()

static int thread_db_load_search ( void  )
static

◆ thread_db_look_up_one_symbol()

int thread_db_look_up_one_symbol ( const char *  name,
CORE_ADDR addrp 
)

◆ thread_db_look_up_symbols()

static void thread_db_look_up_symbols ( void  )
static

◆ thread_db_mourn()

void thread_db_mourn ( struct process_info proc)

◆ thread_db_notice_clone()

void thread_db_notice_clone ( struct thread_info parent_thr,
ptid_t  child_ptid 
)

◆ thread_db_thread_handle()

bool thread_db_thread_handle ( ptid_t  ptid,
gdb_byte **  handle,
int *  handle_len 
)

◆ try_thread_db_load()

static int try_thread_db_load ( const char *  library)
static

◆ try_thread_db_load_1()

static int try_thread_db_load_1 ( void *  handle)
static

◆ try_thread_db_load_from_dir()

static int try_thread_db_load_from_dir ( const char *  dir,
size_t  dir_len 
)
static

Definition at line 655 of file thread-db.c.

References _, free(), LIBTHREAD_DB_SO, try_thread_db_load(), warning(), and xmalloc().

Referenced by thread_db_load_search().

◆ try_thread_db_load_from_sdir()

static int try_thread_db_load_from_sdir ( void  )
static

Definition at line 646 of file thread-db.c.

References LIBTHREAD_DB_SO, and try_thread_db_load().

Referenced by thread_db_load_search().

Variable Documentation

◆ debug_threads

int debug_threads

Definition at line 24 of file debug.c.

Referenced by add_insns(), attach_proc_task_lwp_callback(), attach_thread(), ATTRIBUTE_PRINTF(), captured_main(), check_zombie_leaders(), complete_ongoing_step_over(), delete_fast_tracepoint_jump(), delete_lwp(), delete_raw_breakpoint(), dequeue_one_deferred_signal(), enqueue_one_deferred_signal(), find_new_threads_callback(), find_one_thread(), finish_step_over(), gdb_no_commands_at_breakpoint_z_type(), get_detach_signal(), get_pc(), get_syscall_trapinfo(), handle_detach(), handle_extended_wait(), handle_monitor_command(), handle_serial_event(), handle_target_event(), handle_tracepoint_bkpts(), handle_tracepoints(), insert_memory_breakpoint(), kill_one_lwp_callback(), kill_wait_lwp(), linux_async(), linux_attach_lwp(), linux_detach_one_lwp(), linux_get_pc_32bit(), linux_get_pc_64bit(), linux_kill(), linux_kill_one_lwp(), linux_low_filter_event(), linux_resume(), linux_resume_one_lwp_throw(), linux_resume_one_thread(), linux_set_resume_request(), linux_stabilize_threads(), linux_wait_1(), linux_wait_for_event_filtered(), linux_write_memory(), linux_xfer_siginfo(), lwp_suspended_inc(), lynx_debug(), lynx_ptrace(), maybe_move_out_of_jump_pad(), move_out_of_jump_pad_callback(), need_step_over_p(), nto_trace(), prefork_hook(), proceed_all_lwps(), proceed_one_lwp(), process_point_options(), queue_stop_reply_callback(), reinsert_breakpoints_at(), reinsert_fast_tracepoint_jumps_at(), reinsert_raw_breakpoint(), remove_memory_breakpoint(), resume_stopped_resumed_lwps(), save_stop_reason(), select_event_lwp(), send_sigstop(), set_fast_tracepoint_jump(), set_raw_breakpoint_at(), sigchld_handler(), single_step(), start_step_over(), stop_all_lwps(), thread_db_find_new_threads(), thread_db_load_search(), thread_still_has_status_pending_p(), trace_buffer_alloc(), tracepoint_look_up_symbols(), try_thread_db_load(), try_thread_db_load_1(), uninsert_breakpoints_at(), uninsert_fast_tracepoint_jumps_at(), uninsert_raw_breakpoint(), unstop_all_lwps(), upload_fast_traceframes(), and wait_for_sigstop().

◆ libthread_db_search_path

char* libthread_db_search_path
static

Definition at line 68 of file thread-db.c.

Referenced by thread_db_handle_monitor_command(), and thread_db_load_search().