* 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. */
| 284 | * otherwise, all symbol tables will be searched. |
| 285 | */ |
| 286 | static c_db_sym_t |
| 287 | db_lookup(const char *symstr) |
| 288 | { |
| 289 | c_db_sym_t sp; |
| 290 | int i; |
| 291 | int symtab_start = 0; |
| 292 | int symtab_end = db_nsymtab; |
| 293 | const char *cp; |
| 294 | |
| 295 | /* |
| 296 | * Look for, remove, and remember any symbol table specifier. |
| 297 | */ |
| 298 | for (cp = symstr; *cp; cp++) { |
| 299 | if (*cp == ':') { |
| 300 | for (i = 0; i < db_nsymtab; i++) { |
| 301 | int n = strlen(db_symtabs[i].name); |
| 302 | |
| 303 | if ( |
| 304 | n == (cp - symstr) && |
| 305 | strncmp(symstr, db_symtabs[i].name, n) == 0 |
| 306 | ) { |
| 307 | symtab_start = i; |
| 308 | symtab_end = i + 1; |
| 309 | break; |
| 310 | } |
| 311 | } |
| 312 | if (i == db_nsymtab) { |
| 313 | db_error("invalid symbol table name"); |
| 314 | } |
| 315 | symstr = cp+1; |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | /* |
| 320 | * Look in the specified set of symbol tables. |
| 321 | * Return on first match. |
| 322 | */ |
| 323 | for (i = symtab_start; i < symtab_end; i++) { |
| 324 | sp = X_db_lookup(&db_symtabs[i], symstr); |
| 325 | if (sp) { |
| 326 | db_last_symtab = &db_symtabs[i]; |
| 327 | return sp; |
| 328 | } |
| 329 | } |
| 330 | return 0; |
| 331 | } |
| 332 | |
| 333 | /* |
| 334 | * If true, check across symbol tables for multiple occurrences |
no test coverage detected