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 <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-05-10 18:17:19 +02:00
parent 6a9a58941e
commit c8241c12d0
4 changed files with 13 additions and 0 deletions

View File

@@ -431,6 +431,13 @@ DebuggerSettings::DebuggerSettings()
/*GdbOptionsPage::*/ tr("Uses Python to extend the ordinary GDB breakpoint class.")); /*GdbOptionsPage::*/ tr("Uses Python to extend the ordinary GDB breakpoint class."));
usePseudoTracepoints.setDefaultValue(true); 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.setSettingsKey(debugModeGroup, "UseToolTips");
useToolTipsInMainEditor.setLabelText(tr("Use tooltips in main editor when debugging")); useToolTipsInMainEditor.setLabelText(tr("Use tooltips in main editor when debugging"));
useToolTipsInMainEditor.setToolTip(tr("<p>Checking this will enable tooltips for variable " useToolTipsInMainEditor.setToolTip(tr("<p>Checking this will enable tooltips for variable "
@@ -584,6 +591,7 @@ DebuggerSettings::DebuggerSettings()
page2.registerAspect(&intelFlavor); page2.registerAspect(&intelFlavor);
page2.registerAspect(&skipKnownFrames); page2.registerAspect(&skipKnownFrames);
page2.registerAspect(&usePseudoTracepoints); page2.registerAspect(&usePseudoTracepoints);
page2.registerAspect(&useIndexCache);
page2.registerAspect(&gdbStartupCommands); page2.registerAspect(&gdbStartupCommands);
page2.registerAspect(&gdbPostAttachCommands); page2.registerAspect(&gdbPostAttachCommands);

View File

@@ -112,6 +112,7 @@ public:
Utils::BoolAspect loadGdbDumpers; Utils::BoolAspect loadGdbDumpers;
Utils::BoolAspect intelFlavor; Utils::BoolAspect intelFlavor;
Utils::BoolAspect usePseudoTracepoints; Utils::BoolAspect usePseudoTracepoints;
Utils::BoolAspect useIndexCache;
Utils::StringAspect gdbStartupCommands; Utils::StringAspect gdbStartupCommands;
Utils::StringAspect gdbPostAttachCommands; Utils::StringAspect gdbPostAttachCommands;

View File

@@ -3891,6 +3891,9 @@ void GdbEngine::setupEngine()
runCommand({"set breakpoint pending on"}); runCommand({"set breakpoint pending on"});
runCommand({"set print elements 10000"}); runCommand({"set print elements 10000"});
if (debuggerSettings()->useIndexCache.value())
runCommand({"set index-cache on"});
// Produces a few messages during symtab loading // Produces a few messages during symtab loading
//runCommand("set verbose on"); //runCommand("set verbose on");

View File

@@ -71,6 +71,7 @@ public:
s.loadGdbDumpers, s.loadGdbDumpers,
s.intelFlavor, s.intelFlavor,
s.usePseudoTracepoints, s.usePseudoTracepoints,
s.useIndexCache,
Stretch() Stretch()
}; };