[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-09-25 Thread tnfchris at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

--- Comment #18 from Tamar Christina  ---
Thanks for the quick fix Ian!

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-09-22 Thread ian at airs dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

--- Comment #17 from Ian Lance Taylor  ---
Tamar: Thanks for letting me know.  I just committed a patch that should fix
that problem.

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-09-22 Thread ian at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

--- Comment #16 from ian at gcc dot gnu.org  ---
Author: ian
Date: Fri Sep 22 13:38:10 2017
New Revision: 253095

URL: https://gcc.gnu.org/viewcvs?rev=253095&root=gcc&view=rev
Log:
PR sanitizer/77631
* configure.ac: Check for lstat and readlink.
* elf.c (lstat, readlink): Provide dummy versions if real versions
are not available.
* configure, config.h.in: Rebuild.

Modified:
trunk/libbacktrace/ChangeLog
trunk/libbacktrace/config.h.in
trunk/libbacktrace/configure
trunk/libbacktrace/configure.ac
trunk/libbacktrace/elf.c

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-09-22 Thread tnfchris at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

Tamar Christina  changed:

   What|Removed |Added

 CC||tnfchris at gcc dot gnu.org

--- Comment #15 from Tamar Christina  ---
This patch is causing the aarch64 and arm baremetal builds to fail because
newlib doesn't seem to have lstat.

/tmp/aarch64-none-elf/build/src/gcc/libbacktrace/elf.c: In function
'elf_is_symlink':

/tmp/aarch64-none-elf/build/src/gcc/libbacktrace/elf.c:659:7: error: implicit
declaration of function 'lstat'; did you mean 'stat'?
[-Werror=implicit-function-declaration]

   if (lstat (filename, &st) < 0)

   ^

   stat

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-09-20 Thread ian at airs dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

Ian Lance Taylor  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #14 from Ian Lance Taylor  ---
Should be fixed on trunk, I hope.

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-09-20 Thread ian at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

--- Comment #13 from ian at gcc dot gnu.org  ---
Author: ian
Date: Wed Sep 20 21:09:37 2017
New Revision: 253032

URL: https://gcc.gnu.org/viewcvs?rev=253032&root=gcc&view=rev
Log:
PR sanitizer/77631
Support for external debug info.
* elf.c: Include , , .
(S_ISLNK): Define if not defined.
(xstrnlen): Define if strnlen is not available.
(b_elf_note): Define type.
(NT_GNU_BUILD_ID): Define macro.
(elf_crc32, elf_crc32_file): New static functions.
(elf_is_symlink, elf_readlink): New static functions.
(elf_open_debugfile_by_buildid): New static function.
(elf_try_debugfile): New static function.
(elf_find_debugfile_by_debuglink): New static function.
(elf_open_debugfile_by_debuglink): New static function.
(elf_add): Add filename and debuginfo parameters.  Adjust all
callers.  Look for external debug info notes, and try to fetch
debug info from external file.
(struct phdr_data): Add exe_filename field.
(phdr_callback): Pass filename to elf_add.
(backtrace_initialize): Add filename parameter.
* internal.h (backtrace_initialize): Add filename parameter.
* fileline.c (fileline_initialize): Pass filename to
backtrace_initialize.
* pecoff.c (fileline_initialize): Add unused filename parameter.
* unknown.c (fileline_initialize): Likewise.
* xcoff.c (fileline_initialize): Likewise.
* configure.ac: Check for objcopy --add-gnu-debuglink.
* Makefile.am (dtest): New test target.
* configure, Makefile.in: Rebuild.

Modified:
trunk/libbacktrace/ChangeLog
trunk/libbacktrace/Makefile.am
trunk/libbacktrace/Makefile.in
trunk/libbacktrace/configure
trunk/libbacktrace/configure.ac
trunk/libbacktrace/elf.c
trunk/libbacktrace/fileline.c
trunk/libbacktrace/internal.h
trunk/libbacktrace/pecoff.c
trunk/libbacktrace/unknown.c
trunk/libbacktrace/xcoff.c

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-09-12 Thread ian at airs dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

--- Comment #12 from Ian Lance Taylor  ---
I don't think this is a dup of 67165, which is about compressed debug sections.
 This PR is about debug info in separate files.

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-07-06 Thread tetra2005 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

Yuri Gribov  changed:

   What|Removed |Added

 CC||tetra2005 at gmail dot com

--- Comment #11 from Yuri Gribov  ---
Note that this is a dup of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67165

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-06-16 Thread d.khalikov at partner dot samsung.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

Denis Khalikov  changed:

   What|Removed |Added

  Attachment #41478|0   |1
is obsolete||

--- Comment #10 from Denis Khalikov  ---
Created attachment 41574
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41574&action=edit
patch for PR sanitizer/77631

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-06-06 Thread d.khalikov at partner dot samsung.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

Denis Khalikov  changed:

   What|Removed |Added

  Attachment #40963|0   |1
is obsolete||

--- Comment #9 from Denis Khalikov  ---
Created attachment 41478
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41478&action=edit
patch for PR sanitizer/77631

Hello everyone,
I updated the patch.

List of implemented functionality:

 1. Reading .note.gnu.build-id section.
  a. Parsing section data.

 2. Reading.gnu_debuglink section.
  a. Parsing section data.
  b. Verifying crc32 sum.

 3. Searching for separate debug info file.
  a. /usr/lib/debug/.build-id
  b. /path/to/executable
  c. /path/to/executable/.debug
  d. /usr/lib/debug/path/to/executable


This patch works for me.
Anyway still waiting for review:
https://gcc.gnu.org/ml/gcc-patches/2017-05/msg01462.html

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-03-15 Thread tschwinge at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

--- Comment #8 from Thomas Schwinge  ---
(In reply to myself from comment #6)
> This has been (with low priority) on my long TODO list
> for some time: ever since I started using -gsplit-dwarf and noticed that
> GCC's Internal Compiler Error (ICE) backtraces no longer were as useful as
> they used to be -- at least I suppose that's the very same underlying issue.

Well, as it turns out, reading the *.dwo files generated by -gsplit-dwarf is
actually a different issue than the "debuglink" case discussed here.  So,
that's to stay on my long TODO list for a little longer...  ;-)

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-03-14 Thread d.khalikov at partner dot samsung.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

--- Comment #7 from Denis Khalikov  ---
Thomas, before verifying i should fix issues from the list,
https://gcc.gnu.org/ml/gcc-patches/2017-03/msg00735.html

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-03-14 Thread tschwinge at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

Thomas Schwinge  changed:

   What|Removed |Added

 CC||tschwinge at gcc dot gnu.org

--- Comment #6 from Thomas Schwinge  ---
Denis, very nice!  This has been (with low priority) on my long TODO list for
some time: ever since I started using -gsplit-dwarf and noticed that GCC's
Internal Compiler Error (ICE) backtraces no longer were as useful as they used
to be -- at least I suppose that's the very same underlying issue.  (To
verify/confirm, I'll later test your patch unless somebody else beats me to
it.)

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-03-13 Thread d.khalikov at partner dot samsung.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

Denis Khalikov  changed:

   What|Removed |Added

 CC||d.khalikov at partner dot 
samsung.
   ||com

--- Comment #5 from Denis Khalikov  ---
Yes,i sent to gcc-patc...@gcc.gnu.org.

https://gcc.gnu.org/ml/gcc-patches/2017-03/msg00660.html

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-03-13 Thread ian at airs dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

Ian Lance Taylor  changed:

   What|Removed |Added

 CC||ian at airs dot com

--- Comment #4 from Ian Lance Taylor  ---
Thanks!  Can you send your patch to the mailing list gcc-patc...@gcc.gnu.org
for review?

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2017-03-13 Thread d.khalikov at partner dot samsung.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

--- Comment #3 from Denis Khalikov  ---
Created attachment 40963
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40963&action=edit
patch for PR sanitizer/77631

Hello everyone, i have a patch for this issue.
(see attachment PR_sanitizer_77631)

List of implemented functionality:

1.Reading .gnu_debuglink section from ELF file:
 a. Reading name of debug info file.
 b. Verifying crc32 sum.

2. Searching for separate debug info file from paths: 
 a. /usr/lib/debug/path/to/executable
 b. /path/to/executable
 c. /path/to/executable/.debug

Assumed that debug info file generated by objcopy from binutils.

objcopy --only-keep-debug foo foo.debug
strip -g foo
objcopy --add-gnu-debuglink=foo.debug foo

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2016-09-19 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-09-19
 CC||iant at google dot com
 Ever confirmed|0   |1

--- Comment #2 from Richard Biener  ---
Confirmed, but I think we have a duplicate for this.

[Bug sanitizer/77631] no symbols in backtrace shown by ASan when debug info is split

2016-09-18 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77631

--- Comment #1 from Andrew Pinski  ---
I suspect libbacktrace does not implement this.