[Lldb-commits] [PATCH] D46588: [LLDB][lldb-mi] Add possibility to set breakpoints without selecting a target.
Alexander Polyakov via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed May 16 09:57:38 PDT 2018
polyakov.alex updated this revision to Diff 147117.
polyakov.alex added a comment.
I have all the patches I was sending. I will follow this topic until you decide what to do with lldb-mi testing.
Repository:
rL LLVM
https://reviews.llvm.org/D46588
Files:
packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
tools/lldb-mi/MICmdCmdBreak.cpp
tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
Index: tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
===================================================================
--- tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
+++ tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
@@ -871,7 +871,10 @@
// Throws: None.
//--
lldb::SBTarget CMICmnLLDBDebugSessionInfo::GetTarget() const {
- return GetDebugger().GetSelectedTarget();
+ auto target = GetDebugger().GetSelectedTarget();
+ if (target.IsValid())
+ return target;
+ return GetDebugger().GetDummyTarget();
}
//++
Index: tools/lldb-mi/MICmdCmdBreak.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdBreak.cpp
+++ tools/lldb-mi/MICmdCmdBreak.cpp
@@ -148,6 +148,11 @@
CMICMDBASE_GETOPTION(pArgRestrictBrkPtToThreadId, OptionShort,
m_constStrArgNamedRestrictBrkPtToThreadId);
+ // Ask LLDB for the target to check if we have valid or dummy one.
+ CMICmnLLDBDebugSessionInfo &rSessionInfo(
+ CMICmnLLDBDebugSessionInfo::Instance());
+ lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
+
m_bBrkPtEnabled = !pArgDisableBrkPt->GetFound();
m_bBrkPtIsTemp = pArgTempBrkPt->GetFound();
m_bHaveArgOptionThreadGrp = pArgThreadGroup->GetFound();
@@ -157,7 +162,12 @@
nThreadGrp);
m_strArgOptionThreadGrp = CMIUtilString::Format("i%d", nThreadGrp);
}
- m_bBrkPtIsPending = pArgPendingBrkPt->GetFound();
+
+ if (sbTarget == rSessionInfo.GetDebugger().GetDummyTarget())
+ m_bBrkPtIsPending = true;
+ else
+ m_bBrkPtIsPending = pArgPendingBrkPt->GetFound();
+
if (pArgLocation->GetFound())
m_brkName = pArgLocation->GetValue();
else if (m_bBrkPtIsPending) {
@@ -225,9 +235,6 @@
// Ask LLDB to create a breakpoint
bool bOk = MIstatus::success;
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
switch (eBrkPtType) {
case eBreakPoint_ByAddress:
m_brkPt = sbTarget.BreakpointCreateByAddress(nAddress);
Index: packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
===================================================================
--- packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
@@ -143,6 +143,32 @@
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows.
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races.
+ @skipIfRemote # We do not currently support remote debugging via the MI.
+ def test_lldbmi_break_insert_without_target(self):
+ """Test that 'lldb-mi --interpreter' can set breakpoints without
+ selecting a valid target."""
+
+ self.spawnLldbMi(args=None)
+
+ # This command have to insert breakpoint to the dummy target.
+ self.runCmd("-break-insert main")
+ # FIXME function name is unknown on Darwin, fullname should be ??, line is -1
+ self.expect(
+ "\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\","
+ "addr=\"0xffffffffffffffff\",func=\"\?\?\",file=\"\?\?\",fullname=\"\?\?/\?\?\","
+ "line=\"0\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}"
+ )
+
+ # Add a valid target.
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfRemote # We do not currently support remote debugging via the MI.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46588.147117.patch
Type: text/x-patch
Size: 3915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180516/80c062f3/attachment-0001.bin>
More information about the lldb-commits
mailing list