[DynInst_API:] Cannot find function


Date: Sat, 25 Jul 2015 19:44:09 +0300
From: Ioannis Konstadelias <g1ann1s1332@xxxxxxxxx>
Subject: [DynInst_API:] Cannot find function
Hi everyone,

first of all I use the latest version of dyninstAPI (git head).

I was experimenting with the mutator program of the Appendix A from the manuals (not the re-tee one),
and tried the custom really simple mutatee program below:

#include <stdio.h>

int foo() {return 1;}

int main(void)
{
ÂÂÂ puts("Hello, world!");
ÂÂÂ foo();
ÂÂÂ return 0;
}

I added the counter snippet for main and it worked. But never worked for function foo. The error I took was:

Reading symbols from ./func_instr...done.
(gdb) run
Starting program: /home/gon1332/Training/Dyninst/func_instr
Traceback (most recent call last):
 File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module>
ÂÂÂ from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff46af700 (LWP 23032)]
[New Thread 0x7ffff3eae700 (LWP 23033)]
[New Thread 0x7ffff34a4700 (LWP 23034)]
--SERIOUS-- #100: Image: Unable to find function: foo

Program received signal SIGSEGV, Segmentation fault.
0x00000000004018c7 in findEntryPoint (app=0x63c100) at func_instr.cc:50
50ÂÂÂ ÂÂÂ points = functions[0]->findPoint(BPatch_entry);
(gdb) q
A debugging session is active.

ÂÂÂ Inferior 1 [process 23027] will be killed.

I tried nm and the foo function was there mangled:

â Dyninst nm hello | grep foo
000000000040057d T _Z3foov
but according to your note about findFunction:
"[NOTE: If name is not found to match any demangled function names in the module, the search is repeated as if name is a mangled function name. If this second search succeeds, functions with mangled names matching name are returned instead.]"
shouldn't it be working?

Should I demangle (or mangle) it by myshelf and then search?

Thanks,

Ioannis Konstantelias,
Undergraduate at University of Thessaly
[← Prev in Thread] Current Thread [Next in Thread→]