https://github.com/da-viper created 
https://github.com/llvm/llvm-project/pull/195853

This crash happens in lldb-dap when hovering inspecting over instruction 
addresses in a frame that does not have debug information.

>From 0946416df2b63bd385242dfadce7c29a0ffb6205 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <[email protected]>
Date: Tue, 5 May 2026 14:19:11 +0100
Subject: [PATCH] [lldb] Fix no compile unit crash.

This crash happens in lldb-dap when hovering inspecting over
instruction addresses in a frame that does not have debug information.
---
 lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp | 3 +++
 lldb/source/ValueObject/DILEval.cpp                    | 8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

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);
 }

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to