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 a.out format files.
36 */
37
38 #if defined(__ELF__)
39
40 #include <sys/param.h>
41 #include <sys/systm.h>
42 #include <sys/linker.h>
43
44 #include <machine/bootinfo.h>
45
46 #include <ddb/ddb.h>
47 #include <ddb/db_sym.h>
48
49 db_sym_t
50 X_db_lookup(stab, symstr)
51 db_symtab_t *stab;
52 char * symstr;
53 {
54 linker_sym_t sym;
55
56 if (linker_ddb_lookup(symstr, &sym) == 0)
57 return (db_sym_t) sym;
58 else
59 return (db_sym_t) 0;
60 }
61
62 db_sym_t
63 X_db_search_symbol(symtab, off, strategy, diffp)
64 db_symtab_t * symtab;
65 register
66 db_addr_t off;
67 db_strategy_t strategy;
68 db_expr_t *diffp; /* in/out */
69 {
70 linker_sym_t sym;
71 long diff;
72
73 if (linker_ddb_search_symbol((caddr_t) off, &sym, &diff) == 0) {
74 *diffp = (db_expr_t) diff;
75 return (db_sym_t) sym;
76 }
77
78 return 0;
79 }
80
81 /*
82 * Return the name and value for a symbol.
83 */
84 void
85 X_db_symbol_values(symtab, dbsym, namep, valuep)
86 db_symtab_t *symtab;
87 db_sym_t dbsym;
88 char **namep;
89 db_expr_t *valuep;
90 {
91 linker_sym_t sym = (linker_sym_t) dbsym;
92 linker_symval_t symval;
93
94 linker_ddb_symbol_values(sym, &symval);
95 if (namep)
96 *namep = (char*) symval.name;
97 if (valuep)
98 *valuep = (db_expr_t) symval.value;
99 }
100
101
102 boolean_t
103 X_db_line_at_pc(symtab, cursym, filename, linenum, off)
104 db_symtab_t * symtab;
105 db_sym_t cursym;
106 char **filename;
107 int *linenum;
108 db_expr_t off;
109 {
110 return FALSE;
111 }
112
113 boolean_t
114 X_db_sym_numargs(symtab, cursym, nargp, argnamep)
115 db_symtab_t * symtab;
116 db_sym_t cursym;
117 int *nargp;
118 char **argnamep;
119 {
120 return FALSE;
121 }
122
123 /*
124 * Initialization routine for a.out files.
125 */
126 void
127 kdb_init()
128 {
129 db_add_symbol_table(0, 0, "kernel", 0);
130 }
131 #endif
Cache object: 8b0320935e10adddf55b1d8b70ce13bf
|