MCPcopy Create free account
hub / github.com/F-Stack/f-stack / db_search_symbol

Function db_search_symbol

freebsd/ddb/db_sym.c:368–400  ·  view source on GitHub ↗

* Find the closest symbol to val, and return its name * and the difference between val and the symbol found. */

Source from the content-addressed store, hash-verified

366 * and the difference between val and the symbol found.
367 */
368c_db_sym_t
369db_search_symbol(db_addr_t val, db_strategy_t strategy, db_expr_t *offp)
370{
371 unsigned int diff;
372 size_t newdiff;
373 int i;
374 c_db_sym_t ret, sym;
375
376 /*
377 * The kernel will never map the first page, so any symbols in that
378 * range cannot refer to addresses. Some third-party assembly files
379 * define internal constants which appear in their symbol table.
380 * Avoiding the lookup for those symbols avoids replacing small offsets
381 * with those symbols during disassembly.
382 */
383 if (val < PAGE_SIZE) {
384 *offp = 0;
385 return (C_DB_SYM_NULL);
386 }
387
388 ret = C_DB_SYM_NULL;
389 newdiff = diff = val;
390 for (i = 0; i < db_nsymtab; i++) {
391 sym = X_db_search_symbol(&db_symtabs[i], val, strategy, &newdiff);
392 if ((uintmax_t)newdiff < (uintmax_t)diff) {
393 db_last_symtab = &db_symtabs[i];
394 diff = newdiff;
395 ret = sym;
396 }
397 }
398 *offp = diff;
399 return ret;
400}
401
402/*
403 * Return name and value of a symbol

Callers 15

decode_syscallFunction · 0.85
db_nextframeFunction · 0.85
db_backtraceFunction · 0.85
decode_syscallFunction · 0.85
db_nextframeFunction · 0.85
db_backtraceFunction · 0.85
db_stack_trace_cmdFunction · 0.85
kcsan_md_unwindFunction · 0.85
db_stack_trace_cmdFunction · 0.85
kcsan_reportFunction · 0.85
symbol_nameFunction · 0.85
db_show_print_syinitFunction · 0.85

Calls 1

X_db_search_symbolFunction · 0.85

Tested by

no test coverage detected