[Lldb-commits] [lldb] r333844 - [lldb, lldm-mi] Fix hanging of -exec-run command.
Author: apolyakov Date: Sun Jun 3 08:15:23 2018 New Revision: 333844 URL: http://llvm.org/viewvc/llvm-project?rev=333844&view=rev Log: [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 Added: lldb/trunk/lit/tools/lldb-mi/exec/ lldb/trunk/lit/tools/lldb-mi/exec/exec-run-wrong-binary.test lldb/trunk/lit/tools/lldb-mi/exec/lit.local.cfg Modified: lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp Added: lldb/trunk/lit/tools/lldb-mi/exec/exec-run-wrong-binary.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/exec/exec-run-wrong-binary.test?rev=333844&view=auto == --- lldb/trunk/lit/tools/lldb-mi/exec/exec-run-wrong-binary.test (added) +++ lldb/trunk/lit/tools/lldb-mi/exec/exec-run-wrong-binary.test Sun Jun 3 08:15:23 2018 @@ -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. Added: lldb/trunk/lit/tools/lldb-mi/exec/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/exec/lit.local.cfg?rev=333844&view=auto == --- lldb/trunk/lit/tools/lldb-mi/exec/lit.local.cfg (added) +++ lldb/trunk/lit/tools/lldb-mi/exec/lit.local.cfg Sun Jun 3 08:15:23 2018 @@ -0,0 +1 @@ +config.suffixes = ['.test'] Modified: lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp?rev=333844&r1=333843&r2=333844&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp Sun Jun 3 08:15:23 2018 @@ -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(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r333963 - [lldb, lldb-mi] Enable lldb-mi -break-insert test on Windows.
Author: apolyakov Date: Mon Jun 4 15:39:40 2018 New Revision: 333963 URL: http://llvm.org/viewvc/llvm-project?rev=333963&view=rev Log: [lldb, lldb-mi] Enable lldb-mi -break-insert test on Windows. Summary: The default name for a compiler output on Linux is `a.out`, while on Windows it's `a.exe`. But if we add option `-o a.exe`, the compiler will create the executable `a.exe` on the both systems. Reviewers: aprantl, stella.stamenova Reviewed By: stella.stamenova Subscribers: ki.stfu, llvm-commits, lldb-commits Differential Revision: https://reviews.llvm.org/D47679 Modified: lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test Modified: lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test?rev=333963&r1=333962&r2=333963&view=diff == --- lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test (original) +++ lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test Mon Jun 4 15:39:40 2018 @@ -1,8 +1,7 @@ -# REQUIRES: nowindows +# XFAIL: windows # -> llvm.org/pr24452 -# Rather than XFAILing the test, skip it on Windows because it hangs - -# RUN: %cc %p/inputs/break-insert.c -g +# +# RUN: %cc -o a.exe %p/inputs/break-insert.c -g # RUN: %lldbmi < %s | FileCheck %s # Test that a breakpoint can be inserted before creating a target. @@ -10,7 +9,7 @@ -break-insert breakpoint # CHECK: ^done,bkpt={number="1" --file-exec-and-symbols a.out +-file-exec-and-symbols a.exe # CHECK: ^done -exec-run ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r334215 - [lldb-mi] Re-implement MI -exec-next command.
Author: apolyakov Date: Thu Jun 7 12:09:01 2018 New Revision: 334215 URL: http://llvm.org/viewvc/llvm-project?rev=334215&view=rev Log: [lldb-mi] Re-implement MI -exec-next command. Summary: Now -exec-next command uses SB API for stepping over. Reviewers: aprantl, clayborg, stella.stamenova, labath Reviewed By: aprantl, clayborg, labath Subscribers: labath, ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D47797 Added: lldb/trunk/lit/tools/lldb-mi/exec/exec-next.test lldb/trunk/lit/tools/lldb-mi/exec/inputs/ lldb/trunk/lit/tools/lldb-mi/exec/inputs/main.c Modified: lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp Added: lldb/trunk/lit/tools/lldb-mi/exec/exec-next.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/exec/exec-next.test?rev=334215&view=auto == --- lldb/trunk/lit/tools/lldb-mi/exec/exec-next.test (added) +++ lldb/trunk/lit/tools/lldb-mi/exec/exec-next.test Thu Jun 7 12:09:01 2018 @@ -0,0 +1,30 @@ +# XFAIL: windows +# -> llvm.org/pr24452 +# +# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %lldbmi %t < %s | FileCheck %s + +# Test lldb-mi -exec-next command. + +# Check that we have a valid target created via '%lldbmi %t'. +# CHECK: ^done + +-break-insert main +# CHECK: ^done,bkpt={number="1" + +-exec-run +# CHECK: ^running +# CHECK: *stopped,reason="breakpoint-hit" + +-exec-next --thread 0 +# Check that exec-next can process the case of invalid thread ID. +# CHECK: ^error,msg="Command 'exec-next'. Thread ID invalid" + +-exec-next --thread 1 +# CHECK: ^running +# CHECK: *stopped,reason="end-stepping-range" + +-exec-next +# Check that exec-next can step over in a selected thread. +# CHECK: ^running +# CHECK: *stopped,reason="end-stepping-range" Added: lldb/trunk/lit/tools/lldb-mi/exec/inputs/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/exec/inputs/main.c?rev=334215&view=auto == --- lldb/trunk/lit/tools/lldb-mi/exec/inputs/main.c (added) +++ lldb/trunk/lit/tools/lldb-mi/exec/inputs/main.c Thu Jun 7 12:09:01 2018 @@ -0,0 +1,4 @@ +int main(void) { + int x = 0; + return x; +} Modified: lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp?rev=334215&r1=334214&r2=334215&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp Thu Jun 7 12:09:01 2018 @@ -22,6 +22,7 @@ #include "lldb/API/SBCommandInterpreter.h" #include "lldb/API/SBProcess.h" #include "lldb/API/SBStream.h" +#include "lldb/API/SBThread.h" #include "lldb/lldb-enumerations.h" // In-house headers: @@ -378,12 +379,17 @@ bool CMICmdCmdExecNext::Execute() { CMICmnLLDBDebugSessionInfo &rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance()); - lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger(); - CMIUtilString strCmd("thread step-over"); - if (nThreadId != UINT64_MAX) -strCmd += CMIUtilString::Format(" %llu", nThreadId); - rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult, - false); + + if (nThreadId != UINT64_MAX) { +lldb::SBThread sbThread = rSessionInfo.GetProcess().GetThreadByIndexID(nThreadId); +if (!sbThread.IsValid()) { + SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_INVALID), + m_cmdData.strMiCmd.c_str(), + m_constStrArgThread.c_str())); + return MIstatus::failure; +} +sbThread.StepOver(); + } else rSessionInfo.GetProcess().GetSelectedThread().StepOver(); return MIstatus::success; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r334245 - [lldb-mi] Add overloaded method for setting an error.
Author: apolyakov Date: Thu Jun 7 16:03:49 2018 New Revision: 334245 URL: http://llvm.org/viewvc/llvm-project?rev=334245&view=rev Log: [lldb-mi] Add overloaded method for setting an error. Reviewers: aprantl, clayborg Reviewed By: clayborg Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D47914 Modified: lldb/trunk/tools/lldb-mi/MICmdBase.cpp lldb/trunk/tools/lldb-mi/MICmdBase.h Modified: lldb/trunk/tools/lldb-mi/MICmdBase.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdBase.cpp?rev=334245&r1=334244&r2=334245&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdBase.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmdBase.cpp Thu Jun 7 16:03:49 2018 @@ -214,6 +214,23 @@ void CMICmdBase::SetError(const CMIUtilS //++ // +// Details: Short cut function to enter error information into the command's +// metadata object and set the command's error status. +// Type:Method. +// Args:error - (R) Command result description. +// Return: None. +// Throws: None. +//-- +void CMICmdBase::SetError(const lldb::SBError &error) { + const char *error_cstr = error.GetCString(); + if (error_cstr) +SetError(error_cstr); + else +SetError("unknown error"); +} + +//++ +// // Details: Ask a command to provide its unique identifier. // Type:Method. // Args:A unique identifier for this command class. Modified: lldb/trunk/tools/lldb-mi/MICmdBase.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdBase.h?rev=334245&r1=334244&r2=334245&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdBase.h (original) +++ lldb/trunk/tools/lldb-mi/MICmdBase.h Thu Jun 7 16:03:49 2018 @@ -12,6 +12,8 @@ // C Includes // C++ Includes // Other libraries and framework includes +#include "lldb/API/SBError.h" + // Project includes #include "MICmdArgSet.h" #include "MICmdData.h" @@ -80,6 +82,7 @@ public: // Methods: protected: void SetError(const CMIUtilString &rErrMsg); + void SetError(const lldb::SBError &error); template T *GetOption(const CMIUtilString &vStrOptionName); bool ParseValidateCmdOptions(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r334350 - [lldb, lldb-mi] Re-implement MI -exec-continue command.
Author: apolyakov Date: Sat Jun 9 08:11:37 2018 New Revision: 334350 URL: http://llvm.org/viewvc/llvm-project?rev=334350&view=rev Log: [lldb, lldb-mi] Re-implement MI -exec-continue command. Summary: Now -exec-continue command uses SB API to resume target's process. Reviewers: aprantl, clayborg, labath Reviewed By: clayborg Subscribers: apolyakov, labath, ki.stfu, llvm-commits, lldb-commits Differential Revision: https://reviews.llvm.org/D47415 Added: lldb/trunk/lit/tools/lldb-mi/exec/exec-continue.test Modified: lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp lldb/trunk/tools/lldb-mi/MICmdCmdExec.h Added: lldb/trunk/lit/tools/lldb-mi/exec/exec-continue.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/exec/exec-continue.test?rev=334350&view=auto == --- lldb/trunk/lit/tools/lldb-mi/exec/exec-continue.test (added) +++ lldb/trunk/lit/tools/lldb-mi/exec/exec-continue.test Sat Jun 9 08:11:37 2018 @@ -0,0 +1,20 @@ +# XFAIL: windows +# -> llvm.org/pr24452 +# +# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %lldbmi %t < %s | FileCheck %s + +# Test lldb-mi -exec-continue command. + +# Check that we have a valid target created via '%lldbmi %t'. +# CHECK: ^done + +-break-insert main +# CHECK: ^done,bkpt={number="1" + +-exec-run +# CHECK: ^running +# CHECK: *stopped,reason="breakpoint-hit" + +-exec-continue +# CHECK: ^running Modified: lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp?rev=334350&r1=334349&r2=334350&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp Sat Jun 9 08:11:37 2018 @@ -233,15 +233,10 @@ CMICmdCmdExecContinue::~CMICmdCmdExecCon // Throws: None. //-- bool CMICmdCmdExecContinue::Execute() { - const char *pCmd = "continue"; - CMICmnLLDBDebugSessionInfo &rSessionInfo( - CMICmnLLDBDebugSessionInfo::Instance()); - const lldb::ReturnStatus rtn = - rSessionInfo.GetDebugger().GetCommandInterpreter().HandleCommand( - pCmd, m_lldbResult); - MIunused(rtn); - - if (m_lldbResult.GetErrorSize() == 0) { + lldb::SBError error = + CMICmnLLDBDebugSessionInfo::Instance().GetProcess().Continue(); + + if (error.Success()) { // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM if (!CMIDriver::Instance().SetDriverStateRunningDebugging()) { const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription()); @@ -250,18 +245,11 @@ bool CMICmdCmdExecContinue::Execute() { rErrMsg.c_str())); return MIstatus::failure; } - } else { -// ToDo: Re-evaluate if this is required when application near finished as -// this is parsing LLDB error message -// which seems a hack and is code brittle -const char *pLldbErr = m_lldbResult.GetError(); -const CMIUtilString strLldbMsg(CMIUtilString(pLldbErr).StripCREndOfLine()); -if (strLldbMsg == "error: Process must be launched.") { - CMIDriver::Instance().SetExitApplicationFlag(true); -} +return MIstatus::success; } - return MIstatus::success; + SetError(error.GetCString()); + return MIstatus::failure; } //++ @@ -276,19 +264,9 @@ bool CMICmdCmdExecContinue::Execute() { // Throws: None. //-- bool CMICmdCmdExecContinue::Acknowledge() { - if (m_lldbResult.GetErrorSize() > 0) { -const CMICmnMIValueConst miValueConst(m_lldbResult.GetError()); -const CMICmnMIValueResult miValueResult("message", miValueConst); -const CMICmnMIResultRecord miRecordResult( -m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, -miValueResult); -m_miResultRecord = miRecordResult; - } else { -const CMICmnMIResultRecord miRecordResult( -m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); -m_miResultRecord = miRecordResult; - } - + const CMICmnMIResultRecord miRecordResult( + m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); + m_miResultRecord = miRecordResult; return MIstatus::success; } Modified: lldb/trunk/tools/lldb-mi/MICmdCmdExec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdExec.h?rev=334350&r1=334349&r2=334350&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdCmdExec.h (original) +++ lldb/trunk/tools/lldb-mi/MICmdCmdExec.h Sat Jun 9 08:11:37 2018 @@ -93,8 +93,6 @@ public: /* dtor */ ~CMICmdCmdExecContinue() override; // Attributes: -private: - lldb::SBCommandReturnObject m_lldbResult; }; //++ ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r334364 - [lldb-mi] Re-implement MI -exec-step command.
Author: apolyakov Date: Sun Jun 10 07:58:29 2018 New Revision: 334364 URL: http://llvm.org/viewvc/llvm-project?rev=334364&view=rev Log: [lldb-mi] Re-implement MI -exec-step command. Summary: Now -exec-step uses SB API instead of HandleCommand hack. Reviewers: aprantl, clayborg, labath, stella.stamenova Reviewed By: aprantl Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D47838 Added: lldb/trunk/lit/tools/lldb-mi/exec/exec-step.test Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp lldb/trunk/tools/lldb-mi/MICmdCmdExec.h Added: lldb/trunk/lit/tools/lldb-mi/exec/exec-step.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/exec/exec-step.test?rev=334364&view=auto == --- lldb/trunk/lit/tools/lldb-mi/exec/exec-step.test (added) +++ lldb/trunk/lit/tools/lldb-mi/exec/exec-step.test Sun Jun 10 07:58:29 2018 @@ -0,0 +1,30 @@ +# XFAIL: windows +# -> llvm.org/pr24452 +# +# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %lldbmi %t < %s | FileCheck %s + +# Test lldb-mi -exec-step command. + +# Check that we have a valid target created via '%lldbmi %t'. +# CHECK: ^done + +-break-insert main +# CHECK: ^done,bkpt={number="1" + +-exec-run +# CHECK: ^running +# CHECK: *stopped,reason="breakpoint-hit" + +-exec-step --thread 0 +# Check that exec-step can process the case of invalid thread ID. +# CHECK: ^error,msg="Command 'exec-step'. Thread ID invalid" + +-exec-step --thread 1 +# CHECK: ^running +# CHECK: *stopped,reason="end-stepping-range" + +-exec-step +# Check that exec-step can step-in in a selected thread. +# CHECK: ^running +# CHECK: *stopped,reason="end-stepping-range" Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py?rev=334364&r1=334363&r2=334364&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py Sun Jun 10 07:58:29 2018 @@ -330,9 +330,9 @@ class MiExecTestCase(lldbmi_testcase.MiT # Test that an invalid --thread is handled self.runCmd("-exec-step --thread 0") -self.expect("\^error,message=\"error: Thread index 0 is out of range") +self.expect("\^error,msg=\"Command 'exec-step'. Thread ID invalid") self.runCmd("-exec-step --thread 10") -self.expect("\^error,message=\"error: Thread index 10 is out of range") +self.expect("\^error,msg=\"Command 'exec-step'. Thread ID invalid") # Test that an invalid --frame is handled # FIXME: no error is returned Modified: lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp?rev=334364&r1=334363&r2=334364&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp Sun Jun 10 07:58:29 2018 @@ -487,14 +487,26 @@ bool CMICmdCmdExecStep::Execute() { CMICmnLLDBDebugSessionInfo &rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance()); - lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger(); - CMIUtilString strCmd("thread step-in"); - if (nThreadId != UINT64_MAX) -strCmd += CMIUtilString::Format(" %llu", nThreadId); - rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult, - false); - return MIstatus::success; + lldb::SBError error; + if (nThreadId != UINT64_MAX) { +lldb::SBThread sbThread = +rSessionInfo.GetProcess().GetThreadByIndexID(nThreadId); +if (!sbThread.IsValid()) { + SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_INVALID), + m_cmdData.strMiCmd.c_str(), + m_constStrArgThread.c_str())); + return MIstatus::failure; +} +sbThread.StepInto(nullptr, LLDB_INVALID_LINE_NUMBER, error); + } else rSessionInfo.GetProcess().GetSelectedThread().StepInto( + nullptr, LLDB_INVALID_LINE_NUMBER, error); + + if (error.Success()) +return MIstatus::success; + + SetError(error.GetCString()); + return MIstatus::failure; } //++ @@ -509,21 +521,8 @@ bool CMICmdCmdExecStep::Execute() { // Throws: None. //-- bool CMICmdCmdExecStep::Acknowledge() { - if (m_lldbResult.GetErrorSize() > 0) { -const char *pLldbErr = m_lldbResult.GetError(); -MIunused(pLldbErr); -const CMICmnMIValueConst miValueConst(m_lldbResult.GetError()); -const CMICmnMIValueResult miValueResult("message",
[Lldb-commits] [lldb] r334860 - Revert "[lldb-mi] Add overload method for setting an error"
Author: apolyakov Date: Fri Jun 15 13:20:39 2018 New Revision: 334860 URL: http://llvm.org/viewvc/llvm-project?rev=334860&view=rev Log: Revert "[lldb-mi] Add overload method for setting an error" Summary: This reverts commit r334245 because it duplicates functionality of Status::AsCString used in SBError. Reviewers: aprantl, clayborg Reviewed By: clayborg Subscribers: lldb-commits, ki.stfu Differential Revision: https://reviews.llvm.org/D48212 Modified: lldb/trunk/tools/lldb-mi/MICmdBase.cpp lldb/trunk/tools/lldb-mi/MICmdBase.h Modified: lldb/trunk/tools/lldb-mi/MICmdBase.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdBase.cpp?rev=334860&r1=334859&r2=334860&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdBase.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmdBase.cpp Fri Jun 15 13:20:39 2018 @@ -214,23 +214,6 @@ void CMICmdBase::SetError(const CMIUtilS //++ // -// Details: Short cut function to enter error information into the command's -// metadata object and set the command's error status. -// Type:Method. -// Args:error - (R) Command result description. -// Return: None. -// Throws: None. -//-- -void CMICmdBase::SetError(const lldb::SBError &error) { - const char *error_cstr = error.GetCString(); - if (error_cstr) -SetError(error_cstr); - else -SetError("unknown error"); -} - -//++ -// // Details: Ask a command to provide its unique identifier. // Type:Method. // Args:A unique identifier for this command class. Modified: lldb/trunk/tools/lldb-mi/MICmdBase.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdBase.h?rev=334860&r1=334859&r2=334860&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdBase.h (original) +++ lldb/trunk/tools/lldb-mi/MICmdBase.h Fri Jun 15 13:20:39 2018 @@ -12,8 +12,6 @@ // C Includes // C++ Includes // Other libraries and framework includes -#include "lldb/API/SBError.h" - // Project includes #include "MICmdArgSet.h" #include "MICmdData.h" @@ -82,7 +80,6 @@ public: // Methods: protected: void SetError(const CMIUtilString &rErrMsg); - void SetError(const lldb::SBError &error); template T *GetOption(const CMIUtilString &vStrOptionName); bool ParseValidateCmdOptions(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r335180 - Improve SBThread's stepping API using SBError parameter.
Author: apolyakov Date: Wed Jun 20 14:43:16 2018 New Revision: 335180 URL: http://llvm.org/viewvc/llvm-project?rev=335180&view=rev Log: Improve SBThread's stepping API using SBError parameter. Summary: The new methods will allow to get error messages from stepping API. Reviewers: aprantl, clayborg, labath, jingham Reviewed By: aprantl, clayborg, jingham Subscribers: apolyakov, labath, jingham, clayborg, lemo, lldb-commits Differential Revision: https://reviews.llvm.org/D47991 Modified: lldb/trunk/include/lldb/API/SBThread.h lldb/trunk/scripts/interface/SBThread.i lldb/trunk/source/API/SBThread.cpp Modified: lldb/trunk/include/lldb/API/SBThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=335180&r1=335179&r2=335180&view=diff == --- lldb/trunk/include/lldb/API/SBThread.h (original) +++ lldb/trunk/include/lldb/API/SBThread.h Wed Jun 20 14:43:16 2018 @@ -93,6 +93,8 @@ public: void StepOver(lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping); + void StepOver(lldb::RunMode stop_other_threads, SBError &error); + void StepInto(lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping); void StepInto(const char *target_name, @@ -103,10 +105,16 @@ public: void StepOut(); - void StepOutOfFrame(lldb::SBFrame &frame); + void StepOut(SBError &error); + + void StepOutOfFrame(SBFrame &frame); + + void StepOutOfFrame(SBFrame &frame, SBError &error); void StepInstruction(bool step_over); + void StepInstruction(bool step_over, SBError &error); + SBError StepOverUntil(lldb::SBFrame &frame, lldb::SBFileSpec &file_spec, uint32_t line); @@ -119,6 +127,8 @@ public: void RunToAddress(lldb::addr_t addr); + void RunToAddress(lldb::addr_t addr, SBError &error); + SBError ReturnFromFrame(SBFrame &frame, SBValue &return_value); SBError UnwindInnermostExpression(); @@ -146,8 +156,12 @@ public: //-- bool Suspend(); + bool Suspend(SBError &error); + bool Resume(); + bool Resume(SBError &error); + bool IsSuspended(); bool IsStopped(); Modified: lldb/trunk/scripts/interface/SBThread.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBThread.i?rev=335180&r1=335179&r2=335180&view=diff == --- lldb/trunk/scripts/interface/SBThread.i (original) +++ lldb/trunk/scripts/interface/SBThread.i Wed Jun 20 14:43:16 2018 @@ -211,6 +211,11 @@ public: void StepOver (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping); +%feature("autodoc", +"Do a source level single step over in the currently selected thread.") StepOver; +void +StepOver (lldb::RunMode stop_other_threads, SBError &error); + void StepInto (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping); @@ -218,7 +223,7 @@ public: StepInto (const char *target_name, lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping); %feature("autodoc", " -Step the current thread from the current source line to the line given by end_line, stopping if +Step the current thread from the current source line to the line given by end_line, stopping if the thread steps into the function given by target_name. If target_name is None, then stepping will stop in any of the places we would normally stop. ") StepInto; @@ -231,12 +236,28 @@ public: void StepOut (); +%feature("autodoc", +"Step out of the currently selected thread.") StepOut; +void +StepOut (SBError &error); + void -StepOutOfFrame (lldb::SBFrame &frame); +StepOutOfFrame (SBFrame &frame); + +%feature("autodoc", +"Step out of the specified frame.") StepOutOfFrame; +void +StepOutOfFrame (SBFrame &frame, SBError &error); void StepInstruction(bool step_over); +%feature("autodoc", +"Do an instruction level single step in the currently selected thread. +") StepInstruction; +void +StepInstruction(bool step_over, SBError &error); + SBError StepOverUntil (lldb::SBFrame &frame, lldb::SBFileSpec &file_spec, @@ -254,6 +275,9 @@ public: void RunToAddress (lldb::addr_t addr); +void +RunToAddress (lldb::addr_t addr, SBError &error); + %feature("autodoc", " Force a return from the frame passed in (and any frames younger than it) without executing any more code in those frames. If return_value contains @@ -297,9 +321,15 @@ public: ") Suspend; bool Suspend(); + +bool +Suspend(SBError &error); bool Resume (); + +bool +Resume (SBError &error); bool IsSuspended(); Modified: lldb/trunk/source/API/SBThread.cpp URL: http://llvm.org/viewvc/llvm-proj
[Lldb-commits] [lldb] r335541 - Implement new methods for handling an error in MI commands.
Author: apolyakov Date: Mon Jun 25 15:01:44 2018 New Revision: 335541 URL: http://llvm.org/viewvc/llvm-project?rev=335541&view=rev Log: Implement new methods for handling an error in MI commands. Summary: The new methods take SBError object and call handler, specified by user, depending on SBError status. Reviewers: aprantl, clayborg, labath Reviewed By: aprantl, clayborg Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D48295 Modified: lldb/trunk/tools/lldb-mi/MICmdBase.cpp lldb/trunk/tools/lldb-mi/MICmdBase.h Modified: lldb/trunk/tools/lldb-mi/MICmdBase.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdBase.cpp?rev=335541&r1=335540&r2=335541&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdBase.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmdBase.cpp Mon Jun 25 15:01:44 2018 @@ -214,6 +214,64 @@ void CMICmdBase::SetError(const CMIUtilS //++ // +// Details: Short cut function to check MI command's execute status and +// set an error in case of failure. +// Type:Method. +// Args:error - (R) Error description object. +// successHandler - (R) function describing actions to execute +// in case of success state of passed SBError object. +// errorHandler - (R) function describing actions to execute +// in case of fail status of passed SBError object. +// Return: bool. +// Throws: None. +//-- +bool CMICmdBase::HandleSBError(const lldb::SBError &error, + const std::function &successHandler, + const std::function &errorHandler) { + if (error.Success()) +return successHandler(); + + SetError(error.GetCString()); + errorHandler(); + return MIstatus::failure; +} + +//++ +// +// Details: Short cut function to check MI command's execute status and +// call specified handler function for success case. +// Type:Method. +// Args:error - (R) Error description object. +// successHandler - (R) function describing actions to execute +// in case of success state of passed SBError object. +// Return: bool. +// Throws: None. +//-- +bool CMICmdBase::HandleSBErrorWithSuccess( +const lldb::SBError &error, +const std::function &successHandler) { + return HandleSBError(error, successHandler); +} + +//++ +// +// Details: Short cut function to check MI command's execute status and +// call specified handler function for error case. +// Type:Method. +// Args:error - (R) Error description object. +// errorHandler - (R) function describing actions to execute +// in case of fail status of passed SBError object. +// Return: bool. +// Throws: None. +//-- +bool CMICmdBase::HandleSBErrorWithFailure( +const lldb::SBError &error, +const std::function &errorHandler) { + return HandleSBError(error, [] { return MIstatus::success; }, errorHandler); +} + +//++ +// // Details: Ask a command to provide its unique identifier. // Type:Method. // Args:A unique identifier for this command class. Modified: lldb/trunk/tools/lldb-mi/MICmdBase.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdBase.h?rev=335541&r1=335540&r2=335541&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdBase.h (original) +++ lldb/trunk/tools/lldb-mi/MICmdBase.h Mon Jun 25 15:01:44 2018 @@ -12,6 +12,8 @@ // C Includes // C++ Includes // Other libraries and framework includes +#include "lldb/API/SBError.h" + // Project includes #include "MICmdArgSet.h" #include "MICmdData.h" @@ -80,6 +82,14 @@ public: // Methods: protected: void SetError(const CMIUtilString &rErrMsg); + bool HandleSBError(const lldb::SBError &error, + const std::function &successHandler = + [] { return MIstatus::success; }, + const std::function &errorHandler = [] {}); + bool HandleSBErrorWithSuccess(const lldb::SBError &error, +const std::function &successHandler); + bool HandleSBErrorWithFailure(const lldb::SBError &error, +const std::function &errorHandler); template T *GetOption(const CMIUtilString &vStrOptionName); bool ParseValidateCmdOptions(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r335552 - Fix windows build for r335541.
Author: apolyakov Date: Mon Jun 25 16:29:52 2018 New Revision: 335552 URL: http://llvm.org/viewvc/llvm-project?rev=335552&view=rev Log: Fix windows build for r335541. I didn't include header and used std::function. Modified: lldb/trunk/tools/lldb-mi/MICmdBase.h Modified: lldb/trunk/tools/lldb-mi/MICmdBase.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdBase.h?rev=335552&r1=335551&r2=335552&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdBase.h (original) +++ lldb/trunk/tools/lldb-mi/MICmdBase.h Mon Jun 25 16:29:52 2018 @@ -11,6 +11,8 @@ // C Includes // C++ Includes +#include // for function + // Other libraries and framework includes #include "lldb/API/SBError.h" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r336009 - [lldb-mi] Clean up and update a few MI commands.
Author: apolyakov Date: Fri Jun 29 12:58:31 2018 New Revision: 336009 URL: http://llvm.org/viewvc/llvm-project?rev=336009&view=rev Log: [lldb-mi] Clean up and update a few MI commands. Summary: This patch updates a few MI commands using a new way of handling an errors in lldb-mi and removes unnecessary m_lldbResult variables. Reviewers: aprantl, clayborg, labath Reviewed By: aprantl, clayborg Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D47992 Modified: lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp lldb/trunk/tools/lldb-mi/MICmdCmdExec.h Modified: lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp?rev=336009&r1=336008&r2=336009&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp Fri Jun 29 12:58:31 2018 @@ -126,21 +126,25 @@ bool CMICmdCmdExecRun::Execute() { } lldb::SBProcess process = rSessionInfo.GetTarget().Launch(launchInfo, error); - if ((!process.IsValid()) || (error.Fail())) { + if (!process.IsValid()) { SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PROCESS), m_cmdData.strMiCmd.c_str(), errMsg.GetData())); return MIstatus::failure; } - if (!CMIDriver::Instance().SetDriverStateRunningDebugging()) { -const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription()); -SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE), - m_cmdData.strMiCmd.c_str(), - rErrMsg.c_str())); -return MIstatus::failure; - } - return MIstatus::success; + const auto successHandler = [this] { +if (!CMIDriver::Instance().SetDriverStateRunningDebugging()) { + const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription()); + SetError(CMIUtilString::Format( + MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE), + m_cmdData.strMiCmd.c_str(), rErrMsg.c_str())); + return MIstatus::failure; +} +return MIstatus::success; + }; + + return HandleSBErrorWithSuccess(error, successHandler); } //++ @@ -156,9 +160,8 @@ bool CMICmdCmdExecRun::Execute() { // Throws: None. //-- bool CMICmdCmdExecRun::Acknowledge() { - const CMICmnMIResultRecord miRecordResult( + m_miResultRecord = CMICmnMIResultRecord( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); - m_miResultRecord = miRecordResult; CMICmnLLDBDebugSessionInfo &rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance()); @@ -233,23 +236,21 @@ CMICmdCmdExecContinue::~CMICmdCmdExecCon // Throws: None. //-- bool CMICmdCmdExecContinue::Execute() { - lldb::SBError error = - CMICmnLLDBDebugSessionInfo::Instance().GetProcess().Continue(); - - if (error.Success()) { + const auto successHandler = [this] { // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM if (!CMIDriver::Instance().SetDriverStateRunningDebugging()) { const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription()); - SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE), - m_cmdData.strMiCmd.c_str(), - rErrMsg.c_str())); + SetError(CMIUtilString::Format( + MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE), + m_cmdData.strMiCmd.c_str(), rErrMsg.c_str())); return MIstatus::failure; } return MIstatus::success; - } + }; - SetError(error.GetCString()); - return MIstatus::failure; + return HandleSBErrorWithSuccess( + CMICmnLLDBDebugSessionInfo::Instance().GetProcess().Continue(), + successHandler); } //++ @@ -264,9 +265,8 @@ bool CMICmdCmdExecContinue::Execute() { // Throws: None. //-- bool CMICmdCmdExecContinue::Acknowledge() { - const CMICmnMIResultRecord miRecordResult( + m_miResultRecord = CMICmnMIResultRecord( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); - m_miResultRecord = miRecordResult; return MIstatus::success; } @@ -358,6 +358,7 @@ bool CMICmdCmdExecNext::Execute() { CMICmnLLDBDebugSessionInfo &rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance()); + lldb::SBError error; if (nThreadId != UINT64_MAX) { lldb::SBThread sbThread = rSessionInfo.GetProcess().GetThreadByIndexID(nThreadId); if (!sbThread.IsValid()) { @@ -366,10 +367,12 @@ bool CMICmdCmdExecNext::Execute() { m_constStrArgThread.c_str())); return MIstatus::failure; } -sbThread.StepOver(); - } else rSessionInfo.GetProcess().GetSelectedThread().StepOver(); +sbThread.StepOver(lldb::eOnlyDuringStepping, error); + } else +rSessionInfo.GetProcess().GetSelectedThread().StepOver( +
[Lldb-commits] [lldb] r336155 - [lldb-mi] Re-implement a few MI commands.
Author: apolyakov Date: Mon Jul 2 16:54:06 2018 New Revision: 336155 URL: http://llvm.org/viewvc/llvm-project?rev=336155&view=rev Log: [lldb-mi] Re-implement a few MI commands. Summary: This patch updates exec-next-instruction, exec-step-instruction, exec-finish, exec-interrupt commands to use SB API instead of HandleCommand. Reviewers: aprantl, clayborg Reviewed By: aprantl Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D48520 Added: lldb/trunk/lit/tools/lldb-mi/exec/exec-finish.test lldb/trunk/lit/tools/lldb-mi/exec/exec-interrupt.test lldb/trunk/lit/tools/lldb-mi/exec/exec-next-instruction.test lldb/trunk/lit/tools/lldb-mi/exec/exec-step-instruction.test Modified: lldb/trunk/lit/tools/lldb-mi/exec/inputs/main.c lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp lldb/trunk/tools/lldb-mi/MICmdCmdExec.h Added: lldb/trunk/lit/tools/lldb-mi/exec/exec-finish.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/exec/exec-finish.test?rev=336155&view=auto == --- lldb/trunk/lit/tools/lldb-mi/exec/exec-finish.test (added) +++ lldb/trunk/lit/tools/lldb-mi/exec/exec-finish.test Mon Jul 2 16:54:06 2018 @@ -0,0 +1,33 @@ +# XFAIL: windows +# -> llvm.org/pr24452 +# +# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %lldbmi %t < %s | FileCheck %s + +# Test lldb-mi -exec-finish command. + +# Check that we have a valid target created via '%lldbmi %t'. +# CHECK: ^done + +-break-insert main +# CHECK: ^done,bkpt={number="1" + +-break-insert dummyFunction +# CHECK: ^done,bkpt={number="2" + +-exec-run +# CHECK: ^running +# CHECK: *stopped,reason="breakpoint-hit" + +-exec-finish --thread 0 +# Check that exec-finish can process the case of invalid thread ID. +# CHECK: ^error,msg="Command 'exec-finish'. Thread ID invalid" + +-exec-finish --thread 1 +# CHECK: ^running +# CHECK: *stopped,reason="breakpoint-hit" + +-exec-finish +# Check exec-finish in a selected thread. +# CHECK: ^running +# CHECK: *stopped,reason="end-stepping-range" Added: lldb/trunk/lit/tools/lldb-mi/exec/exec-interrupt.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/exec/exec-interrupt.test?rev=336155&view=auto == --- lldb/trunk/lit/tools/lldb-mi/exec/exec-interrupt.test (added) +++ lldb/trunk/lit/tools/lldb-mi/exec/exec-interrupt.test Mon Jul 2 16:54:06 2018 @@ -0,0 +1,20 @@ +# XFAIL: windows +# -> llvm.org/pr24452 +# +# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %lldbmi %t < %s | FileCheck %s + +# Test lldb-mi -exec-interrupt command. + +# Check that we have a valid target created via '%lldbmi %t'. +# CHECK: ^done + +-break-insert main +# CHECK: ^done,bkpt={number="1" + +-exec-run +# CHECK: ^running +# CHECK: *stopped,reason="breakpoint-hit" + +-exec-interrupt +# CHECK: ^error,msg="Process is not running." Added: lldb/trunk/lit/tools/lldb-mi/exec/exec-next-instruction.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/exec/exec-next-instruction.test?rev=336155&view=auto == --- lldb/trunk/lit/tools/lldb-mi/exec/exec-next-instruction.test (added) +++ lldb/trunk/lit/tools/lldb-mi/exec/exec-next-instruction.test Mon Jul 2 16:54:06 2018 @@ -0,0 +1,30 @@ +# XFAIL: windows +# -> llvm.org/pr24452 +# +# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %lldbmi %t < %s | FileCheck %s + +# Test lldb-mi -exec-next-instruction command. + +# Check that we have a valid target created via '%lldbmi %t'. +# CHECK: ^done + +-break-insert main +# CHECK: ^done,bkpt={number="1" + +-exec-run +# CHECK: ^running +# CHECK: *stopped,reason="breakpoint-hit" + +-exec-next-instruction --thread 0 +# Check that exec-next-instruction can process the case of invalid thread ID. +# CHECK: ^error,msg="Command 'exec-next-instruction'. Thread ID invalid" + +-exec-next-instruction --thread 1 +# CHECK: ^running +# CHECK: *stopped,reason="end-stepping-range" + +-exec-next-instruction +# Check exec-next-instruction in a selected thread. +# CHECK: ^running +# CHECK: *stopped,reason="end-stepping-range" Added: lldb/trunk/lit/tools/lldb-mi/exec/exec-step-instruction.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/exec/exec-step-instruction.test?rev=336155&view=auto == --- lldb/trunk/lit/tools/lldb-mi/exec/exec-step-instruction.test (added) +++ lldb/trunk/lit/tools/lldb-mi/exec/exec-step-instruction.test Mon Jul 2 16:54:06 2018 @@ -0,0 +1,30 @@ +# XFAIL: windows +# -> llvm.org/pr24452 +# +# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %lldbmi %t < %s | FileCheck %s + +# Test lldb-mi -exec-step-instruction command. + +# Check that we have a valid target created via '%
[Lldb-commits] [lldb] r336200 - Add new API to SBTarget and SBModule classes.
Author: apolyakov Date: Tue Jul 3 07:22:44 2018 New Revision: 336200 URL: http://llvm.org/viewvc/llvm-project?rev=336200&view=rev Log: Add new API to SBTarget and SBModule classes. Summary: The new API allows to find a list of compile units related to target/module. Reviewers: aprantl, clayborg Reviewed By: aprantl Subscribers: jingham, lldb-commits Differential Revision: https://reviews.llvm.org/D48801 Modified: lldb/trunk/include/lldb/API/SBModule.h lldb/trunk/include/lldb/API/SBTarget.h lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py lldb/trunk/scripts/interface/SBModule.i lldb/trunk/scripts/interface/SBTarget.i lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/API/SBTarget.cpp Modified: lldb/trunk/include/lldb/API/SBModule.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=336200&r1=336199&r2=336200&view=diff == --- lldb/trunk/include/lldb/API/SBModule.h (original) +++ lldb/trunk/include/lldb/API/SBModule.h Tue Jul 3 07:22:44 2018 @@ -129,6 +129,21 @@ public: lldb::SBCompileUnit GetCompileUnitAtIndex(uint32_t); + //-- + /// Find compile units related to *this module and passed source + /// file. + /// + /// @param[in] sb_file_spec + /// A lldb::SBFileSpec object that contains source file + /// specification. + /// + /// @return + /// A lldb::SBSymbolContextList that gets filled in with all of + /// the symbol contexts for all the matches. + //-- + lldb::SBSymbolContextList + FindCompileUnits(const lldb::SBFileSpec &sb_file_spec); + size_t GetNumSymbols(); lldb::SBSymbol GetSymbolAtIndex(size_t idx); Modified: lldb/trunk/include/lldb/API/SBTarget.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=336200&r1=336199&r2=336200&view=diff == --- lldb/trunk/include/lldb/API/SBTarget.h (original) +++ lldb/trunk/include/lldb/API/SBTarget.h Tue Jul 3 07:22:44 2018 @@ -292,6 +292,21 @@ public: lldb::SBModule FindModule(const lldb::SBFileSpec &file_spec); + //-- + /// Find compile units related to *this target and passed source + /// file. + /// + /// @param[in] sb_file_spec + /// A lldb::SBFileSpec object that contains source file + /// specification. + /// + /// @return + /// A lldb::SBSymbolContextList that gets filled in with all of + /// the symbol contexts for all the matches. + //-- + lldb::SBSymbolContextList + FindCompileUnits(const lldb::SBFileSpec &sb_file_spec); + lldb::ByteOrder GetByteOrder(); uint32_t GetAddressByteSize(); Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py?rev=336200&r1=336199&r2=336200&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py Tue Jul 3 07:22:44 2018 @@ -141,3 +141,29 @@ class ModuleAndSectionAPIsTestCase(TestB INDENT2 = INDENT * 2 for cu in exe_module.compile_unit_iter(): print(cu) + +@add_test_categories(['pyapi']) +def test_find_compile_units(self): +"""Exercise SBModule.FindCompileUnits() API.""" +d = {'EXE': 'b.out'} +self.build(dictionary=d) +self.setTearDownCleanup(dictionary=d) +self.find_compile_units(self.getBuildArtifact('b.out')) + +def find_compile_units(self, exe): +"""Exercise SBModule.FindCompileUnits() API.""" +source_name_list = ["main.cpp", "b.cpp", "c.cpp"] + +# Create a target by the debugger. +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, VALID_TARGET) + +num_modules = target.GetNumModules() +for i in range(num_modules): +module = target.GetModuleAtIndex(i) +for source_name in source_name_list: +list = module.FindCompileUnits(lldb.SBFileSpec(source_name, False)) +for sc in list: +self.assertTrue( +sc.GetCompileUnit().GetFileSpec().GetFilename() == +source_name) Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/tar
[Lldb-commits] [lldb] r336206 - [lldb-mi] Re-implement symbol-list-lines command.
Author: apolyakov Date: Tue Jul 3 08:40:20 2018 New Revision: 336206 URL: http://llvm.org/viewvc/llvm-project?rev=336206&view=rev Log: [lldb-mi] Re-implement symbol-list-lines command. Summary: Now this command uses SB API instead of HandleCommand. Reviewers: aprantl, clayborg Reviewed By: aprantl, clayborg Subscribers: ki.stfu, eraman, lldb-commits Differential Revision: https://reviews.llvm.org/D48802 Added: lldb/trunk/lit/tools/lldb-mi/symbol/ lldb/trunk/lit/tools/lldb-mi/symbol/inputs/ lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.c lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.h lldb/trunk/lit/tools/lldb-mi/symbol/inputs/main.c lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.c lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.h lldb/trunk/lit/tools/lldb-mi/symbol/lit.local.cfg lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test Removed: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/Makefile lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/main.cpp lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.cpp lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test2.cpp Modified: lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.h Added: lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.c?rev=336206&view=auto == --- lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.c (added) +++ lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.c Tue Jul 3 08:40:20 2018 @@ -0,0 +1,3 @@ +void HelpFunction(void) { + int x = 12345; +} Added: lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.h?rev=336206&view=auto == --- lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.h (added) +++ lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.h Tue Jul 3 08:40:20 2018 @@ -0,0 +1 @@ +void HelpFunction(void); Added: lldb/trunk/lit/tools/lldb-mi/symbol/inputs/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/inputs/main.c?rev=336206&view=auto == --- lldb/trunk/lit/tools/lldb-mi/symbol/inputs/main.c (added) +++ lldb/trunk/lit/tools/lldb-mi/symbol/inputs/main.c Tue Jul 3 08:40:20 2018 @@ -0,0 +1,6 @@ +#include "symbol-list-lines.h" + +int main(void) { + int x = GetZero(); + return 0; +} Added: lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.c?rev=336206&view=auto == --- lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.c (added) +++ lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.c Tue Jul 3 08:40:20 2018 @@ -0,0 +1,6 @@ +#include "list-lines-helper.h" + +int GetZero() { + HelpFunction(); + return 0; +} Added: lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.h?rev=336206&view=auto == --- lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.h (added) +++ lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.h Tue Jul 3 08:40:20 2018 @@ -0,0 +1 @@ +int GetZero(); Added: lldb/trunk/lit/tools/lldb-mi/symbol/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/lit.local.cfg?rev=336206&view=auto == --- lldb/trunk/lit/tools/lldb-mi/symbol/lit.local.cfg (added) +++ lldb/trunk/lit/tools/lldb-mi/symbol/lit.local.cfg Tue Jul 3 08:40:20 2018 @@ -0,0 +1 @@ +config.suffixes = ['.test'] Added: lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test?rev=336206&view=auto == --- lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test (added) +++ lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test Tue Jul 3 08:40:20 2018 @@ -0,0 +1,17 @@ +# RUN: %cc -o %t %p/inputs/main.c %p/inputs/symbol-list-lines.c %p/inputs/list-lines-help
[Lldb-commits] [lldb] r336212 - Fix MSVC2015 compilation failure after r336206 patch.
Author: apolyakov Date: Tue Jul 3 09:07:30 2018 New Revision: 336212 URL: http://llvm.org/viewvc/llvm-project?rev=336212&view=rev Log: Fix MSVC2015 compilation failure after r336206 patch. Added missing headers. Modified: lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp Modified: lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp?rev=336212&r1=336211&r2=336212&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp Tue Jul 3 09:07:30 2018 @@ -11,6 +11,12 @@ // Third Party Headers: #include "llvm/ADT/Twine.h" +#include "lldb/API/SBAddress.h" +#include "lldb/API/SBLineEntry.h" +#include "lldb/API/SBFileSpec.h" +#include "lldb/API/SBCompileUnit.h" +#include "lldb/API/SBSymbolContext.h" +#include "lldb/API/SBSymbolContextList.h" // In-house headers: #include "MICmdArgValFile.h" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r336235 - Ammend "Fix MSVC2015 compilation failure after r336206 patch".
Author: apolyakov Date: Tue Jul 3 15:51:01 2018 New Revision: 336235 URL: http://llvm.org/viewvc/llvm-project?rev=336235&view=rev Log: Ammend "Fix MSVC2015 compilation failure after r336206 patch". Modified: lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp Modified: lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp?rev=336235&r1=336234&r2=336235&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp Tue Jul 3 15:51:01 2018 @@ -39,6 +39,8 @@ CreateMITuplePCLine(const uint32_t addr, } } // namespace +using namespace lldb; // For operator==(const SBAddress &, const SBAddress &). + //++ // // Details: CMICmdCmdSymbolListLines constructor. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r333837 - Test commit. Fix typo in comment.
Author: apolyakov Date: Sun Jun 3 05:41:00 2018 New Revision: 333837 URL: http://llvm.org/viewvc/llvm-project?rev=333837&view=rev Log: Test commit. Fix typo in comment. Modified: lldb/trunk/tools/lldb-mi/MICmdCmdTarget.cpp Modified: lldb/trunk/tools/lldb-mi/MICmdCmdTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdTarget.cpp?rev=333837&r1=333836&r2=333837&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdCmdTarget.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmdCmdTarget.cpp Sun Jun 3 05:41:00 2018 @@ -115,7 +115,7 @@ bool CMICmdCmdTargetSelect::Execute() { const CMIUtilString strUrl = CMIUtilString::Format("connect://%s", pArgParameters->GetValue().c_str()); - // Ask LLDB to collect to the target port + // Ask LLDB to connect to the target port const char *pPlugin("gdb-remote"); lldb::SBError error; lldb::SBProcess process = rSessionInfo.GetTarget().ConnectRemote( ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r336494 - Add LLDB_API to SBAddress's operator==.
Author: apolyakov Date: Sat Jul 7 11:54:44 2018 New Revision: 336494 URL: http://llvm.org/viewvc/llvm-project?rev=336494&view=rev Log: Add LLDB_API to SBAddress's operator==. Summary: Add LLDB_API to SBAddress's operator== to fix lldb-mi build on Windows. Patch by Aleksandr Urakov! Differential Revision: https://reviews.llvm.org/D49006 Modified: lldb/trunk/include/lldb/API/SBAddress.h Modified: lldb/trunk/include/lldb/API/SBAddress.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAddress.h?rev=336494&r1=336493&r2=336494&view=diff == --- lldb/trunk/include/lldb/API/SBAddress.h (original) +++ lldb/trunk/include/lldb/API/SBAddress.h Sat Jul 7 11:54:44 2018 @@ -101,7 +101,7 @@ protected: const lldb_private::Address *operator->() const; - friend bool operator==(const SBAddress &lhs, const SBAddress &rhs); + friend bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs); lldb_private::Address *get(); @@ -117,7 +117,7 @@ private: std::unique_ptr m_opaque_ap; }; -bool operator==(const SBAddress &lhs, const SBAddress &rhs); +bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs); } // namespace lldb ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r337064 - [lldb-mi] Make symbol-list-lines.test XFAIL on Windows
Author: apolyakov Date: Fri Jul 13 15:41:16 2018 New Revision: 337064 URL: http://llvm.org/viewvc/llvm-project?rev=337064&view=rev Log: [lldb-mi] Make symbol-list-lines.test XFAIL on Windows It's a temporary decision until we reach out what causes a failure. Modified: lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test Modified: lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test?rev=337064&r1=337063&r2=337064&view=diff == --- lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test (original) +++ lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test Fri Jul 13 15:41:16 2018 @@ -1,3 +1,6 @@ +# XFAIL: windows +# -> llvm.org/pr24452 +# # RUN: %cc -o %t %p/inputs/main.c %p/inputs/symbol-list-lines.c %p/inputs/list-lines-helper.c -g # RUN: %lldbmi %t < %s | FileCheck %s ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r337689 - [lldb-mi] Re-implement data-info-line command.
Author: apolyakov Date: Mon Jul 23 06:02:41 2018 New Revision: 337689 URL: http://llvm.org/viewvc/llvm-project?rev=337689&view=rev Log: [lldb-mi] Re-implement data-info-line command. Summary: Now data-info-line command uses SB API instead of HandleCommand. Reviewers: aprantl, clayborg, jingham Reviewed By: aprantl Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D49062 Added: lldb/trunk/lit/tools/lldb-mi/data/ lldb/trunk/lit/tools/lldb-mi/data/data-info-line.test lldb/trunk/lit/tools/lldb-mi/data/inputs/ lldb/trunk/lit/tools/lldb-mi/data/inputs/data-info-line.c lldb/trunk/lit/tools/lldb-mi/data/lit.local.cfg Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp lldb/trunk/tools/lldb-mi/MICmdCmdData.h Added: lldb/trunk/lit/tools/lldb-mi/data/data-info-line.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/data/data-info-line.test?rev=337689&view=auto == --- lldb/trunk/lit/tools/lldb-mi/data/data-info-line.test (added) +++ lldb/trunk/lit/tools/lldb-mi/data/data-info-line.test Mon Jul 23 06:02:41 2018 @@ -0,0 +1,36 @@ +# XFAIL: windows +# -> llvm.org/pr24452 +# +# RUN: %cc -o %t %p/inputs/data-info-line.c -g +# RUN: %lldbmi %t < %s | FileCheck %s + +# Test lldb-mi -data-info-line command. + +# Check that we have a valid target created via '%lldbmi %t'. +# CHECK: ^done + +-break-insert main +# CHECK: ^done,bkpt={number="1" + +-exec-run +# CHECK: ^running +# CHECK: *stopped,reason="breakpoint-hit" + +-data-info-line *0x0 +# Test that -data-info-line fails when invalid address is specified. +# CHECK: ^error,msg="Command 'data-info-line'. Error: The LineEntry is absent or has an unknown format." + +-data-info-line unknown_file:1 +# Test that -data-info-line fails when file is unknown. +# CHECK: ^error,msg="Command 'data-info-line'. Error: The LineEntry is absent or has an unknown format." + +-data-info-line data-info-line.c:bad_line +# Test that -data-info-line fails when line has invalid format. +# CHECK: ^error,msg="Command 'data-info-line'. Error: The LineEntry is absent or has an unknown format." + +-data-info-line data-info-line.c:0 +# Test that -data-info-line fails when invalid line is specified. +# CHECK: ^error,msg="Command 'data-info-line'. Error: The LineEntry is absent or has an unknown format." + +-data-info-line data-info-line.c:2 +# CHECK: ^done,start="0x{{[0-9a-f]+}}",end="0x{{[0-9a-f]+}}",file="{{.*}}data-info-line.c",line="{{[0-9]+}}" Added: lldb/trunk/lit/tools/lldb-mi/data/inputs/data-info-line.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/data/inputs/data-info-line.c?rev=337689&view=auto == --- lldb/trunk/lit/tools/lldb-mi/data/inputs/data-info-line.c (added) +++ lldb/trunk/lit/tools/lldb-mi/data/inputs/data-info-line.c Mon Jul 23 06:02:41 2018 @@ -0,0 +1,4 @@ +int main(void) { + int x = 0; + return 12345 + x; +} Added: lldb/trunk/lit/tools/lldb-mi/data/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/data/lit.local.cfg?rev=337689&view=auto == --- lldb/trunk/lit/tools/lldb-mi/data/lit.local.cfg (added) +++ lldb/trunk/lit/tools/lldb-mi/data/lit.local.cfg Mon Jul 23 06:02:41 2018 @@ -0,0 +1 @@ +config.suffixes = ['.test'] Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py?rev=337689&r1=337688&r2=337689&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py Mon Jul 23 06:02:41 2018 @@ -335,62 +335,6 @@ class MiDataTestCase(lldbmi_testcase.MiT @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfDarwin # pexpect is known to be unreliable on Darwin @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races -def test_lldbmi_data_info_line(self): -"""Test that 'lldb-mi --interpreter' works for -data-info-line.""" - -self.spawnLldbMi(args=None) - -# Load executable -self.runCmd("-file-exec-and-symbols %s" % self.myexe) -self.expect("\^done") - -# Run to main -self.runCmd("-break-insert -f main") -self.expect("\^done,bkpt={number=\"1\"") -self.runCmd("-exec-run") -self.expect("\^running") -self.expect("\*stopped,reason=\"breakpoint-hit\"") - -# Get the address of main and its line -self.runCmd("-data-evaluate-exp
[Lldb-commits] [lldb] r337692 - Fix windows build after r337689
Author: apolyakov Date: Mon Jul 23 07:10:30 2018 New Revision: 337692 URL: http://llvm.org/viewvc/llvm-project?rev=337692&view=rev Log: Fix windows build after r337689 Added missing header. Modified: lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp Modified: lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp?rev=337692&r1=337691&r2=337692&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp Mon Jul 23 07:10:30 2018 @@ -44,6 +44,7 @@ #include "MICmnLLDBUtilSBValue.h" #include "MICmnMIResultRecord.h" #include "MICmnMIValueConst.h" +#include "Platform.h" namespace { CMIUtilString IntToHexAddrStr(uint32_t number) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r339160 - [lldb-mi] Re-implement MI HandleProcessEventStateSuspended.
Author: apolyakov Date: Tue Aug 7 10:55:26 2018 New Revision: 339160 URL: http://llvm.org/viewvc/llvm-project?rev=339160&view=rev Log: [lldb-mi] Re-implement MI HandleProcessEventStateSuspended. Summary: Now this function uses SB API instead of HandleCommand. Reviewers: aprantl, clayborg, labath Reviewed By: aprantl Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D49632 Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp?rev=339160&r1=339159&r2=339160&view=diff == --- lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp Tue Aug 7 10:55:26 2018 @@ -950,6 +950,7 @@ bool CMICmnLLDBDebuggerHandleEvents::Han bool CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateSuspended( const lldb::SBEvent &vEvent) { bool bOk = MIstatus::success; + lldb::SBStream streamOut; lldb::SBDebugger &rDebugger = CMICmnLLDBDebugSessionInfo::Instance().GetDebugger(); lldb::SBProcess sbProcess = @@ -958,16 +959,17 @@ bool CMICmnLLDBDebuggerHandleEvents::Han if (rDebugger.GetSelectedTarget() == target) { if (!UpdateSelectedThread()) return MIstatus::failure; - -lldb::SBCommandReturnObject result; -const lldb::ReturnStatus status = -rDebugger.GetCommandInterpreter().HandleCommand("process status", -result, false); -MIunused(status); -bOk = TextToStderr(result.GetError()); -bOk = bOk && TextToStdout(result.GetOutput()); +sbProcess.GetDescription(streamOut); +// Add a delimiter between process' and threads' info. +streamOut.Printf("\n"); +for (uint32_t i = 0, e = sbProcess.GetNumThreads(); i < e; ++i) { + const lldb::SBThread thread = sbProcess.GetThreadAtIndex(i); + if (!thread.IsValid()) +continue; + thread.GetDescription(streamOut); +} +bOk = TextToStdout(streamOut.GetData()); } else { -lldb::SBStream streamOut; const MIuint nTargetIndex = rDebugger.GetIndexOfTarget(target); if (nTargetIndex != UINT_MAX) streamOut.Printf("Target %d: (", nTargetIndex); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r339175 - Add new API to SBTarget class
Author: apolyakov Date: Tue Aug 7 13:23:57 2018 New Revision: 339175 URL: http://llvm.org/viewvc/llvm-project?rev=339175&view=rev Log: Add new API to SBTarget class Summary: The new API appends an image search path to the target's path mapping list. Reviewers: aprantl, clayborg, labath Reviewed By: aprantl Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D49739 Modified: lldb/trunk/include/lldb/API/SBTarget.h lldb/trunk/scripts/interface/SBTarget.i lldb/trunk/source/API/SBTarget.cpp Modified: lldb/trunk/include/lldb/API/SBTarget.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=339175&r1=339174&r2=339175&view=diff == --- lldb/trunk/include/lldb/API/SBTarget.h (original) +++ lldb/trunk/include/lldb/API/SBTarget.h Tue Aug 7 13:23:57 2018 @@ -272,6 +272,9 @@ public: lldb::SBFileSpec GetExecutable(); + void AppendImageSearchPath(const char *from, const char *to, + lldb::SBError &error); + bool AddModule(lldb::SBModule &module); lldb::SBModule AddModule(const char *path, const char *triple, Modified: lldb/trunk/scripts/interface/SBTarget.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBTarget.i?rev=339175&r1=339174&r2=339175&view=diff == --- lldb/trunk/scripts/interface/SBTarget.i (original) +++ lldb/trunk/scripts/interface/SBTarget.i Tue Aug 7 13:23:57 2018 @@ -373,6 +373,11 @@ public: lldb::SBFileSpec GetExecutable (); +void +AppendImageSearchPath (const char *from, + const char *to, + SBError &error); + bool AddModule (lldb::SBModule &module); Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=339175&r1=339174&r2=339175&view=diff == --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Tue Aug 7 13:23:57 2018 @@ -1457,6 +1457,26 @@ bool SBTarget::DeleteAllWatchpoints() { return false; } +void SBTarget::AppendImageSearchPath(const char *from, const char *to, + lldb::SBError &error) { + TargetSP target_sp(GetSP()); + if (!target_sp) +return error.SetErrorString("invalid target"); + + const ConstString csFrom(from), csTo(to); + if (!csFrom) +return error.SetErrorString(" path can't be empty"); + if (!csTo) +return error.SetErrorString(" path can't be empty"); + + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + if (log) +log->Printf("SBTarget(%p)::%s: '%s' -> '%s'", +static_cast(target_sp.get()), __FUNCTION__, +from, to); + target_sp->GetImageSearchPathList().Append(csFrom, csTo, true); +} + lldb::SBModule SBTarget::AddModule(const char *path, const char *triple, const char *uuid_cstr) { return AddModule(path, triple, uuid_cstr, NULL); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r339178 - [lldb-mi] Re-implement target-select command
Author: apolyakov Date: Tue Aug 7 13:45:46 2018 New Revision: 339178 URL: http://llvm.org/viewvc/llvm-project?rev=339178&view=rev Log: [lldb-mi] Re-implement target-select command Now target-select uses SB API instead of HandleCommand. This patch has been reviewed along with the r339175. Differential Revision: https://reviews.llvm.org/D49739 Added: lldb/trunk/lit/tools/lldb-mi/target/ lldb/trunk/lit/tools/lldb-mi/target/inputs/ lldb/trunk/lit/tools/lldb-mi/target/inputs/main.c lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py lldb/trunk/lit/tools/lldb-mi/target/lit.local.cfg lldb/trunk/lit/tools/lldb-mi/target/target-select-so-path.test Modified: lldb/trunk/lit/lit.cfg lldb/trunk/tools/lldb-mi/MICmdCmdTarget.cpp Modified: lldb/trunk/lit/lit.cfg URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/lit.cfg?rev=339178&r1=339177&r2=339178&view=diff == --- lldb/trunk/lit/lit.cfg (original) +++ lldb/trunk/lit/lit.cfg Tue Aug 7 13:45:46 2018 @@ -56,7 +56,10 @@ config.environment['PYTHON_EXECUTABLE'] # Register substitutions config.substitutions.append(('%python', "'%s'" % (config.python_executable))) -debugserver = lit.util.which('debugserver', lldb_tools_dir) +if platform.system() in ['Darwin']: +debugserver = lit.util.which('debugserver', lldb_tools_dir) +else: +debugserver = lit.util.which('lldb-server', lldb_tools_dir) lldb = "%s -S %s/lit-lldb-init" % (lit.util.which('lldb', lldb_tools_dir), config.test_source_root) @@ -91,7 +94,10 @@ config.substitutions.append(('%lldbmi', config.substitutions.append(('%lldb', lldb)) if debugserver is not None: -config.substitutions.append(('%debugserver', debugserver)) +if platform.system() in ['Darwin']: +config.substitutions.append(('%debugserver', debugserver)) +else: +config.substitutions.append(('%debugserver', debugserver + ' gdbserver')) for pattern in [r"\bFileCheck\b", r"\blldb-test\b", Added: lldb/trunk/lit/tools/lldb-mi/target/inputs/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/target/inputs/main.c?rev=339178&view=auto == --- lldb/trunk/lit/tools/lldb-mi/target/inputs/main.c (added) +++ lldb/trunk/lit/tools/lldb-mi/target/inputs/main.c Tue Aug 7 13:45:46 2018 @@ -0,0 +1,4 @@ +int main(void) { + int x = 0; + return x; +} Added: lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py?rev=339178&view=auto == --- lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py (added) +++ lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py Tue Aug 7 13:45:46 2018 @@ -0,0 +1,39 @@ +#!/usr/bin/env python2 + +import os +import sys +import subprocess + + +hostname = 'localhost' + +(r, w) = os.pipe() +args = sys.argv +# Get debugserver, lldb-mi and FileCheck executables' paths with arguments. +debugserver = ' '.join([args[1], '--pipe', str(w), hostname + ':0']) +lldbmi = args[2] +test_file = args[3] +filecheck = 'FileCheck ' + test_file + +# Run debugserver, lldb-mi and FileCheck. +debugserver_proc = subprocess.Popen(debugserver.split()) +lldbmi_proc = subprocess.Popen(lldbmi, stdin=subprocess.PIPE, + stdout=subprocess.PIPE, shell=True) +filecheck_proc = subprocess.Popen(filecheck, stdin=lldbmi_proc.stdout, + shell=True) + +# Get a tcp port chosen by debugserver. +# The number quite big to get lldb-server's output and to not hang. +bytes_to_read = 10 +port_bytes = os.read(r, bytes_to_read) +port = str(port_bytes.decode('utf-8').strip('\x00')) + +with open(test_file, 'r') as f: +# Replace '$PORT' with a free port number and pass +# test's content to lldb-mi. +lldbmi_proc.stdin.write(f.read().replace('$PORT', port)) +lldbmi_proc.wait() +filecheck_proc.wait() + +debugserver_proc.kill() +exit(filecheck_proc.returncode) Added: lldb/trunk/lit/tools/lldb-mi/target/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/target/lit.local.cfg?rev=339178&view=auto == --- lldb/trunk/lit/tools/lldb-mi/target/lit.local.cfg (added) +++ lldb/trunk/lit/tools/lldb-mi/target/lit.local.cfg Tue Aug 7 13:45:46 2018 @@ -0,0 +1 @@ +config.suffixes = ['.test'] Added: lldb/trunk/lit/tools/lldb-mi/target/target-select-so-path.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/target/target-select-so-path.test?rev=339178&view=auto == --- lldb/trunk/lit
[Lldb-commits] [lldb] r339189 - Add documentation for SBTarget::AppendImageSearchPath
Author: apolyakov Date: Tue Aug 7 14:41:59 2018 New Revision: 339189 URL: http://llvm.org/viewvc/llvm-project?rev=339189&view=rev Log: Add documentation for SBTarget::AppendImageSearchPath Modified: lldb/trunk/include/lldb/API/SBTarget.h lldb/trunk/scripts/interface/SBTarget.i Modified: lldb/trunk/include/lldb/API/SBTarget.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=339189&r1=339188&r2=339189&view=diff == --- lldb/trunk/include/lldb/API/SBTarget.h (original) +++ lldb/trunk/include/lldb/API/SBTarget.h Tue Aug 7 14:41:59 2018 @@ -272,6 +272,7 @@ public: lldb::SBFileSpec GetExecutable(); + // Append the path mapping (from -> to) to the target's paths mapping list. void AppendImageSearchPath(const char *from, const char *to, lldb::SBError &error); Modified: lldb/trunk/scripts/interface/SBTarget.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBTarget.i?rev=339189&r1=339188&r2=339189&view=diff == --- lldb/trunk/scripts/interface/SBTarget.i (original) +++ lldb/trunk/scripts/interface/SBTarget.i Tue Aug 7 14:41:59 2018 @@ -373,6 +373,9 @@ public: lldb::SBFileSpec GetExecutable (); +%feature("docstring", " +/// Append the path mapping (from -> to) to the target's paths mapping list. +") AppendImageSearchPath; void AppendImageSearchPath (const char *from, const char *to, ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r343033 - [lldb-mi] Fix bugs in target-select-so-path.test
Author: apolyakov Date: Tue Sep 25 14:49:33 2018 New Revision: 343033 URL: http://llvm.org/viewvc/llvm-project?rev=343033&view=rev Log: [lldb-mi] Fix bugs in target-select-so-path.test Summary: * This patch fixes hanging of the test in case of using python3, changes callback function that will be called if the timer ends, changes python interpreter to `%python` that is set up by llvm-lit. * Also, the test didn't work properly since it didn't contain a call of filecheck_proc.communicate(), that means that filecheck didn't run and its return code was equal to 0 in all cases. Reviewers: teemperor, labath, tatyana-krasnukha, aprantl Reviewed By: teemperor, labath Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D52498 Modified: lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py lldb/trunk/lit/tools/lldb-mi/target/target-select-so-path.test Modified: lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py?rev=343033&r1=343032&r2=343033&view=diff == --- lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py (original) +++ lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py Tue Sep 25 14:49:33 2018 @@ -1,5 +1,3 @@ -#!/usr/bin/env python2 - import os import sys import subprocess @@ -9,6 +7,10 @@ from threading import Timer hostname = 'localhost' (r, w) = os.pipe() +kwargs = {} +if sys.version_info >= (3,2): +kwargs['pass_fds'] = [w] + args = sys.argv # Get debugserver, lldb-mi and FileCheck executables' paths with arguments. debugserver = ' '.join([args[1], '--pipe', str(w), hostname + ':0']) @@ -17,14 +19,14 @@ test_file = args[3] filecheck = 'FileCheck ' + test_file # Run debugserver, lldb-mi and FileCheck. -debugserver_proc = subprocess.Popen(debugserver.split()) +debugserver_proc = subprocess.Popen(debugserver.split(), **kwargs) lldbmi_proc = subprocess.Popen(lldbmi, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True) filecheck_proc = subprocess.Popen(filecheck, stdin=subprocess.PIPE, shell=True) timeout_sec = 30 -timer = Timer(timeout_sec, lldbmi_proc.kill) +timer = Timer(timeout_sec, exit, [filecheck_proc.returncode]) try: timer.start() @@ -37,9 +39,10 @@ try: with open(test_file, 'r') as f: # Replace '$PORT' with a free port number and pass # test's content to lldb-mi. -lldbmi_proc.stdin.write(f.read().replace('$PORT', port)) +lldbmi_proc.stdin.write(f.read().replace('$PORT', port).encode('utf-8')) out, err = lldbmi_proc.communicate() filecheck_proc.stdin.write(out) +filecheck_proc.communicate() finally: timer.cancel() Modified: lldb/trunk/lit/tools/lldb-mi/target/target-select-so-path.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/target/target-select-so-path.test?rev=343033&r1=343032&r2=343033&view=diff == --- lldb/trunk/lit/tools/lldb-mi/target/target-select-so-path.test (original) +++ lldb/trunk/lit/tools/lldb-mi/target/target-select-so-path.test Tue Sep 25 14:49:33 2018 @@ -1,7 +1,7 @@ # UNSUPPORTED: windows, darwin # # RUN: %cc -o %t %p/inputs/main.c -g -# RUN: python %p/inputs/target-select-so-path.py "%debugserver" "%lldbmi %t" %s +# RUN: %python %p/inputs/target-select-so-path.py "%debugserver" "%lldbmi %t" %s # Test that -target-select command can hook up a path # added by gdb-set solib-search-path. ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r341667 - [ARC] Make char unsigned by default
Author: apolyakov Date: Fri Sep 7 07:45:32 2018 New Revision: 341667 URL: http://llvm.org/viewvc/llvm-project?rev=341667&view=rev Log: [ARC] Make char unsigned by default Summary: This patch specifies 'char' default sign on ARC. Reviewers: tatyana-krasnukha, clayborg Reviewed By: tatyana-krasnukha, clayborg Subscribers: clayborg, lldb-commits Differential Revision: https://reviews.llvm.org/D51594 Modified: lldb/trunk/source/Utility/ArchSpec.cpp Modified: lldb/trunk/source/Utility/ArchSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ArchSpec.cpp?rev=341667&r1=341666&r2=341667&view=diff == --- lldb/trunk/source/Utility/ArchSpec.cpp (original) +++ lldb/trunk/source/Utility/ArchSpec.cpp Fri Sep 7 07:45:32 2018 @@ -815,6 +815,7 @@ bool ArchSpec::CharIsSignedByDefault() c case llvm::Triple::ppc64le: case llvm::Triple::systemz: case llvm::Triple::xcore: + case llvm::Triple::arc: return false; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r342329 - [lldb-mi] Correct regex in the symbol-list-lines test
Author: apolyakov Date: Sat Sep 15 10:05:20 2018 New Revision: 342329 URL: http://llvm.org/viewvc/llvm-project?rev=342329&view=rev Log: [lldb-mi] Correct regex in the symbol-list-lines test Summary: The test failed in case of compiling a test suite with gcc (checked versions are 5.2.0 and 7.3.0) because it adds one more line entry comparing to clang. It doesn't break the test's logic, so I just added a regex that matches this case. Reviewers: tatyana-krasnukha, aprantl, clayborg Reviewed By: aprantl Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D52101 Modified: lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test Modified: lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test?rev=342329&r1=342328&r2=342329&view=diff == --- lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test (original) +++ lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test Sat Sep 15 10:05:20 2018 @@ -14,7 +14,7 @@ # CHECK: ^error,msg="File Handler. Invalid file name path" -symbol-list-lines symbol-list-lines.c -# CHECK: ^done,lines=[{pc="0x{{[0-9A-Fa-f]+}}",line="3"},{pc="0x{{[0-9A-Fa-f]+}}",line="4"},{pc="0x{{[0-9A-Fa-f]+}}",line="5"}] +# CHECK: ^done,lines=[{pc="0x{{[0-9A-Fa-f]+}}",line="3"},{pc="0x{{[0-9A-Fa-f]+}}",line="4"},{pc="0x{{[0-9A-Fa-f]+}}",line="5"}{{.*}}] -symbol-list-lines list-lines-helper.c -# CHECK: ^done,lines=[{pc="0x{{[0-9A-Fa-f]+}}",line="1"},{pc="0x{{[0-9A-Fa-f]+}}",line="2"},{pc="0x{{[0-9A-Fa-f]+}}",line="3"}] +# CHECK: ^done,lines=[{pc="0x{{[0-9A-Fa-f]+}}",line="1"},{pc="0x{{[0-9A-Fa-f]+}}",line="2"},{pc="0x{{[0-9A-Fa-f]+}}",line="3"}{{.*}}] ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r342915 - [lldb-mi] Fix hanging of target-select-so-path.test
Author: apolyakov Date: Mon Sep 24 12:10:48 2018 New Revision: 342915 URL: http://llvm.org/viewvc/llvm-project?rev=342915&view=rev Log: [lldb-mi] Fix hanging of target-select-so-path.test Summary: The target-select-so-path test might hang on some platforms. The reason of that behavior was in incorrect usage of Filecheck and lldb-mi processes. Instead of redirecting lldb-mi's output to Filecheck, we should run lldb-mi session, finish the session, collect its output and then pass it to Filecheck. Also, this patch adds a timer to the test to prevent it from hanging in the future. Reviewers: tatyana-krasnukha, aprantl, teemperor Reviewed By: tatyana-krasnukha, teemperor Subscribers: apolyakov, aprantl, teemperor, ki.stfu, abidh, lldb-commits Differential Revision: https://reviews.llvm.org/D52139 Modified: lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py Modified: lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py?rev=342915&r1=342914&r2=342915&view=diff == --- lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py (original) +++ lldb/trunk/lit/tools/lldb-mi/target/inputs/target-select-so-path.py Mon Sep 24 12:10:48 2018 @@ -3,6 +3,7 @@ import os import sys import subprocess +from threading import Timer hostname = 'localhost' @@ -19,21 +20,28 @@ filecheck = 'FileCheck ' + test_file debugserver_proc = subprocess.Popen(debugserver.split()) lldbmi_proc = subprocess.Popen(lldbmi, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True) -filecheck_proc = subprocess.Popen(filecheck, stdin=lldbmi_proc.stdout, +filecheck_proc = subprocess.Popen(filecheck, stdin=subprocess.PIPE, shell=True) -# Get a tcp port chosen by debugserver. -# The number quite big to get lldb-server's output and to not hang. -bytes_to_read = 10 -port_bytes = os.read(r, bytes_to_read) -port = str(port_bytes.decode('utf-8').strip('\x00')) - -with open(test_file, 'r') as f: -# Replace '$PORT' with a free port number and pass -# test's content to lldb-mi. -lldbmi_proc.stdin.write(f.read().replace('$PORT', port)) -lldbmi_proc.wait() -filecheck_proc.wait() +timeout_sec = 30 +timer = Timer(timeout_sec, lldbmi_proc.kill) +try: +timer.start() + +# Get a tcp port chosen by debugserver. +# The number quite big to get lldb-server's output and to not hang. +bytes_to_read = 10 +port_bytes = os.read(r, bytes_to_read) +port = str(port_bytes.decode('utf-8').strip('\x00')) + +with open(test_file, 'r') as f: +# Replace '$PORT' with a free port number and pass +# test's content to lldb-mi. +lldbmi_proc.stdin.write(f.read().replace('$PORT', port)) +out, err = lldbmi_proc.communicate() +filecheck_proc.stdin.write(out) +finally: +timer.cancel() debugserver_proc.kill() exit(filecheck_proc.returncode) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r360564 - @skipIfLinux flaky lldb-mi tests
Hi, Unfortunately, the next few months I'll be busy with my bachelor's thesis, so I can't dive into that problem right now. I've just tested lldb-mi on Ubuntu Linux 18.04 and it seems that there is some race condition somewhere in lldb-mi or lldb's core, I ran lldb-mi's LIT test suite for five times and all tests were successfully passed, but at the sixth try one test unexpectedly failed. On Mon, May 13, 2019 at 12:17 PM Pavel Labath wrote: > On 13/05/2019 11:00, Raphael Isemann wrote: > > These tests are now SkipIf Windows, FreeBSD, Darwin AND Linux :( So > > unless someone sets up a Minix or GNU Hurd bot these tests are never > > run. > > Yeah, the state of lldb-mi is... sad :/ > > > > > CC'ing Alexander who was IIRC able to fix these tests in the past, so > > maybe he has an idea what's going on. > > > The most recent failures are here: > > http://lab.llvm.org:8014/builders/lldb-x86_64-debian/builds/1354/steps/test/logs/stdio > > http://lab.llvm.org:8014/builders/lldb-x86_64-debian/builds/1343/steps/test/logs/stdio > > http://lab.llvm.org:8014/builders/lldb-x86_64-debian/builds/1324/steps/test/logs/stdio > > pl > > > -- Alexander ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits