clang -g -fsanitize=address produces broken debug info?

Clang can produce .debug_aranges? Somebody asked me about this recently, and I couldn’t get clang to produce a non-empty section, unless I was compiling an assembler source.

–paulr

Exactly, we don't produce it at the moment. It's on the list mind you, but ...

-eric

When I compile with -fsanitize=address the resulting binary contains a
.debug_aranges section on Linux. However it is incomplete and it trips
up lldb.
-Kal

Do you have an example? A random testcase didn't have anything emitted.

-eric

This appears to be fixed ToT. Must have been fixed very recently? The
last build I did was last week. You can also reproduce with clang-3.3.
-Kal

Hi Eric,

I am still seeing this issue actually. Last night I built clang with clang to save time. I just figured out this issue is only visible if you build clang with gcc/g++.

I am on Debian Wheezy and LLVM was configured with:

cmake $LLVMSrcDir
-DCMAKE_BUILD_TYPE=Release
-DFFI_LIBRARY_DIR=/usr/lib/x86_64-linux-gnu
-DFFI_INCLUDE_DIR=/usr/include/x86_64-linux-gnu
-DLLVM_ENABLE_FFI=ON

See below for more info.

Thanks,

-Kal

I don't have one handy, but my guess is that it's not building the
compiler with gcc that's the issue - it's that you have .o files
linked in that have debug information with aranges in there. I imagine
you wouldn't see the aranges in the file if you did:

clang -g -fsanitize=address main.c -c

and then looked at main.o before linking.

-eric