diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2010-07-15 08:36:18 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2010-07-15 08:39:48 (GMT) |
commit | 518a8ab0fe67965555973788e3eea643882cb80c (patch) | |
tree | 4efe108abacc687d059a9093d901052858263aaa /tools/runonphone | |
parent | 12b6275a21076df582e80c422b31560d8ee995d0 (diff) | |
download | Qt-518a8ab0fe67965555973788e3eea643882cb80c.zip Qt-518a8ab0fe67965555973788e3eea643882cb80c.tar.gz Qt-518a8ab0fe67965555973788e3eea643882cb80c.tar.bz2 |
fix for looping crash log on data abort
When a thread panics, calling resume allows the thread to proceed to the
exit handler and shut down.
When a thread takes an exception, calling resume continues from the same
point so the exception happens again.
To avoid this, we add crashed thread ids to a list. If we see the same
thread crash again, we terminate the process without trying to fetch the
call stack a second time.
Reviewed-by: Jason Barron
Diffstat (limited to 'tools/runonphone')
-rw-r--r-- | tools/runonphone/trksignalhandler.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/tools/runonphone/trksignalhandler.cpp b/tools/runonphone/trksignalhandler.cpp index b6d446f..898692a 100644 --- a/tools/runonphone/trksignalhandler.cpp +++ b/tools/runonphone/trksignalhandler.cpp @@ -71,8 +71,10 @@ private: QFile crashlogtextfile; QFile crashstackfile; QList<CrashState> queuedCrashes; + QList<int> dyingThreads; QString crashlogPath; bool crashlog; + bool terminateNeeded; }; void TrkSignalHandler::copyingStarted() @@ -201,15 +203,23 @@ void TrkSignalHandler::stopped(uint pc, uint pid, uint tid, const QString& reaso cs.crashPC = pc; cs.crashReason = reason; - d->queuedCrashes.append(cs); - - if (d->queuedCrashes.count() == 1) { - d->err << "Fetching registers and stack..." << endl; - emit getRegistersAndCallStack(pid, tid); + if (d->dyingThreads.contains(tid)) { + if(d->queuedCrashes.isEmpty()) + emit terminate(); + else + d->terminateNeeded = true; + } else { + d->queuedCrashes.append(cs); + d->dyingThreads.append(tid); + + if (d->queuedCrashes.count() == 1) { + d->err << "Fetching registers and stack..." << endl; + emit getRegistersAndCallStack(pid, tid); + } } } else - emit resume(pid, tid); + emit terminate(); } void TrkSignalHandler::registersAndCallStackReadComplete(const QList<uint>& registers, const QByteArray& stack) @@ -307,6 +317,8 @@ void TrkSignalHandler::registersAndCallStackReadComplete(const QList<uint>& regi d->err << "Fetching registers and stack..." << endl; emit getRegistersAndCallStack(cs.pid, cs.tid); } + else if (d->terminateNeeded) + emit terminate(); } @@ -333,7 +345,8 @@ TrkSignalHandlerPrivate::TrkSignalHandlerPrivate() : out(stdout), err(stderr), loglevel(0), - lastpercent(0) + lastpercent(0), + terminateNeeded(false) { } |