Commit | Line | Data |
---|---|---|
15637ed4 RG |
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. | |
15637ed4 | 25 | * |
78ed81a3 | 26 | * $Id$ |
15637ed4 | 27 | */ |
78ed81a3 | 28 | |
15637ed4 RG |
29 | /* |
30 | * Author: Alessandro Forin, Carnegie Mellon University | |
31 | * Date: 8/90 | |
32 | */ | |
33 | ||
34 | /* | |
35 | * This module can handle multiple symbol tables | |
36 | */ | |
37 | typedef struct { | |
38 | char *name; /* symtab name */ | |
39 | char *start; /* symtab location */ | |
40 | char *end; | |
41 | char *private; /* optional machdep pointer */ | |
42 | } db_symtab_t; | |
43 | ||
44 | extern db_symtab_t *db_last_symtab; /* where last symbol was found */ | |
45 | ||
46 | /* | |
47 | * Symbol representation is specific to the symtab style: | |
48 | * BSD compilers use dbx' nlist, other compilers might use | |
49 | * a different one | |
50 | */ | |
51 | typedef char * db_sym_t; /* opaque handle on symbols */ | |
52 | #define DB_SYM_NULL ((db_sym_t)0) | |
53 | ||
54 | /* | |
55 | * Non-stripped symbol tables will have duplicates, for instance | |
56 | * the same string could match a parameter name, a local var, a | |
57 | * global var, etc. | |
58 | * We are most concern with the following matches. | |
59 | */ | |
60 | typedef int db_strategy_t; /* search strategy */ | |
61 | ||
62 | #define DB_STGY_ANY 0 /* anything goes */ | |
63 | #define DB_STGY_XTRN 1 /* only external symbols */ | |
64 | #define DB_STGY_PROC 2 /* only procedures */ | |
65 | ||
66 | extern boolean_t db_qualify_ambiguous_names; | |
67 | /* if TRUE, check across symbol tables | |
68 | * for multiple occurrences of a name. | |
69 | * Might slow down quite a bit */ | |
70 | ||
71 | /* | |
72 | * Functions exported by the symtable module | |
73 | */ | |
74 | extern void db_add_symbol_table(); | |
75 | /* extend the list of symbol tables */ | |
76 | ||
77 | extern int db_value_of_name(/* char*, db_expr_t* */); | |
78 | /* find symbol value given name */ | |
79 | ||
80 | extern db_sym_t db_search_symbol(/* db_expr_t, db_strategy_t, int* */); | |
81 | /* find symbol given value */ | |
82 | ||
83 | extern void db_symbol_values(/* db_sym_t, char**, db_expr_t* */); | |
84 | /* return name and value of symbol */ | |
85 | ||
86 | #define db_find_sym_and_offset(val,namep,offp) \ | |
87 | db_symbol_values(db_search_symbol(val,DB_STGY_ANY,offp),namep,0) | |
88 | /* find name&value given approx val */ | |
89 | ||
90 | #define db_find_xtrn_sym_and_offset(val,namep,offp) \ | |
91 | db_symbol_values(db_search_symbol(val,DB_STGY_XTRN,offp),namep,0) | |
92 | /* ditto, but no locals */ | |
93 | ||
94 | extern int db_eqname(/* char*, char*, char */); | |
95 | /* strcmp, modulo leading char */ | |
96 | ||
97 | extern void db_printsym(/* db_expr_t, db_strategy_t */); | |
98 | /* print closest symbol to a value */ |