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