diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index b114544c00ae818c49e5808f648abfb73acddd01..05302371620b262632760023bac36137caa19273 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -108,6 +108,7 @@ using namespace TextEditor; DebuggerStartParameters::DebuggerStartParameters() : attachPID(-1), useTerminal(false), + isSnapshot(false), breakAtMain(false), qmlServerAddress("127.0.0.1"), qmlServerPort(0), diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index bc6a57498e82d922391e5d28ebe2830fc5ffa871..e18e763e16912521fcf29324b31864867bea4662 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -68,6 +68,7 @@ public: QString executable; QString displayName; QString coreFile; + bool isSnapshot; // set if created internally QStringList processArgs; QStringList environment; QString workingDirectory; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 38e2f75a1c71b9cf7020fb30dc3f9ae49f1c7765..b82e340aec2dae7d904b614ca50a0fe87ccf729a 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -3022,6 +3022,7 @@ void GdbEngine::handleMakeSnapshot(const GdbResponse &response) function = frame.function + _(":") + QString::number(frame.line); } sp.displayName = function + _(": ") + QDateTime::currentDateTime().toString(); + sp.isSnapshot = true; DebuggerRunControl *rc = DebuggerPlugin::createDebugger(sp); DebuggerPlugin::startDebugger(rc); } else { diff --git a/src/plugins/debugger/snapshothandler.cpp b/src/plugins/debugger/snapshothandler.cpp index 2e9571c7535f431aa6f1acd228974a4ffceed76a..c9bf24303bbe8b842175c6cda824c02ec02ceb29 100644 --- a/src/plugins/debugger/snapshothandler.cpp +++ b/src/plugins/debugger/snapshothandler.cpp @@ -127,9 +127,9 @@ SnapshotHandler::~SnapshotHandler() { for (int i = m_snapshots.size(); --i >= 0; ) { if (DebuggerEngine *engine = engineAt(i)) { - QString fileName = engine->startParameters().coreFile; - if (!fileName.isEmpty()) - QFile::remove(fileName); + const DebuggerStartParameters & sp = engine->startParameters(); + if (sp.isSnapshot && !sp.coreFile.isEmpty()) + QFile::remove(sp.coreFile); } } } @@ -270,8 +270,8 @@ void SnapshotHandler::removeSnapshot(int index) const DebuggerEngine *engine = engineAt(index); QTC_ASSERT(engine, return); QString fileName = engine->startParameters().coreFile; - if (!fileName.isEmpty()) - QFile::remove(fileName); + //if (!fileName.isEmpty()) + // QFile::remove(fileName); m_snapshots.removeAt(index); if (index == m_currentIndex) m_currentIndex = -1;