https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86090

            Bug ID: 86090
           Summary: [ASAN] ASAN does not properly configure libbacktrace.
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: d.khalikov at partner dot samsung.com
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at 
gcc dot gnu.org
  Target Milestone: ---

Created attachment 44252
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44252&action=edit
libsanitizer.patch

Since sanitizers build libbacktrace from source, sanitizer's configure should 
check for lstat and readlink function directly, because by default libbacktrace
uses dummy versions which return -1 and therefore could not symbolize stripped
debuginfo with gnu-debuglink.

Steps to reproduce:

$g++ --version
output:
g++ (GCC) 9.0.0 20180606 (experimental)

$cat test.cc
int main () { int *ptr = new int[1]; return ptr[1]; }
$g++ -o test test.cc -fsanitize=address -g
$objcopy --only-keep-debug test test.debug
$strip -g test
$objcopy --add-gnu-debuglink=test.debug test
./test

output:
...
#0 0x4007af in main (/path/to/exe/test+0x4007af)
...

The backtrace is not symbolized.

Possible patch is attached.

Reply via email to