2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
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.
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.
16 * Carnegie Mellon requests users of this software to return to
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
23 * any improvements or extensions that they make and grant Carnegie the
24 * rights to redistribute these changes.
26 * $FreeBSD: src/sys/ddb/db_sym.h,v 1.19 1999/08/28 00:41:10 peter Exp $
29 #ifndef _DDB_DB_SYM_H_
30 #define _DDB_DB_SYM_H_
37 * Author: Alessandro Forin, Carnegie Mellon University
42 * This module can handle multiple symbol tables
45 char *name
; /* symtab name */
46 char *start
; /* symtab location */
48 char *private; /* optional machdep pointer */
52 * Symbol representation is specific to the symtab style:
53 * BSD compilers use dbx' nlist, other compilers might use
56 typedef char * db_sym_t
; /* opaque handle on symbols */
57 typedef const char * c_db_sym_t
; /* opaque handle on symbols */
58 #define DB_SYM_NULL ((db_sym_t)0)
59 #define C_DB_SYM_NULL ((c_db_sym_t)0)
62 * Non-stripped symbol tables will have duplicates, for instance
63 * the same string could match a parameter name, a local var, a
65 * We are most concern with the following matches.
67 typedef int db_strategy_t
; /* search strategy */
69 #define DB_STGY_ANY 0 /* anything goes */
70 #define DB_STGY_XTRN 1 /* only external symbols */
71 #define DB_STGY_PROC 2 /* only procedures */
74 * Functions exported by the symtable module
76 void db_add_symbol_table (char *, char *, char *, char *);
77 /* extend the list of symbol tables */
79 c_db_sym_t
db_search_symbol (db_addr_t
, db_strategy_t
, db_expr_t
*);
80 /* find symbol given value */
82 void db_symbol_values (c_db_sym_t
, const char **, db_expr_t
*);
83 /* return name and value of symbol */
85 #define db_find_sym_and_offset(val,namep,offp) \
86 db_symbol_values(db_search_symbol(val,DB_STGY_ANY,offp),namep,0)
87 /* find name&value given approx val */
89 #define db_find_xtrn_sym_and_offset(val,namep,offp) \
90 db_symbol_values(db_search_symbol(val,DB_STGY_XTRN,offp),namep,0)
91 /* ditto, but no locals */
93 boolean_t
db_eqname (const char *, const char *, int);
94 /* strcmp, modulo leading char */
96 void db_printsym (db_expr_t
, db_strategy_t
);
97 /* print closest symbol to a value */
99 int db_sym_numargs (c_db_sym_t
, int *, char **);
101 boolean_t
X_db_line_at_pc (db_symtab_t
*symtab
, c_db_sym_t cursym
,
102 char **filename
, int *linenum
,
104 c_db_sym_t
X_db_lookup (db_symtab_t
*stab
, const char *symstr
);
105 c_db_sym_t
X_db_search_symbol (db_symtab_t
*symtab
, db_addr_t off
,
106 db_strategy_t strategy
,
108 boolean_t
X_db_sym_numargs (db_symtab_t
*, c_db_sym_t
, int *,
110 void X_db_symbol_values (db_symtab_t
*symtab
,
111 c_db_sym_t sym
, const char **namep
,
114 #endif /* !_DDB_DB_SYM_H_ */