[Lldb-commits] [lldb] [lldb] Fix no compile unit crash. (PR #195853)
via lldb-commits
lldb-commits at lists.llvm.org
Tue May 5 06:24:17 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Ebuka Ezike (da-viper)
<details>
<summary>Changes</summary>
This crash happens in lldb-dap when hovering inspecting over instruction addresses in a frame that does not have debug information.
---
Full diff: https://github.com/llvm/llvm-project/pull/195853.diff
2 Files Affected:
- (modified) lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp (+3)
- (modified) lldb/source/ValueObject/DILEval.cpp (+6-2)
``````````diff
diff --git a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
index fdc0caa8dd731..74c29e2b803e3 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
@@ -99,6 +99,9 @@ Searcher::CallbackReturn BreakpointResolverFileRegex::SearchCallback(
return eCallbackReturnContinue;
CompileUnit *cu = context.comp_unit;
+ if (!cu)
+ return eCallbackReturnContinue;
+
FileSpec cu_file_spec = cu->GetPrimaryFile();
std::vector<uint32_t> line_matches;
context.target_sp->GetSourceManager().FindLinesMatchingRegex(
diff --git a/lldb/source/ValueObject/DILEval.cpp b/lldb/source/ValueObject/DILEval.cpp
index 42b7529e11345..47b4db4a044d2 100644
--- a/lldb/source/ValueObject/DILEval.cpp
+++ b/lldb/source/ValueObject/DILEval.cpp
@@ -17,6 +17,7 @@
#include "lldb/ValueObject/ValueObject.h"
#include "lldb/ValueObject/ValueObjectRegister.h"
#include "lldb/ValueObject/ValueObjectVariable.h"
+#include "llvm/Support/ErrorExtras.h"
#include "llvm/Support/FormatAdapters.h"
#include <memory>
@@ -43,11 +44,14 @@ static lldb::ValueObjectSP ArrayToPointerConversion(ValueObject &valobj,
}
static llvm::Expected<lldb::TypeSystemSP>
-GetTypeSystemFromCU(std::shared_ptr<StackFrame> ctx) {
+GetTypeSystemFromCU(const std::shared_ptr<StackFrame> &ctx) {
SymbolContext symbol_context =
ctx->GetSymbolContext(lldb::eSymbolContextCompUnit);
- lldb::LanguageType language = symbol_context.comp_unit->GetLanguage();
+ if (!symbol_context.comp_unit)
+ return llvm::createStringErrorV("no compile unit for frame: {}",
+ ctx->GetFunctionName());
+ lldb::LanguageType language = symbol_context.comp_unit->GetLanguage();
symbol_context = ctx->GetSymbolContext(lldb::eSymbolContextModule);
return symbol_context.module_sp->GetTypeSystemForLanguage(language);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/195853
More information about the lldb-commits
mailing list