From e122877f10988d791cd7d7cd667ce17febec3a16 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Mon, 1 Mar 2021 15:26:35 -0800 Subject: Add a progress class that can track long running operations in LLDB. LLDB can often appear deadlocked to users that use IDEs when it is indexing DWARF, or parsing symbol tables. These long running operations can make a debug session appear to be doing nothing even though a lot of work is going on inside LLDB. This patch adds a public API to allow clients to listen to debugger events that report progress and will allow UI to create an activity window or display that can show users what is going on and keep them informed of expensive operations that are going on inside LLDB. Differential Revision: https://reviews.llvm.org/D97739 --- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp') diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index df0586367832..ae432ac89eaa 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -16,6 +16,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/PluginManager.h" +#include "lldb/Core/Progress.h" #include "lldb/Core/Section.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/LZMA.h" @@ -37,6 +38,7 @@ #include "llvm/Object/Decompressor.h" #include "llvm/Support/ARMBuildAttributes.h" #include "llvm/Support/CRC.h" +#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MipsABIFlags.h" @@ -1861,7 +1863,7 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) { // unified section list. if (GetType() != eTypeDebugInfo) unified_section_list = *m_sections_up; - + // If there's a .gnu_debugdata section, we'll try to read the .symtab that's // embedded in there and replace the one in the original object file (if any). // If there's none in the orignal object file, we add it to it. @@ -1923,7 +1925,7 @@ std::shared_ptr ObjectFileELF::GetGnuDebugDataObjectFile() { ArchSpec spec = m_gnu_debug_data_object_file->GetArchitecture(); if (spec && m_gnu_debug_data_object_file->SetModulesArchitecture(spec)) return m_gnu_debug_data_object_file; - + return nullptr; } @@ -2707,6 +2709,9 @@ Symtab *ObjectFileELF::GetSymtab() { if (!module_sp) return nullptr; + Progress progress(llvm::formatv("Parsing symbol table for {0}", + m_file.GetFilename().AsCString(""))); + // We always want to use the main object file so we (hopefully) only have one // cached copy of our symtab, dynamic sections, etc. ObjectFile *module_obj_file = module_sp->GetObjectFile(); -- cgit v1.2.3