diff --git a/debuggers/gdb/debugsession.h b/debuggers/gdb/debugsession.h --- a/debuggers/gdb/debugsession.h +++ b/debuggers/gdb/debugsession.h @@ -80,6 +80,8 @@ KDevelop::IVariableController* variableController() const override; KDevelop::IFrameStackModel* frameStackModel() const override; + bool isCrashed() const; + using IDebugSession::event; Q_SIGNALS: void applicationStandardOutputLines(const QStringList& lines); @@ -296,6 +298,8 @@ ///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 {