Skip to content

Commit b8d8405

Browse files
authored
[LLDB] Expose checking if the symbol file exists/is loaded via SBModule (#134163)
The motivation for this patch is that in Statistics.cpp we [check to see if the module symfile is loaded](https://github.com/llvm/llvm-project/blob/990a086d9da0bc2fd53a6a4c95ecbbe23a297a83/lldb/source/Target/Statistics.cpp#L353C60-L353C75) to calculate how much debug info has been loaded. I have an external utility that only wants to look at the loaded debug info, which isn't exposed by the SBAPI.
1 parent e3c0565 commit b8d8405

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lldb/include/lldb/API/SBModule.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ class LLDB_API SBModule {
290290
lldb::SBAddress GetObjectFileHeaderAddress() const;
291291
lldb::SBAddress GetObjectFileEntryPointAddress() const;
292292

293+
/// Get if the symbol file for this module is loaded.
294+
bool IsDebugInfoLoaded() const;
295+
293296
/// Get the number of global modules.
294297
static uint32_t GetNumberAllocatedModules();
295298

lldb/source/API/SBModule.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,18 @@ lldb::SBAddress SBModule::GetObjectFileEntryPointAddress() const {
659659
return sb_addr;
660660
}
661661

662+
bool SBModule::IsDebugInfoLoaded() const {
663+
LLDB_INSTRUMENT_VA(this);
664+
665+
ModuleSP module_sp(GetSP());
666+
if (module_sp) {
667+
SymbolFile *sym_file = module_sp->GetSymbolFile(/*create=*/false);
668+
return sym_file && sym_file->GetLoadDebugInfoEnabled();
669+
}
670+
671+
return false;
672+
}
673+
662674
uint32_t SBModule::GetNumberAllocatedModules() {
663675
LLDB_INSTRUMENT();
664676

0 commit comments

Comments
 (0)