FreeBSD/Linux Kernel Cross Reference
sys/ddb/db_sym.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie the
24 * rights to redistribute these changes.
25 *
26 * $FreeBSD$
27 */
28
29 #ifndef _DDB_DB_SYM_H_
30 #define _DDB_DB_SYM_H_
31
32 /*
33 * Author: Alessandro Forin, Carnegie Mellon University
34 * Date: 8/90
35 */
36
37 /*
38 * This module can handle multiple symbol tables
39 */
40 typedef struct {
41 char *name; /* symtab name */
42 char *start; /* symtab location */
43 char *end;
44 char *private; /* optional machdep pointer */
45 } db_symtab_t;
46
47 /*
48 * Symbol representation is specific to the symtab style:
49 * BSD compilers use dbx' nlist, other compilers might use
50 * a different one
51 */
52 typedef char * db_sym_t; /* opaque handle on symbols */
53 #define DB_SYM_NULL ((db_sym_t)0)
54
55 /*
56 * Non-stripped symbol tables will have duplicates, for instance
57 * the same string could match a parameter name, a local var, a
58 * global var, etc.
59 * We are most concern with the following matches.
60 */
61 typedef int db_strategy_t; /* search strategy */
62
63 #define DB_STGY_ANY 0 /* anything goes */
64 #define DB_STGY_XTRN 1 /* only external symbols */
65 #define DB_STGY_PROC 2 /* only procedures */
66
67 /*
68 * Functions exported by the symtable module
69 */
70 void db_add_symbol_table __P((char *, char *, char *, char *));
71 /* extend the list of symbol tables */
72
73 db_sym_t db_search_symbol __P((db_addr_t, db_strategy_t, db_expr_t *));
74 /* find symbol given value */
75
76 void db_symbol_values __P((db_sym_t, char **, db_expr_t *));
77 /* return name and value of symbol */
78
79 #define db_find_sym_and_offset(val,namep,offp) \
80 db_symbol_values(db_search_symbol(val,DB_STGY_ANY,offp),namep,0)
81 /* find name&value given approx val */
82
83 #define db_find_xtrn_sym_and_offset(val,namep,offp) \
84 db_symbol_values(db_search_symbol(val,DB_STGY_XTRN,offp),namep,0)
85 /* ditto, but no locals */
86
87 int db_eqname __P((char *, char *, int));
88 /* strcmp, modulo leading char */
89
90 void db_printsym __P((db_expr_t, db_strategy_t));
91 /* print closest symbol to a value */
92
93 int db_sym_numargs __P((db_sym_t, int *, char **));
94
95 boolean_t X_db_line_at_pc __P((db_symtab_t *symtab, db_sym_t cursym,
96 char **filename, int *linenum,
97 db_expr_t off));
98 db_sym_t X_db_lookup __P((db_symtab_t *stab, char *symstr));
99 db_sym_t X_db_search_symbol __P((db_symtab_t *symtab, db_addr_t off,
100 db_strategy_t strategy,
101 db_expr_t *diffp));
102 int X_db_sym_numargs __P((db_symtab_t *, db_sym_t, int *,
103 char **));
104 void X_db_symbol_values __P((db_symtab_t *symtab,
105 db_sym_t sym, char **namep,
106 db_expr_t *valuep));
107
108 #endif /* !_DDB_DB_SYM_H_ */
Cache object: 7eda9f834c411f62119a475860692455
|