Commit b981f504 authored by hjk's avatar hjk
Browse files

Debugger: Let LldbEngine pass current token to dumper



Change-Id: Ifea751354f637f67e640d36ba1baa95678c86ee9
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
parent a0f8a67d
......@@ -633,6 +633,7 @@ class Dumper(DumperBase):
return None
def setupInferior(self, args):
self.reportToken(args)
error = lldb.SBError()
self.executable_ = args['executable']
......@@ -686,6 +687,7 @@ class Dumper(DumperBase):
s.start()
def prepare(self, args):
self.reportToken(args)
error = lldb.SBError()
listener = self.debugger.GetListener()
......@@ -821,6 +823,7 @@ class Dumper(DumperBase):
return None
def reportStack(self, args):
self.reportToken(args)
if not self.process:
self.report('msg="No process"')
return
......@@ -891,6 +894,12 @@ class Dumper(DumperBase):
self.report(result)
self.reportContinuation(args)
def reportToken(self, args):
if "token" in args:
# Unusual syntax intended, to support the double-click in left
# logview pane feature.
self.report('token(\"%s\")' % args["token"])
def reportContinuation(self, args):
if "continuation" in args:
self.report('continuation=\"%s\"' % args["continuation"])
......@@ -1529,17 +1538,21 @@ class Dumper(DumperBase):
self.process.Kill()
self.reportState("inferiorshutdownok")
def quit(self, _ = None):
def quit(self, args = {}):
self.reportToken(args)
self.reportState("engineshutdownok")
self.process.Kill()
def executeStepI(self, _ = None):
def executeStepI(self, args = {}):
self.reportToken(args)
self.currentThread().StepInstruction(lldb.eOnlyThisThread)
def executeStepOut(self, _ = None):
def executeStepOut(self, args = {}):
self.reportToken(args)
self.currentThread().StepOut()
def executeRunToLocation(self, args):
self.reportToken(args)
addr = args.get('address', 0)
if addr:
error = self.currentThread().RunToAddress(addr)
......@@ -1556,6 +1569,7 @@ class Dumper(DumperBase):
self.reportData()
def executeJumpToLocation(self, args):
self.reportToken(args)
frame = self.currentFrame()
if not frame:
self.reportStatus("No frame available.")
......@@ -1612,6 +1626,7 @@ class Dumper(DumperBase):
self.report('success="%d",output="%s",error="%s"' % (success, output, error))
def updateData(self, args):
self.reportToken(args)
self.expandedINames = set(args.get('expanded', []))
self.autoDerefPointers = int(args.get('autoderef', '0'))
self.useDynamicType = int(args.get('dyntype', '0'))
......@@ -1655,7 +1670,8 @@ class Dumper(DumperBase):
result += ',offset="%s"},' % (addr - base)
self.report(result + ']')
def loadDumperFiles(self, _ = None):
def loadDumperFiles(self, args):
self.reportToken(args)
result = self.setupDumper()
self.report(result)
......
......@@ -75,6 +75,12 @@ using namespace Utils;
namespace Debugger {
namespace Internal {
static int &currentToken()
{
static int token = 0;
return token;
}
///////////////////////////////////////////////////////////////////////
//
// LldbEngine
......@@ -85,7 +91,6 @@ LldbEngine::LldbEngine(const DebuggerStartParameters &startParameters)
: DebuggerEngine(startParameters), m_continueAtNextSpontaneousStop(false)
{
m_lastAgentId = 0;
m_lastToken = 0;
setObjectName(QLatin1String("LldbEngine"));
if (startParameters.useTerminal) {
......@@ -126,11 +131,13 @@ void LldbEngine::executeDebuggerCommand(const QString &command, DebuggerLanguage
runCommand(cmd);
}
void LldbEngine::runCommand(const DebuggerCommand &command)
void LldbEngine::runCommand(const DebuggerCommand &command_)
{
QTC_ASSERT(m_lldbProc.state() == QProcess::Running, notifyEngineIll());
++m_lastToken;
QByteArray token = QByteArray::number(m_lastToken);
const int tok = ++currentToken();
DebuggerCommand command = command_;
command.arg("token", tok);
QByteArray token = QByteArray::number(tok);
QByteArray cmd = command.function + "({" + command.args + "})";
showMessage(_(token + cmd + '\n'), LogInput);
m_lldbProc.write("script theDumper." + cmd + "\n");
......
......@@ -187,7 +187,6 @@ private:
// FIXME: Make generic.
int m_lastAgentId;
int m_lastToken;
int m_continueAtNextSpontaneousStop;
QMap<QPointer<DisassemblerAgent>, int> m_disassemblerAgents;
QMap<QPointer<MemoryAgent>, int> m_memoryAgents;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment