db_sym.h revision 1.8 1 1.8 ross /* $NetBSD: db_sym.h,v 1.8 1998/01/31 04:14:47 ross Exp $ */
2 1.5 cgd
3 1.1 cgd /*
4 1.1 cgd * Mach Operating System
5 1.1 cgd * Copyright (c) 1991,1990 Carnegie Mellon University
6 1.1 cgd * All Rights Reserved.
7 1.1 cgd *
8 1.1 cgd * Permission to use, copy, modify and distribute this software and its
9 1.1 cgd * documentation is hereby granted, provided that both the copyright
10 1.1 cgd * notice and this permission notice appear in all copies of the
11 1.1 cgd * software, derivative works or modified versions, and any portions
12 1.1 cgd * thereof, and that both notices appear in supporting documentation.
13 1.1 cgd *
14 1.1 cgd * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
15 1.1 cgd * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
16 1.1 cgd * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 1.1 cgd *
18 1.1 cgd * Carnegie Mellon requests users of this software to return to
19 1.1 cgd *
20 1.1 cgd * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
21 1.1 cgd * School of Computer Science
22 1.1 cgd * Carnegie Mellon University
23 1.1 cgd * Pittsburgh PA 15213-3890
24 1.1 cgd *
25 1.1 cgd * any improvements or extensions that they make and grant Carnegie the
26 1.1 cgd * rights to redistribute these changes.
27 1.2 cgd *
28 1.1 cgd * Author: Alessandro Forin, Carnegie Mellon University
29 1.1 cgd * Date: 8/90
30 1.1 cgd */
31 1.1 cgd
32 1.1 cgd /*
33 1.1 cgd * This module can handle multiple symbol tables
34 1.1 cgd */
35 1.1 cgd typedef struct {
36 1.1 cgd char *name; /* symtab name */
37 1.1 cgd char *start; /* symtab location */
38 1.1 cgd char *end;
39 1.1 cgd char *private; /* optional machdep pointer */
40 1.1 cgd } db_symtab_t;
41 1.1 cgd
42 1.1 cgd extern db_symtab_t *db_last_symtab; /* where last symbol was found */
43 1.1 cgd
44 1.1 cgd /*
45 1.1 cgd * Symbol representation is specific to the symtab style:
46 1.1 cgd * BSD compilers use dbx' nlist, other compilers might use
47 1.1 cgd * a different one
48 1.1 cgd */
49 1.1 cgd typedef char * db_sym_t; /* opaque handle on symbols */
50 1.1 cgd #define DB_SYM_NULL ((db_sym_t)0)
51 1.1 cgd
52 1.1 cgd /*
53 1.1 cgd * Non-stripped symbol tables will have duplicates, for instance
54 1.1 cgd * the same string could match a parameter name, a local var, a
55 1.1 cgd * global var, etc.
56 1.1 cgd * We are most concern with the following matches.
57 1.1 cgd */
58 1.1 cgd typedef int db_strategy_t; /* search strategy */
59 1.1 cgd
60 1.1 cgd #define DB_STGY_ANY 0 /* anything goes */
61 1.1 cgd #define DB_STGY_XTRN 1 /* only external symbols */
62 1.1 cgd #define DB_STGY_PROC 2 /* only procedures */
63 1.1 cgd
64 1.1 cgd extern boolean_t db_qualify_ambiguous_names;
65 1.1 cgd /* if TRUE, check across symbol tables
66 1.1 cgd * for multiple occurrences of a name.
67 1.1 cgd * Might slow down quite a bit */
68 1.1 cgd
69 1.8 ross extern unsigned int db_maxoff; /* like gdb's "max-symbolic-offset" */
70 1.1 cgd /*
71 1.1 cgd * Functions exported by the symtable module
72 1.1 cgd */
73 1.6 mycroft int db_add_symbol_table __P((char *, char *, char *, char *));
74 1.1 cgd /* extend the list of symbol tables */
75 1.3 brezak
76 1.6 mycroft void db_del_symbol_table __P((char *));
77 1.3 brezak /* remove a symbol table from list */
78 1.1 cgd
79 1.7 christos boolean_t db_eqname __P((char *, char *, int));
80 1.7 christos /* strcmp, modulo leading char */
81 1.7 christos
82 1.6 mycroft int db_value_of_name __P((char *, db_expr_t *));
83 1.1 cgd /* find symbol value given name */
84 1.1 cgd
85 1.7 christos db_sym_t db_lookup __P((char *));
86 1.7 christos
87 1.7 christos boolean_t db_symbol_is_ambiguous __P((db_sym_t));
88 1.7 christos
89 1.6 mycroft db_sym_t db_search_symbol __P((db_addr_t, db_strategy_t, db_expr_t *));
90 1.1 cgd /* find symbol given value */
91 1.1 cgd
92 1.6 mycroft void db_symbol_values __P((db_sym_t, char **, db_expr_t *));
93 1.1 cgd /* return name and value of symbol */
94 1.1 cgd
95 1.1 cgd #define db_find_sym_and_offset(val,namep,offp) \
96 1.1 cgd db_symbol_values(db_search_symbol(val,DB_STGY_ANY,offp),namep,0)
97 1.1 cgd /* find name&value given approx val */
98 1.1 cgd
99 1.1 cgd #define db_find_xtrn_sym_and_offset(val,namep,offp) \
100 1.1 cgd db_symbol_values(db_search_symbol(val,DB_STGY_XTRN,offp),namep,0)
101 1.1 cgd /* ditto, but no locals */
102 1.1 cgd
103 1.6 mycroft void db_printsym __P((db_expr_t, db_strategy_t));
104 1.1 cgd /* print closest symbol to a value */
105 1.7 christos
106 1.7 christos boolean_t db_line_at_pc __P((db_sym_t, char **, int *, db_expr_t));
107 1.7 christos
108 1.7 christos int db_sym_numargs __P((db_sym_t, int *, char **));
109