diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index 3a37c4a9242e12710a45dad093e00dbd387d449a..49d0b7537efa3420b4bbefc6dddfd6c55cab5dd1 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -81,6 +81,22 @@ SeparateLatin1StringFormat, \ SeparateUtf8StringFormat \ = range(100, 112) +# Breakpoints. Keep synchronized with BreakpointType in breakpoint.h +UnknownType, \ +BreakpointByFileAndLine, \ +BreakpointByFunction, \ +BreakpointByAddress, \ +BreakpointAtThrow, \ +BreakpointAtCatch, \ +BreakpointAtMain, \ +BreakpointAtFork, \ +BreakpointAtExec, \ +BreakpointAtSysCall, \ +WatchpointAtAddress, \ +WatchpointAtExpression, \ +BreakpointOnQmlSignalEmit, \ +BreakpointAtJavaScriptThrow, \ + = range(0, 14) # # matplot based display for array-like structures. # diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 47084e512c90b28eda9de8c738af9f3786417ea4..a986707f0f92170f8fef60f9e1bb7251d880fbb5 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -28,18 +28,15 @@ # ############################################################################# -import atexit import inspect import os import platform import re import sys -import subprocess import threading import lldb -currentDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) -sys.path.insert(1, currentDir) +sys.path.insert(1, os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))) from dumper import * @@ -51,8 +48,6 @@ from dumper import * qqWatchpointOffset = 10000 -lldb.theDumper = None - def warn(message): print('\n\nWARNING="%s",\n' % message.encode("latin1").replace('"', "'")) @@ -66,22 +61,6 @@ def fileName(file): return str(file) if file.IsValid() else '' -# Breakpoints. Keep synchronized with BreakpointType in breakpoint.h -UnknownType = 0 -BreakpointByFileAndLine = 1 -BreakpointByFunction = 2 -BreakpointByAddress = 3 -BreakpointAtThrow = 4 -BreakpointAtCatch = 5 -BreakpointAtMain = 6 -BreakpointAtFork = 7 -BreakpointAtExec = 8 -BreakpointAtSysCall = 9 -WatchpointAtAddress = 10 -WatchpointAtExpression = 11 -BreakpointOnQmlSignalEmit = 12 -BreakpointAtJavaScriptThrow = 13 - def check(exp): if not exp: raise RuntimeError("Check failed") @@ -187,8 +166,6 @@ class Dumper(DumperBase): def __init__(self): DumperBase.__init__(self) - lldb.theDumper = self - self.outputLock = threading.Lock() self.debugger = lldb.SBDebugger.Create() #self.debugger.SetLoggingCallback(loggingCallback) @@ -255,6 +232,9 @@ class Dumper(DumperBase): self.qmlBreakpointResolvers = {} self.qmlTriggeredBreakpoint = None + self.report('lldbversion=\"%s\"' % lldb.SBDebugger.GetVersionString()) + self.reportState("enginesetupok") + def enterSubItem(self, item): if isinstance(item.name, lldb.SBValue): # Avoid $$__synth__ suffix on Mac. @@ -1719,7 +1699,6 @@ class Dumper(DumperBase): # Used in dumper auto test. -# Usage: python lldbbridge.py /path/to/testbinary comma-separated-inames class Tester(Dumper): def __init__(self, binary, expandedINames): Dumper.__init__(self) diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 359403bfa4d8788ae51061d781256e2f4fe1106b..01c5d9651a378b9d38becc6ab8c1268135831f1c 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -118,7 +118,6 @@ LldbEngine::~LldbEngine() m_stubProc.disconnect(); // Avoid spurious state transitions from late exiting stub } - void LldbEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages) { DebuggerCommand cmd("executeDebuggerCommand"); @@ -133,7 +132,7 @@ void LldbEngine::runCommand(const DebuggerCommand &command) QByteArray token = QByteArray::number(m_lastToken); QByteArray cmd = command.function + "({" + command.args + "})"; showMessage(_(token + cmd + '\n'), LogInput); - m_lldbProc.write("sc db." + cmd + "\n"); + m_lldbProc.write("script theDumper." + cmd + "\n"); } void LldbEngine::debugLastCommand() @@ -269,14 +268,10 @@ void LldbEngine::startLldb() const QByteArray dumperSourcePath = ICore::resourcePath().toLocal8Bit() + "/debugger/"; - m_lldbProc.write("sc sys.path.insert(1, '" + dumperSourcePath + "')\n"); - m_lldbProc.write("sc from lldbbridge import *\n"); - m_lldbProc.write("sc print(dir())\n"); - m_lldbProc.write("sc db = Dumper()\n"); - m_lldbProc.write("sc db.report('lldbversion=\"%s\"' % lldb.SBDebugger.GetVersionString())\n"); - - showMessage(_("ENGINE SUCCESSFULLY STARTED")); - notifyEngineSetupOk(); + m_lldbProc.write("script sys.path.insert(1, '" + dumperSourcePath + "')\n"); + m_lldbProc.write("script from lldbbridge import *\n"); + m_lldbProc.write("script print(dir())\n"); + m_lldbProc.write("script theDumper = Dumper()\n"); // This triggers reportState("enginesetupok") } void LldbEngine::setupInferior()