Annotation of src/usr.bin/pmdb/symbol.h, Revision 1.4
1.4 ! art 1: /* $OpenBSD: symbol.h,v 1.3 2002/03/15 17:49:51 art Exp $ */
1.1 art 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;
1.3 art 33: reg st_offs;
1.1 art 34: };
35:
36: /* Flags in st_flags */
37: #define ST_EXEC 0x01 /* this is the executable */
38:
39: struct sym_ops {
40: struct sym_table *(*sop_open)(const char *);
41: void (*sop_close)(struct sym_table *);
42: char *(*sop_name_and_off)(struct sym_table *, reg, reg *);
43: int (*sop_lookup)(struct pstate *, const char *, reg *);
44: void (*sop_update)(struct pstate *);
45: };
46:
47: void sym_init_exec(struct pstate *, const char *);
48: void sym_destroy(struct pstate *);
49: void sym_update(struct pstate *);
50: char *sym_name_and_offset(struct pstate *, reg, char *, size_t, reg *);
51: int sym_lookup(struct pstate *, const char *, reg *);
52: char *sym_print(struct pstate *, reg, char *, size_t);
53:
54: /* Internal for symbol handlers only. */
1.3 art 55: struct sym_table *st_open(struct pstate *, const char *, reg);
1.1 art 56:
57: #ifdef PMDB_ELF
58: int sym_check_elf(const char *, struct pstate *);
59: #endif
60: #ifdef PMDB_AOUT
61: int sym_check_aout(const char *, struct pstate *);
62: #endif
1.4 ! art 63:
! 64: int cmd_sym_load(int, char **, void *);