-/* $OpenBSD: db_trace.c,v 1.30 2017/05/29 06:14:10 mpi Exp $ */
+/* $OpenBSD: db_trace.c,v 1.31 2017/05/30 15:39:04 mpi Exp $ */
/* $NetBSD: db_trace.c,v 1.1 2003/04/26 18:39:27 fvdl Exp $ */
/*
#define INTERRUPT 3
#define AST 4
-int db_numargs(struct callframe *, db_sym_t);
+int db_numargs(struct callframe *, Elf_Sym *);
void db_nextframe(struct callframe **, db_addr_t *, long *, int,
int (*) (const char *, ...));
* reliably determine the values currently, just return 0.
*/
int
-db_numargs(struct callframe *fp, db_sym_t sym)
+db_numargs(struct callframe *fp, Elf_Sym *sym)
{
#ifdef DDBCTF
int args;
unsigned int i;
char * name;
db_expr_t offset;
- db_sym_t sym;
+ Elf_Sym * sym;
sym = db_search_symbol(callpc, DB_STGY_ANY, &offset);
db_symbol_values(sym, &name, NULL);
struct trapframe *tf;
char *name;
db_expr_t offset;
- db_sym_t sym;
+ Elf_Sym * sym;
int is_trap;
st->st_pc[st->st_count++] = callpc;
-/* $OpenBSD: db_trace.c,v 1.4 2017/02/17 17:16:04 patrick Exp $ */
+/* $OpenBSD: db_trace.c,v 1.5 2017/05/30 15:39:04 mpi Exp $ */
/* $NetBSD: db_trace.c,v 1.8 2003/01/17 22:28:48 thorpej Exp $ */
/*
u_int64_t frame, lastframe, lr, lastlr, sp;
char c, *cp = modif;
db_expr_t offset;
- db_sym_t sym;
+ Elf_Sym * sym;
char *name;
boolean_t kernel_only = TRUE;
boolean_t trace_thread = FALSE;
-/* $OpenBSD: db_interface.c,v 1.39 2017/04/30 16:45:45 mpi Exp $ */
+/* $OpenBSD: db_interface.c,v 1.40 2017/05/30 15:39:04 mpi Exp $ */
/*
* Copyright (c) 1999-2003 Michael Shalayeff
char *modif, int (*pr)(const char *, ...))
{
register_t *fp, pc, rp, *argp;
- db_sym_t sym;
+ Elf_Sym *sym;
db_expr_t off;
char *name;
int nargs;
-/* $OpenBSD: db_trace.c,v 1.27 2017/05/29 06:14:10 mpi Exp $ */
+/* $OpenBSD: db_trace.c,v 1.28 2017/05/30 15:39:04 mpi Exp $ */
/* $NetBSD: db_trace.c,v 1.18 1996/05/03 19:42:01 christos Exp $ */
/*
#define INTERRUPT 3
#define AST 4
-int db_numargs(struct callframe *, db_sym_t);
+int db_numargs(struct callframe *, Elf_Sym *);
void db_nextframe(struct callframe **, db_addr_t *, int *, int,
int (*pr)(const char *, ...));
* Figure out how many arguments were passed into the frame at "fp".
*/
int
-db_numargs(struct callframe *fp, db_sym_t sym)
+db_numargs(struct callframe *fp, Elf_Sym *sym)
{
int *argp;
int inst;
int narg;
char * name;
db_expr_t offset;
- db_sym_t sym;
+ Elf_Sym *sym;
sym = db_search_symbol(callpc, DB_STGY_ANY, &offset);
db_symbol_values(sym, &name, NULL);
for (i = 0; i < DB_STACK_TRACE_MAX && frame != NULL; i++) {
char *name;
db_expr_t offset;
- db_sym_t sym;
+ Elf_Sym *sym;
int is_trap = 0;
st->st_pc[st->st_count++] = callpc;
-/* $OpenBSD: db_trace.c,v 1.16 2016/09/19 21:18:35 jasper Exp $ */
+/* $OpenBSD: db_trace.c,v 1.17 2017/05/30 15:39:04 mpi Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
static vaddr_t
stack_decode(db_addr_t addr, vaddr_t *stack, int (*pr)(const char *, ...))
{
- db_sym_t proc;
+ Elf_Sym *proc;
db_expr_t offset_from_proc;
uint instructions_to_search;
db_addr_t check_addr;
vaddr_t str30_addr = 0;
vaddr_t last_subu_addr = 0;
- /* get what we hope will be the db_sym_t for the function name */
+ /* get what we hope will be the symbol for the function name */
proc = db_search_symbol(addr, DB_STGY_PROC, &offset_from_proc);
if (offset_from_proc == addr) /* i.e. no symbol found */
proc = NULL;
-/* $OpenBSD: trap.c,v 1.123 2017/04/20 15:42:26 visa Exp $ */
+/* $OpenBSD: trap.c,v 1.124 2017/05/30 15:39:04 mpi Exp $ */
/*
* Copyright (c) 1988 University of Utah.
extern char k_general[];
#ifdef DDB
db_expr_t diff;
- db_sym_t sym;
+ Elf_Sym *sym;
char *symname;
#endif
-/* $OpenBSD: db_trace.c,v 1.11 2017/01/24 00:58:55 mpi Exp $ */
+/* $OpenBSD: db_trace.c,v 1.12 2017/05/30 15:39:05 mpi Exp $ */
/* $NetBSD: db_trace.c,v 1.15 1996/02/22 23:23:41 gwr Exp $ */
/*
{
db_addr_t lr, sp, lastsp;
db_expr_t offset;
- db_sym_t sym;
+ Elf_Sym *sym;
char *name;
char c, *cp = modif;
int trace_proc = 0;
-/* $OpenBSD: db_disasm.c,v 1.3 2007/02/26 19:33:41 miod Exp $ */
+/* $OpenBSD: db_disasm.c,v 1.4 2017/05/30 15:39:05 mpi Exp $ */
/* $NetBSD: db_disasm.c,v 1.13 2006/01/21 02:09:06 uwe Exp $ */
/*
size_t len;
db_expr_t d, value;
char *name;
- db_sym_t cursym;
+ Elf_Sym *cursym;
extern unsigned long db_lastsym;
extern unsigned int db_maxoff;
-/* $OpenBSD: db_trace.c,v 1.6 2014/07/13 12:11:01 jasper Exp $ */
+/* $OpenBSD: db_trace.c,v 1.7 2017/05/30 15:39:05 mpi Exp $ */
/* $NetBSD: db_trace.c,v 1.19 2006/01/21 22:10:59 uwe Exp $ */
/*-
} else {
char *name;
db_expr_t offset;
- db_sym_t sym;
+ Elf_Sym *sym;
DPRINTF(" (1)newpc 0x%lx, newfp 0x%lx\n",
-/* $OpenBSD: openfirm.c,v 1.19 2016/05/19 09:15:28 kettenis Exp $ */
+/* $OpenBSD: openfirm.c,v 1.20 2017/05/30 15:39:05 mpi Exp $ */
/* $NetBSD: openfirm.c,v 1.13 2001/06/21 00:08:02 eeh Exp $ */
/*
cell_t offset;
cell_t symbol;
} *args = (struct args*)cells;
- db_sym_t symbol;
+ Elf_Sym *symbol;
db_expr_t value;
db_expr_t offset;
-/* $OpenBSD: db_ctf.c,v 1.9 2017/05/29 06:14:10 mpi Exp $ */
+/* $OpenBSD: db_ctf.c,v 1.10 2017/05/30 15:39:05 mpi Exp $ */
/*
* Copyright (c) 2016 Jasper Lievisse Adriaanse <jasper@openbsd.org>
* For a given function name, return the number of arguments.
*/
int
-db_ctf_func_numargs(db_sym_t st)
+db_ctf_func_numargs(Elf_Sym *st)
{
Elf_Sym *symp, *stp = (Elf_Sym *)st;
uint16_t *fstart, *fend;
-/* $OpenBSD: db_elf.c,v 1.25 2017/05/28 11:41:52 mpi Exp $ */
+/* $OpenBSD: db_elf.c,v 1.26 2017/05/30 15:39:05 mpi Exp $ */
/* $NetBSD: db_elf.c,v 1.13 2000/07/07 21:55:18 jhawk Exp $ */
/*-
* Search for the symbol with the given address (matching within the
* provided threshold).
*/
-db_sym_t
+Elf_Sym *
db_elf_sym_search(db_addr_t off, db_strategy_t strategy,
db_expr_t *diffp)
{
else
*diffp = diff;
- return ((db_sym_t)rsymp);
+ return (rsymp);
}
/*
* Return the name and value for a symbol.
*/
void
-db_symbol_values(db_sym_t sym, char **namep, db_expr_t *valuep)
+db_symbol_values(Elf_Sym *sym, char **namep, db_expr_t *valuep)
{
db_symtab_t *stab = &db_symtab;
Elf_Sym *symp = (Elf_Sym *)sym;
* if we can find the appropriate debugging symbol.
*/
int
-db_elf_line_at_pc(db_sym_t cursym, char **filename,
+db_elf_line_at_pc(Elf_Sym *cursym, char **filename,
int *linenum, db_expr_t off)
{
db_symtab_t *stab = &db_symtab;
default:
suffix[0] = '\0';
}
- (*db_forall_func)((db_sym_t)symp,
+ (*db_forall_func)(symp,
strtab + symp->st_name, suffix, 0, arg);
}
}
sym = db_elf_sym_lookup(name);
if (sym == NULL)
return (0);
- db_symbol_values((db_sym_t)sym, &name, valuep);
+ db_symbol_values(sym, &name, valuep);
return (1);
}
-/* $OpenBSD: db_hangman.c,v 1.36 2016/09/16 19:00:25 jasper Exp $ */
+/* $OpenBSD: db_hangman.c,v 1.37 2017/05/30 15:39:05 mpi Exp $ */
/*
* Copyright (c) 1996 Theo de Raadt, Michael Shalayeff
struct db_hang_forall_arg {
int cnt;
- db_sym_t sym;
+ Elf_Sym *sym;
};
/*
* Horrible abuse of the forall function, but we're not in a hurry.
*/
-static void db_hang_forall(db_sym_t, char *, char *, int, void *);
+static void db_hang_forall(Elf_Sym *, char *, char *, int, void *);
static void
-db_hang_forall(db_sym_t sym, char *name, char *suff, int pre, void *varg)
+db_hang_forall(Elf_Sym *sym, char *name, char *suff, int pre, void *varg)
{
struct db_hang_forall_arg *arg = varg;
-/* $OpenBSD: db_sym.c,v 1.52 2017/05/27 16:08:23 claudio Exp $ */
+/* $OpenBSD: db_sym.c,v 1.53 2017/05/30 15:39:05 mpi Exp $ */
/* $NetBSD: db_sym.c,v 1.24 2000/08/11 22:50:47 tv Exp $ */
/*
* Find the closest symbol to val, and return its name
* and the difference between val and the symbol found.
*/
-db_sym_t
+Elf_Sym *
db_search_symbol(db_addr_t val, db_strategy_t strategy, db_expr_t *offp)
{
unsigned int diff;
db_expr_t newdiff;
- db_sym_t ret = NULL, sym;
+ Elf_Sym *ret = NULL, *sym;
newdiff = diff = ~0;
sym = db_elf_sym_search(val, strategy, &newdiff);
char *name;
db_expr_t value;
int linenum;
- db_sym_t cursym;
+ Elf_Sym *cursym;
char buf[DB_FORMAT_BUF_SIZE];
if (off <= db_lastsym) {
#define _DDB_DB_SYM_H_
#include <sys/stdint.h>
-
-/*
- * Symbol representation is specific to the symtab style:
- * BSD compilers use dbx' nlist, other compilers might use
- * a different one
- */
-typedef char * db_sym_t; /* opaque handle on symbols */
+#include <sys/exec_elf.h>
/*
* Non-stripped symbol tables will have duplicates, for instance
* the type, prefix an initial ignorable function prefix (e.g. "_"
* in a.out), and arg an opaque argument to be passed in.
*/
-typedef void (db_forall_func_t)(db_sym_t, char *, char *, int, void *);
+typedef void (db_forall_func_t)(Elf_Sym *, char *, char *, int, void *);
extern unsigned int db_maxoff; /* like gdb's "max-symbolic-offset" */
int db_value_of_name(char *, db_expr_t *);
/* find symbol value given name */
-db_sym_t db_search_symbol(db_addr_t, db_strategy_t, db_expr_t *);
+Elf_Sym * db_search_symbol(db_addr_t, db_strategy_t, db_expr_t *);
/* find symbol given value */
-void db_symbol_values(db_sym_t, char **, db_expr_t *);
+void db_symbol_values(Elf_Sym *, char **, db_expr_t *);
/* return name and value of symbol */
#define db_find_sym_and_offset(val,namep,offp) \
/* print closest symbol to a value */
int db_elf_sym_init(int, void *, void *, const char *);
-db_sym_t db_elf_sym_search(db_addr_t, db_strategy_t, db_expr_t *);
-int db_elf_line_at_pc(db_sym_t, char **, int *, db_expr_t);
+Elf_Sym * db_elf_sym_search(db_addr_t, db_strategy_t, db_expr_t *);
+int db_elf_line_at_pc(Elf_Sym *, char **, int *, db_expr_t);
void db_elf_sym_forall(db_forall_func_t db_forall_func, void *);
bool db_dwarf_line_at_pc(const char *, size_t, uintptr_t,
const char **, const char **, int *);
#ifdef DDBCTF
-int db_ctf_func_numargs(db_sym_t);
+int db_ctf_func_numargs(Elf_Sym *);
#endif
#endif /* _DDB_DB_SYM_H_ */
-/* $OpenBSD: exec_elf.h,v 1.73 2017/02/18 06:42:08 jsg Exp $ */
+/* $OpenBSD: exec_elf.h,v 1.74 2017/05/30 15:39:05 mpi Exp $ */
/*
* Copyright (c) 1995, 1996 Erik Theisen. All rights reserved.
*
#endif
#ifdef _KERNEL
+struct exec_package;
+
int exec_elf_makecmds(struct proc *, struct exec_package *);
#endif /* _KERNEL */