From c8241c12d0094b18d963d7f635f10d469ca0cbcb Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 10 May 2021 18:17:19 +0200 Subject: [PATCH] Debugger: Add an option to enable newer gdb's symbol index cache GDB 8.3+ can automatically save indices of DWARF symbols on disk to speed up further loading of the same binaries. Make this option available to the user and switch it on by default. No harm is done for gdb builds without this feature. Task-number: QTCREATORBUG-23207 Change-Id: Id0d467eee429a94f1d8e826a883179796732d31e Reviewed-by: Christian Stenger --- src/plugins/debugger/debuggeractions.cpp | 8 ++++++++ src/plugins/debugger/debuggeractions.h | 1 + src/plugins/debugger/gdb/gdbengine.cpp | 3 +++ src/plugins/debugger/gdb/gdboptionspage.cpp | 1 + 4 files changed, 13 insertions(+) diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 9dd8475f00b..630eeb5504d 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -431,6 +431,13 @@ DebuggerSettings::DebuggerSettings() /*GdbOptionsPage::*/ tr("Uses Python to extend the ordinary GDB breakpoint class.")); usePseudoTracepoints.setDefaultValue(true); + useIndexCache.setSettingsKey(debugModeGroup, "UseIndexCache"); + useIndexCache.setLabelText(tr("Use automatic symbol cache")); + useIndexCache.setToolTip(tr("It is possible for GDB to automatically save a copy of " + "its symbol index in a cache on disk and retrieve it from there when loading the same " + "binary in the future.")); + useIndexCache.setDefaultValue(true); + useToolTipsInMainEditor.setSettingsKey(debugModeGroup, "UseToolTips"); useToolTipsInMainEditor.setLabelText(tr("Use tooltips in main editor when debugging")); useToolTipsInMainEditor.setToolTip(tr("

Checking this will enable tooltips for variable " @@ -584,6 +591,7 @@ DebuggerSettings::DebuggerSettings() page2.registerAspect(&intelFlavor); page2.registerAspect(&skipKnownFrames); page2.registerAspect(&usePseudoTracepoints); + page2.registerAspect(&useIndexCache); page2.registerAspect(&gdbStartupCommands); page2.registerAspect(&gdbPostAttachCommands); diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index 0f07cdf226e..46036b0c9da 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -112,6 +112,7 @@ public: Utils::BoolAspect loadGdbDumpers; Utils::BoolAspect intelFlavor; Utils::BoolAspect usePseudoTracepoints; + Utils::BoolAspect useIndexCache; Utils::StringAspect gdbStartupCommands; Utils::StringAspect gdbPostAttachCommands; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index ed55a53e902..d7e2231221b 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -3891,6 +3891,9 @@ void GdbEngine::setupEngine() runCommand({"set breakpoint pending on"}); runCommand({"set print elements 10000"}); + if (debuggerSettings()->useIndexCache.value()) + runCommand({"set index-cache on"}); + // Produces a few messages during symtab loading //runCommand("set verbose on"); diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp index c531f5d1336..f49a30e1fce 100644 --- a/src/plugins/debugger/gdb/gdboptionspage.cpp +++ b/src/plugins/debugger/gdb/gdboptionspage.cpp @@ -71,6 +71,7 @@ public: s.loadGdbDumpers, s.intelFlavor, s.usePseudoTracepoints, + s.useIndexCache, Stretch() };