db_sym.h (199706ee) | db_sym.h (56c88695) |
---|---|
1/* $OpenBSD: db_sym.h,v 1.11 1997/05/29 03:28:45 mickey Exp $ */ 2/* $NetBSD: db_sym.h,v 1.7 1996/02/05 01:57:16 christos Exp $ */ | 1/* $NetBSD: db_sym.h,v 1.13 2000/05/25 19:57:36 jhawk Exp $ */ |
3 4/* 5 * Mach Operating System 6 * Copyright (c) 1993,1992,1991,1990 Carnegie Mellon University 7 * All Rights Reserved. 8 * 9 * Permission to use, copy, modify and distribute this software and its 10 * documentation is hereby granted, provided that both the copyright --- 14 unchanged lines hidden (view full) --- 25 * 26 * any improvements or extensions that they make and grant Carnegie Mellon 27 * the rights to redistribute these changes. 28 * 29 * Author: Alessandro Forin, Carnegie Mellon University 30 * Date: 8/90 31 */ 32 | 2 3/* 4 * Mach Operating System 5 * Copyright (c) 1993,1992,1991,1990 Carnegie Mellon University 6 * All Rights Reserved. 7 * 8 * Permission to use, copy, modify and distribute this software and its 9 * documentation is hereby granted, provided that both the copyright --- 14 unchanged lines hidden (view full) --- 24 * 25 * any improvements or extensions that they make and grant Carnegie Mellon 26 * the rights to redistribute these changes. 27 * 28 * Author: Alessandro Forin, Carnegie Mellon University 29 * Date: 8/90 30 */ 31 |
33#ifndef _DDB_DB_SYM_ 34#define _DDB_DB_SYM_ 35 | |
36/* 37 * This module can handle multiple symbol tables 38 */ | 32/* 33 * This module can handle multiple symbol tables 34 */ |
39 40#include <sys/queue.h> 41 42typedef struct db_symtab { 43 TAILQ_ENTRY(db_symtab) list; /* all the tabs */ 44 char *name; /* symtab name */ 45 u_int id; /* id */ | 35typedef struct { 36 const char *name; /* symtab name */ |
46 char *start; /* symtab location */ | 37 char *start; /* symtab location */ |
47 char *end; /* end of symtab */ 48 char *rend; /* real end (as it passed) */ | 38 char *end; |
49 char *private; /* optional machdep pointer */ | 39 char *private; /* optional machdep pointer */ |
50} *db_symtab_t; | 40} db_symtab_t; |
51 | 41 |
52extern db_symtab_t db_last_symtab; /* where last symbol was found */ 53extern size_t db_nsymtabs; /* number of symbol tables */ | 42extern db_symtab_t *db_last_symtab; /* where last symbol was found */ |
54 55/* 56 * Symbol representation is specific to the symtab style: 57 * BSD compilers use dbx' nlist, other compilers might use 58 * a different one 59 */ 60typedef char * db_sym_t; /* opaque handle on symbols */ 61#define DB_SYM_NULL ((db_sym_t)0) --- 5 unchanged lines hidden (view full) --- 67 * We are most concern with the following matches. 68 */ 69typedef int db_strategy_t; /* search strategy */ 70 71#define DB_STGY_ANY 0 /* anything goes */ 72#define DB_STGY_XTRN 1 /* only external symbols */ 73#define DB_STGY_PROC 2 /* only procedures */ 74 | 43 44/* 45 * Symbol representation is specific to the symtab style: 46 * BSD compilers use dbx' nlist, other compilers might use 47 * a different one 48 */ 49typedef char * db_sym_t; /* opaque handle on symbols */ 50#define DB_SYM_NULL ((db_sym_t)0) --- 5 unchanged lines hidden (view full) --- 56 * We are most concern with the following matches. 57 */ 58typedef int db_strategy_t; /* search strategy */ 59 60#define DB_STGY_ANY 0 /* anything goes */ 61#define DB_STGY_XTRN 1 /* only external symbols */ 62#define DB_STGY_PROC 2 /* only procedures */ 63 |
64 65/* 66 * Internal db_forall function calling convention: 67 * 68 * (*db_forall_func)(stab, sym, name, suffix, prefix, arg); 69 * 70 * stab is the symbol table, symbol the (opaque) symbol pointer, 71 * name the name of the symbol, suffix a string representing 72 * the type, prefix an initial ignorable function prefix (e.g. "_" 73 * in a.out), and arg an opaque argument to be passed in. 74 */ 75typedef void (db_forall_func_t) 76 __P((db_symtab_t *, db_sym_t, char *, char *, int, void *)); 77 78void X_db_forall __P((db_symtab_t *, 79 db_forall_func_t db_forall_func, void *)); 80 81/* 82 * A symbol table may be in one of many formats. All symbol tables 83 * must be of the same format as the master kernel symbol table. 84 */ 85typedef struct { 86 const char *sym_format; 87 boolean_t (*sym_init) __P((int, void *, void *, const char *)); 88 db_sym_t (*sym_lookup) __P((db_symtab_t *, char *)); 89 db_sym_t (*sym_search) __P((db_symtab_t *, db_addr_t, db_strategy_t, 90 db_expr_t *)); 91 void (*sym_value) __P((db_symtab_t *, db_sym_t, char **, 92 db_expr_t *)); 93 boolean_t (*sym_line_at_pc) __P((db_symtab_t *, db_sym_t, 94 char **, int *, db_expr_t)); 95 boolean_t (*sym_numargs) __P((db_symtab_t *, db_sym_t, int *, 96 char **)); 97 void (*sym_forall) __P((db_symtab_t *, 98 db_forall_func_t *db_forall_func, void *)); 99} db_symformat_t; 100 |
|
75extern boolean_t db_qualify_ambiguous_names; 76 /* if TRUE, check across symbol tables 77 * for multiple occurrences of a name. 78 * Might slow down quite a bit */ 79 | 101extern boolean_t db_qualify_ambiguous_names; 102 /* if TRUE, check across symbol tables 103 * for multiple occurrences of a name. 104 * Might slow down quite a bit */ 105 |
106extern unsigned int db_maxoff; /* like gdb's "max-symbolic-offset" */ |
|
80/* 81 * Functions exported by the symtable module 82 */ | 107/* 108 * Functions exported by the symtable module 109 */ |
83void db_sym_init __P((void)); 84int db_add_symbol_table __P((char *, char *, char *, char *, char *)); | 110int db_add_symbol_table __P((char *, char *, const char *, char *)); |
85 /* extend the list of symbol tables */ 86 87void db_del_symbol_table __P((char *)); 88 /* remove a symbol table from list */ | 111 /* extend the list of symbol tables */ 112 113void db_del_symbol_table __P((char *)); 114 /* remove a symbol table from list */ |
89db_symtab_t db_istab __P((size_t)); 90db_symtab_t db_symiter __P((db_symtab_t)); 91 /* iterate through all the symtabs, if any */ | |
92 93boolean_t db_eqname __P((char *, char *, int)); 94 /* strcmp, modulo leading char */ 95 96int db_value_of_name __P((char *, db_expr_t *)); 97 /* find symbol value given name */ 98 99db_sym_t db_lookup __P((char *)); 100 | 115 116boolean_t db_eqname __P((char *, char *, int)); 117 /* strcmp, modulo leading char */ 118 119int db_value_of_name __P((char *, db_expr_t *)); 120 /* find symbol value given name */ 121 122db_sym_t db_lookup __P((char *)); 123 |
101char *db_qualify __P((db_sym_t, char *)); | 124void db_sifting __P((char *, int)); 125 /* print partially matching symbol names */ |
102 103boolean_t db_symbol_is_ambiguous __P((db_sym_t)); 104 105db_sym_t db_search_symbol __P((db_addr_t, db_strategy_t, db_expr_t *)); 106 /* find symbol given value */ 107 108void db_symbol_values __P((db_sym_t, char **, db_expr_t *)); 109 /* return name and value of symbol */ --- 7 unchanged lines hidden (view full) --- 117 /* ditto, but no locals */ 118 119void db_printsym __P((db_expr_t, db_strategy_t)); 120 /* print closest symbol to a value */ 121 122boolean_t db_line_at_pc __P((db_sym_t, char **, int *, db_expr_t)); 123 124int db_sym_numargs __P((db_sym_t, int *, char **)); | 126 127boolean_t db_symbol_is_ambiguous __P((db_sym_t)); 128 129db_sym_t db_search_symbol __P((db_addr_t, db_strategy_t, db_expr_t *)); 130 /* find symbol given value */ 131 132void db_symbol_values __P((db_sym_t, char **, db_expr_t *)); 133 /* return name and value of symbol */ --- 7 unchanged lines hidden (view full) --- 141 /* ditto, but no locals */ 142 143void db_printsym __P((db_expr_t, db_strategy_t)); 144 /* print closest symbol to a value */ 145 146boolean_t db_line_at_pc __P((db_sym_t, char **, int *, db_expr_t)); 147 148int db_sym_numargs __P((db_sym_t, int *, char **)); |
125struct exec; 126void db_stub_xh __P((db_symtab_t, struct exec *)); 127int db_symtablen __P((db_symtab_t)); 128int db_symatoff __P((db_symtab_t, int, void*, int*)); | 149char *db_qualify __P((db_sym_t, const char *)); |
129 | 150 |
130/* db_hangman.c */ 131void db_hangman __P((db_expr_t, int, db_expr_t, char *)); | 151/* 152 * XXX - should explicitly ask for aout symbols in machine/db_machdep.h 153 */ 154#ifndef DB_NO_AOUT 155#define DB_AOUT_SYMBOLS 156#endif |
132 | 157 |
133#endif /* _DDB_DB_SYM_H_ */ | 158#ifdef DB_AOUT_SYMBOLS 159extern db_symformat_t db_symformat_aout; 160#endif 161#ifdef DB_ELF_SYMBOLS 162extern db_symformat_t db_symformat_elf; 163#endif |