In code compiled with -finstrument-functions, g++ injects code to call this function at the beginning of instrumented functions. By implementing this function (and __cyg_profile_func_exit), libcsdbg simulates the call stack of each thread.
- Parameters
-
[in] | this_fn | the address of the called function |
[in] | call_site | the address where the function was called |
- Note
- If an exception occurs, the process exits
Definition at line 36 of file tracer.cpp.
References __D_ASSERT, csdbg::filter::apply(), csdbg::plugin::begin(), csdbg::thread::called(), csdbg::process::current_thread(), csdbg::tracer::filter_count(), csdbg::tracer::get_filter(), csdbg::tracer::get_plugin(), csdbg::util::header(), csdbg::process::ilookup(), csdbg::tracer::interface(), likely, csdbg::util::lock(), csdbg::process::lookup(), csdbg::filter::mode(), csdbg::tracer::plugin_count(), csdbg::tracer::proc(), unlikely, and csdbg::util::unlock().
42 tracer *iface = tracer::interface();
50 #ifdef CSDBG_WITH_PLUGIN
52 for (
u32 i = 0, sz = iface->plugin_count();
likely(i < sz); i++)
54 iface->get_plugin(i)->begin(this_fn, call_site);
57 catch (exception &x) {
61 catch (std::exception &x) {
66 util::header(std::cerr,
"x");
67 std::cerr <<
"plugin " << std::dec << i <<
": unidentified exception\r\n";
74 process *proc = iface->proc();
76 #ifdef CSDBG_WITH_FILTER
78 const i8 *path = proc->ilookup(addr, base);
81 if (
likely(path != NULL) )
82 for (
u32 i = 0, sz = iface->filter_count();
likely(i < sz); i++) {
83 filter *filt = iface->get_filter(i);
84 if (
likely(filt->mode()) )
98 const i8 *nm = proc->lookup(addr);
99 if (
likely(nm != NULL) ) {
100 #ifdef CSDBG_WITH_FILTER
102 for (
u32 i = 0, sz = iface->filter_count();
likely(i < sz); i++) {
103 filter *filt = iface->get_filter(i);
104 if (
likely(!filt->mode()) )
114 proc->current_thread()->called(addr, site, nm);
121 catch (exception &x) {
125 catch (std::exception &x) {
char i8
8-bit signed integer
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
unsigned int u32
32-bit unsigned integer
unsigned long long mem_addr_t
64-bit memory address
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
#define __D_ASSERT(x)
Assertion macro.