Discussion:
Kill db_sifting()
Martin Pieuchot
2016-01-25 15:04:32 UTC
Permalink
It is unused, ok?

Index: db_sym.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_sym.c,v
retrieving revision 1.41
diff -u -p -r1.41 db_sym.c
--- db_sym.c 25 Jan 2016 14:50:13 -0000 1.41
+++ db_sym.c 25 Jan 2016 14:53:41 -0000
@@ -52,8 +52,6 @@ db_symtab_t db_symtabs[MAXNOSYMTABS] = {

db_symtab_t *db_last_symtab;

-static db_forall_func_t db_sift;
-
extern char end[];

/*
@@ -270,106 +268,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?
Index: db_sym.h
===================================================================
RCS file: /cvs/src/sys/ddb/db_sym.h,v
retrieving revision 1.18
diff -u -p -r1.18 db_sym.h
--- db_sym.h 25 Jan 2016 14:30:30 -0000 1.18
+++ db_sym.h 25 Jan 2016 14:53:41 -0000
@@ -120,9 +120,6 @@ int db_value_of_name(char *, db_expr_t *

db_sym_t db_lookup(char *);

-void db_sifting(char *, int);
- /* print partially matching symbol names */
-
boolean_t db_symbol_is_ambiguous(db_sym_t);

db_sym_t db_search_symbol(db_addr_t, db_strategy_t, db_expr_t *);
Loading...