[lldb] Prevent crash when adding a stop hook with --shlib
authorJonas Devlieghere <jonas@devlieghere.com>
Thu, 14 Apr 2022 17:45:11 +0000 (10:45 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Thu, 14 Apr 2022 18:00:21 +0000 (11:00 -0700)
commit64d9b233b9905a951b450eff5b258707a35e110f
treec9dc813737b883faf5fcb3dafe225e747fdfabb3
parent104e086a4f095cd53a384f0e37c97506106eda3e
[lldb] Prevent crash when adding a stop hook with --shlib

Currently, lldb crashes when adding a stop hook with --shlib because we
unconditionally use the target in SymbolContextSpecifier::AddSpecification.
This patch prevents the crash and add a test.

rdar://68524781

Differential revision: https://reviews.llvm.org/D123746
lldb/source/Symbol/SymbolContext.cpp
lldb/test/Shell/Commands/command-stop-hook-no-target.test [new file with mode: 0644]