FreeBSD/sys/ddb/db_sym.c
/*
 * Lookup a symbol.
 * 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.
 */
Lookup a symbol.
If the symbol has a qualifier ,
then only the specified symbol table will be searched;
otherwise, all symbol tables will be searched.
Lookup a symbol . If the symbol has a qualifier then only the specified symbol table will be searched ; otherwise all symbol tables will be searched .
static c_db_sym_t
db_lookup(const char *symstr)
{
	c_db_sym_t sp;
	register int i;
	int symtab_start = 0;
	int symtab_end = db_nsymtab;
	register const char *cp;
	for (cp = symstr; *cp; cp++) {
		if (*cp == ':') {
			for (i = 0; i < db_nsymtab; i++) {
				int n = strlen(db_symtabs[i].name);
				if (
				    n == (cp - symstr) &&
				    strncmp(symstr, db_symtabs[i].name, n) == 0
				) {
					symtab_start = i;
					symtab_end = i + 1;
					break;
				}
			}
			if (i == db_nsymtab) {
				db_error("invalid symbol table name");
			}
			symstr = cp+1;
		}
	}
	for (i = symtab_start; i < symtab_end; i++) {
		sp = X_db_lookup(&db_symtabs[i], symstr);
		if (sp) {
			db_last_symtab = &db_symtabs[i];
			return sp;
		}
	}
	return 0;
}
static c_db_sym_t db_lookup ( const char * symstr ) { c_db_sym_t sp ; register int i ; int symtab_start = 0 ; int symtab_end = db_nsymtab ; register const char * cp ; for ( cp = symstr ; * cp ; cp ++ ) { if ( * cp == ' ' ) { for ( i = 0 ; i < db_nsymtab ; i ++ ) { int n = strlen ( db_symtabs [ i ] . name ) ; if ( n == ( cp - symstr ) && strncmp ( symstr , db_symtabs [ i ] . name , n ) == 0 ) { symtab_start = i ; symtab_end = i + 1 ; break ; } } if ( i == db_nsymtab ) { db_error ( " " ) ; } symstr = cp + 1 ; } } for ( i = symtab_start ; i < symtab_end ; i ++ ) { sp = X_db_lookup ( & db_symtabs [ i ] , symstr ) ; if ( sp ) { db_last_symtab = & db_symtabs [ i ] ; return sp ; } } return 0 ; }
Lookup a symbol.
Lookup a symbol .
/*
	 * Look for, remove, and remember any symbol table specifier.
	 */ /*
	 * Look in the specified set of symbol tables.
	 * Return on first match.
	 */