diff --git a/debuggers/gdb/debugsession.h b/debuggers/gdb/debugsession.h --- a/debuggers/gdb/debugsession.h +++ b/debuggers/gdb/debugsession.h @@ -290,16 +290,15 @@ /**When program stops and all commands from queue are executed and this variable is true, program state shown to the user is updated.*/ bool state_reload_needed; - - QTime commandExecutionTime; - /**True if program has stopped and all stuff like breakpoints is being updated.*/ bool stateReloadInProgress_; + /**True if running crashes*/ + bool m_isCrashed; + + QTime commandExecutionTime; ///Exit code of the last inferior(in format: exit normally, with code "number" e.t.c) QString m_inferiorExitCode; - - bool m_isCrashed; }; } diff --git a/debuggers/gdb/debugsession.cpp b/debuggers/gdb/debugsession.cpp --- a/debuggers/gdb/debugsession.cpp +++ b/debuggers/gdb/debugsession.cpp @@ -77,6 +77,7 @@ , state_(s_dbgNotStarted | s_appNotStarted) , state_reload_needed(false) , stateReloadInProgress_(false) + , m_isCrashed(false) { configure(); @@ -731,6 +732,8 @@ // Continuing from SIG FPE/SEGV will cause a "Cannot ..." and // that'll end the program. programFinished(i18n("Program received signal %1 (%2)", name, user_name)); + + m_isCrashed = true; } } @@ -770,6 +773,10 @@ setStateOff(s_automaticContinue); } +bool DebugSession::isCrashed() const +{ + return m_isCrashed; +} void DebugSession::processNotification(const GDBMI::AsyncRecord & async) { diff --git a/debuggers/gdb/gdbframestackmodel.cpp b/debuggers/gdb/gdbframestackmodel.cpp --- a/debuggers/gdb/gdbframestackmodel.cpp +++ b/debuggers/gdb/gdbframestackmodel.cpp @@ -79,10 +79,16 @@ threadsList << i; } setThreads(threadsList); - if (r.hasField("current-thread-id")) - setCurrentThread(r["current-thread-id"].toInt()); -} + if (r.hasField("current-thread-id")) { + int currentThreadId = r["current-thread-id"].toInt(); + + setCurrentThread(currentThreadId); + if (session()->isCrashed()) { + setCrashedThreadIndex(currentThreadId); + } + } +} struct FrameListHandler : public GDBCommandHandler {