rdb.h revision 7a5d89c451efe2f22ced23ea9fcaa00be2a9b64f
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _RDB_H
#define _RDB_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <rtld_db.h>
#include <procfs.h>
#include <proc_service.h>
#include <libelf.h>
#include <gelf.h>
#include <rdb_mach.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Definitions from 2.7 sys/procfs_isa.h.
*/
#ifndef PR_MODEL_LP64
#define PR_MODEL_UNKNOWN 0
#endif
#define INTERPSECT ".interp"
#define PLTSECT ".plt"
/*
* Flags for step_n routine
*/
typedef enum {
FLG_SN_NONE = 0,
} sn_flags_e;
typedef enum {
RET_FAILED = -1,
RET_OK = 0
} retc_t;
/*
* sym_tbl_t contains a primary and an (optional) auxiliary symbol table, which
* we wish to treat as a single logical symbol table. In this logical table,
* the data from the auxiliary table preceeds that from the primary. Symbol
* indices start at [0], which is the first item in the auxiliary table
* if there is one. The sole purpose for this is so that we can treat the
* combination of .SUNW_ldynsym and .dynsym sections as a logically single
* entity without having to violate the public interface to libelf.
*
* Both tables must share the same string table section.
*
* The symtab_getsym() function serves as a gelf_getsym() replacement
* that is aware of the two tables and makes them look like a single table
* to the caller.
*
*/
typedef struct sym_tbl {
char *st_strs; /* ptr to strings */
} sym_tbl_t;
typedef struct map_info {
char *mi_name; /* file info */
char *mi_refname; /* filter reference name */
int mi_mapfd; /* file desc. for mapping */
unsigned mi_pltentsz; /* size of PLT entries */
/* good luck */
} map_info_t;
/* null string */
/* possible */
typedef struct map_list {
} map_list_t;
/*
* Break point information
*/
typedef struct bpt_struct {
unsigned bl_flags; /* break point flags */
struct bpt_struct *bl_next;
} bptlist_t;
#define MASK_BP_SPECIAL \
#define MASK_BP_STOP \
#define MASK_BP_ALL \
/*
* Proc Services Structure
*/
struct ps_prochandle {
int pp_ctlfd; /* open ctl proc fd */
int pp_statusfd; /* open status proc fd */
int pp_asfd; /* open as proc fd */
int pp_mapfd; /* open map proc fd */
void *pp_auxvp; /* pointer to AUX vectors */
int pp_flags; /* misc flags */
int pp_dmodel; /* data model */
};
/*
* Debugging Structure
*/
typedef struct rtld_debug {
int rd_vers;
} rtld_debug_t;
/*
* values for rdb_flags
*/
/*
* Globals
*/
extern struct ps_prochandle proch;
extern unsigned long rdb_flags;
/*
* Functions
*/
GElf_Sym *, char **);
extern unsigned continue_to_break(struct ps_prochandle *);
unsigned);
extern void disasm(struct ps_prochandle *, int);
extern void free_linkmaps(struct ps_prochandle *);
extern ulong_t hexstr_to_num(const char *);
extern void list_breakpoints(struct ps_prochandle *);
map_info_t *mp);
extern char *print_address(unsigned long);
extern char *print_address_ps(struct ps_prochandle *,
unsigned long, unsigned);
char *);
extern void print_varstring(struct ps_prochandle *, const char *);
extern void print_mach_varstring(struct ps_prochandle *,
const char *);
extern void rdb_help(const char *);
extern void rdb_prompt();
extern void perr(char *);
ulong_t, char *, int);
unsigned);
char **);
GElf_Sym *);
extern int yyparse(void);
extern void yyerror(char *);
extern int yylex(void);
#ifdef __cplusplus
}
#endif
#endif /* _RDB_H */