GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
/tmp/gdb-13.1/gdb/aix-thread.c File Reference
#include "defs.h"
#include "gdbthread.h"
#include "target.h"
#include "inferior.h"
#include "regcache.h"
#include "gdbcmd.h"
#include "ppc-tdep.h"
#include "observable.h"
#include "objfiles.h"
#include <procinfo.h>
#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/reg.h>
#include <sched.h>
#include <sys/pthdebug.h>

Go to the source code of this file.

Classes

struct  aix_thread_info
 
struct  pd_thread
 
class  aix_thread_target
 

Macros

#define pthdb_tid_t   tid_t
 
#define PD_TID(ptid)   (pd_active && ptid.tid () != 0)
 
#define PDC_SUCCESS   PTHDB_SUCCESS
 
#define PDC_FAILURE   PTHDB_CALLBACK
 
#define addr_ptr   int *
 

Functions

int getthrds (pid_t, struct thrdsinfo64 *, int, tid_t *, int)
 
static aix_thread_infoget_aix_thread_info (thread_info *thread)
 
static int pdc_symbol_addrs (pthdb_user_t, pthdb_symbol_t *, int)
 
static int pdc_read_data (pthdb_user_t, void *, pthdb_addr_t, size_t)
 
static int pdc_write_data (pthdb_user_t, void *, pthdb_addr_t, size_t)
 
static int pdc_read_regs (pthdb_user_t user, pthdb_tid_t tid, unsigned long long flags, pthdb_context_t *context)
 
static int pdc_write_regs (pthdb_user_t user, pthdb_tid_t tid, unsigned long long flags, pthdb_context_t *context)
 
static int pdc_alloc (pthdb_user_t, size_t, void **)
 
static int pdc_realloc (pthdb_user_t, void *, size_t, void **)
 
static int pdc_dealloc (pthdb_user_t, void *)
 
static const char * pd_status2str (int status)
 
static int ptrace_check (int req, int id, int ret)
 
static int ptrace64aix (int req, int id, long long addr, int data, int *buf)
 
static int ptrace32 (int req, int id, addr_ptr addr, int data, int *buf)
 
static void pid_to_prc (ptid_t *ptidp)
 
static char * state2str (pthdb_state_t state)
 
static int pcmp (const void *p1v, const void *p2v)
 
static int giter_count (struct thread_info *thread, void *countp)
 
static int giter_accum (struct thread_info *thread, void *bufp)
 
static int ptid_cmp (ptid_t ptid1, ptid_t ptid2)
 
static int gcmp (const void *t1v, const void *t2v)
 
static pthdb_tid_t get_signaled_thread (int pid)
 
static void sync_threadlists (int pid)
 
static int iter_tid (struct thread_info *thread, void *tidp)
 
static ptid_t pd_update (int pid)
 
static ptid_t pd_activate (int pid)
 
static void pd_deactivate (void)
 
static void pd_enable (void)
 
static void pd_disable (void)
 
static void new_objfile (struct objfile *objfile)
 
static void aix_thread_inferior_created (inferior *inf)
 
static void supply_gprs64 (struct regcache *regcache, uint64_t *vals)
 
static void supply_reg32 (struct regcache *regcache, int regno, uint32_t val)
 
static void supply_fprs (struct regcache *regcache, double *vals)
 
static int special_register_p (struct gdbarch *gdbarch, int regno)
 
static void supply_sprs64 (struct regcache *regcache, uint64_t iar, uint64_t msr, uint32_t cr, uint64_t lr, uint64_t ctr, uint32_t xer, uint32_t fpscr)
 
static void supply_sprs32 (struct regcache *regcache, uint32_t iar, uint32_t msr, uint32_t cr, uint32_t lr, uint32_t ctr, uint32_t xer, uint32_t fpscr)
 
static void fetch_regs_user_thread (struct regcache *regcache, pthdb_pthread_t pdtid)
 
static void fetch_regs_kernel_thread (struct regcache *regcache, int regno, pthdb_tid_t tid)
 
static void fill_gprs64 (const struct regcache *regcache, uint64_t *vals)
 
static void fill_gprs32 (const struct regcache *regcache, uint32_t *vals)
 
static void fill_fprs (const struct regcache *regcache, double *vals)
 
static void fill_sprs64 (const struct regcache *regcache, uint64_t *iar, uint64_t *msr, uint32_t *cr, uint64_t *lr, uint64_t *ctr, uint32_t *xer, uint32_t *fpscr)
 
