mdb_proc.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _MDB_PROC_H
#define _MDB_PROC_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <mdb/mdb_target_impl.h>
#include <mdb/mdb_io_impl.h>
#include <mdb/mdb_addrvec.h>
#include <mdb/mdb_modapi.h>
#include <mdb/mdb_gelf.h>
#include <libproc.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _MDB
/*
* The proc target must provide support for examining multi-threaded processes
* that use the raw LWP interface, as well as those that use either of the
* existing libthread.so implementations. We must also support multiple active
* instances of the proc target, as well as the notion that a clean process
* can dlopen() libthread after startup, at which point we need to switch to
* using libthread_db interfaces to properly debug it. To satisfy these
* constraints, we declare an ops vector of functions for obtaining the
* register sets of each thread. The proc target will define two versions
* of this vector, one for the LWP mode and one for the libthread_db mode,
* and then switch the ops vector pointer as appropriate during debugging.
* The macros defined below expand to calls to the appropriate entry point.
*/
typedef struct pt_ptl_ops {
#ifdef __sparc
prxregset_t *);
const prxregset_t *);
#endif
prfpregset_t *);
const prfpregset_t *);
} pt_ptl_ops_t;
#define PTL_CTOR(t) \
#define PTL_DTOR(t) \
#define PTL_TID(t) \
#ifdef __sparc
#endif /* __sparc */
/*
* When we are following children and a vfork(2) occurs, we append the libproc
* handle for the parent to a list of vfork parents. We need to keep track of
* this handle so that when the child subsequently execs or dies, we clear out
* our breakpoints before releasing the parent.
*/
typedef struct pt_vforkp {
} pt_vforkp_t;
/*
* Private data structure for the proc target. Among other things, we keep
* pointers to the various symbol tables and the ELF file for the executable
* here, along with handles for our ops vector defined above.
*/
typedef struct pt_data {
void *p_ptl_hdl; /* Proc thread layer handle */
const char *p_stdin; /* File for stdin redirect */
const char *p_stdout; /* File for stdout redirect */
int p_oflags; /* Flags for open(2) */
int p_gflags; /* Flags for Pgrab() */
int p_rflags; /* Flags for Prelease() */
int p_signal; /* Signal to post at next run */
int p_rtld_finished; /* Has rtld init completed? */
int p_rdstate; /* Dlopen state (see below) */
int p_maxsig; /* Maximum valid signal */
} pt_data_t;
#define PT_RD_NONE 0 /* No update pending */
/*
* The mdb_tgt_gregset type is opaque to callers of the target interface.
* Inside the target we define it explicitly to be a prgregset_t.
*/
struct mdb_tgt_gregset {
};
typedef struct pt_symarg {
void *psym_private; /* Callback data */
const char *psym_obj; /* Containing object */
} pt_symarg_t;
typedef struct pt_maparg {
void *pmap_private; /* Callback data */
} pt_maparg_t;
typedef struct pt_stkarg {
void *pstk_private; /* Callback data */
} pt_stkarg_t;
typedef struct pt_addarg_t {
} pt_addarg_t;
typedef struct pt_brkpt {
} pt_brkpt_t;
typedef struct pt_bparg {
char *pta_symbol; /* Symbolic name */
} pt_bparg_t;
/*
* The proc_isadep.c file is expected to define the following
* ISA-dependent pieces of the proc target:
*/
mdb_tgt_reg_t *);
extern void pt_addfpregs(mdb_tgt_t *);
const mdb_tgt_gregset_t *, boolean_t);
extern const mdb_tgt_regdesc_t pt_regdesc[];
#endif /* _MDB */
#ifdef __cplusplus
}
#endif
#endif /* _MDB_PROC_H */