Commit bcd279a1 authored by hjk's avatar hjk

debugger: make maximal number of stack entries configurable

parent 4198ffa1
......@@ -93,6 +93,8 @@ private:
Q_SLOT void lineEditEditingFinished();
Q_SLOT void pathChooserEditingFinished();
Q_SLOT void actionTriggered(bool);
Q_SLOT void spinBoxValueChanged(int);
Q_SLOT void spinBoxValueChanged(QString);
QVariant m_value;
QVariant m_defaultValue;
......
......@@ -250,16 +250,16 @@ DebuggerSettings *theDebuggerSettings()
// Settings
//
item = new SavedAction(instance);
instance->insertItem(GdbLocation, item);
item->setSettingsKey("DebugMode", "Location");
instance->insertItem(GdbLocation, item);
item = new SavedAction(instance);
instance->insertItem(GdbEnvironment, item);
item->setSettingsKey("DebugMode", "Environment");
instance->insertItem(GdbEnvironment, item);
item = new SavedAction(instance);
instance->insertItem(GdbScriptFile, item);
item->setSettingsKey("DebugMode", "ScriptFile");
instance->insertItem(GdbScriptFile, item);
item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "AutoQuit");
......@@ -268,43 +268,48 @@ DebuggerSettings *theDebuggerSettings()
instance->insertItem(AutoQuit, item);
item = new SavedAction(instance);
instance->insertItem(UseToolTips, item);
item->setSettingsKey("DebugMode", "UseToolTips");
item->setText(QObject::tr("Use tooltips when debugging"));
item->setCheckable(true);
instance->insertItem(UseToolTips, item);
item = new SavedAction(instance);
instance->insertItem(TerminalApplication, item);
item->setDefaultValue("xterm");
item->setSettingsKey("DebugMode", "Terminal");
instance->insertItem(TerminalApplication, item);
item = new SavedAction(instance);
instance->insertItem(ListSourceFiles, item);
item->setSettingsKey("DebugMode", "ListSourceFiles");
item->setText(QObject::tr("List source files"));
item->setCheckable(true);
instance->insertItem(ListSourceFiles, item);
item = new SavedAction(instance);
instance->insertItem(SkipKnownFrames, item);
item->setSettingsKey("DebugMode", "SkipKnownFrames");
item->setText(QObject::tr("Skip known frames"));
item->setCheckable(true);
instance->insertItem(SkipKnownFrames, item);
item = new SavedAction(instance);
instance->insertItem(AllPluginBreakpoints, item);
item->setSettingsKey("DebugMode", "AllPluginBreakpoints");
instance->insertItem(AllPluginBreakpoints, item);
item = new SavedAction(instance);
instance->insertItem(SelectedPluginBreakpoints, item);
item->setSettingsKey("DebugMode", "SelectedPluginBreakpoints");
instance->insertItem(SelectedPluginBreakpoints, item);
item = new SavedAction(instance);
instance->insertItem(NoPluginBreakpoints, item);
item->setSettingsKey("DebugMode", "NoPluginBreakpoints");
instance->insertItem(NoPluginBreakpoints, item);
item = new SavedAction(instance);
instance->insertItem(SelectedPluginBreakpointsPattern, item);
item->setSettingsKey("DebugMode", "SelectedPluginBreakpointsPattern");
instance->insertItem(SelectedPluginBreakpointsPattern, item);
item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "MaximalStackDepth");
item->setDefaultValue(20);
instance->insertItem(MaximalStackDepth, item);
return instance;
}
......
......@@ -76,6 +76,9 @@ enum DebuggerActionCode
GdbEnvironment,
GdbScriptFile,
// Stack
MaximalStackDepth,
// Watchers & Locals
WatchExpression,
WatchExpressionInWindow,
......
......@@ -297,6 +297,8 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
m_ui.checkBoxSkipKnownFrames);
m_group.insert(theDebuggerAction(UseToolTips),
m_ui.checkBoxUseToolTips);
m_group.insert(theDebuggerAction(MaximalStackDepth),
m_ui.spinBoxMaximalStackDepth);
m_ui.lineEditSelectedPluginBreakpointsPattern->
setEnabled(theDebuggerAction(SelectedPluginBreakpoints)->value().toBool());
......
......@@ -886,7 +886,7 @@ void GdbEngine::handleTargetCore(const GdbResultRecord &record)
qq->stackHandler()->setCurrentIndex(0);
updateLocals(); // Quick shot
sendSynchronizedCommand("-stack-list-frames", StackListFrames);
reloadStack();
if (supportsThreads())
sendSynchronizedCommand("-thread-list-ids", StackListThreads, 0);
......@@ -1303,6 +1303,13 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
#endif
}
void GdbEngine::reloadStack()
{
QString cmd = "-stack-list-frames";
if (int stackDepth = theDebuggerAction(MaximalStackDepth)->value().toInt())
cmd += " 0 " + QString::number(stackDepth);
sendSynchronizedCommand(cmd, StackListFrames);
}
void GdbEngine::handleAsyncOutput2(const GdbMi &data)
{
......@@ -1315,7 +1322,7 @@ void GdbEngine::handleAsyncOutput2(const GdbMi &data)
updateLocals(); // Quick shot
int currentId = data.findChild("thread-id").data().toInt();
sendSynchronizedCommand("-stack-list-frames", StackListFrames);
reloadStack();
if (supportsThreads())
sendSynchronizedCommand("-thread-list-ids", StackListThreads, currentId);
......@@ -1739,7 +1746,7 @@ void GdbEngine::handleAttach()
qq->stackHandler()->setCurrentIndex(0);
updateLocals(); // Quick shot
sendSynchronizedCommand("-stack-list-frames", StackListFrames);
reloadStack();
if (supportsThreads())
sendSynchronizedCommand("-thread-list-ids", StackListThreads, 0);
......@@ -2441,7 +2448,7 @@ void GdbEngine::handleStackSelectThread(const GdbResultRecord &record, int)
Q_UNUSED(record);
//qDebug("FIXME: StackHandler::handleOutput: SelectThread");
q->showStatusMessage(tr("Retrieving data for stack view..."), 3000);
sendCommand("-stack-list-frames", StackListFrames);
reloadStack();
}
......@@ -2458,7 +2465,8 @@ void GdbEngine::handleStackListFrames(const GdbResultRecord &record)
int topFrame = -1;
for (int i = 0; i != stack.childCount(); ++i) {
int n = stack.childCount();
for (int i = 0; i != n; ++i) {
//qDebug() << "HANDLING FRAME: " << stack.childAt(i).toString();
const GdbMi frameMi = stack.childAt(i);
StackFrame frame(i);
......@@ -2495,6 +2503,16 @@ void GdbEngine::handleStackListFrames(const GdbResultRecord &record)
topFrame = i;
}
if (n >= theDebuggerAction(MaximalStackDepth)->value().toInt()) {
StackFrame frame(n);
frame.file = "...";
frame.function = "...";
frame.from = "...";
frame.line = 0;
frame.address = "...";
stackFrames.append(frame);
}
qq->stackHandler()->setFrames(stackFrames);
#if 0
......
......@@ -280,6 +280,7 @@ private:
void handleStackListFrames(const GdbResultRecord &record);
void handleStackSelectThread(const GdbResultRecord &record, int cookie);
void handleStackListThreads(const GdbResultRecord &record, int cookie);
void reloadStack();
//
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>410</width>
<height>435</height>
<width>429</width>
<height>452</height>
</rect>
</property>
<property name="windowTitle">
......@@ -182,6 +182,42 @@ you indent to use or the name of a terminal that will be searched in your PATH.<
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="labelMaximalStackDepth">
<property name="text">
<string>Maximal stack depth:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBoxMaximalStackDepth">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="frame">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="specialValueText">
<string>&lt;unlimited&gt;</string>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
......
......@@ -37,11 +37,9 @@
using namespace Debugger::Internal;
StackFrame::StackFrame(int l) :
level(l),
line(0)
{
}
StackFrame::StackFrame(int l)
: level(l), line(0)
{}
bool StackFrame::isUsable() const
{
......@@ -183,6 +181,7 @@ bool StackHandler::isDebuggingDumpers() const
return false;
}
////////////////////////////////////////////////////////////////////////
//
// ThreadsHandler
......
......@@ -29,7 +29,7 @@
#include "stackwindow.h"
#include "stackhandler.h"
#include "debuggeractions.h"
#include <utils/qtcassert.h>
......@@ -102,6 +102,8 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addSeparator();
menu.addAction(act1);
menu.addAction(act2);
menu.addSeparator();
menu.addAction(theDebuggerAction(SettingsDialog));
QAction *act = menu.exec(ev->globalPos());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment