ianlancetaylor / libbacktrace

A C library that may be linked into a C/C++ program to produce symbolic backtraces

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pecoff implementation stripping underscores fails with c++ stacktraces

Plericromon opened this issue · comments

The following line causes underscores to be stripped from function names:

/* Strip leading '_'. */

For example boost::stacktrace will run a demangle on the returned symbols from libbacktrace. Without the leading underscore function names will not be demangled. See an example:

Function name in COFF symbol table:
_ZN3foo3Bar6fooBarEv

Function name returned from backtrace_syminfo with COFF search function:
ZN3foo3Bar6fooBarEv

While the former can be demangled to foo::Bar::fooBar() the latter cant.

What is the reason for stripping the leading underscore? Would it be possible to avoid this?

Why are you asking here?

Seems as though this question would be better sent to a GCC forum of some sort. Looking at the GCC source I see that this line was added in the following commit:

gcc-mirror/gcc@48ee217

The person who added this code might have some insights here.

I check this repository out, compile it, use it, a file that is part of this repository does not perform the way I think it should, so I create an issue in that repository. This is pretty much why I am asking here?

Is this repository here not maintained? Or what is the relationship between the files here and on the gcc mirror?

This repository is a stand-alone copy of a library that lives in the GCC sources.

I believe the problem is that 32-bit x86 PE uses a leading underscore bug 64-bit x86_64 PE does not. Are you using 64-bit PE?

CC @gingold-adacore

Ah, got it. Yes, I am on x86_64, here the _ removal is causing issues. What would be the appropriate place to raise the issue if its not here?

You could file a bug report against gcc/libbacktace at https://gcc.gnu.org/bugzilla.

This is most likely fixed by 2f5efbf.