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