db_sym.h revision 1.1 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 (at) 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 /*
27 * HISTORY
28 * $Log: db_sym.h,v $
29 * Revision 1.1 1993/03/21 09:45:37 cgd
30 * Initial revision
31 *
32 * Revision 1.1 1992/03/25 21:45:29 pace
33 * Initial revision
34 *
35 * Revision 2.3 91/02/05 17:07:12 mrt
36 * Changed to new Mach copyright
37 * [91/01/31 16:19:27 mrt]
38 *
39 * Revision 2.2 90/08/27 21:52:39 dbg
40 * Changed type of db_sym_t to char * - it's a better type for an
41 * opaque pointer.
42 * [90/08/22 dbg]
43 *
44 * Created.
45 * [90/08/19 af]
46 *
47 */
48 /*
49 * Author: Alessandro Forin, Carnegie Mellon University
50 * Date: 8/90
51 */
52
53 /*
54 * This module can handle multiple symbol tables
55 */
56 typedef struct {
57 char *name; /* symtab name */
58 char *start; /* symtab location */
59 char *end;
60 char *private; /* optional machdep pointer */
61 } db_symtab_t;
62
63 extern db_symtab_t *db_last_symtab; /* where last symbol was found */
64
65 /*
66 * Symbol representation is specific to the symtab style:
67 * BSD compilers use dbx' nlist, other compilers might use
68 * a different one
69 */
70 typedef char * db_sym_t; /* opaque handle on symbols */
71 #define DB_SYM_NULL ((db_sym_t)0)
72
73 /*
74 * Non-stripped symbol tables will have duplicates, for instance
75 * the same string could match a parameter name, a local var, a
76 * global var, etc.
77 * We are most concern with the following matches.
78 */
79 typedef int db_strategy_t; /* search strategy */
80
81 #define DB_STGY_ANY 0 /* anything goes */
82 #define DB_STGY_XTRN 1 /* only external symbols */
83 #define DB_STGY_PROC 2 /* only procedures */
84
85 extern boolean_t db_qualify_ambiguous_names;
86 /* if TRUE, check across symbol tables
87 * for multiple occurrences of a name.
88 * Might slow down quite a bit */
89
90 /*
91 * Functions exported by the symtable module
92 */
93 extern void db_add_symbol_table();
94 /* extend the list of symbol tables */
95
96 extern int db_value_of_name(/* char*, db_expr_t* */);
97 /* find symbol value given name */
98
99 extern db_sym_t db_search_symbol(/* db_expr_t, db_strategy_t, int* */);
100 /* find symbol given value */
101
102 extern void db_symbol_values(/* db_sym_t, char**, db_expr_t* */);
103 /* return name and value of symbol */
104
105 #define db_find_sym_and_offset(val,namep,offp) \
106 db_symbol_values(db_search_symbol(val,DB_STGY_ANY,offp),namep,0)
107 /* find name&value given approx val */
108
109 #define db_find_xtrn_sym_and_offset(val,namep,offp) \
110 db_symbol_values(db_search_symbol(val,DB_STGY_XTRN,offp),namep,0)
111 /* ditto, but no locals */
112
113 extern int db_eqname(/* char*, char*, char */);
114 /* strcmp, modulo leading char */
115
116 extern void db_printsym(/* db_expr_t, db_strategy_t */);
117 /* print closest symbol to a value */
118