[Lldb-commits] [lldb] r345157 - Revert rL345127: [LLDB] - Add support for DW_RLE_base_address and DW_RLE_offset_pair entries
George Rimar via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 24 09:21:57 PDT 2018
Author: grimar
Date: Wed Oct 24 09:21:56 2018
New Revision: 345157
URL: http://llvm.org/viewvc/llvm-project?rev=345157&view=rev
Log:
Revert rL345127: [LLDB] - Add support for DW_RLE_base_address and DW_RLE_offset_pair entries
It broke BB:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/11671/consoleFull#434797663d489585b-5106-414a-ac11-3ff90657619c
Removed:
lldb/trunk/lit/Breakpoint/Inputs/debug_rnglist_offset_pair.yaml
lldb/trunk/lit/Breakpoint/debug_rnglist_offset_pair.test
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
Removed: lldb/trunk/lit/Breakpoint/Inputs/debug_rnglist_offset_pair.yaml
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Breakpoint/Inputs/debug_rnglist_offset_pair.yaml?rev=345156&view=auto
==============================================================================
--- lldb/trunk/lit/Breakpoint/Inputs/debug_rnglist_offset_pair.yaml (original)
+++ lldb/trunk/lit/Breakpoint/Inputs/debug_rnglist_offset_pair.yaml (removed)
@@ -1,53 +0,0 @@
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_EXEC
- Machine: EM_X86_64
- Entry: 0x0000000000400440
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x0000000000400440
- AddressAlign: 0x0000000000000010
- Content: 31ED4989D15E4889E24883E4F0505449C7C0C005400048C7C15005400048C7C740054000E8B7FFFFFFF4660F1F44000055B820204000483D202040004889E57417B8000000004885C0740D5DBF20204000FFE00F1F4400005DC3660F1F440000BE20204000554881EE202040004889E548C1FE034889F048C1E83F4801C648D1FE7415B8000000004885C0740B5DBF20204000FFE00F1F005DC3660F1F440000803D391B0000007517554889E5E87EFFFFFFC605271B0000015DC30F1F440000F3C30F1F4000662E0F1F840000000000554889E55DEB89660F1F840000000000B9020000008B05F91A00000F1F44000021F883C1FF75F98905E71A0000C3669050BF01000000E8D5FFFFFF31C059C390415741564189FF415541544C8D25A618000055488D2DA6180000534989F64989D54C29E54883EC0848C1FD03E86FFEFFFF4885ED742031DB0F1F8400000000004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F840000000000F3C3
- - Name: .debug_str_offsets
- Type: SHT_PROGBITS
- AddressAlign: 0x0000000000000001
- Content: 300000000500000000000000230000002C0000004F00000051000000550000005D0000006100000066000000680000006A000000
- - Name: .debug_str
- Type: SHT_PROGBITS
- Flags: [ SHF_MERGE, SHF_STRINGS ]
- AddressAlign: 0x0000000000000001
- Content: 636C616E672076657273696F6E20382E302E3020287472756E6B203334343033352900746573742E637070002F686F6D652F756D622F74657374735F323031382F3130365F726E676C6973747332004300696E74005F5A33666F6F6900666F6F006D61696E00500049005700
- - Name: .debug_loc
- Type: SHT_PROGBITS
- AddressAlign: 0x0000000000000001
- Content: 05000000000000001000000000000000030011009F00000000000000000000000000000000
- - Name: .debug_abbrev
- Type: SHT_PROGBITS
- AddressAlign: 0x0000000000000001
- Content: 011101252513050325721710171B251101120674170000023400032549133F193A0B3B0B0218000003240003253E0B0B0B0000042E011101120640187A196E2503253A0B3B0B3F190000050500021803253A0B3B0B49130000060B01110112060000073400021703253A0B3B0B49130000080B015517000009340003253A0B3B0B491300000A2E011101120640187A1903253A0B3B0B49133F1900000B48007F137D0100000C0F004913000000
- - Name: .debug_info
- Type: SHT_PROGBITS
- AddressAlign: 0x0000000000000001
- Content: AC0000000500010800000000010004000108000000000000000220054000000000002F0000000C00000002033C000000010309032420400000000000030405040420054000000000001E0000000157050601040501550801043C0000000625054000000000001800000007000000000901063C000000080C000000090A0107AA0000000000000A40054000000000000F000000015707010E3C0000000B400000004B05400000000000000C3C00000000
- - Name: .debug_rnglists
- Type: SHT_PROGBITS
- AddressAlign: 0x0000000000000001
- Content: 18000000050008000000000005200540000000000004051204171D00
- - Name: .debug_macinfo
- Type: SHT_PROGBITS
- AddressAlign: 0x0000000000000001
- Content: '00'
- - Name: .debug_line
- Type: SHT_PROGBITS
- AddressAlign: 0x0000000000000001
- Content: 7F000000050008004C000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E0223000000003D8C80E874CE6D5F1FC4A6544BE9D5B323000000003D8C80E874CE6D5F1FC4A6544BE9D5B300090220054000000000001605080A5B0515C60503063C0508063005016805004105030A21A00204000101
- - Name: .debug_line_str
- Type: SHT_PROGBITS
- Flags: [ SHF_MERGE, SHF_STRINGS ]
- AddressAlign: 0x0000000000000001
- Content: 2F686F6D652F756D622F74657374735F323031382F3130365F726E676C697374733200746573742E63707000
-Symbols:
Removed: lldb/trunk/lit/Breakpoint/debug_rnglist_offset_pair.test
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Breakpoint/debug_rnglist_offset_pair.test?rev=345156&view=auto
==============================================================================
--- lldb/trunk/lit/Breakpoint/debug_rnglist_offset_pair.test (original)
+++ lldb/trunk/lit/Breakpoint/debug_rnglist_offset_pair.test (removed)
@@ -1,33 +0,0 @@
-# RUN: yaml2obj %p/Inputs/debug_rnglist_offset_pair.yaml > %ttest
-# RUN: lldb-test breakpoints %ttest %s | FileCheck %s
-
-# The following code and invocation were used to produce asm file,
-# which was manually edited to add DW_RLE_base_address entry.
-# clang -S -g -gdwarf-5 -O1 test.cpp -o test.s
-# Then it was compiled and converted to yaml.
-#
-# int C = 0;
-# void foo(int P)
-# {
-# for (int I = 0; I < 2; ++I) {
-# int *W = &C;
-# *W &= P;
-# }
-# }
-#
-# int main ()
-# {
-# foo (1);
-# return 0;
-# }
-#
-# clang and LLD versions were 8.0.0 (trunk 344035)
-#
-# Output file contains .debug_rnglists section with entries:
-# DW_RLE_offset_pair and DW_RLE_base_address.
-
-b foo
-# CHECK-LABEL: b foo
-# CHECK: Address: {{.*}}`foo(int) + 5 at test.cpp:8:8
-
-
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=345157&r1=345156&r2=345157&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Wed Oct 24 09:21:56 2018
@@ -456,15 +456,20 @@ bool DWARFDebugInfoEntry::GetDIENamesAnd
break;
case DW_AT_ranges: {
- const DWARFDebugRangesBase *debug_ranges = dwarf2Data->DebugRanges();
- if (debug_ranges)
- debug_ranges->FindRanges(cu, form_value.Unsigned(), ranges);
- else
+ const DWARFDebugRanges *debug_ranges = dwarf2Data->DebugRanges();
+ if (debug_ranges) {
+ debug_ranges->FindRanges(cu->GetRangesBase(), form_value.Unsigned(), ranges);
+ // All DW_AT_ranges are relative to the base address of the compile
+ // unit. We add the compile unit base address to make sure all the
+ // addresses are properly fixed up.
+ ranges.Slide(cu->GetBaseAddress());
+ } else {
cu->GetSymbolFileDWARF()->GetObjectFile()->GetModule()->ReportError(
"{0x%8.8x}: DIE has DW_AT_ranges(0x%" PRIx64
") attribute yet DWARF has no .debug_ranges, please file a bug "
"and attach the file at the start of this error message",
m_offset, form_value.Unsigned());
+ }
} break;
case DW_AT_name:
@@ -1060,8 +1065,10 @@ size_t DWARFDebugInfoEntry::GetAttribute
dwarf2Data, cu, DW_AT_ranges, DW_INVALID_OFFSET,
check_specification_or_abstract_origin);
if (debug_ranges_offset != DW_INVALID_OFFSET) {
- if (DWARFDebugRangesBase *debug_ranges = dwarf2Data->DebugRanges())
- debug_ranges->FindRanges(cu, debug_ranges_offset, ranges);
+ if (DWARFDebugRanges *debug_ranges = dwarf2Data->DebugRanges())
+ debug_ranges->FindRanges(cu->GetRangesBase(), debug_ranges_offset,
+ ranges);
+ ranges.Slide(cu->GetBaseAddress());
} else if (check_hi_lo_pc) {
dw_addr_t lo_pc = LLDB_INVALID_ADDRESS;
dw_addr_t hi_pc = LLDB_INVALID_ADDRESS;
@@ -1716,9 +1723,12 @@ bool DWARFDebugInfoEntry::LookupAddress(
dwarf2Data, cu, DW_AT_ranges, DW_INVALID_OFFSET);
if (debug_ranges_offset != DW_INVALID_OFFSET) {
DWARFRangeList ranges;
- DWARFDebugRangesBase *debug_ranges = dwarf2Data->DebugRanges();
- debug_ranges->FindRanges(cu, debug_ranges_offset, ranges);
-
+ DWARFDebugRanges *debug_ranges = dwarf2Data->DebugRanges();
+ debug_ranges->FindRanges(cu->GetRangesBase(), debug_ranges_offset, ranges);
+ // All DW_AT_ranges are relative to the base address of the compile
+ // unit. We add the compile unit base address to make sure all the
+ // addresses are properly fixed up.
+ ranges.Slide(cu->GetBaseAddress());
if (ranges.FindEntryThatContains(address)) {
found_address = true;
// puts("***MATCH***");
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp?rev=345157&r1=345156&r2=345157&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp Wed Oct 24 09:21:56 2018
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
#include "DWARFDebugRanges.h"
-#include "DWARFUnit.h"
#include "SymbolFileDWARF.h"
#include "lldb/Utility/Stream.h"
#include <assert.h>
@@ -30,6 +29,8 @@ static dw_addr_t GetBaseAddressMarker(ui
DWARFDebugRanges::DWARFDebugRanges() : m_range_map() {}
+DWARFDebugRanges::~DWARFDebugRanges() {}
+
void DWARFDebugRanges::Extract(SymbolFileDWARF *dwarf2Data) {
DWARFRangeList range_list;
lldb::offset_t offset = 0;
@@ -111,27 +112,23 @@ void DWARFDebugRanges::Dump(Stream &s,
}
}
-bool DWARFDebugRanges::FindRanges(const DWARFUnit *cu,
+bool DWARFDebugRanges::FindRanges(dw_addr_t debug_ranges_base,
dw_offset_t debug_ranges_offset,
DWARFRangeList &range_list) const {
- dw_addr_t debug_ranges_address = cu->GetRangesBase() + debug_ranges_offset;
+ dw_addr_t debug_ranges_address = debug_ranges_base + debug_ranges_offset;
range_map_const_iterator pos = m_range_map.find(debug_ranges_address);
if (pos != m_range_map.end()) {
range_list = pos->second;
-
- // All DW_AT_ranges are relative to the base address of the compile
- // unit. We add the compile unit base address to make sure all the
- // addresses are properly fixed up.
- range_list.Slide(cu->GetBaseAddress());
return true;
}
return false;
}
-bool DWARFDebugRngLists::ExtractRangeList(
- const DWARFDataExtractor &data, uint8_t addrSize,
- lldb::offset_t *offset_ptr, std::vector<RngListEntry> &rangeList) {
- rangeList.clear();
+bool DWARFDebugRngLists::ExtractRangeList(const DWARFDataExtractor &data,
+ uint8_t addrSize,
+ lldb::offset_t *offset_ptr,
+ DWARFRangeList &rangeList) {
+ rangeList.Clear();
bool error = false;
while (!error) {
@@ -142,27 +139,14 @@ bool DWARFDebugRngLists::ExtractRangeLis
case DW_RLE_start_length: {
dw_addr_t begin = data.GetMaxU64(offset_ptr, addrSize);
dw_addr_t len = data.GetULEB128(offset_ptr);
- rangeList.push_back({DW_RLE_start_length, begin, len});
+ rangeList.Append(DWARFRangeList::Entry(begin, len));
break;
}
case DW_RLE_start_end: {
dw_addr_t begin = data.GetMaxU64(offset_ptr, addrSize);
dw_addr_t end = data.GetMaxU64(offset_ptr, addrSize);
- rangeList.push_back({DW_RLE_start_end, begin, end - begin});
- break;
- }
-
- case DW_RLE_base_address: {
- dw_addr_t base = data.GetMaxU64(offset_ptr, addrSize);
- rangeList.push_back({DW_RLE_base_address, base, 0});
- break;
- }
-
- case DW_RLE_offset_pair: {
- dw_addr_t begin = data.GetULEB128(offset_ptr);
- dw_addr_t end = data.GetULEB128(offset_ptr);
- rangeList.push_back({DW_RLE_offset_pair, begin, end});
+ rangeList.Append(DWARFRangeList::Entry(begin, end - begin));
break;
}
@@ -178,35 +162,6 @@ bool DWARFDebugRngLists::ExtractRangeLis
return false;
}
-bool DWARFDebugRngLists::FindRanges(const DWARFUnit *cu,
- dw_offset_t debug_ranges_offset,
- DWARFRangeList &range_list) const {
- range_list.Clear();
- dw_addr_t debug_ranges_address = cu->GetRangesBase() + debug_ranges_offset;
- auto pos = m_range_map.find(debug_ranges_address);
- if (pos != m_range_map.end()) {
- dw_addr_t BaseAddr = cu->GetBaseAddress();
- for (const RngListEntry &E : pos->second) {
- switch (E.encoding) {
- case DW_RLE_start_length:
- range_list.Append(DWARFRangeList::Entry(E.value0, E.value1));
- break;
- case DW_RLE_base_address:
- BaseAddr = E.value0;
- break;
- case DW_RLE_offset_pair:
- range_list.Append(
- DWARFRangeList::Entry(BaseAddr + E.value0, E.value1 - E.value0));
- break;
- default:
- llvm_unreachable("unexpected encoding");
- }
- }
- return true;
- }
- return false;
-}
-
void DWARFDebugRngLists::Extract(SymbolFileDWARF *dwarf2Data) {
const DWARFDataExtractor &data = dwarf2Data->get_debug_rnglists_data();
lldb::offset_t offset = 0;
@@ -236,8 +191,9 @@ void DWARFDebugRngLists::Extract(SymbolF
Offsets.push_back(data.GetPointer(&offset));
lldb::offset_t listOffset = offset;
- std::vector<RngListEntry> rangeList;
+ DWARFRangeList rangeList;
while (offset < end && ExtractRangeList(data, addrSize, &offset, rangeList)) {
+ rangeList.Sort();
m_range_map[listOffset] = rangeList;
listOffset = offset;
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h?rev=345157&r1=345156&r2=345157&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h Wed Oct 24 09:21:56 2018
@@ -15,26 +15,18 @@
#include <map>
-class DWARFDebugRangesBase {
-public:
- virtual ~DWARFDebugRangesBase(){};
-
- virtual void Extract(SymbolFileDWARF *dwarf2Data) = 0;
- virtual bool FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset,
- DWARFRangeList &range_list) const = 0;
-};
-
-class DWARFDebugRanges final : public DWARFDebugRangesBase {
+class DWARFDebugRanges {
public:
DWARFDebugRanges();
-
- virtual void Extract(SymbolFileDWARF *dwarf2Data) override;
- virtual bool FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset,
- DWARFRangeList &range_list) const override;
+ virtual ~DWARFDebugRanges();
+ virtual void Extract(SymbolFileDWARF *dwarf2Data);
static void Dump(lldb_private::Stream &s,
const lldb_private::DWARFDataExtractor &debug_ranges_data,
lldb::offset_t *offset_ptr, dw_addr_t cu_base_addr);
+ bool FindRanges(dw_addr_t debug_ranges_base,
+ dw_offset_t debug_ranges_offset,
+ DWARFRangeList &range_list) const;
protected:
bool Extract(SymbolFileDWARF *dwarf2Data, lldb::offset_t *offset_ptr,
@@ -47,25 +39,16 @@ protected:
};
// DWARF v5 .debug_rnglists section.
-class DWARFDebugRngLists final : public DWARFDebugRangesBase {
- struct RngListEntry {
- uint8_t encoding;
- uint64_t value0;
- uint64_t value1;
- };
-
+class DWARFDebugRngLists : public DWARFDebugRanges {
public:
void Extract(SymbolFileDWARF *dwarf2Data) override;
- bool FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset,
- DWARFRangeList &range_list) const override;
protected:
bool ExtractRangeList(const lldb_private::DWARFDataExtractor &data,
uint8_t addrSize, lldb::offset_t *offset_ptr,
- std::vector<RngListEntry> &list);
+ DWARFRangeList &list);
std::vector<uint64_t> Offsets;
- std::map<dw_offset_t, std::vector<RngListEntry>> m_range_map;
};
#endif // SymbolFileDWARF_DWARFDebugRanges_h_
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=345157&r1=345156&r2=345157&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Oct 24 09:21:56 2018
@@ -769,7 +769,7 @@ SymbolFileDWARF::GetDWARFCompileUnit(lld
return NULL;
}
-DWARFDebugRangesBase *SymbolFileDWARF::DebugRanges() {
+DWARFDebugRanges *SymbolFileDWARF::DebugRanges() {
if (m_ranges.get() == NULL) {
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Timer scoped_timer(func_cat, "%s this = %p", LLVM_PRETTY_FUNCTION,
@@ -786,7 +786,7 @@ DWARFDebugRangesBase *SymbolFileDWARF::D
return m_ranges.get();
}
-const DWARFDebugRangesBase *SymbolFileDWARF::DebugRanges() const {
+const DWARFDebugRanges *SymbolFileDWARF::DebugRanges() const {
return m_ranges.get();
}
@@ -3379,10 +3379,15 @@ VariableSP SymbolFileDWARF::ParseVariabl
case DW_AT_start_scope: {
if (form_value.Form() == DW_FORM_sec_offset) {
DWARFRangeList dwarf_scope_ranges;
- const DWARFDebugRangesBase *debug_ranges = DebugRanges();
- debug_ranges->FindRanges(die.GetCU(),
+ const DWARFDebugRanges *debug_ranges = DebugRanges();
+ debug_ranges->FindRanges(die.GetCU()->GetRangesBase(),
form_value.Unsigned(),
dwarf_scope_ranges);
+
+ // All DW_AT_start_scope are relative to the base address of the
+ // compile unit. We add the compile unit base address to make
+ // sure all the addresses are properly fixed up.
+ dwarf_scope_ranges.Slide(die.GetCU()->GetBaseAddress());
} else {
// TODO: Handle the case when DW_AT_start_scope have form
// constant. The
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=345157&r1=345156&r2=345157&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Wed Oct 24 09:21:56 2018
@@ -53,7 +53,8 @@ class DWARFDebugAranges;
class DWARFDebugInfo;
class DWARFDebugInfoEntry;
class DWARFDebugLine;
-class DWARFDebugRangesBase;
+class DWARFDebugRanges;
+class DWARFDebugRngLists;
class DWARFDeclContext;
class DWARFDIECollection;
class DWARFFormValue;
@@ -265,9 +266,9 @@ public:
const DWARFDebugInfo *DebugInfo() const;
- DWARFDebugRangesBase *DebugRanges();
+ DWARFDebugRanges *DebugRanges();
- const DWARFDebugRangesBase *DebugRanges() const;
+ const DWARFDebugRanges *DebugRanges() const;
const lldb_private::DWARFDataExtractor &DebugLocData();
@@ -511,7 +512,7 @@ protected:
typedef std::shared_ptr<std::set<DIERef>> DIERefSetSP;
typedef std::unordered_map<std::string, DIERefSetSP> NameToOffsetMap;
NameToOffsetMap m_function_scope_qualified_name_map;
- std::unique_ptr<DWARFDebugRangesBase> m_ranges;
+ std::unique_ptr<DWARFDebugRanges> m_ranges;
UniqueDWARFASTTypeMap m_unique_ast_type_map;
DIEToTypePtr m_die_to_type;
DIEToVariableSP m_die_to_variable_sp;
More information about the lldb-commits
mailing list