FreeBSD/Linux Kernel Cross Reference
sys/ddb/db_kld.c
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.
25 *
26 * from db_aout.c,v 1.20 1998/06/07 17:09:36 dfr Exp
27 */
28 /*
29 * Author: David B. Golub, Carnegie Mellon University
30 * Date: 7/90
31 */
32 /*
33 * Symbol table routines for kld maintained kernels.
34 */
35
36 #include <sys/cdefs.h>
37 __FBSDID("$FreeBSD: releng/5.2/sys/ddb/db_kld.c 116176 2003-06-10 22:09:23Z obrien $");
38
39 #include "opt_ddb.h"
40
41 #ifndef DDB_NOKLDSYM
42
43 #include <sys/param.h>
44 #include <sys/systm.h>
45 #include <sys/linker.h>
46
47 #include <ddb/ddb.h>
48 #include <ddb/db_sym.h>
49
50 c_db_sym_t
51 X_db_lookup(stab, symstr)
52 db_symtab_t *stab;
53 const char * symstr;
54 {
55 c_linker_sym_t sym;
56
57 if (linker_ddb_lookup(symstr, &sym) == 0)
58 return (c_db_sym_t) sym;
59 else
60 return (c_db_sym_t) 0;
61 }
62
63 c_db_sym_t
64 X_db_search_symbol(symtab, off, strategy, diffp)
65 db_symtab_t * symtab;
66 register
67 db_addr_t off;
68 db_strategy_t strategy;
69 db_expr_t *diffp; /* in/out */
70 {
71 c_linker_sym_t sym;
72 long diff;
73
74 if (linker_ddb_search_symbol((caddr_t) off, &sym, &diff) == 0) {
75 *diffp = (db_expr_t) diff;
76 return (c_db_sym_t) sym;
77 }
78
79 return 0;
80 }
81
82 /*
83 * Return the name and value for a symbol.
84 */
85 void
86 X_db_symbol_values(symtab, dbsym, namep, valuep)
87 db_symtab_t *symtab;
88 c_db_sym_t dbsym;
89 const char **namep;
90 db_expr_t *valuep;
91 {
92 c_linker_sym_t sym = (c_linker_sym_t) dbsym;
93 linker_symval_t symval;
94
95 linker_ddb_symbol_values(sym, &symval);
96 if (namep)
97 *namep = (const char*) symval.name;
98 if (valuep)
99 *valuep = (db_expr_t) symval.value;
100 }
101
102
103 boolean_t
104 X_db_line_at_pc(symtab, cursym, filename, linenum, off)
105 db_symtab_t * symtab;
106 c_db_sym_t cursym;
107 char **filename;
108 int *linenum;
109 db_expr_t off;
110 {
111 return FALSE;
112 }
113
114 boolean_t
115 X_db_sym_numargs(symtab, cursym, nargp, argnamep)
116 db_symtab_t * symtab;
117 c_db_sym_t cursym;
118 int *nargp;
119 char **argnamep;
120 {
121 return FALSE;
122 }
123
124 /*
125 * Initialization routine for a.out files.
126 */
127 void
128 kdb_init()
129 {
130 db_add_symbol_table(0, 0, "kernel", 0);
131 }
132
133 #endif /* !DDB_NOKLDSYM */
Cache object: 16edde10c53443a5a917ae35f1a51caa
|