Skip to content

[lldb][Dwarf] Add missing timer when parsing .debug_abbrev. #86568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 27, 2024

Conversation

ZequanWu
Copy link
Contributor

@ZequanWu ZequanWu commented Mar 25, 2024

The time spent on parsing .debug_abbrev is also part of debug info parsing time.

@ZequanWu ZequanWu requested a review from Michael137 March 25, 2024 19:57
@ZequanWu ZequanWu requested a review from JDevlieghere as a code owner March 25, 2024 19:57
@llvmbot llvmbot added the lldb label Mar 25, 2024
@llvmbot
Copy link
Member

llvmbot commented Mar 25, 2024

@llvm/pr-subscribers-lldb

Author: Zequan Wu (ZequanWu)

Changes

ParseLineTable not only parses .debug_line but also constructs LineTable.

This moves m_parse_time into the the function body of ParseLLVMLineTable to more accurately reflect parsing time on .debug_line. This also add missing timer when parsing .debug_abbrev.


Full diff: https://github.com/llvm/llvm-project/pull/86568.diff

1 Files Affected:

  • (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+6-4)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 08ce7b82b0c16a..8039a35ed8941c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -145,8 +145,10 @@ static PluginProperties &GetGlobalPluginProperties() {
 
 static const llvm::DWARFDebugLine::LineTable *
 ParseLLVMLineTable(DWARFContext &context, llvm::DWARFDebugLine &line,
-                   dw_offset_t line_offset, dw_offset_t unit_offset) {
+                   dw_offset_t line_offset, dw_offset_t unit_offset,
+                   StatsDuration &parse_time) {
   Log *log = GetLog(DWARFLog::DebugInfo);
+  ElapsedTime elapsed(parse_time);
 
   llvm::DWARFDataExtractor data = context.getOrLoadLineData().GetAsLLVMDWARF();
   llvm::DWARFContext &ctx = context.GetAsLLVM();
@@ -693,6 +695,7 @@ llvm::DWARFDebugAbbrev *SymbolFileDWARF::DebugAbbrev() {
   if (debug_abbrev_data.GetByteSize() == 0)
     return nullptr;
 
+  ElapsedTime elapsed(m_parse_time);
   auto abbr =
       std::make_unique<llvm::DWARFDebugAbbrev>(debug_abbrev_data.GetAsLLVM());
   llvm::Error error = abbr->parse();
@@ -1228,10 +1231,9 @@ bool SymbolFileDWARF::ParseLineTable(CompileUnit &comp_unit) {
   if (offset == DW_INVALID_OFFSET)
     return false;
 
-  ElapsedTime elapsed(m_parse_time);
   llvm::DWARFDebugLine line;
-  const llvm::DWARFDebugLine::LineTable *line_table =
-      ParseLLVMLineTable(m_context, line, offset, dwarf_cu->GetOffset());
+  const llvm::DWARFDebugLine::LineTable *line_table = ParseLLVMLineTable(
+      m_context, line, offset, dwarf_cu->GetOffset(), m_parse_time);
 
   if (!line_table)
     return false;

Copy link

✅ With the latest revision this PR passed the Python code formatter.

Copy link

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Collaborator

@clayborg clayborg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SymbolFileDWARF::ParseLineTable() does more work after using llvm to parse the line table and we still need to measure this. So I believe that the current timer was in the correct position. Parse time for DWARF means how long to we take to both parse and to cleanup the information for LLDB to use, so the entire SymbolFileDWARF::ParseLineTable() function should be measured.

@ZequanWu ZequanWu changed the title [lldb][Dwarf] Fix dwarf parse time for line table and .debug_abbrev. [lldb][Dwarf] Add missing timer when parsing .debug_abbrev. Mar 26, 2024
@ZequanWu ZequanWu merged commit 9f84594 into llvm:main Mar 27, 2024
@ZequanWu ZequanWu deleted the lldb-dwarf-time branch March 27, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants