Annotation of src/usr.bin/pmdb/symbol.h, Revision 1.1.1.1
1.1 art 1: /* $PMDB: symbol.h,v 1.7 2002/03/07 14:27:08 art Exp $ */
2: /*
3: * Copyright (c) 2002 Artur Grabowski <art@openbsd.org>
4: * All rights reserved.
5: *
6: * Redistribution and use in source and binary forms, with or without
7: * modification, are permitted provided that the following conditions
8: * are met:
9: *
10: * 1. Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: * 2. The name of the author may not be used to endorse or promote products
13: * derived from this software without specific prior written permission.
14: *
15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
16: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17: * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
18: * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21: * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22: * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23: * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25: */
26:
27: #include <sys/param.h>
28:
29: struct sym_table {
30: TAILQ_ENTRY(sym_table) st_list;
31: char st_fname[MAXPATHLEN];
32: int st_flags;
33: };
34:
35: /* Flags in st_flags */
36: #define ST_EXEC 0x01 /* this is the executable */
37:
38: struct sym_ops {
39: struct sym_table *(*sop_open)(const char *);
40: void (*sop_close)(struct sym_table *);
41: char *(*sop_name_and_off)(struct sym_table *, reg, reg *);
42: int (*sop_lookup)(struct pstate *, const char *, reg *);
43: void (*sop_update)(struct pstate *);
44: };
45:
46: void sym_init_exec(struct pstate *, const char *);
47: void sym_destroy(struct pstate *);
48: void sym_update(struct pstate *);
49: char *sym_name_and_offset(struct pstate *, reg, char *, size_t, reg *);
50: int sym_lookup(struct pstate *, const char *, reg *);
51: char *sym_print(struct pstate *, reg, char *, size_t);
52:
53: /* Internal for symbol handlers only. */
54: struct sym_table *st_open(struct pstate *, const char *);
55:
56: #ifdef PMDB_ELF
57: int sym_check_elf(const char *, struct pstate *);
58: #endif
59: #ifdef PMDB_AOUT
60: int sym_check_aout(const char *, struct pstate *);
61: #endif