[Lldb-commits] [PATCH] D47678: [lldb, lldm-mi] Fix hanging of -exec-run command.

Alexander Polyakov via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Jun 2 14:44:00 PDT 2018


polyakov.alex updated this revision to Diff 149619.
polyakov.alex added a comment.

A bit of refactoring.


Repository:
  rL LLVM

https://reviews.llvm.org/D47678

Files:
  tools/lldb-mi/MICmdCmdExec.cpp


Index: tools/lldb-mi/MICmdCmdExec.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdExec.cpp
+++ tools/lldb-mi/MICmdCmdExec.cpp
@@ -99,6 +99,19 @@
 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();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47678.149619.patch
Type: text/x-patch
Size: 916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180602/ec94eb8f/attachment.bin>


More information about the lldb-commits mailing list