summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-09-14 02:20:48 +0000
committerGreg Clayton <gclayton@apple.com>2010-09-14 02:20:48 +0000
commit016a95eb040364e47bc25ddbdfcdaf306ad7ce2b (patch)
treef8a87af145e212ec86e5207e59b8a045b30b6af3 /lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
parente1328dc0e958f8190492fc9c870ced6e1441bf01 (diff)
downloadbcm5719-llvm-016a95eb040364e47bc25ddbdfcdaf306ad7ce2b.tar.gz
bcm5719-llvm-016a95eb040364e47bc25ddbdfcdaf306ad7ce2b.zip
Looking at some of the test suite failures in DWARF in .o files with the
debug map showed that the location lists in the .o files needed some refactoring in order to work. The case that was failing was where a function that was in the "__TEXT.__textcoal_nt" in the .o file, and in the "__TEXT.__text" section in the main executable. This made symbol lookup fail due to the way we were finding a real address in the debug map which was by finding the section that the function was in in the .o file and trying to find this in the main executable. Now the section list supports finding a linked address in a section or any child sections. After fixing this, we ran into issue that were due to DWARF and how it represents locations lists. DWARF makes a list of address ranges and expressions that go along with those address ranges. The location addresses are expressed in terms of a compile unit address + offset. This works fine as long as nothing moves around. When stuff moves around and offsets change between the remapped compile unit base address and the new function address, then we can run into trouble. To deal with this, we now store supply a location list slide amount to any location list expressions that will allow us to make the location list addresses into zero based offsets from the object that owns the location list (always a function in our case). With these fixes we can now re-link random address ranges inside the debugger for use with our DWARF + debug map, incremental linking, and more. Another issue that arose when doing the DWARF in the .o files was that GCC 4.2 emits a ".debug_aranges" that only mentions functions that are externally visible. This makes .debug_aranges useless to us and we now generate a real address range lookup table in the DWARF parser at the same time as we index the name tables (that are needed because .debug_pubnames is just as useless). llvm-gcc doesn't generate a .debug_aranges section, though this could be fixed, we aren't going to rely upon it. Renamed a bunch of "UINT_MAX" to "UINT32_MAX". llvm-svn: 113829
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp39
1 files changed, 27 insertions, 12 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index 19eef06d3d1..50a7e9ba5ed 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -56,7 +56,7 @@ DWARFDebugInfoEntry::Attributes::FindAttributeIndex(dw_attr_t attr) const
if (pos->attr == attr)
return std::distance(beg, pos);
}
- return UINT_MAX;
+ return UINT32_MAX;
}
void
@@ -69,14 +69,14 @@ DWARFDebugInfoEntry::Attributes::Append(const DWARFCompileUnit *cu, dw_offset_t
bool
DWARFDebugInfoEntry::Attributes::ContainsAttribute(dw_attr_t attr) const
{
- return FindAttributeIndex(attr) != UINT_MAX;
+ return FindAttributeIndex(attr) != UINT32_MAX;
}
bool
DWARFDebugInfoEntry::Attributes::RemoveAttribute(dw_attr_t attr)
{
uint32_t attr_index = FindAttributeIndex(attr);
- if (attr_index != UINT_MAX)
+ if (attr_index != UINT32_MAX)
{
m_infos.erase(m_infos.begin() + attr_index);
return true;
@@ -584,9 +584,9 @@ DWARFDebugInfoEntry::Compare
if (a_attr_count != b_attr_count)
{
uint32_t is_decl_index = a_attrs.FindAttributeIndex(DW_AT_declaration);
- uint32_t a_name_index = UINT_MAX;
- uint32_t b_name_index = UINT_MAX;
- if (is_decl_index != UINT_MAX)
+ uint32_t a_name_index = UINT32_MAX;
+ uint32_t b_name_index = UINT32_MAX;
+ if (is_decl_index != UINT32_MAX)
{
if (a_attr_count == 2)
{
@@ -597,13 +597,13 @@ DWARFDebugInfoEntry::Compare
else
{
is_decl_index = b_attrs.FindAttributeIndex(DW_AT_declaration);
- if (is_decl_index != UINT_MAX && a_attr_count == 2)
+ if (is_decl_index != UINT32_MAX && a_attr_count == 2)
{
a_name_index = a_attrs.FindAttributeIndex(DW_AT_name);
b_name_index = b_attrs.FindAttributeIndex(DW_AT_name);
}
}
- if (a_name_index != UINT_MAX && b_name_index != UINT_MAX)
+ if (a_name_index != UINT32_MAX && b_name_index != UINT32_MAX)
{
if (a_attrs.ExtractFormValueAtIndex(dwarf2Data, a_name_index, a_form_value) &&
b_attrs.ExtractFormValueAtIndex(dwarf2Data, b_name_index, b_form_value))
@@ -794,6 +794,7 @@ DWARFDebugInfoEntry::GetDIENamesAndRanges
dw_addr_t lo_pc = DW_INVALID_ADDRESS;
dw_addr_t hi_pc = DW_INVALID_ADDRESS;
std::vector<dw_offset_t> die_offsets;
+ bool set_frame_base_loclist_addr = false;
if (m_abbrevDecl)
{
const DataExtractor& debug_info_data = dwarf2Data->get_debug_info_data();
@@ -892,18 +893,26 @@ DWARFDebugInfoEntry::GetDIENamesAndRanges
{
uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart();
uint32_t block_length = form_value.Unsigned();
- frame_base->SetOpcodeData(debug_info_data, block_offset, block_length, NULL);
+ frame_base->SetOpcodeData(debug_info_data, block_offset, block_length);
}
else
{
- const DataExtractor& debug_loc_data = dwarf2Data->get_debug_loc_data();
+ const DataExtractor &debug_loc_data = dwarf2Data->get_debug_loc_data();
const dw_offset_t debug_loc_offset = form_value.Unsigned();
size_t loc_list_length = DWARFLocationList::Size(debug_loc_data, debug_loc_offset);
if (loc_list_length > 0)
{
- Address base_address(cu->GetBaseAddress(), dwarf2Data->GetObjectFile()->GetSectionList());
- frame_base->SetOpcodeData(debug_loc_data, debug_loc_offset, loc_list_length, &base_address);
+ frame_base->SetOpcodeData(debug_loc_data, debug_loc_offset, loc_list_length);
+ if (lo_pc != DW_INVALID_ADDRESS)
+ {
+ assert (lo_pc >= cu->GetBaseAddress());
+ frame_base->SetLocationListSlide(lo_pc - cu->GetBaseAddress());
+ }
+ else
+ {
+ set_frame_base_loclist_addr = true;
+ }
}
}
}
@@ -928,6 +937,12 @@ DWARFDebugInfoEntry::GetDIENamesAndRanges
ranges.AddRange(lo_pc, lo_pc);
}
}
+
+ if (set_frame_base_loclist_addr)
+ {
+ assert (ranges.LowestAddress(0) >= cu->GetBaseAddress());
+ frame_base->SetLocationListSlide(ranges.LowestAddress(0) - cu->GetBaseAddress());
+ }
if (ranges.Size() == 0 || (name == NULL) || (mangled == NULL))
{
OpenPOWER on IntegriCloud