wuhailinjerry / edb-debugger

Automatically exported from code.google.com/p/edb-debugger
GNU General Public License v2.0
0 stars 0 forks source link

read c++ name mangling #108

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
On a large project, with no debug information, but symbol tables (as read by 
there is a function _Z6foobarijPhi as reported by readelf -s libwhatever.so. 

gdb correctly shows the function as foobar(int, unsigned int, unsigned char*, 
int) in the backtrace/frame information, but edb doesn't appear to try 
displaying it, or any other function, at all.
The "Find function" plugin also doesn't list any function in the libwhatever.so 
range.

in the 0.9.17 deb version

Original issue reported on code.google.com by evan.teran on 3 Oct 2012 at 3:22

GoogleCodeExporter commented 9 years ago
Well, firstly, have you generated symbols for the target binary and all 
libraries it uses (they have separate symbols of course). This should, at the 
very least give you mangled symbols to work with. Things like, "_Z6foobarijPhi" 
should start showing up if setup properly.

As for c++ name mangling support, technically, if the symbol files have 
unmangled names, edb should display them... but you are correct in that the 
symbol generation code does not do name unmangling at all, and that is 
something that needs to be added :-).

Thanks,
Evan Teran

Original comment by evan.teran on 3 Oct 2012 at 5:25

GoogleCodeExporter commented 9 years ago
>Well, firstly, have you generated symbols for the target binary and all
libraries it uses (they have separate symbols of course

How?

Does it do it automatically when attaching like gdb?

Original comment by evan.teran on 3 Oct 2012 at 5:25

GoogleCodeExporter commented 9 years ago
No, it's not automatic (yet). To generate symbols from an existing file you can 
run something like this:

    ./edb --symbols /lib/libc.so.6 > symbols/libc.so.6.map

The name of the symbol file matters. Also, you need to set edb (via the config 
dialog) the "Symbols Directory" to point to the directory that the map file 
will be in. See the README for more details.

Like I said, this will certainly give you **mangled** symbols. I think if this 
file happens to have unmangled symbols it will probably work ok. This is not 
automatic yet though. It can be done manually by post-processing the files and 
using the c++filt program which is usually part of the binutils package.

There are however 2 gaps in the features here though:

1) automatic symbol generation when a file is not present
2) demangling of symbols is not done at all yet by edb itself. Certainly this 
should be added at some point.

I will work on these.

Original comment by evan.teran on 3 Oct 2012 at 5:25

GoogleCodeExporter commented 9 years ago

Original comment by evan.teran on 3 Oct 2012 at 2:46

GoogleCodeExporter commented 9 years ago

Original comment by evan.teran on 4 Apr 2014 at 3:44