libcsdbg  1.28
C++ exception (and generic) stack trace debug library
const i8 * csdbg::process::lookup ( mem_addr_t  addr)
virtual

Lookup an address to resolve a symbol.

Parameters
[in]addrthe address
Returns
the demangled symbol or NULL if the address is unresolved
Note
If demangling failed upon symbol table loading/parsing the decorated symbol is returned

Definition at line 266 of file process.cpp.

References cache_add(), cache_lookup(), likely, m_modules, csdbg::symbol::name(), and unlikely.

Referenced by csdbg::__cyg_profile_func_enter(), and csdbg::__cyg_profile_func_exit().

267 {
268  const symbol *sym = cache_lookup(addr);
269  if ( likely(sym != NULL) )
270  return sym->name();
271 
272  for (u32 i = 0, sz = m_modules->size(); likely(i < sz); i++) {
273  const i8 *retval = m_modules->at(i)->lookup(addr);
274 
275  if ( unlikely(retval != NULL) ) {
276  cache_add(addr, retval);
277  return retval;
278  }
279  }
280 
281  /* The address was not resolved */
282  cache_add(addr, NULL);
283  return NULL;
284 }
chain< symtab > * m_modules
Symbol table list.
Definition: process.hpp:39
char i8
8-bit signed integer
Definition: config.hpp:72
virtual process & cache_add(mem_addr_t, const i8 *)
Add a symbol to the lookup cache.
Definition: process.cpp:21
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
Definition: config.hpp:344
unsigned int u32
32-bit unsigned integer
Definition: config.hpp:102
virtual const symbol * cache_lookup(mem_addr_t) const
Perform a cache lookup.
Definition: process.cpp:47
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
Definition: config.hpp:349

+ Here is the call graph for this function:

+ Here is the caller graph for this function: