[Lldb-commits] [PATCH] Fixed parsing of the .debug_aranges section.
Greg Clayton
gclayton at apple.com
Mon Sep 9 16:09:54 PDT 2013
Looks good.
Greg
On Sep 9, 2013, at 3:52 PM, Richard Mitton <richard at codersnotes.com> wrote:
> On 09/09/2013 03:37 PM, Greg Clayton wrote:
>> I would change the std::set to use the dw_offset_t instead of the "DWARFCompileUnit *" and that way you can skip the compile unit lookup every time for each address range. Then the first loop becomes:
>
> Agreed, that would speed it up a little. Done.
>
> http://llvm-reviews.chandlerc.com/D1609
>
> CHANGE SINCE LAST DIFF
> http://llvm-reviews.chandlerc.com/D1609?vs=4071&id=4145#toc
>
> Files:
> source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
> source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
>
> Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
> ===================================================================
> --- source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
> +++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
> @@ -66,18 +66,35 @@
> m_cu_aranges_ap->Extract (debug_aranges_data);
>
> }
> - else
> +
> + // Make a list of all CUs represented by the arange data in the file.
> + std::set<dw_offset_t> cus_with_data;
> + for (size_t n=0;n<m_cu_aranges_ap.get()->GetNumRanges();n++)
> {
> - if (log)
> - log->Printf ("DWARFDebugInfo::GetCompileUnitAranges() for \"%s\" by parsing",
> - m_dwarf2Data->GetObjectFile()->GetFileSpec().GetPath().c_str());
> - const size_t num_compile_units = GetNumCompileUnits();
> - const bool clear_dies_if_already_not_parsed = true;
> - for (size_t idx = 0; idx < num_compile_units; ++idx)
> + dw_offset_t offset = m_cu_aranges_ap.get()->OffsetAtIndex(n);
> + if (offset != DW_INVALID_OFFSET)
> + cus_with_data.insert (offset);
> + }
> +
> + // Manually build arange data for everything that wasn't in the .debug_aranges table.
> + bool printed = false;
> + const size_t num_compile_units = GetNumCompileUnits();
> + const bool clear_dies_if_already_not_parsed = true;
> + for (size_t idx = 0; idx < num_compile_units; ++idx)
> + {
> + DWARFCompileUnit* cu = GetCompileUnitAtIndex(idx);
> +
> + dw_offset_t offset = cu->GetOffset();
> + if (cus_with_data.find(offset) == cus_with_data.end())
> {
> - DWARFCompileUnit* cu = GetCompileUnitAtIndex(idx);
> - if (cu)
> - cu->BuildAddressRangeTable (m_dwarf2Data, m_cu_aranges_ap.get(), clear_dies_if_already_not_parsed);
> + if (log)
> + {
> + if (!printed)
> + log->Printf ("DWARFDebugInfo::GetCompileUnitAranges() for \"%s\" by parsing",
> + m_dwarf2Data->GetObjectFile()->GetFileSpec().GetPath().c_str());
> + printed = true;
> + }
> + cu->BuildAddressRangeTable (m_dwarf2Data, m_cu_aranges_ap.get(), clear_dies_if_already_not_parsed);
> }
> }
>
> Index: source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
> ===================================================================
> --- source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
> +++ source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
> @@ -174,10 +174,11 @@
> {
> strm->Printf ("Logging categories for '%s':\n"
> " all - turn on all available logging categories\n"
> - " info - log the parsing if .debug_info\n"
> - " line - log the parsing if .debug_line\n"
> - " pubnames - log the parsing if .debug_pubnames\n"
> - " pubtypes - log the parsing if .debug_pubtypes\n"
> + " info - log the parsing of .debug_info\n"
> + " line - log the parsing of .debug_line\n"
> + " pubnames - log the parsing of .debug_pubnames\n"
> + " pubtypes - log the parsing of .debug_pubtypes\n"
> + " aranges - log the parsing of .debug_aranges\n"
> " lookups - log any lookups that happen by name, regex, or address\n"
> " completion - log struct/unions/class type completions\n"
> " map - log insertions of object files into DWARF debug maps\n",
> <D1609.2.patch>_______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
More information about the lldb-commits
mailing list