[PATCH] Debug Info on Windows

David Blaikie dblaikie at gmail.com
Fri Jul 26 10:26:06 PDT 2013


On Fri, Jul 26, 2013 at 12:44 AM, Carlo Kok <ck at remobjects.com> wrote:
> Op 25-7-2013 22:14, David Blaikie schreef:
>
>> On Thu, Jul 25, 2013 at 1:06 PM, Carlo Kok <ck at remobjects.com> wrote:
>>>
>>> Attached is a possible fix for:
>>> Bug 16249 - LLVM generates broken debug info on Windows
>>>
>>>  From what I can find out the issue is that DIE Labels to strings and
>>> other
>>> objects should be emitted as a coff "secrel32" symbol, not a .long.
>>>
>>> After applying this patch gdb and llvm-dwarfdump can properly read the
>>> file.
>>
>>
>> Can you provide test coverage for this?
>
>
> Attached is a patch that checks the asm output for the proper sections.
>
> I tried creating a testcase that uses dwarfdump but
> llvm-dwarfdump doesn't properly support the coff secrel32 relocations

That's fine - in this case the fix is to emit a particular kind of
relocation & I think it's probably reasonable/necessary to check the
asm output for that relocation (I did similar things with TLS debug
info, for example). Even if dwarfdump supported relocations of this
kind, you'd only see the post-relocated value which isn't necessarily
clear evidence that we emitted the right kind of relocation, I'd
imagine (though I don't know a lot about relocations or how obvious
the reloc-resolved values would be as an indicator that we emitted the
right relocation type).

If possible, we're trying to make a habit of including the original
(C, in your case I assume) source & Clang command line (ideally
produced from Clang since it's generally accessible to LLVM developers
- if it's something that can only be produced by some other frontend,
I'd be curious to hear about that too) in the LLVM debug info test
cases if possible. (& keep the IR an exact copy of what Clang
produced, rather than anything hand-reduced unless there's a good
reason to do so)

(oh, and your patch uses naming inconsistent with LLVM's naming
convention (value should be Value))

> (prints stderr like:
> error: failed to compute relocation: IMAGE_REL_I386_SECREL
> error: failed to compute relocation: IMAGE_REL_I386_SECREL
> error: failed to compute relocation: IMAGE_REL_I386_SECREL
> error: failed to compute relocation: IMAGE_REL_I386_SECREL
> error: failed to compute relocation: IMAGE_REL_I386_SECREL
>
> even for gcc generated debug info).



More information about the llvm-commits mailing list