We are only supporting ELF so this abstraction type is no longer needed.

I'll make my life easier with CTF if I don't have to cast types when
looking for type information.

Ok to kill this abstraction?


Index: arch/amd64/amd64/db_trace.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/amd64/db_trace.c,v
retrieving revision 1.30
diff -u -p -r1.30 db_trace.c
--- arch/amd64/amd64/db_trace.c 29 May 2017 06:14:10 -0000      1.30
+++ arch/amd64/amd64/db_trace.c 30 May 2017 10:26:12 -0000
@@ -79,7 +79,7 @@ struct db_variable * db_eregs = db_regs 
 #define        INTERRUPT       3
 #define        AST             4
 
-int db_numargs(struct callframe *, db_sym_t);
+int db_numargs(struct callframe *, Elf_Sym *);
 void db_nextframe(struct callframe **, db_addr_t *, long *, int,
     int (*) (const char *, ...));
 
@@ -92,7 +92,7 @@ void db_nextframe(struct callframe **, d
  * reliably determine the values currently, just return 0.
  */
 int
-db_numargs(struct callframe *fp, db_sym_t sym)
+db_numargs(struct callframe *fp, Elf_Sym *sym)
 {
 #ifdef DDBCTF
        int args;
@@ -231,7 +231,7 @@ db_stack_trace_print(db_expr_t addr, boo
                unsigned int    i;
                char *          name;
                db_expr_t       offset;
-               db_sym_t        sym;
+               Elf_Sym *       sym;
 
                sym = db_search_symbol(callpc, DB_STGY_ANY, &offset);
                db_symbol_values(sym, &name, NULL);
@@ -366,7 +366,7 @@ db_save_stack_trace(struct db_stack_trac
                struct trapframe *tf;
                char            *name;
                db_expr_t       offset;
-               db_sym_t        sym;
+               Elf_Sym *       sym;
                int             is_trap;
 
                st->st_pc[st->st_count++] = callpc;
Index: arch/arm64/arm64/db_trace.c
===================================================================
RCS file: /cvs/src/sys/arch/arm64/arm64/db_trace.c,v
retrieving revision 1.4
diff -u -p -r1.4 db_trace.c
--- arch/arm64/arm64/db_trace.c 17 Feb 2017 17:16:04 -0000      1.4
+++ arch/arm64/arm64/db_trace.c 30 May 2017 10:26:17 -0000
@@ -66,7 +66,7 @@ db_stack_trace_print(db_expr_t addr, int
        u_int64_t       frame, lastframe, lr, lastlr, sp;
        char            c, *cp = modif;
        db_expr_t       offset;
-       db_sym_t        sym;
+       Elf_Sym *       sym;
        char            *name;
        boolean_t       kernel_only = TRUE;
        boolean_t       trace_thread = FALSE;
Index: arch/hppa/hppa/db_interface.c
===================================================================
RCS file: /cvs/src/sys/arch/hppa/hppa/db_interface.c,v
retrieving revision 1.39
diff -u -p -r1.39 db_interface.c
--- arch/hppa/hppa/db_interface.c       30 Apr 2017 16:45:45 -0000      1.39
+++ arch/hppa/hppa/db_interface.c       30 May 2017 10:26:24 -0000
@@ -227,7 +227,7 @@ db_stack_trace_print(db_expr_t addr, int
     char *modif, int (*pr)(const char *, ...))
 {
        register_t *fp, pc, rp, *argp;
-       db_sym_t sym;
+       Elf_Sym *sym;
        db_expr_t off;
        char *name;
        int nargs;
Index: arch/i386/i386/db_trace.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/db_trace.c,v
retrieving revision 1.27
diff -u -p -r1.27 db_trace.c
--- arch/i386/i386/db_trace.c   29 May 2017 06:14:10 -0000      1.27
+++ arch/i386/i386/db_trace.c   30 May 2017 10:26:49 -0000
@@ -74,7 +74,7 @@ struct db_variable *db_eregs = db_regs +
 #define        INTERRUPT       3
 #define        AST             4
 
-int db_numargs(struct callframe *, db_sym_t);
+int db_numargs(struct callframe *, Elf_Sym *);
 void db_nextframe(struct callframe **, db_addr_t *, int *, int,
     int (*pr)(const char *, ...));
 
@@ -82,7 +82,7 @@ void db_nextframe(struct callframe **, d
  * Figure out how many arguments were passed into the frame at "fp".
  */
 int
-db_numargs(struct callframe *fp, db_sym_t sym)
+db_numargs(struct callframe *fp, Elf_Sym *sym)
 {
        int     *argp;
        int     inst;
@@ -236,7 +236,7 @@ db_stack_trace_print(db_expr_t addr, boo
                int             narg;
                char *  name;
                db_expr_t       offset;
-               db_sym_t        sym;
+               Elf_Sym         *sym;
 
                sym = db_search_symbol(callpc, DB_STGY_ANY, &offset);
                db_symbol_values(sym, &name, NULL);
@@ -339,7 +339,7 @@ db_save_stack_trace(struct db_stack_trac
        for (i = 0; i < DB_STACK_TRACE_MAX && frame != NULL; i++) {
                char            *name;
                db_expr_t       offset;
-               db_sym_t        sym;
+               Elf_Sym         *sym;
                int             is_trap = 0;
 
                st->st_pc[st->st_count++] = callpc;
Index: arch/m88k/m88k/db_trace.c
===================================================================
RCS file: /cvs/src/sys/arch/m88k/m88k/db_trace.c,v
retrieving revision 1.16
diff -u -p -r1.16 db_trace.c
--- arch/m88k/m88k/db_trace.c   19 Sep 2016 21:18:35 -0000      1.16
+++ arch/m88k/m88k/db_trace.c   30 May 2017 10:27:14 -0000
@@ -458,7 +458,7 @@ static int next_address_likely_wrong = 0
 static vaddr_t
 stack_decode(db_addr_t addr, vaddr_t *stack, int (*pr)(const char *, ...))
 {
-       db_sym_t proc;
+       Elf_Sym *proc;
        db_expr_t offset_from_proc;
        uint instructions_to_search;
        db_addr_t check_addr;
@@ -470,7 +470,7 @@ stack_decode(db_addr_t addr, vaddr_t *st
        vaddr_t str30_addr = 0;
        vaddr_t last_subu_addr = 0;
 
-       /* get what we hope will be the db_sym_t for the function name */
+       /* get what we hope will be the symbol for the function name */
        proc = db_search_symbol(addr, DB_STGY_PROC, &offset_from_proc);
        if (offset_from_proc == addr) /* i.e. no symbol found */
                proc = NULL;
Index: arch/mips64/mips64/trap.c
===================================================================
RCS file: /cvs/src/sys/arch/mips64/mips64/trap.c,v
retrieving revision 1.123
diff -u -p -r1.123 trap.c
--- arch/mips64/mips64/trap.c   20 Apr 2017 15:42:26 -0000      1.123
+++ arch/mips64/mips64/trap.c   30 May 2017 10:27:21 -0000
@@ -1206,7 +1206,7 @@ stacktrace_subr(struct trapframe *regs, 
        extern char k_general[];
 #ifdef DDB
        db_expr_t diff;
-       db_sym_t sym;
+       Elf_Sym *sym;
        char *symname;
 #endif
 
Index: arch/powerpc/ddb/db_trace.c
===================================================================
RCS file: /cvs/src/sys/arch/powerpc/ddb/db_trace.c,v
retrieving revision 1.11
diff -u -p -r1.11 db_trace.c
--- arch/powerpc/ddb/db_trace.c 24 Jan 2017 00:58:55 -0000      1.11
+++ arch/powerpc/ddb/db_trace.c 30 May 2017 10:27:30 -0000
@@ -119,7 +119,7 @@ db_stack_trace_print(db_expr_t addr, int
 {
        db_addr_t        lr, sp, lastsp;
        db_expr_t        offset;
-       db_sym_t         sym;
+       Elf_Sym         *sym;
        char            *name;
        char             c, *cp = modif;
        int              trace_proc = 0;
Index: arch/sh/sh/db_disasm.c
===================================================================
RCS file: /cvs/src/sys/arch/sh/sh/db_disasm.c,v
retrieving revision 1.3
diff -u -p -r1.3 db_disasm.c
--- arch/sh/sh/db_disasm.c      26 Feb 2007 19:33:41 -0000      1.3
+++ arch/sh/sh/db_disasm.c      30 May 2017 10:27:38 -0000
@@ -152,7 +152,7 @@ disasm_branch(char *buf, size_t bufsiz, 
        size_t len;
        db_expr_t d, value;
        char *name;
-       db_sym_t cursym;
+       Elf_Sym *cursym;
        extern unsigned long db_lastsym;
        extern unsigned int db_maxoff;
 
Index: arch/sh/sh/db_trace.c
===================================================================
RCS file: /cvs/src/sys/arch/sh/sh/db_trace.c,v
retrieving revision 1.6
diff -u -p -r1.6 db_trace.c
--- arch/sh/sh/db_trace.c       13 Jul 2014 12:11:01 -0000      1.6
+++ arch/sh/sh/db_trace.c       30 May 2017 10:27:44 -0000
@@ -113,7 +113,7 @@ db_stack_trace_print(db_expr_t addr, int
                } else {
                        char *name;
                        db_expr_t offset;
-                       db_sym_t sym;
+                       Elf_Sym *sym;
 
 
                        DPRINTF("    (1)newpc 0x%lx, newfp 0x%lx\n",
Index: arch/sparc64/sparc64/openfirm.c
===================================================================
RCS file: /cvs/src/sys/arch/sparc64/sparc64/openfirm.c,v
retrieving revision 1.19
diff -u -p -r1.19 openfirm.c
--- arch/sparc64/sparc64/openfirm.c     19 May 2016 09:15:28 -0000      1.19
+++ arch/sparc64/sparc64/openfirm.c     30 May 2017 10:27:50 -0000
@@ -802,7 +802,7 @@ void OF_val2sym(cells)
                cell_t offset;
                cell_t symbol;
        } *args = (struct args*)cells;
-       db_sym_t symbol;
+       Elf_Sym *symbol;
        db_expr_t value;
        db_expr_t offset;
 
Index: ddb/db_elf.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_elf.c,v
retrieving revision 1.25
diff -u -p -r1.25 db_elf.c
--- ddb/db_elf.c        28 May 2017 11:41:52 -0000      1.25
+++ ddb/db_elf.c        30 May 2017 10:28:32 -0000
@@ -263,7 +263,7 @@ db_elf_sym_lookup(char *symstr)
  * Search for the symbol with the given address (matching within the
  * provided threshold).
  */
-db_sym_t
+Elf_Sym *
 db_elf_sym_search(db_addr_t off, db_strategy_t strategy,
     db_expr_t *diffp)
 {
@@ -324,14 +324,14 @@ db_elf_sym_search(db_addr_t off, db_stra
        else
                *diffp = diff;
 
-       return ((db_sym_t)rsymp);
+       return (rsymp);
 }
 
 /*
  * Return the name and value for a symbol.
  */
 void
-db_symbol_values(db_sym_t sym, char **namep, db_expr_t *valuep)
+db_symbol_values(Elf_Sym *sym, char **namep, db_expr_t *valuep)
 {
        db_symtab_t *stab = &db_symtab;
        Elf_Sym *symp = (Elf_Sym *)sym;
@@ -362,7 +362,7 @@ db_symbol_values(db_sym_t sym, char **na
  * if we can find the appropriate debugging symbol.
  */
 int
-db_elf_line_at_pc(db_sym_t cursym, char **filename,
+db_elf_line_at_pc(Elf_Sym *cursym, char **filename,
     int *linenum, db_expr_t off)
 {
        db_symtab_t *stab = &db_symtab;
@@ -426,7 +426,7 @@ db_elf_sym_forall(db_forall_func_t db_fo
                        default:
                                suffix[0] = '\0';
                        }
-                       (*db_forall_func)((db_sym_t)symp,
+                       (*db_forall_func)(symp,
                            strtab + symp->st_name, suffix, 0, arg);
                }
 }
@@ -439,6 +439,6 @@ db_value_of_name(char *name, db_expr_t *
        sym = db_elf_sym_lookup(name);
        if (sym == NULL)
            return (0);
-       db_symbol_values((db_sym_t)sym, &name, valuep);
+       db_symbol_values(sym, &name, valuep);
        return (1);
 }
Index: ddb/db_hangman.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_hangman.c,v
retrieving revision 1.36
diff -u -p -r1.36 db_hangman.c
--- ddb/db_hangman.c    16 Sep 2016 19:00:25 -0000      1.36
+++ ddb/db_hangman.c    30 May 2017 10:28:49 -0000
@@ -66,16 +66,16 @@ static const char substchar[]="\\/|\\/O|
 
 struct db_hang_forall_arg {
        int cnt;
-       db_sym_t sym;
+       Elf_Sym *sym;
 };
 
 /*
  * Horrible abuse of the forall function, but we're not in a hurry.
  */
-static void db_hang_forall(db_sym_t, char *, char *, int, void *);
+static void db_hang_forall(Elf_Sym *, char *, char *, int, void *);
 
 static void
-db_hang_forall(db_sym_t sym, char *name, char *suff, int pre, void *varg)
+db_hang_forall(Elf_Sym *sym, char *name, char *suff, int pre, void *varg)
 {
        struct db_hang_forall_arg *arg = varg;
 
Index: ddb/db_sym.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_sym.c,v
retrieving revision 1.52
diff -u -p -r1.52 db_sym.c
--- ddb/db_sym.c        27 May 2017 16:08:23 -0000      1.52
+++ ddb/db_sym.c        30 May 2017 10:29:16 -0000
@@ -95,12 +95,12 @@ db_eqname(char *src, char *dst, int c)
  * Find the closest symbol to val, and return its name
  * and the difference between val and the symbol found.
  */
-db_sym_t
+Elf_Sym *
 db_search_symbol(db_addr_t val, db_strategy_t strategy, db_expr_t *offp)
 {
        unsigned int    diff;
        db_expr_t       newdiff;
-       db_sym_t        ret = NULL, sym;
+       Elf_Sym         *ret = NULL, *sym;
 
        newdiff = diff = ~0;
        sym = db_elf_sym_search(val, strategy, &newdiff);
@@ -143,7 +143,7 @@ db_printsym(db_expr_t off, db_strategy_t
        char            *name;
        db_expr_t       value;
        int             linenum;
-       db_sym_t        cursym;
+       Elf_Sym         *cursym;
        char            buf[DB_FORMAT_BUF_SIZE];
 
        if (off <= db_lastsym) {
Index: ddb/db_sym.h
===================================================================
RCS file: /cvs/src/sys/ddb/db_sym.h,v
retrieving revision 1.29
diff -u -p -r1.29 db_sym.h
--- ddb/db_sym.h        29 May 2017 06:14:10 -0000      1.29
+++ ddb/db_sym.h        30 May 2017 10:30:14 -0000
@@ -33,13 +33,7 @@
 #define _DDB_DB_SYM_H_
 
 #include <sys/stdint.h>
-
-/*
- * Symbol representation is specific to the symtab style:
- * BSD compilers use dbx' nlist, other compilers might use
- * a different one
- */
-typedef        char *          db_sym_t;       /* opaque handle on symbols */
+#include <sys/exec_elf.h>
 
 /*
  * Non-stripped symbol tables will have duplicates, for instance
@@ -64,7 +58,7 @@ typedef int           db_strategy_t;  /* search st
  * the type, prefix an initial ignorable function prefix (e.g. "_"
  * in a.out), and arg an opaque argument to be passed in.
  */
-typedef void (db_forall_func_t)(db_sym_t, char *, char *, int, void *);
+typedef void (db_forall_func_t)(Elf_Sym *, char *, char *, int, void *);
 
 extern unsigned int db_maxoff;         /* like gdb's "max-symbolic-offset" */
 
@@ -74,10 +68,10 @@ int db_eqname(char *, char *, int);
 int db_value_of_name(char *, db_expr_t *);
                                        /* find symbol value given name */
 
-db_sym_t db_search_symbol(db_addr_t, db_strategy_t, db_expr_t *);
+Elf_Sym * db_search_symbol(db_addr_t, db_strategy_t, db_expr_t *);
                                        /* find symbol given value */
 
-void db_symbol_values(db_sym_t, char **, db_expr_t *);
+void db_symbol_values(Elf_Sym *, char **, db_expr_t *);
                                        /* return name and value of symbol */
 
 #define db_find_sym_and_offset(val,namep,offp) \
@@ -92,15 +86,15 @@ void db_printsym(db_expr_t, db_strategy_
                                        /* print closest symbol to a value */
 
 int db_elf_sym_init(int, void *, void *, const char *);
-db_sym_t db_elf_sym_search(db_addr_t, db_strategy_t, db_expr_t *);
-int db_elf_line_at_pc(db_sym_t, char **, int *, db_expr_t);
+Elf_Sym * db_elf_sym_search(db_addr_t, db_strategy_t, db_expr_t *);
+int db_elf_line_at_pc(Elf_Sym *, char **, int *, db_expr_t);
 void db_elf_sym_forall(db_forall_func_t db_forall_func, void *);
 
 bool db_dwarf_line_at_pc(const char *, size_t, uintptr_t,
     const char **, const char **, int *);
 
 #ifdef DDBCTF
-int    db_ctf_func_numargs(db_sym_t);
+int    db_ctf_func_numargs(Elf_Sym *);
 #endif
 
 #endif /* _DDB_DB_SYM_H_ */
Index: ddb/db_ctf.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_ctf.c,v
retrieving revision 1.9
diff -u -p -r1.9 db_ctf.c
--- ddb/db_ctf.c        29 May 2017 06:14:10 -0000      1.9
+++ ddb/db_ctf.c        30 May 2017 10:31:31 -0000
@@ -152,7 +152,7 @@ db_ctf_idx2sym(size_t *idx, uint8_t type
  * For a given function name, return the number of arguments.
  */
 int
-db_ctf_func_numargs(db_sym_t st)
+db_ctf_func_numargs(Elf_Sym *st)
 {
        Elf_Sym                 *symp, *stp = (Elf_Sym *)st;
        uint16_t                *fstart, *fend;
Index: sys/exec_elf.h
===================================================================
RCS file: /cvs/src/sys/sys/exec_elf.h,v
retrieving revision 1.73
diff -u -p -r1.73 exec_elf.h
--- sys/exec_elf.h      18 Feb 2017 06:42:08 -0000      1.73
+++ sys/exec_elf.h      30 May 2017 10:30:54 -0000
@@ -736,6 +736,8 @@ extern Elf_Dyn              _DYNAMIC[];
 #endif
 
 #ifdef _KERNEL
+struct exec_package;
+
 int    exec_elf_makecmds(struct proc *, struct exec_package *);
 #endif /* _KERNEL */
 

Reply via email to