[cfe-dev] clang -g -fsanitize=address produces broken debug info?

Eric Christopher echristo at gmail.com
Tue Aug 13 14:15:22 PDT 2013


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


On Tue, Aug 13, 2013 at 2:09 AM, Kal Conley <kcconley at gmail.com> wrote:
> 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
> -----------------------------------------------------------------------
> #clang --version
> clang version 3.4 (188254)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
>
> #cat main.c
> int main() { return 42; }
>
> #clang -g main.c
>
> #readelf --debug-dump=aranges a.out
>
> #clang -g -fsanitize=address main.c
>
> #readelf --debug-dump=aranges a.out
> Contents of the .debug_aranges section:
>
>   Length:                   252
>   Version:                  2
>   Offset into .debug_info:  0x0
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     00000000004081b0 0000000000006feb
>     0000000000408020 000000000000001f
>     0000000000408040 0000000000000022
>     0000000000408062 000000000000001f
>     000000000040f1a0 0000000000000058
>     000000000040f200 0000000000000123
>     000000000040f330 00000000000006e5
>     000000000040fa20 00000000000000b7
>     000000000040fae0 00000000000002f0
>     000000000040fdd0 0000000000000238
>     0000000000410010 000000000000013d
>     0000000000410150 000000000000015a
>     00000000004102b0 00000000000000bc
>     0000000000408130 0000000000000024
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x1d36c
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000410370 0000000000001510
>     0000000000000000 0000000000000000
>   Length:                   60
>   Version:                  2
>   Offset into .debug_info:  0x20e2a
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000411880 0000000000001052
>     0000000000408160 000000000000000e
>     0000000000000000 0000000000000000
>   Length:                   60
>   Version:                  2
>   Offset into .debug_info:  0x23d32
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     00000000004128e0 000000000001f3e8
>     0000000000431cd0 000000000000013c
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x600db
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000431e10 000000000000007f
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x610bb
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000431e90 00000000000007c5
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x63398
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000432660 000000000000058c
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x64ef4
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000432bf0 000000000000137f
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x67e43
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000433f70 0000000000000395
>     0000000000000000 0000000000000000
>   Length:                   28
>   Version:                  2
>   Offset into .debug_info:  0x6947c
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000000000 0000000000000000
>   Length:                   108
>   Version:                  2
>   Offset into .debug_info:  0x69b17
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000434310 000000000000286a
>     000000000040f1a0 0000000000000058
>     0000000000436b80 0000000000000039
>     0000000000436bc0 00000000000000e1
>     0000000000436cb0 0000000000000052
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x72727
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000436d10 00000000000019f2
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x76190
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000438710 0000000000000044
>     0000000000000000 0000000000000000
>   Length:                   60
>   Version:                  2
>   Offset into .debug_info:  0x76a8f
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000438760 0000000000000a15
>     0000000000408170 0000000000000024
>     0000000000000000 0000000000000000
>   Length:                   108
>   Version:                  2
>   Offset into .debug_info:  0x7a35f
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000439180 0000000000000edb
>     000000000043a060 0000000000000002
>     000000000043a070 0000000000000002
>     000000000043a080 0000000000000002
>     000000000043a090 0000000000000002
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x7e487
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     000000000043a0a0 0000000000000048
>     0000000000000000 0000000000000000
>   Length:                   28
>   Version:                  2
>   Offset into .debug_info:  0x7e5ee
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000000000 0000000000000000
>   Length:                   124
>   Version:                  2
>   Offset into .debug_info:  0x7e66a
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     000000000043a0f0 0000000000000d48
>     000000000040f1a0 0000000000000058
>     000000000043ae40 000000000000010d
>     000000000043af50 00000000000004ca
>     000000000043b420 00000000000002f5
>     000000000043b720 0000000000000247
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x85f86
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     000000000043b970 00000000000006dd
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x8761e
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     000000000043c050 000000000000056c
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x88696
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     000000000043c5c0 0000000000000ba2
>     0000000000000000 0000000000000000
>   Length:                   76
>   Version:                  2
>   Offset into .debug_info:  0x8980d
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     000000000043d170 00000000000013cc
>     0000000000408081 00000000000000ad
>     0000000000000000 000000000000004a
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x8fd76
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     000000000043e540 000000000000004a
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x944b2
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     000000000043e590 00000000000006dc
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x95bf4
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     000000000043ec70 0000000000000b49
>     0000000000000000 0000000000000000
>   Length:                   60
>   Version:                  2
>   Offset into .debug_info:  0x971b8
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     000000000043f7c0 00000000000004e4
>     000000000040f1a0 0000000000000058
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x9907e
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     000000000043fcb0 00000000000006f7
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x9aac9
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     00000000004403b0 00000000000007a2
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x9c33c
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000440b60 0000000000000025
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x9c52b
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000440b90 0000000000000131
>     0000000000000000 0000000000000000
>   Length:                   140
>   Version:                  2
>   Offset into .debug_info:  0x9ca24
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000440cd0 0000000000001045
>     000000000043a060 0000000000000002
>     000000000043a070 0000000000000002
>     0000000000441d20 0000000000000002
>     000000000043a080 0000000000000002
>     0000000000441d30 0000000000000002
>     000000000043a090 0000000000000002
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x9fa70
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000441d40 0000000000000021
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0x9fc33
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000441d70 000000000000076e
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0xa156b
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     00000000004424e0 00000000000001d3
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0xa21c7
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     00000000004426c0 0000000000000d76
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0xa560a
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     0000000000443440 0000000000000e9c
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0xa8808
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     00000000004442e0 00000000000001c4
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0xa936e
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     00000000004444b0 0000000000000408
>     0000000000000000 0000000000000000
>   Length:                   60
>   Version:                  2
>   Offset into .debug_info:  0xa9b58
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     00000000004448c0 0000000000001ff5
>     00000000004081a0 000000000000000e
>     0000000000000000 0000000000000000
>   Length:                   44
>   Version:                  2
>   Offset into .debug_info:  0xb054e
>   Pointer Size:             8
>   Segment Size:             0
>
>     Address            Length
>     00000000004468c0 00000000000004f2
>     0000000000000000 0000000000000000
>
>
> 2013/8/12 Kal Conley <kcconley at gmail.com>
>>
>> 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
>>
>> Am 8/12/13 10:28 PM, schrieb Eric Christopher:
>> > Do you have an example? A random testcase didn't have anything emitted.
>> >
>> > -eric
>> >
>> > On Mon, Aug 12, 2013 at 1:22 PM, Kal Conley <kcconley at gmail.com> wrote:
>> >> 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
>> >>
>> >> Am 8/12/13 8:11 PM, schrieb Eric Christopher:
>> >>> Exactly, we don't produce it at the moment. It's on the list mind you,
>> >>> but ...
>> >>>
>> >>> -eric
>> >>>
>> >>> On Mon, Aug 12, 2013 at 11:02 AM, Robinson, Paul
>> >>> <Paul_Robinson at playstation.sony.com> wrote:
>> >>>> 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
>> >>>>
>> >>>>
>> >>>>
>> >>>> From: cfe-dev-bounces at cs.uiuc.edu
>> >>>> [mailto:cfe-dev-bounces at cs.uiuc.edu] On
>> >>>> Behalf Of David Blaikie
>> >>>> Sent: Monday, August 12, 2013 10:13 AM
>> >>>> To: Kal Conley
>> >>>> Cc: cfe-dev Developers
>> >>>> Subject: Re: [cfe-dev] clang -g -fsanitize=address produces broken
>> >>>> debug
>> >>>> info?
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>> On Aug 12, 2013 9:55 AM, "Kal Conley" <kcconley at gmail.com> wrote:
>> >>>>> Hi,
>> >>>>> DWARF info produced with "clang -g -fsanitize=address" doesn't have
>> >>>>> a
>> >>>>> complete .debug_aranges section. LLDB relies on .debug_aranges if it
>> >>>>> is
>> >>>>> present, thus LLDB fails to load any debug info for clang binaries
>> >>>>> built
>> >>>>> with -fsanitize=address. The LLDB folks believe this is a clang bug.
>> >>>>> Can
>> >>>>> someone from the clang side look into this?
>> >>>> Can you describe in what way it is broken? Do you have a reduced test
>> >>>> case?
>> >>>>
>> >>>>> Thanks,
>> >>>>> -Kal
>> >>>>> _______________________________________________
>> >>>>> cfe-dev mailing list
>> >>>>> cfe-dev at cs.uiuc.edu
>> >>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>> >>>> _______________________________________________
>> >>>> cfe-dev mailing list
>> >>>> cfe-dev at cs.uiuc.edu
>> >>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>> >>>>
>>
>




More information about the cfe-dev mailing list