Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DWARF5 is not supported by drsyms, resulting in no line numbers with gcc 11+ #2485

Closed
derekbruening opened this issue Sep 21, 2023 · 0 comments · Fixed by #2490
Closed

DWARF5 is not supported by drsyms, resulting in no line numbers with gcc 11+ #2485

derekbruening opened this issue Sep 21, 2023 · 0 comments · Fixed by #2490

Comments

@derekbruening
Copy link
Contributor

Building Dr. Memory on a system with gcc 12.2, the tests fail b/c they can't get line numbers:

Error #1: UNADDRESSABLE ACCESS beyond heap bounds: reading 0x00007f796fc01223-0x00007f796fc01224 1 byte(s)
# 0 main   (0x00007f796fbfb33a <malloc+0x133a>)        
    ??:0                                                                                  

It's because the test binary has DWARF5:

$ readelf --debug-dump=info tests/malloc | grep -A 2 'Compilation Unit @'
  Compilation Unit @ offset 0:
   Length:        0x78d (32-bit)
   Version:       5

Dr. Memory uses DynamoRIO's drsyms library, and it uses elftoolchain, picked due to its BSD instead of GPL license. However, it is not kept up to date these days and lacks DWARF5 support: https://sourceforge.net/p/elftoolchain/tickets/611.

This is filed in the DynamoRIO tracker as DynamoRIO/dynamorio#5926.

Adding -gdwarf-4: the test works.

derekbruening added a commit that referenced this issue Sep 21, 2023
+ DWARF5 is now the gcc default but is not supported (#2485) so we add
  -gdwarf-4 to our test flags and the docs.

+ Adds Linux syscall entries for rseq and getrandom, seen on tiny apps now.

+ Fixes a bug in the size of kernel_sigset_t which was resulting in
  false positive uninitialized errors in rt_sigaction.

+ Updates drltrace code for droption now being in a namespace.

+ Adds --recursive to the git submodule commands to get minizip for
  the DR build.

+ Relaxes the drltrace tests to allow __IO_puts and __open.
derekbruening added a commit that referenced this issue Sep 21, 2023
Updates DR to bbd4ffadd.

Fixes several issues with the latest DR and recent Linux platforms:

+ DWARF5 is now the gcc default but is not supported (#2485) so we add
  -gdwarf-4 to our test flags and the docs.

+ Adds Linux syscall entries for rseq and getrandom, seen on tiny apps now.

+ Fixes a bug in the size of kernel_sigset_t which was resulting in
  false positive uninitialized errors in rt_sigaction.

+ Updates drltrace code for droption now being in a namespace.

+ Adds --recursive to the git submodule commands to get minizip for
  the DR build.

+ Relaxes the drltrace tests to allow __IO_puts and __open.
bmcutler added a commit to Submitty/Tutorial that referenced this issue Sep 22, 2023
with g++11 it is necessary to compile with dwarf4 to get line numbers
from DrMemory

            "command" : "clang++ -g -gdwarf-4 -Wall -o a.out *.cpp",
// NOTE: Compiling with the -gdwarf-4 option is required with g++ 11+
            // so that DrMemory can print source code line numbers with.
            // See also:
            // DynamoRIO/drmemory#2485

Also, in PR Submitty/Submitty#9793 the category
for a system call previously in the unknown category is updated so that
the configuration runs without the system call failure.

---------

Co-authored-by: Barb Cutler <Barb Cutler>
derekbruening added a commit that referenced this issue Jan 13, 2024
Updates DR to 3e3b976e316e9469ca36338fb7f3fa086739d03a which pulls in
the use of elfutils in drsyms for DWARF-5 support on Linux.

Updates the documentation and flags for Linux to remove -gdwarf-4.

Fixes #2485
derekbruening added a commit that referenced this issue Jan 14, 2024
Updates DR to 3e3b976e316e9469ca36338fb7f3fa086739d03a which pulls in
the use of elfutils in drsyms for DWARF-5 support on Linux.

Updates the documentation and flags for Linux to remove -gdwarf-4.

Fixes #2485
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant