aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorhjk <hjk@theqtcompany.com>2016-04-13 18:19:45 +0200
committerhjk <hjk@theqtcompany.com>2016-04-15 10:50:45 +0000
commitc0fabbe169a9678eb8df0505de54fdaf9fec1a3f (patch)
treeaf34a6567046167fb8ed817c5827af3974aed56c /share
parent62fc258ac01dc31caada235568c2e92e21d3208d (diff)
Debugger: Add breakpoint commands for LLDB backend
Commands needs to be given in Python, i.e. something like import time print time.asctime() for i in range(1, 10): print(i) works. Task-number: QTCREATORBUG-15585 Change-Id: I7724617e4bbe85a717ae78b21014e2b55c4089c8 Reviewed-by: Alexandru Croitor <alexandru.croitor@theqtcompany.com> Reviewed-by: hjk <hjk@theqtcompany.com>
Diffstat (limited to 'share')
-rw-r--r--share/qtcreator/debugger/lldbbridge.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py
index 6fd697fcc3..506f2379a8 100644
--- a/share/qtcreator/debugger/lldbbridge.py
+++ b/share/qtcreator/debugger/lldbbridge.py
@@ -160,6 +160,7 @@ lldb.SBType.__str__ = lldb.SBType.GetName
class Dumper(DumperBase):
def __init__(self):
DumperBase.__init__(self)
+ lldb.theDumper = self
self.outputLock = threading.Lock()
self.debugger = lldb.SBDebugger.Create()
@@ -1489,6 +1490,21 @@ class Dumper(DumperBase):
bp.SetIgnoreCount(int(args["ignorecount"]))
bp.SetCondition(self.hexdecode(args["condition"]))
bp.SetEnabled(bool(args["enabled"]))
+ bp.SetScriptCallbackBody('\n'.join([
+ "def foo(frame = frame, bp_loc = bp_loc, dict = internal_dict):",
+ " " + self.hexdecode(args["command"]).replace('\n', '\n '),
+ "from cStringIO import StringIO",
+ "origout = sys.stdout",
+ "sys.stdout = StringIO()",
+ "result = foo()",
+ "d = lldb.theDumper",
+ "output = d.hexencode(sys.stdout.getvalue())",
+ "sys.stdout = origout",
+ "d.report('output={channel=\"stderr\",data=\"' + output + '\"}')",
+ "if result is False:",
+ " d.reportState('continueafternextstop')",
+ "return True"
+ ]))
if isinstance(bp, lldb.SBBreakpoint):
bp.SetOneShot(bool(args["oneshot"]))
self.reportResult(self.describeBreakpoint(bp) + extra, args)