GDB (xrefs)

Classes | Macros | Functions | Variables
/tmp/gdb-8.1/gdb/bsd-uthread.c File Reference
`#include "defs.h"`
`#include "gdbcore.h"`
`#include "gdbthread.h"`
`#include "inferior.h"`
`#include "objfiles.h"`
`#include "observer.h"`
`#include "regcache.h"`
`#include "solib.h"`
`#include "solist.h"`
`#include "symfile.h"`
`#include "target.h"`
`#include "gdb_obstack.h"`
`#include "bsd-uthread.h"`

Go to the source code of this file.

## Classes
struct | bsd_uthread_ops

## Macros
#define | BSD_UTHREAD_PTHREAD_MAGIC 0xd09ba115
#define | BSD_UTHREAD_PS_RUNNING 0
#define | BSD_UTHREAD_PS_DEAD 18

## Functions
static void * | bsd_uthread_init (struct obstack *obstack)
void | bsd_uthread_set_supply_uthread (struct gdbarch *gdbarch, void(*supply_uthread)(struct regcache *, int, CORE_ADDR))
void | bsd_uthread_set_collect_uthread (struct gdbarch *gdbarch, void(*collect_uthread)(const struct regcache *, int, CORE_ADDR))
static void | bsd_uthread_check_magic (CORE_ADDR addr)
static CORE_ADDR | bsd_uthread_lookup_address (const char *name, struct objfile *objfile)
static int | bsd_uthread_lookup_offset (const char *name, struct objfile *objfile)
static CORE_ADDR | bsd_uthread_read_memory_address (CORE_ADDR addr)
static int | bsd_uthread_activate (struct objfile *objfile)
static void | bsd_uthread_close (struct target_ops *self)
static void | bsd_uthread_deactivate (void)
static void | bsd_uthread_inferior_created (struct target_ops *ops, int from_tty)
static void | bsd_uthread_solib_loaded (struct so_list *so)
static void | bsd_uthread_solib_unloaded (struct so_list *so)
static void | bsd_uthread_mourn_inferior (struct target_ops *ops)
static void | bsd_uthread_fetch_registers (struct target_ops *ops, struct regcache *regcache, int regnum)
static void | bsd_uthread_store_registers (struct target_ops *ops, struct regcache *regcache, int regnum)
static ptid_t | bsd_uthread_wait (struct target_ops *ops, ptid_t ptid, struct target_waitstatus *status, int options)
static void | bsd_uthread_resume (struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal sig)
static int | bsd_uthread_thread_alive (struct target_ops *ops, ptid_t ptid)
static void | bsd_uthread_update_thread_list (struct target_ops *ops)
static const char * | bsd_uthread_extra_thread_info (struct target_ops *self, struct thread_info *info)
static const char * | bsd_uthread_pid_to_str (struct target_ops *ops, ptid_t ptid)
static struct target_ops * | bsd_uthread_target (void)
void | _initialize_bsd_uthread (void)

## Variables
static struct target_ops * | bsd_uthread_ops_hack
static struct gdbarch_data * | bsd_uthread_data
static CORE_ADDR | bsd_uthread_thread_run_addr
static CORE_ADDR | bsd_uthread_thread_list_addr
static int | bsd_uthread_thread_state_offset = -1
static int | bsd_uthread_thread_next_offset = -1
static int | bsd_uthread_thread_ctx_offset
static const char * | bsd_uthread_solib_name
static int | bsd_uthread_active
static const char * | bsd_uthread_solib_names []
static const char * | bsd_uthread_state []

## Macro Definition Documentation

## ◆ BSD_UTHREAD_PS_DEAD

#define BSD_UTHREAD_PS_DEAD 18

Definition at line 108 of file bsd-uthread.c.

Referenced by bsd_uthread_thread_alive().

## ◆ BSD_UTHREAD_PS_RUNNING

#define BSD_UTHREAD_PS_RUNNING 0

Definition at line 107 of file bsd-uthread.c.

## ◆ BSD_UTHREAD_PTHREAD_MAGIC

#define BSD_UTHREAD_PTHREAD_MAGIC 0xd09ba115

Definition at line 92 of file bsd-uthread.c.

Referenced by bsd_uthread_check_magic(), and bsd_uthread_wait().

## Function Documentation

## ◆ _initialize_bsd_uthread()

void _initialize_bsd_uthread | ( | void |  | ) |

Definition at line 551 of file bsd-uthread.c.

References bsd_uthread_data, bsd_uthread_inferior_created(), bsd_uthread_init(), bsd_uthread_solib_loaded(), bsd_uthread_solib_unloaded(), bsd_uthread_target(), complete_target_initialization(), gdbarch_data_register_pre_init(), observer_attach_inferior_created(), observer_attach_solib_loaded(), and observer_attach_solib_unloaded().

## ◆ bsd_uthread_activate()

static int bsd_uthread_activate | ( | struct objfile * | objfile | ) |
| static

Definition at line 165 of file bsd-uthread.c.

References bsd_uthread_active, bsd_uthread_data, bsd_uthread_lookup_address(), bsd_uthread_lookup_offset(), bsd_uthread_ops_hack, bsd_uthread_thread_ctx_offset, bsd_uthread_thread_list_addr, bsd_uthread_thread_next_offset, bsd_uthread_thread_run_addr, bsd_uthread_thread_state_offset, push_target(), bsd_uthread_ops::supply_uthread, and target_gdbarch().

Referenced by bsd_uthread_inferior_created(), and bsd_uthread_solib_loaded().

## ◆ bsd_uthread_check_magic()

static void bsd_uthread_check_magic | ( | CORE_ADDR | addr | ) |
| static

Definition at line 97 of file bsd-uthread.c.

References _, BSD_UTHREAD_PTHREAD_MAGIC, error(), gdbarch_byte_order(), read_memory_unsigned_integer(), and target_gdbarch().

Referenced by bsd_uthread_fetch_registers(), bsd_uthread_store_registers(), and bsd_uthread_thread_alive().

## ◆ bsd_uthread_close()

static void bsd_uthread_close | ( | struct target_ops * | self | ) |
| static

Definition at line 211 of file bsd-uthread.c.

References bsd_uthread_active, bsd_uthread_solib_name, bsd_uthread_thread_ctx_offset, bsd_uthread_thread_list_addr, bsd_uthread_thread_next_offset, bsd_uthread_thread_run_addr, and bsd_uthread_thread_state_offset.

Referenced by bsd_uthread_target().

## ◆ bsd_uthread_deactivate()

static void bsd_uthread_deactivate | ( | void |  | ) |
| static

Definition at line 225 of file bsd-uthread.c.

References bsd_uthread_active, bsd_uthread_ops_hack, and unpush_target().

Referenced by bsd_uthread_mourn_inferior(), and bsd_uthread_solib_unloaded().

## ◆ bsd_uthread_extra_thread_info()

static const char* bsd_uthread_extra_thread_info | ( | struct target_ops * | self,
|  | struct thread_info * | info
| ) |  |
| static

Definition at line 491 of file bsd-uthread.c.

References bsd_uthread_state, bsd_uthread_thread_state_offset, gdbarch_byte_order(), offset, thread_info::ptid, ptid_get_tid(), read_memory_unsigned_integer(), and target_gdbarch().

Referenced by bsd_uthread_target().

## ◆ bsd_uthread_fetch_registers()

static void bsd_uthread_fetch_registers | ( | struct target_ops * | ops,
|  | struct regcache * | regcache,
|  | int | regnum
| ) |  |
| static

Definition at line 287 of file bsd-uthread.c.

References regcache::arch(), target_ops::beneath, bsd_uthread_check_magic(), bsd_uthread_data, bsd_uthread_read_memory_address(), bsd_uthread_thread_ctx_offset, bsd_uthread_thread_run_addr, find_target_beneath(), inferior_ptid, make_scoped_restore(), ptid_get_tid(), regcache_get_ptid(), regnum, bsd_uthread_ops::supply_uthread, and target_ops::to_fetch_registers.

Referenced by bsd_uthread_target().

## ◆ bsd_uthread_inferior_created()

static void bsd_uthread_inferior_created | ( | struct target_ops * | ops,
|  | int | from_tty
| ) |  |
| static

Definition at line 235 of file bsd-uthread.c.

References bsd_uthread_activate().

Referenced by _initialize_bsd_uthread().

## ◆ bsd_uthread_init()

static void* bsd_uthread_init | ( | struct obstack * | obstack | ) |
| static

Definition at line 55 of file bsd-uthread.c.

References OBSTACK_ZALLOC.

Referenced by _initialize_bsd_uthread().

## ◆ bsd_uthread_lookup_address()

static CORE_ADDR bsd_uthread_lookup_address | ( | const char * | name,
|  | struct objfile * | objfile
| ) |  |
| static

Definition at line 129 of file bsd-uthread.c.

References BMSYMBOL_VALUE_ADDRESS, lookup_minimal_symbol(), and name.

Referenced by bsd_uthread_activate(), and bsd_uthread_lookup_offset().

## ◆ bsd_uthread_lookup_offset()

static int bsd_uthread_lookup_offset | ( | const char * | name,
|  | struct objfile * | objfile
| ) |  |
| static

Definition at line 141 of file bsd-uthread.c.

References bsd_uthread_lookup_address(), gdbarch_byte_order(), name, read_memory_unsigned_integer(), and target_gdbarch().

Referenced by bsd_uthread_activate().

## ◆ bsd_uthread_mourn_inferior()

static void bsd_uthread_mourn_inferior | ( | struct target_ops * | ops | ) |
| static

Definition at line 279 of file bsd-uthread.c.

References target_ops::beneath, bsd_uthread_deactivate(), find_target_beneath(), and target_ops::to_mourn_inferior.

Referenced by bsd_uthread_target().

## ◆ bsd_uthread_pid_to_str()

static const char* bsd_uthread_pid_to_str | ( | struct target_ops * | ops,
|  | ptid_t | ptid
| ) |  |
| static

Definition at line 511 of file bsd-uthread.c.

References normal_pid_to_str(), ptid_get_pid(), ptid_get_tid(), and xsnprintf().

Referenced by bsd_uthread_target().

## ◆ bsd_uthread_read_memory_address()

static CORE_ADDR bsd_uthread_read_memory_address | ( | CORE_ADDR | addr | ) |
| static

Definition at line 154 of file bsd-uthread.c.

References builtin_type::builtin_data_ptr, builtin_type(), read_memory_typed_address(), and target_gdbarch().

Referenced by bsd_uthread_fetch_registers(), bsd_uthread_store_registers(), bsd_uthread_update_thread_list(), and bsd_uthread_wait().

## ◆ bsd_uthread_resume()

static void bsd_uthread_resume | ( | struct target_ops * | ops,
|  | ptid_t | ptid,
|  | int | step,
|  | enum gdb_signal | sig
| ) |  |
| static

Definition at line 403 of file bsd-uthread.c.

References target_ops::beneath, find_target_beneath(), and target_ops::to_resume.

Referenced by bsd_uthread_target().

## ◆ bsd_uthread_set_collect_uthread()

void bsd_uthread_set_collect_uthread | ( | struct gdbarch * | gdbarch,
|  | void(*)(const struct regcache *, int, CORE_ADDR) | collect_uthread
| ) |  |

Definition at line 81 of file bsd-uthread.c.

References bsd_uthread_data, and bsd_uthread_ops::collect_uthread.

Referenced by amd64obsd_init_abi(), i386obsd_init_abi(), sparc32obsd_init_abi(), and sparc64obsd_init_abi().

## ◆ bsd_uthread_set_supply_uthread()

void bsd_uthread_set_supply_uthread | ( | struct gdbarch * | gdbarch,
|  | void(*)(struct regcache *, int, CORE_ADDR) | supply_uthread
| ) |  |

Definition at line 67 of file bsd-uthread.c.

References bsd_uthread_data, and bsd_uthread_ops::supply_uthread.

Referenced by amd64obsd_init_abi(), i386obsd_init_abi(), sparc32obsd_init_abi(), and sparc64obsd_init_abi().

## ◆ bsd_uthread_solib_loaded()

static void bsd_uthread_solib_loaded | ( | struct so_list * | so | ) |
| static

Definition at line 249 of file bsd-uthread.c.

References bsd_uthread_activate(), bsd_uthread_solib_name, bsd_uthread_solib_names, so_list::objfile, so_list::so_original_name, solib_read_symbols(), and startswith().

Referenced by _initialize_bsd_uthread().

## ◆ bsd_uthread_solib_unloaded()

static void bsd_uthread_solib_unloaded | ( | struct so_list * | so | ) |
| static

Definition at line 269 of file bsd-uthread.c.

References bsd_uthread_deactivate(), bsd_uthread_solib_name, and so_list::so_original_name.

Referenced by _initialize_bsd_uthread().

## ◆ bsd_uthread_store_registers()

static void bsd_uthread_store_registers | ( | struct target_ops * | ops,
|  | struct regcache * | regcache,
|  | int | regnum
| ) |  |
| static

Definition at line 321 of file bsd-uthread.c.

References regcache::arch(), target_ops::beneath, bsd_uthread_check_magic(), bsd_uthread_data, bsd_uthread_read_memory_address(), bsd_uthread_thread_ctx_offset, bsd_uthread_thread_run_addr, bsd_uthread_ops::collect_uthread, find_target_beneath(), inferior_ptid, make_scoped_restore(), ptid_get_tid(), regcache_get_ptid(), regnum, and target_ops::to_store_registers.

Referenced by bsd_uthread_target().

## ◆ bsd_uthread_target()

static struct target_ops* bsd_uthread_target | ( | void |  | ) |
| static

Definition at line 526 of file bsd-uthread.c.

References bsd_uthread_close(), bsd_uthread_extra_thread_info(), bsd_uthread_fetch_registers(), bsd_uthread_mourn_inferior(), bsd_uthread_ops_hack, bsd_uthread_pid_to_str(), bsd_uthread_resume(), bsd_uthread_store_registers(), bsd_uthread_thread_alive(), bsd_uthread_update_thread_list(), bsd_uthread_wait(), OPS_MAGIC, thread_stratum, target_ops::to_close, target_ops::to_doc, target_ops::to_extra_thread_info, target_ops::to_fetch_registers, target_ops::to_longname, target_ops::to_magic, target_ops::to_mourn_inferior, target_ops::to_pid_to_str, target_ops::to_resume, target_ops::to_shortname, target_ops::to_store_registers, target_ops::to_stratum, target_ops::to_thread_alive, target_ops::to_update_thread_list, target_ops::to_wait, and XCNEW.

Referenced by _initialize_bsd_uthread().

## ◆ bsd_uthread_thread_alive()

static int bsd_uthread_thread_alive | ( | struct target_ops * | ops,
|  | ptid_t | ptid
| ) |  |
| static

Definition at line 412 of file bsd-uthread.c.

References target_ops::beneath, bsd_uthread_check_magic(), BSD_UTHREAD_PS_DEAD, bsd_uthread_thread_state_offset, find_target_beneath(), gdbarch_byte_order(), offset, ptid_get_tid(), read_memory_unsigned_integer(), target_gdbarch(), and target_ops::to_thread_alive.

Referenced by bsd_uthread_target().

## ◆ bsd_uthread_update_thread_list()

static void bsd_uthread_update_thread_list | ( | struct target_ops * | ops | ) |
| static

Definition at line 434 of file bsd-uthread.c.

References add_thread(), bsd_uthread_read_memory_address(), bsd_uthread_thread_list_addr, bsd_uthread_thread_next_offset, in_thread_list(), inferior_ptid, is_exited(), offset, pid, prune_threads(), ptid_build(), ptid_get_pid(), ptid_get_tid(), and thread_change_ptid().

Referenced by bsd_uthread_target().

## ◆ bsd_uthread_wait()

static ptid_t bsd_uthread_wait | ( | struct target_ops * | ops,
|  | ptid_t | ptid,
|  | struct target_waitstatus * | status,
|  | int | options
| ) |  |
| static

Definition at line 353 of file bsd-uthread.c.

References add_thread(), target_ops::beneath, BSD_UTHREAD_PTHREAD_MAGIC, bsd_uthread_read_memory_address(), bsd_uthread_thread_run_addr, extract_unsigned_integer(), find_target_beneath(), gdbarch_byte_order(), in_thread_list(), inferior_ptid, is_exited(), ptid_build(), ptid_get_pid(), ptid_get_tid(), status, target_gdbarch(), target_read_memory(), TARGET_WAITKIND_EXITED, TARGET_WAITKIND_SIGNALLED, thread_change_ptid(), and target_ops::to_wait.

Referenced by bsd_uthread_target().

## Variable Documentation

## ◆ bsd_uthread_active

int bsd_uthread_active
| static

Definition at line 126 of file bsd-uthread.c.

Referenced by bsd_uthread_activate(), bsd_uthread_close(), and bsd_uthread_deactivate().

## ◆ bsd_uthread_data

struct gdbarch_data* bsd_uthread_data
| static

Definition at line 43 of file bsd-uthread.c.

Referenced by _initialize_bsd_uthread(), bsd_uthread_activate(), bsd_uthread_fetch_registers(), bsd_uthread_set_collect_uthread(), bsd_uthread_set_supply_uthread(), and bsd_uthread_store_registers().

## ◆ bsd_uthread_ops_hack

struct target_ops* bsd_uthread_ops_hack
| static

Definition at line 37 of file bsd-uthread.c.

Referenced by bsd_uthread_activate(), bsd_uthread_deactivate(), and bsd_uthread_target().

## ◆ bsd_uthread_solib_name

const char* bsd_uthread_solib_name
| static

Definition at line 123 of file bsd-uthread.c.

Referenced by bsd_uthread_close(), bsd_uthread_solib_loaded(), and bsd_uthread_solib_unloaded().

## ◆ bsd_uthread_solib_names

const char* bsd_uthread_solib_names[]
| static

Initial value:
=
{
"/usr/lib/libc_r.so",
"/usr/lib/libpthread.so",
NULL
}

Definition at line 241 of file bsd-uthread.c.

Referenced by bsd_uthread_solib_loaded().

## ◆ bsd_uthread_state

const char* bsd_uthread_state[]
| static

Initial value:
=
{
"RUNNING",
"SIGTHREAD",
"MUTEX_WAIT",
"COND_WAIT",
"FDLR_WAIT",
"FDLW_WAIT",
"FDR_WAIT",
"FDW_WAIT",
"FILE_WAIT",
"POLL_WAIT",
"SELECT_WAIT",
"SLEEP_WAIT",
"WAIT_WAIT",
"SIGSUSPEND",
"SIGWAIT",
"SPINBLOCK",
"JOIN",
"SUSPENDED",
"DEAD",
"DEADLOCK"
}

Definition at line 463 of file bsd-uthread.c.

Referenced by bsd_uthread_extra_thread_info().

## ◆ bsd_uthread_thread_ctx_offset

int bsd_uthread_thread_ctx_offset
| static

Definition at line 120 of file bsd-uthread.c.

Referenced by bsd_uthread_activate(), bsd_uthread_close(), bsd_uthread_fetch_registers(), and bsd_uthread_store_registers().

## ◆ bsd_uthread_thread_list_addr

CORE_ADDR bsd_uthread_thread_list_addr
| static

Definition at line 115 of file bsd-uthread.c.

Referenced by bsd_uthread_activate(), bsd_uthread_close(), and bsd_uthread_update_thread_list().

## ◆ bsd_uthread_thread_next_offset

int bsd_uthread_thread_next_offset = -1
| static

Definition at line 119 of file bsd-uthread.c.

Referenced by bsd_uthread_activate(), bsd_uthread_close(), and bsd_uthread_update_thread_list().

## ◆ bsd_uthread_thread_run_addr

CORE_ADDR bsd_uthread_thread_run_addr
| static

Definition at line 112 of file bsd-uthread.c.

Referenced by bsd_uthread_activate(), bsd_uthread_close(), bsd_uthread_fetch_registers(), bsd_uthread_store_registers(), and bsd_uthread_wait().

## ◆ bsd_uthread_thread_state_offset

int bsd_uthread_thread_state_offset = -1
| static

Definition at line 118 of file bsd-uthread.c.

Referenced by bsd_uthread_activate(), bsd_uthread_close(), bsd_uthread_extra_thread_info(), and bsd_uthread_thread_alive().