-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[LLDB] Expose checking if the symbol file exists/is loaded via SBModule #134163
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
Conversation
|
@llvm/pr-subscribers-lldb Author: Jacob Lalonde (Jlalond) ChangesThe motivation for this patch is that in Statistics.cpp we check to see if the module symfile is loaded 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. Full diff: https://github.com/llvm/llvm-project/pull/134163.diff 2 Files Affected:
diff --git a/lldb/include/lldb/API/SBModule.h b/lldb/include/lldb/API/SBModule.h
index 85332066ee687..651455bdb78d2 100644
--- a/lldb/include/lldb/API/SBModule.h
+++ b/lldb/include/lldb/API/SBModule.h
@@ -290,6 +290,9 @@ class LLDB_API SBModule {
lldb::SBAddress GetObjectFileHeaderAddress() const;
lldb::SBAddress GetObjectFileEntryPointAddress() const;
+ /// Get if the symbol file for this module is loaded.
+ bool IsDebugInfoLoaded() const;
+
/// Get the number of global modules.
static uint32_t GetNumberAllocatedModules();
diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp
index 985107ec68efd..4978a553f57c7 100644
--- a/lldb/source/API/SBModule.cpp
+++ b/lldb/source/API/SBModule.cpp
@@ -659,6 +659,18 @@ lldb::SBAddress SBModule::GetObjectFileEntryPointAddress() const {
return sb_addr;
}
+bool SBModule::IsDebugInfoLoaded() const {
+ LLDB_INSTRUMENT_VA(this);
+
+ ModuleSP module_sp(GetSP());
+ if (module_sp) {
+ SymbolFile *sym_file = module_sp->GetSymbolFile(/*create=*/false);
+ return sym_file && sym_file->GetLoadDebugInfoEnabled();
+ }
+
+ return false;
+}
+
uint32_t SBModule::GetNumberAllocatedModules() {
LLDB_INSTRUMENT();
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/15374 Here is the relevant piece of the build log for the reference |
|
Seems unrelated, but I will check in the morning. |
|
Just a quick comment here for this: This isn't clear what it is returning. What it seems like it should be returning from the name is "are there debug symbols in this module. But what is actually exposed should be more like: The new API added as is seems like we are saying "is there some debug info in the symbol file". But this will always return true unless symbols on demand is restricting debug info access. If we have a "a.out" binary that has no debug info, it will have a "SymbolFileSymtab" and with no debug info and it will return true because it has a symbol file and it isn't restricted by symbols on demand. Can we revert this and switch to my above suggestion if everyone agrees? |
…s loaded via SBModule" (#134341) Reverts llvm/llvm-project#134163 Reverting while @clayborg and I come up with a better API
The motivation for this patch is that in Statistics.cpp we check to see if the module symfile is loaded 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.