bsd.lib.mk: Add INTERNALLIBPROF knob.
[dragonfly.git] / sys / ddb / db_kld.c
blob65a2659198cd08cf5b8e7743613353cd30234502
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * All Rights Reserved.
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_kld.c,v 1.9 2000/01/11 13:25:12 peter Exp $
27 * from db_aout.c,v 1.20 1998/06/07 17:09:36 dfr Exp
31 * Author: David B. Golub, Carnegie Mellon University
32 * Date: 7/90
35 * Symbol table routines for kld maintained kernels.
38 #include <sys/param.h>
39 #include <sys/systm.h>
40 #include <sys/linker.h>
42 #include <ddb/ddb.h>
43 #include <ddb/db_sym.h>
45 #if defined(__x86_64__)
46 vm_offset_t ksym_start, ksym_end;
47 #endif
49 c_db_sym_t
50 X_db_lookup(db_symtab_t *stab, const char *symstr)
52 c_linker_sym_t sym;
54 if (linker_ddb_lookup(symstr, &sym) == 0)
55 return (c_db_sym_t) sym;
56 else
57 return (c_db_sym_t) 0;
61 * Parameters:
62 * diffp: in/out
64 c_db_sym_t
65 X_db_search_symbol(db_symtab_t *symtab, db_addr_t off, db_strategy_t strategy,
66 db_expr_t *diffp)
68 c_linker_sym_t sym;
69 long diff;
71 if (linker_ddb_search_symbol((caddr_t) off, &sym, &diff) == 0) {
72 *diffp = (db_expr_t) diff;
73 return (c_db_sym_t) sym;
76 return 0;
80 * Return the name and value for a symbol.
82 void
83 X_db_symbol_values(db_symtab_t *symtab, c_db_sym_t dbsym, const char **namep,
84 db_expr_t *valuep)
86 c_linker_sym_t sym = (c_linker_sym_t) dbsym;
87 linker_symval_t symval;
89 symval.name = NULL;
90 symval.value = NULL;
91 linker_ddb_symbol_values(sym, &symval);
92 if (namep)
93 *namep = (const char*) symval.name;
94 if (valuep)
95 *valuep = (db_expr_t) symval.value;
99 boolean_t
100 X_db_line_at_pc(db_symtab_t *symtab, c_db_sym_t cursym, char **filename,
101 int *linenum, db_expr_t off)
103 return FALSE;
106 boolean_t
107 X_db_sym_numargs(db_symtab_t *symtab, c_db_sym_t cursym, int *nargp,
108 char **argnamep)
110 return FALSE;
114 * Initialization routine for a.out files.
116 void
117 kdb_init(void)
119 db_add_symbol_table(0, 0, "kernel", 0);