summaryrefslogtreecommitdiffstats
path: root/lldb/tools/lldb-mi
diff options
context:
space:
mode:
authorAlexander Polyakov <polyakov.alx@gmail.com>2018-06-03 15:15:23 +0000
committerAlexander Polyakov <polyakov.alx@gmail.com>2018-06-03 15:15:23 +0000
commitcc92f5038e7c1070e1ab4271d114ea0baade5416 (patch)
tree04aea2a5439be90de8b32b3129349550858bdfc6 /lldb/tools/lldb-mi
parent1f60e2b41b0b274fccf98e26bbd1eb600af1f167 (diff)
downloadbcm5719-llvm-cc92f5038e7c1070e1ab4271d114ea0baade5416.tar.gz
bcm5719-llvm-cc92f5038e7c1070e1ab4271d114ea0baade5416.zip
[lldb, lldm-mi] Fix hanging of -exec-run command.
Summary: -exec-run command hanged in case of invalid or dummy target. Reviewers: aprantl, stella.stamenova Reviewed By: aprantl Subscribers: ki.stfu, llvm-commits, lldb-commits Differential Revision: https://reviews.llvm.org/D47678 llvm-svn: 333844
Diffstat (limited to 'lldb/tools/lldb-mi')
-rw-r--r--lldb/tools/lldb-mi/MICmdCmdExec.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lldb/tools/lldb-mi/MICmdCmdExec.cpp b/lldb/tools/lldb-mi/MICmdCmdExec.cpp
index 8fa63f4d98e..4a6f40b26d4 100644
--- a/lldb/tools/lldb-mi/MICmdCmdExec.cpp
+++ b/lldb/tools/lldb-mi/MICmdCmdExec.cpp
@@ -99,6 +99,19 @@ bool CMICmdCmdExecRun::ParseArgs() {
bool CMICmdCmdExecRun::Execute() {
CMICmnLLDBDebugSessionInfo &rSessionInfo(
CMICmnLLDBDebugSessionInfo::Instance());
+
+ {
+ // Check we have a valid target.
+ // Note: target created via 'file-exec-and-symbols' command.
+ lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
+ if (!sbTarget.IsValid() ||
+ sbTarget == rSessionInfo.GetDebugger().GetDummyTarget()) {
+ SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET_CURRENT),
+ m_cmdData.strMiCmd.c_str()));
+ return MIstatus::failure;
+ }
+ }
+
lldb::SBError error;
lldb::SBStream errMsg;
lldb::SBLaunchInfo launchInfo = rSessionInfo.GetTarget().GetLaunchInfo();
OpenPOWER on IntegriCloud