static void fill_sprs32 (const struct regcache *regcache, uint32_t *iar, uint32_t *msr, uint32_t *cr, uint32_t *lr, uint32_t *ctr, uint32_t *xer, uint32_t *fpscr)
 
static void store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid)
 
static void store_regs_kernel_thread (const struct regcache *regcache, int regno, pthdb_tid_t tid)
 
void _initialize_aix_thread ()
 

Variables

static bool debug_aix_thread
 
static const target_info aix_thread_target_info
 
static aix_thread_target aix_thread_ops
 
static CORE_ADDR pd_brk_addr
 
static int pd_able = 0
 
static int pd_active = 0
 
static int arch64
 
static pthdb_callbacks_t pd_callbacks
 
static pthdb_session_t pd_session
 

Macro Definition Documentation

◆ addr_ptr

#define addr_ptr   int *

Definition at line 301 of file aix-thread.c.

◆ PD_TID

#define PD_TID (   ptid)    (pd_active && ptid.tid () != 0)

Definition at line 73 of file aix-thread.c.

◆ PDC_FAILURE

#define PDC_FAILURE   PTHDB_CALLBACK

Definition at line 78 of file aix-thread.c.

◆ PDC_SUCCESS

#define PDC_SUCCESS   PTHDB_SUCCESS

Definition at line 77 of file aix-thread.c.

◆ pthdb_tid_t

#define pthdb_tid_t   tid_t

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

Function Documentation

◆ _initialize_aix_thread()

void _initialize_aix_thread ( )

◆ aix_thread_inferior_created()

static void aix_thread_inferior_created ( inferior inf)
static

Definition at line 1021 of file aix-thread.c.

References pd_enable().

Referenced by _initialize_aix_thread().

◆ fetch_regs_kernel_thread()

static void fetch_regs_kernel_thread ( struct regcache regcache,
int  regno,
pthdb_tid_t  tid 
)
static

◆ fetch_regs_user_thread()

static void fetch_regs_user_thread ( struct regcache regcache,
pthdb_pthread_t  pdtid 
)
static

◆ fill_fprs()

static void fill_fprs ( const struct regcache regcache,
double *  vals 
)
static

◆ fill_gprs32()

static void fill_gprs32 ( const struct regcache regcache,
uint32_t *  vals 
)
static

◆ fill_gprs64()

static void fill_gprs64 ( const struct regcache regcache,
uint64_t *  vals 
)
static

◆ fill_sprs32()

static void fill_sprs32 ( const struct regcache regcache,
uint32_t *  iar,
uint32_t *  msr,
uint32_t *  cr,
uint32_t *  lr,
uint32_t *  ctr,
uint32_t *  xer,
uint32_t *  fpscr 
)
static

◆ fill_sprs64()

static void fill_sprs64 ( const struct regcache regcache,
uint64_t *  iar,
uint64_t *  msr,
uint32_t *  cr,
uint64_t *  lr,
uint64_t *  ctr,
uint32_t *  xer,
uint32_t *  fpscr 
)
static

◆ gcmp()

static int gcmp ( const void *  t1v,
const void *  t2v 
)
static

Definition at line 699 of file aix-thread.c.

References thread_info::ptid, and ptid_cmp().

Referenced by sync_threadlists().

◆ get_aix_thread_info()

static aix_thread_info * get_aix_thread_info ( thread_info thread)
static

◆ get_signaled_thread()

static pthdb_tid_t get_signaled_thread ( int  pid)
static

Definition at line 711 of file aix-thread.c.

References getthrds(), and pid.

Referenced by pd_update().

◆ getthrds()

int getthrds ( pid_t  ,
struct thrdsinfo64 *  ,
int  ,
tid_t *  ,
int   
)

Referenced by get_signaled_thread().

◆ giter_accum()

static int giter_accum ( struct thread_info thread,
void *  bufp 
)
static

Definition at line 665 of file aix-thread.c.

References PD_TID, and thread_info::ptid.

Referenced by sync_threadlists().

◆ giter_count()

static int giter_count ( struct thread_info thread,
void *  countp 
)
static

Definition at line 650 of file aix-thread.c.

References PD_TID, and thread_info::ptid.

Referenced by sync_threadlists().

◆ iter_tid()

static int iter_tid ( struct thread_info thread,
void *  tidp 
)
static

Definition at line 870 of file aix-thread.c.

References get_aix_thread_info(), pthdb_tid_t, aix_thread_info::tid, and pd_thread::tid.

Referenced by pd_update().

◆ new_objfile()

static void new_objfile ( struct objfile objfile)
static

Definition at line 1010 of file aix-thread.c.

References pd_disable(), and pd_enable().

Referenced by _initialize_aix_thread().

◆ pcmp()

static int pcmp ( const void *  p1v,
const void *  p2v 
)
static

Definition at line 635 of file aix-thread.c.

References pd_thread::pthid.

Referenced by sync_threadlists().

◆ pd_activate()

static ptid_t pd_activate ( int  pid)
static

Definition at line 918 of file aix-thread.c.

References arch64, pd_active, pd_callbacks, pd_session, pd_update(), pid, and status.

Referenced by pd_enable(), and aix_thread_target::wait().

◆ pd_deactivate()

static void pd_deactivate ( void  )
static

Definition at line 936 of file aix-thread.c.

References inferior_ptid, pd_active, pd_session, and pid_to_prc().

Referenced by aix_thread_target::mourn_inferior(), and pd_disable().

◆ pd_disable()

static void pd_disable ( void  )
static

◆ pd_enable()

static void pd_enable ( void  )
static

◆ pd_status2str()

static const char * pd_status2str ( int  status)
static

Definition at line 202 of file aix-thread.c.

References status.

Referenced by fetch_regs_user_thread(), pdc_read_data(), pdc_write_data(), and store_regs_user_thread().

◆ pd_update()

static ptid_t pd_update ( int  pid)
static

◆ pdc_alloc()

static int pdc_alloc ( pthdb_user_t  user_current_pid,
size_t  len,
void **  bufp 
)
static

Definition at line 555 of file aix-thread.c.

References debug_aix_thread, gdb_printf(), gdb_stdlog, PDC_FAILURE, PDC_SUCCESS, and xmalloc().

◆ pdc_dealloc()

static int pdc_dealloc ( pthdb_user_t  user_current_pid,
void *  buf 
)
static

Definition at line 594 of file aix-thread.c.

References debug_aix_thread, gdb_printf(), gdb_stdlog, PDC_SUCCESS, and xfree().

◆ pdc_read_data()

static int pdc_read_data ( pthdb_user_t  user_current_pid,
void *  buf,
pthdb_addr_t  addr,
size_t  len 
)
static

◆ pdc_read_regs()

static int pdc_read_regs ( pthdb_user_t  user,
pthdb_tid_t  tid,
unsigned long long  flags,
pthdb_context_t *  context 
)
static

◆ pdc_realloc()

static int pdc_realloc ( pthdb_user_t  user_current_pid,
void *  buf,
size_t  len,
void **  bufp 
)
static

Definition at line 577 of file aix-thread.c.

References debug_aix_thread, gdb_printf(), gdb_stdlog, PDC_FAILURE, PDC_SUCCESS, and xrealloc().

◆ pdc_symbol_addrs()

static int pdc_symbol_addrs ( pthdb_user_t  user_current_pid,
pthdb_symbol_t *  symbols,
int  count 
)
static

◆ pdc_write_data()

static int pdc_write_data ( pthdb_user_t  user_current_pid,
void *  buf,
pthdb_addr_t  addr,
size_t  len 
)
static

◆ pdc_write_regs()

static int pdc_write_regs ( pthdb_user_t  user,
pthdb_tid_t  tid,
unsigned long long  flags,
pthdb_context_t *  context 
)
static

Definition at line 448 of file aix-thread.c.

References arch64, debug_aix_thread, flags, gdb_printf(), gdb_stdlog, ptrace32(), and ptrace64aix().

◆ pid_to_prc()

static void pid_to_prc ( ptid_t *  ptidp)
static

Definition at line 316 of file aix-thread.c.

References PD_TID.

Referenced by pd_deactivate(), and aix_thread_target::wait().

◆ ptid_cmp()

static int ptid_cmp ( ptid_t  ptid1,
ptid_t  ptid2 
)
static

Definition at line 678 of file aix-thread.c.

Referenced by gcmp(), and sync_threadlists().

◆ ptrace32()

static int ptrace32 ( int  req,
int  id,
addr_ptr  addr,
int  data,
int *  buf 
)
static

◆ ptrace64aix()

static int ptrace64aix ( int  req,
int  id,
long long  addr,
int  data,
int *  buf 
)
static

◆ ptrace_check()

static int ptrace_check ( int  req,
int  id,
int  ret 
)
static

Definition at line 246 of file aix-thread.c.

References debug_aix_thread, gdb_printf(), and gdb_stdlog.

Referenced by ptrace32(), and ptrace64aix().

◆ special_register_p()

static int special_register_p ( struct gdbarch gdbarch,
int  regno 
)
static

◆ state2str()

static char * state2str ( pthdb_state_t  state)
static

Definition at line 607 of file aix-thread.c.

Referenced by aix_thread_target::extra_thread_info().

◆ store_regs_kernel_thread()

static void store_regs_kernel_thread ( const struct regcache regcache,
int  regno,
pthdb_tid_t  tid 
)
static

◆ store_regs_user_thread()

static void store_regs_user_thread ( const struct regcache regcache,
pthdb_pthread_t  pdtid 
)
static

◆ supply_fprs()

static void supply_fprs ( struct regcache regcache,
double *  vals 
)
static

◆ supply_gprs64()

static void supply_gprs64 ( struct regcache regcache,
uint64_t *  vals 
)
static

◆ supply_reg32()

static void supply_reg32 ( struct regcache regcache,
int  regno,
uint32_t  val 
)
static

Definition at line 1132 of file aix-thread.c.

References reg_buffer::raw_supply().

Referenced by fetch_regs_kernel_thread(), and fetch_regs_user_thread().

◆ supply_sprs32()

static void supply_sprs32 ( struct regcache regcache,
uint32_t  iar,
uint32_t  msr,
uint32_t  cr,
uint32_t  lr,
uint32_t  ctr,
uint32_t  xer,
uint32_t  fpscr 
)
static

◆ supply_sprs64()

static void supply_sprs64 ( struct regcache regcache,
uint64_t  iar,
uint64_t  msr,
uint32_t  cr,
uint64_t  lr,
uint64_t  ctr,
uint32_t  xer,
uint32_t  fpscr 
)
static

◆ sync_threadlists()

static void sync_threadlists ( int  pid)
static

Variable Documentation

◆ aix_thread_ops

aix_thread_target aix_thread_ops
static

Definition at line 145 of file aix-thread.c.

Referenced by pd_disable(), and pd_enable().

◆ aix_thread_target_info

const target_info aix_thread_target_info
static
Initial value:
= {
"aix-threads",
N_("AIX pthread support"),
}

Definition at line 106 of file aix-thread.c.

Referenced by aix_thread_target::info().

◆ arch64

int arch64
static

◆ debug_aix_thread

bool debug_aix_thread
static

◆ pd_able

int pd_able = 0
static

Definition at line 154 of file aix-thread.c.

Referenced by pd_disable(), and pd_enable().

◆ pd_active

int pd_active = 0
static

◆ pd_brk_addr

CORE_ADDR pd_brk_addr
static

Definition at line 150 of file aix-thread.c.

Referenced by pd_enable(), and aix_thread_target::wait().

◆ pd_callbacks

pthdb_callbacks_t pd_callbacks
static
Initial value:
= {
NULL
}
static int pdc_dealloc(pthdb_user_t, void *)
Definition: aix-thread.c:594
static int pdc_symbol_addrs(pthdb_user_t, pthdb_symbol_t *, int)
Definition: aix-thread.c:329
static int pdc_write_data(pthdb_user_t, void *, pthdb_addr_t, size_t)
Definition: aix-thread.c:532
static int pdc_read_regs(pthdb_user_t user, pthdb_tid_t tid, unsigned long long flags, pthdb_context_t *context)
Definition: aix-thread.c:376
static int pdc_alloc(pthdb_user_t, size_t, void **)
Definition: aix-thread.c:555
static int pdc_realloc(pthdb_user_t, void *, size_t, void **)
Definition: aix-thread.c:577
static int pdc_read_data(pthdb_user_t, void *, pthdb_addr_t, size_t)
Definition: aix-thread.c:498
static int pdc_write_regs(pthdb_user_t user, pthdb_tid_t tid, unsigned long long flags, pthdb_context_t *context)
Definition: aix-thread.c:448

Definition at line 182 of file aix-thread.c.

Referenced by pd_activate(), and pd_enable().

◆ pd_session

pthdb_session_t pd_session
static