This revision was automatically updated to reflect the committed changes. Closed by commit rL333844: [lldb, lldm-mi] Fix hanging of -exec-run command. (authored by apolyakov, committed by ).
Changed prior to commit: https://reviews.llvm.org/D47678?vs=149626&id=149641#toc Repository: rL LLVM https://reviews.llvm.org/D47678 Files: lldb/trunk/lit/tools/lldb-mi/exec/exec-run-wrong-binary.test lldb/trunk/lit/tools/lldb-mi/exec/lit.local.cfg lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp Index: lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp =================================================================== --- lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp +++ lldb/trunk/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(); Index: lldb/trunk/lit/tools/lldb-mi/exec/exec-run-wrong-binary.test =================================================================== --- lldb/trunk/lit/tools/lldb-mi/exec/exec-run-wrong-binary.test +++ lldb/trunk/lit/tools/lldb-mi/exec/exec-run-wrong-binary.test @@ -0,0 +1,6 @@ +# RUN: %lldbmi < %s | FileCheck %s + +# Test that -exec-run command won't hang in case of wrong name of binary file. + +-file-exec-and-symbols name.exe +# CHECK: ^error,msg="Command 'file-exec-and-symbols'. Target binary 'name.exe' is invalid. Index: lldb/trunk/lit/tools/lldb-mi/exec/lit.local.cfg =================================================================== --- lldb/trunk/lit/tools/lldb-mi/exec/lit.local.cfg +++ lldb/trunk/lit/tools/lldb-mi/exec/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes = ['.test']
Index: lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp =================================================================== --- lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp +++ lldb/trunk/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(); Index: lldb/trunk/lit/tools/lldb-mi/exec/exec-run-wrong-binary.test =================================================================== --- lldb/trunk/lit/tools/lldb-mi/exec/exec-run-wrong-binary.test +++ lldb/trunk/lit/tools/lldb-mi/exec/exec-run-wrong-binary.test @@ -0,0 +1,6 @@ +# RUN: %lldbmi < %s | FileCheck %s + +# Test that -exec-run command won't hang in case of wrong name of binary file. + +-file-exec-and-symbols name.exe +# CHECK: ^error,msg="Command 'file-exec-and-symbols'. Target binary 'name.exe' is invalid. Index: lldb/trunk/lit/tools/lldb-mi/exec/lit.local.cfg =================================================================== --- lldb/trunk/lit/tools/lldb-mi/exec/lit.local.cfg +++ lldb/trunk/lit/tools/lldb-mi/exec/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes = ['.test']
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits