diff options
Diffstat (limited to 'sys/ddb/db_sym.c')
-rw-r--r-- | sys/ddb/db_sym.c | 104 |
1 files changed, 1 insertions, 103 deletions
diff --git a/sys/ddb/db_sym.c b/sys/ddb/db_sym.c index a461f73e7da..855d9a1c1d5 100644 --- a/sys/ddb/db_sym.c +++ b/sys/ddb/db_sym.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_sym.c,v 1.41 2016/01/25 14:50:13 mpi Exp $ */ +/* $OpenBSD: db_sym.c,v 1.42 2016/01/27 08:03:37 mpi Exp $ */ /* $NetBSD: db_sym.c,v 1.24 2000/08/11 22:50:47 tv Exp $ */ /* @@ -52,8 +52,6 @@ db_symtab_t db_symtabs[MAXNOSYMTABS] = {{0,},}; db_symtab_t *db_last_symtab; -static db_forall_func_t db_sift; - extern char end[]; /* @@ -271,106 +269,6 @@ db_lookup(char *symstr) return 0; } -/* Private structure for passing args to db_sift() from db_sifting(). */ -struct db_sift_args { - char *symstr; - int mode; -}; - -/* - * Does the work of db_sifting(), called once for each - * symbol via X_db_forall(), prints out symbols matching - * criteria. - */ -static void -db_sift(db_symtab_t *stab, db_sym_t sym, char *name, char *suffix, int prefix, - void *arg) -{ - char c, sc; - char *find, *p; - size_t len; - struct db_sift_args *dsa; - - dsa = (struct db_sift_args*)arg; - - find = dsa->symstr; /* String we're looking for. */ - p = name; /* String we're searching within. */ - - /* Matching algorithm cribbed from strstr(), which is not - in the kernel. */ - if ((c = *find++) != 0) { - len = strlen(find); - do { - do { - if ((sc = *p++) == 0) - return; - } while (sc != c); - } while (strncmp(p, find, len) != 0); - } - if (dsa->mode=='F') /* ala ls -F */ - db_printf("%s%s ", name, suffix); - else - db_printf("%s ", name); -} - -/* - * "Sift" for a partial symbol. - * Named for the Sun OpenPROM command ("sifting"). - * If the symbol has a qualifier (e.g., ux:vm_map), - * then only the specified symbol table will be searched; - * otherwise, all symbol tables will be searched.. - * - * "mode" is how-to-display, set from modifiers. - */ -void -db_sifting(char *symstr, int mode) -{ - char *cp; - int i; - int symtab_start = 0; - int symtab_end = MAXNOSYMTABS; - struct db_sift_args dsa; - - /* - * Look for, remove, and remember any symbol table specifier. - */ - for (cp = symstr; *cp; cp++) { - if (*cp == ':') { - *cp = '\0'; - for (i = 0; i < MAXNOSYMTABS; i++) { - if (db_symtabs[i].name && - ! strcmp(symstr, db_symtabs[i].name)) { - symtab_start = i; - symtab_end = i + 1; - break; - } - } - *cp = ':'; - if (i == MAXNOSYMTABS) { - db_error("invalid symbol table name"); - /*NOTREACHED*/ - } - symstr = cp+1; - } - } - - /* Pass args to db_sift(). */ - dsa.symstr = symstr; - dsa.mode = mode; - - /* - * Look in the specified set of symbol tables. - */ - for (i = symtab_start; i < symtab_end; i++) - if (db_symtabs[i].name) { - db_printf("Sifting table %s:\n", db_symtabs[i].name); - X_db_forall(&db_symtabs[i], db_sift, &dsa); - } - - return; -} - - /* * Does this symbol name appear in more than one symbol table? * Used by db_symbol_values to decide whether to qualify a symbol. |