[Lldb-commits] [PATCH] D123746: [lldb] Prevent crash when adding a stop hook with --shlib
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 14 11:00:42 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG64d9b233b990: [lldb] Prevent crash when adding a stop hook with --shlib (authored by JDevlieghere).
Herald added a project: LLDB.
Changed prior to commit:
https://reviews.llvm.org/D123746?vs=422695&id=422915#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123746/new/
https://reviews.llvm.org/D123746
Files:
lldb/source/Symbol/SymbolContext.cpp
lldb/test/Shell/Commands/command-stop-hook-no-target.test
Index: lldb/test/Shell/Commands/command-stop-hook-no-target.test
===================================================================
--- /dev/null
+++ lldb/test/Shell/Commands/command-stop-hook-no-target.test
@@ -0,0 +1,4 @@
+# RUN: %clang_host -g %S/Inputs/main.c -o %t
+# RUN: %lldb -b -o 'target stop-hook add --name test --shlib test -o "p 95000 + 126"' -o 'file %t' -o 'b main' -o 'r' 2>&1 | FileCheck %s
+# CHECK: Stop hook #1 added
+# CHECK-NOT: 95126
Index: lldb/source/Symbol/SymbolContext.cpp
===================================================================
--- lldb/source/Symbol/SymbolContext.cpp
+++ lldb/source/Symbol/SymbolContext.cpp
@@ -960,8 +960,9 @@
// See if we can find the Module, if so stick it in the SymbolContext.
FileSpec module_file_spec(spec_string);
ModuleSpec module_spec(module_file_spec);
- lldb::ModuleSP module_sp(
- m_target_sp->GetImages().FindFirstModule(module_spec));
+ lldb::ModuleSP module_sp =
+ m_target_sp ? m_target_sp->GetImages().FindFirstModule(module_spec)
+ : nullptr;
m_type |= eModuleSpecified;
if (module_sp)
m_module_sp = module_sp;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123746.422915.patch
Type: text/x-patch
Size: 1163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220414/eac633f0/attachment-0001.bin>
More information about the lldb-commits
mailing list