From e9237c20c6b15da9350428e26ac4777a7c4361a9 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Jan 2015 10:25:21 +0100 Subject: [PATCH] Debugger: Work on LLDB auto-test on Linux Write the full command to a temporary file for easier re-use. Un-ignore the first stop, this does not seem to be needed in the new async setup. In some cases LLDB is not able to extract the even the top most frame of the stopped thread (happened 2 out of 100 runs of the QDateTime dumper). It's unclear why. For now just report the fact. Change-Id: I76a63bc288f1ae6f5bd9b9604a47f051912b93d7 Reviewed-by: hjk --- share/qtcreator/debugger/lldbbridge.py | 29 +++++++++++++++++++------- tests/auto/debugger/tst_dumpers.cpp | 6 +++++- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 0d05c7329b2..eb7e3252498 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -1764,10 +1764,6 @@ class Tester(Dumper): savedReport = self.report self.report = lambda stuff: 0 - ignoreStops = 1 - if sys.platform == "darwin": - ignoreStops = 0 - error = lldb.SBError() launchInfo = lldb.SBLaunchInfo([]) launchInfo.SetWorkingDirectory(os.getcwd()) @@ -1792,12 +1788,23 @@ class Tester(Dumper): #warn('event={type="%s",data="%s",msg="%s",flavor="%s",state="%s"}' # % (event.GetType(), out.GetData(), msg, flavor, state)) state = lldb.SBProcess.GetStateFromEvent(event) - if state == lldb.eStateExited: + if state == lldb.eStateExited: # 10 break - if state == lldb.eStateStopped: - if ignoreStops == 0: + if state == lldb.eStateStopped: # 5 + stoppedThread = self.firstStoppedThread() + if stoppedThread is None: + warn("NO STOPPED THREAD FOUND") + for i in xrange(0, self.process.GetNumThreads()): + thread = self.process.GetThreadAtIndex(i) + reason = thread.GetStopReason() + warn("THREAD: %s REASON: %s" % (thread, reason)) + continue + + try: + frame = stoppedThread.GetFrameAtIndex(0) break - ignoreStops -= 1 + except: + warn("NO FRAME FOUND FOR THREAD %s" % stoppedThread) else: warn('TIMEOUT') @@ -1810,6 +1817,12 @@ class Tester(Dumper): # This seems highly fragile and depending on the "No-ops" in the # event handling above. self.process.SetSelectedThread(stoppedThread) + + frame = stoppedThread.GetFrameAtIndex(0) + #file = fileName(frame.line_entry.file) + #line = frame.line_entry.line + #warn('LOCATION={file="%s",line="%s",addr="%s"}' + # % (file, line, frame.pc)) self.report = savedReport self.reportVariables() self.report("@NS@%s@" % self.qtNamespace()) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 23a16adb351..b6b693f2fb7 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -1263,7 +1263,11 @@ void tst_Dumpers::dumper() << QString::fromUtf8(m_debuggerBinary) << t->buildPath + QLatin1String("/doit") << QString::fromUtf8(expanded); - qDebug() << exe.constData() << ' ' << qPrintable(args.join(QLatin1String(" "))); + QFile fullLldb(t->buildPath + QLatin1String("/lldbcommand.txt")); + fullLldb.setPermissions(QFile::ReadOwner|QFile::WriteOwner|QFile::ExeOwner|QFile::ReadGroup|QFile::ReadOther); + fullLldb.open(QIODevice::WriteOnly); + fullLldb.write(exe + ' ' + args.join(QLatin1String(" ")).toUtf8()); + fullLldb.close(); } t->input = cmds;