[llvm] r203192 - DebugInfo: Limit r203187 to non-darwin as lldb can't handle this yet
Eric Christopher
echristo at gmail.com
Fri Mar 7 13:56:40 PST 2014
Bunch of things in the debuginfo-tests directory were failing after the commit.
-eric
On Fri, Mar 7, 2014 at 1:55 PM, Greg Clayton <gclayton at apple.com> wrote:
> Here was the change from back in July 2013:
>
> Author: athirumu
> Date: Thu Jul 25 10:13:50 2013
> New Revision: 187125
>
> URL: http://llvm.org/viewvc/llvm-project?rev=187125&view=rev
> Log:
> Fixes LLDB address ranges with gcc 4.8
> - Modifies the DWARF parser for DWARF 4 specification of hi_pc as an offset-from-low-pc.
>
> Modified:
> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
>
> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=187125&r1=187124&r2=187125&view=diff
> ==============================================================================
> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Thu Jul 25 10:13:50 2013
> @@ -774,6 +774,8 @@ DWARFDebugInfoEntry::GetDIENamesAndRange
> uint32_t i;
> dw_attr_t attr;
> dw_form_t form;
> + bool do_offset = false;
> +
> for (i=0; i<numAttributes; ++i)
> {
> abbrevDecl->GetAttrAndFormByIndexUnchecked(i, attr, form);
> @@ -783,12 +785,24 @@ DWARFDebugInfoEntry::GetDIENamesAndRange
> switch (attr)
> {
> case DW_AT_low_pc:
> + lo_pc = form_value.Unsigned();
> +
> + if (do_offset)
> + hi_pc += lo_pc;
> + do_offset = false;
> + break;
> +
> case DW_AT_entry_pc:
> lo_pc = form_value.Unsigned();
> break;
>
> case DW_AT_high_pc:
> hi_pc = form_value.Unsigned();
> + if (form_value.Form() != DW_FORM_addr)
> + if (lo_pc == LLDB_INVALID_ADDRESS)
> + do_offset = hi_pc != LLDB_INVALID_ADDRESS;
> + else
> + hi_pc += lo_pc; // DWARF 4 introduces <offset-from-lo-pc> to save on relocations
> break;
>
> case DW_AT_ranges:
> @@ -1410,6 +1424,64 @@ DWARFDebugInfoEntry::GetAttributeValueAs
> }
>
> //----------------------------------------------------------------------
> +// GetAttributeHighPC
> +//
> +// Get the hi_pc, adding hi_pc to lo_pc when specified
> +// as an <offset-from-low-pc>.
> +//
> +// Returns the hi_pc or fail_value.
> +//----------------------------------------------------------------------
> +dw_addr_t
> +DWARFDebugInfoEntry::GetAttributeHighPC
> +(
> + SymbolFileDWARF* dwarf2Data,
> + const DWARFCompileUnit* cu,
> + dw_addr_t lo_pc,
> + uint64_t fail_value
> +) const
> +{
> + DWARFFormValue form_value;
> +
> + if (GetAttributeValue(dwarf2Data, cu, DW_AT_high_pc, form_value))
> + {
> + dw_addr_t hi_pc = form_value.Unsigned();
> + if (form_value.Form() != DW_FORM_addr)
> + hi_pc += lo_pc; // DWARF4 can specify the hi_pc as an <offset-from-lowpc>
> + return hi_pc;
> + }
> + return fail_value;
> +}
> +
> +//----------------------------------------------------------------------
> +// GetAttributeAddressRange
> +//
> +// Get the lo_pc and hi_pc, adding hi_pc to lo_pc when specified
> +// as an <offset-from-low-pc>.
> +//
> +// Returns true or sets lo_pc and hi_pc to fail_value.
> +//----------------------------------------------------------------------
> +bool
> +DWARFDebugInfoEntry::GetAttributeAddressRange
> +(
> + SymbolFileDWARF* dwarf2Data,
> + const DWARFCompileUnit* cu,
> + dw_addr_t& lo_pc,
> + dw_addr_t& hi_pc,
> + uint64_t fail_value
> +) const
> +{
> + lo_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_low_pc, fail_value);
> + if (lo_pc != fail_value)
> + {
> + hi_pc = GetAttributeHighPC(dwarf2Data, cu, lo_pc, fail_value);
> + if (hi_pc != fail_value)
> + return true;
> + }
> + lo_pc = fail_value;
> + hi_pc = fail_value;
> + return false;
> +}
> +//----------------------------------------------------------------------
> // GetAttributeValueAsLocation
> //
> // Get the value of an attribute as reference and fix up and compile
> @@ -1740,13 +1812,11 @@ DWARFDebugInfoEntry::BuildAddressRangeTa
> {
> if (m_tag == DW_TAG_subprogram)
> {
> + dw_addr_t lo_pc = LLDB_INVALID_ADDRESS;
> dw_addr_t hi_pc = LLDB_INVALID_ADDRESS;
> - dw_addr_t lo_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_low_pc, LLDB_INVALID_ADDRESS);
> - if (lo_pc != LLDB_INVALID_ADDRESS)
> - hi_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_high_pc, LLDB_INVALID_ADDRESS);
> - if (hi_pc != LLDB_INVALID_ADDRESS)
> + if (GetAttributeAddressRange(dwarf2Data, cu, lo_pc, hi_pc, LLDB_INVALID_ADDRESS))
> {
> - /// printf("BuildAddressRangeTable() 0x%8.8x: %30s: [0x%8.8x - 0x%8.8x)\n", m_offset, DW_TAG_value_to_name(tag), lo_pc, hi_pc);
> + /// printf("BuildAddressRangeTable() 0x%8.8x: %30s: [0x%8.8x - 0x%8.8x)\n", m_offset, DW_TAG_value_to_name(tag), lo_pc, hi_pc);
> debug_aranges->AppendRange (cu->GetOffset(), lo_pc, hi_pc);
> }
> }
> @@ -1781,11 +1851,9 @@ DWARFDebugInfoEntry::BuildFunctionAddres
> {
> if (m_tag == DW_TAG_subprogram)
> {
> + dw_addr_t lo_pc = LLDB_INVALID_ADDRESS;
> dw_addr_t hi_pc = LLDB_INVALID_ADDRESS;
> - dw_addr_t lo_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_low_pc, LLDB_INVALID_ADDRESS);
> - if (lo_pc != LLDB_INVALID_ADDRESS)
> - hi_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_high_pc, LLDB_INVALID_ADDRESS);
> - if (hi_pc != LLDB_INVALID_ADDRESS)
> + if (GetAttributeAddressRange(dwarf2Data, cu, lo_pc, hi_pc, LLDB_INVALID_ADDRESS))
> {
> // printf("BuildAddressRangeTable() 0x%8.8x: [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")\n", m_offset, lo_pc, hi_pc); // DEBUG ONLY
> debug_aranges->AppendRange (GetOffset(), lo_pc, hi_pc);
> @@ -2075,7 +2143,7 @@ DWARFDebugInfoEntry::LookupAddress
> dw_addr_t lo_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_low_pc, LLDB_INVALID_ADDRESS);
> if (lo_pc != LLDB_INVALID_ADDRESS)
> {
> - dw_addr_t hi_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_high_pc, LLDB_INVALID_ADDRESS);
> + dw_addr_t hi_pc = GetAttributeHighPC(dwarf2Data, cu, lo_pc, LLDB_INVALID_ADDRESS);
> if (hi_pc != LLDB_INVALID_ADDRESS)
> {
> // printf("\n0x%8.8x: %30s: address = 0x%8.8x [0x%8.8x - 0x%8.8x) ", m_offset, DW_TAG_value_to_name(tag), address, lo_pc, hi_pc);
>
> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h?rev=187125&r1=187124&r2=187125&view=diff
> ==============================================================================
> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (original)
> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Thu Jul 25 10:13:50 2013
> @@ -197,6 +197,19 @@ public:
> const dw_attr_t attr,
> int64_t fail_value) const;
>
> + dw_addr_t GetAttributeHighPC(
> + SymbolFileDWARF* dwarf2Data,
> + const DWARFCompileUnit* cu,
> + dw_addr_t lo_pc,
> + uint64_t fail_value) const;
> +
> + bool GetAttributeAddressRange(
> + SymbolFileDWARF* dwarf2Data,
> + const DWARFCompileUnit* cu,
> + dw_addr_t& lo_pc,
> + dw_addr_t& hi_pc,
> + uint64_t fail_value) const;
> +
> dw_offset_t GetAttributeValueAsLocation(
> SymbolFileDWARF* dwarf2Data,
> const DWARFCompileUnit* cu,
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
> On Mar 7, 2014, at 1:53 PM, Greg Clayton <gclayton at apple.com> wrote:
>
>> I just looked at the code and we do have code in LLDB to handle this already. Were you seeing errors on the LLDB test suite?
>>
>> On Mar 6, 2014, at 6:29 PM, David Blaikie <dblaikie at gmail.com> wrote:
>>
>>> On Thu, Mar 6, 2014 at 6:19 PM, David Blaikie <dblaikie at gmail.com> wrote:
>>>> Author: dblaikie
>>>> Date: Thu Mar 6 20:19:41 2014
>>>> New Revision: 203192
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=203192&view=rev
>>>> Log:
>>>> DebugInfo: Limit r203187 to non-darwin as lldb can't handle this yet
>>>
>>> Adrian, Greg,
>>>
>>> You guys might want to consider supporting this in lld as it'll reduce
>>> the number of relocations for debug info quite substantially (I
>>> haven't gathered numbers yet, but working on it - we're over 50%
>>> higher on relocations in debug_info than GCC ToT, we're hoping this
>>> issue is most of that)
>>>
>>>>
>>>> Modified:
>>>> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>>>> llvm/trunk/test/DebugInfo/X86/dbg-value-location.ll
>>>>
>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=203192&r1=203191&r2=203192&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Mar 6 20:19:41 2014
>>>> @@ -413,8 +413,11 @@ DIE *DwarfDebug::updateSubprogramScopeDI
>>>> }
>>>>
>>>> SPCU->addLabelAddress(SPDie, dwarf::DW_AT_low_pc, FunctionBeginSym);
>>>> - SPCU->addLabelDelta(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym,
>>>> - FunctionBeginSym);
>>>> + if (Triple(Asm->getTargetTriple()).isOSDarwin())
>>>> + SPCU->addLabelAddress(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym);
>>>> + else
>>>> + SPCU->addLabelDelta(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym,
>>>> + FunctionBeginSym);
>>>>
>>>> const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
>>>> MachineLocation Location(RI->getFrameRegister(*Asm->MF));
>>>>
>>>> Modified: llvm/trunk/test/DebugInfo/X86/dbg-value-location.ll
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-value-location.ll?rev=203192&r1=203191&r2=203192&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/test/DebugInfo/X86/dbg-value-location.ll (original)
>>>> +++ llvm/trunk/test/DebugInfo/X86/dbg-value-location.ll Thu Mar 6 20:19:41 2014
>>>> @@ -4,7 +4,7 @@ target datalayout = "e-p:64:64:64-i1:8:8
>>>> target triple = "x86_64-apple-darwin10.0.0"
>>>> ;Radar 8950491
>>>>
>>>> -;CHECK: .long Lset6
>>>> +;CHECK: .long Lset5
>>>> ;CHECK-NEXT: ## DW_AT_decl_file
>>>> ;CHECK-NEXT: ## DW_AT_decl_line
>>>> ;CHECK-NEXT: ## DW_AT_type
>>>>
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
More information about the llvm-commits
mailing list