In code compiled with -finstrument-functions, g++ injects code to call this function at the end of instrumented functions. By implementing this function (and __cyg_profile_func_enter), libcsdbg simulates the call stack of each thread.
- Parameters
-
[in] | this_fn | the address of the returning function |
[in] | call_site | the address that the program counter will return to |
- Note
- If an exception occurs, the process exits
Definition at line 147 of file tracer.cpp.
References __D_ASSERT, csdbg::filter::apply(), csdbg::process::current_thread(), csdbg::plugin::end(), 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(), csdbg::thread::returned(), unlikely, and csdbg::util::unlock().
153 tracer *iface = tracer::interface();
161 #ifdef CSDBG_WITH_PLUGIN
163 for (
i32 i = iface->plugin_count() - 1;
likely(i >= 0); i--)
165 iface->get_plugin(i)->end(this_fn, call_site);
168 catch (exception &x) {
172 catch (std::exception &x) {
177 util::header(std::cerr,
"x");
178 std::cerr <<
"plugin " << std::dec << i <<
": unidentified exception\r\n";
184 process *proc = iface->proc();
186 #ifdef CSDBG_WITH_FILTER
188 const i8 *path = proc->ilookup(addr, base);
191 if (
likely(path != NULL) )
192 for (
u32 i = 0, sz = iface->filter_count();
likely(i < sz); i++) {
193 filter *filt = iface->get_filter(i);
194 if (
likely(filt->mode()) )
197 if (
unlikely(filt->apply(path)) ) {
208 const i8 *nm = proc->lookup(addr);
209 if (
likely(nm != NULL) ) {
210 #ifdef CSDBG_WITH_FILTER
212 for (
u32 i = 0, sz = iface->filter_count();
likely(i < sz); i++) {
213 filter *filt = iface->get_filter(i);
214 if (
likely(!filt->mode()) )
224 proc->current_thread()->returned();
231 catch (exception x) {
235 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
int i32
32-bit signed 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.