[PATCH] Debug Info on Windows
Carlo Kok
ck at remobjects.com
Thu Aug 1 11:46:36 PDT 2013
Op 1-8-2013 19:12, David Blaikie schreef:
> On Tue, Jul 30, 2013 at 12:40 AM, Carlo Kok <ck at remobjects.com> wrote:
>> Op 26-7-2013 22:39, Carlo Kok schreef:
>>
>>> Op 26-7-2013 21:58, David Blaikie schreef:
>>>>>>
>>>>>> b) Could we sink this logic down into DIELabel (or
>>>>>> DIEString)::EmitValue rather than having the special case up here in
>>>>>> emitDIE?
>>>>>
>>>>>
>>>>>
>>>>> DIELabel then. DIEString calls DIELabel.
>>>>
>>>>
>>>> Great... and sorry to keep iterating like this, but looking now at the
>>>> only current (committed) use of "needsDwarfSectionOffsetDirective"
>>>> that's down in AsmPrinter::EmitSectionOffset, so what would happen if
>>>> we pushed this one layer further down, into
>>>> AsmPrinter::EmitLabelReference?
>>>>
>>>> - Dave
>>>>
>>>
>>>
>>> The only other thing this would affect is DW_AT_Location:
>>> case dwarf::DW_AT_location: {
>>> if (DIELabel *L = dyn_cast<DIELabel>(Values[i])) {
>>> if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
>>> Asm->EmitLabelReference(L->getValue(), 4);
>>> else
>>> Asm->EmitLabelDifference(L->getValue(),
>>> DwarfDebugLocSectionSym, 4);
>>> } else {
>>> Values[i]->EmitValue(Asm, Form);
>>> }
>>> break;
>>> }
>>>
>>>
>>> Problem is, I don't know what this would affect.
>>>
>>
>> I can't even get one of the clang testcases to hit this. What would be the
>> next step?
>
> That's strange - I just tried this & had the following tests fail:
>
> LLVM :: CodeGen/Hexagon/hwloop-dbg.ll
> LLVM :: CodeGen/PowerPC/dbg.ll
> LLVM :: CodeGen/X86/2010-05-25-DotDebugLoc.ll
> LLVM :: CodeGen/X86/dbg-byval-parameter.ll
> LLVM :: DebugInfo/X86/DW_AT_location-reference.ll
> LLVM :: DebugInfo/X86/arguments.ll
> LLVM :: DebugInfo/X86/dbg_value_direct.ll
> LLVM :: DebugInfo/X86/parameters.ll
> LLVM :: DebugInfo/X86/subreg.ll
> LLVM :: DebugInfo/inlined-arguments.ll
> LLVM :: DebugInfo/two-cus-from-same-file.ll
>
> It might be worth understanding how this code is reachable to see if
> it's a case you also want to fix on Windows (in which case sinking
> this down into EmitLabelReference is the right thing to do, but adding
> extra tests to cover this other callsite might be valuable).
So I finally got to reproduce those testcases by forcing a failure, but
really don't know enough to be able to understand why it hits those.
(Either way once there is a good testcase that shows this failing this
will be easy to fix in a new patch). What seems to happen that IF a,
afer optimization an (X86) register gets moved into a stack spot it
emits something like:
.secrel32 Ldebug_loc0
# DW_AT_location
...
Ldebug_loc0:
.long Lfunc_begin1
.long Ltmp6
Now if all the other section refs of coff are any indication this sub
entry also needs a secrel32 for the:
.long Ltmp6
(As it refers to within the same section)
So it seems my change change (the secrel32 Ldebug_lco0) is fine, but
this will probably need an additional .secrel32 for the sub entry, that
said I'll try to find a testcase for that first before I want to work on
fixing it.
>
> But it generally seems like the right place for this, to the best of
> my limited understanding, so I'll sign off on this with or without
> that extra testing.
>
Cool. It's in.
--
Carlo Kok
More information about the llvm-commits
mailing list