Commit d5596bf1 authored by Friedemann Kleint's avatar Friedemann Kleint

Debugger: Remove unused 'precise breakpoints' setting.

Remove break window menu action to toggle 'Full path'.
Remove gdb setting 'Use full path'.
Clean up break dialog:
- Set PathChooser::ExpectedKind before value (showed up in red).
- Use PathChooser::setPath()/path() instead of lineedit text
- Return thread spec
- Add validator for ignorecount as for breakcondition.ui
Remove unused fields from breakcondition.ui

Reviewed-by: hjk
Task-number: QTCREATORBUG-2593
parent 5ff80548
......@@ -2,55 +2,37 @@
<ui version="4.0">
<class>BreakCondition</class>
<widget class="QDialog" name="BreakCondition">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>435</width>
<height>142</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="labelFunction">
<property name="text">
<string>Function:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditFunction"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelCondition">
<property name="text">
<string>Condition:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditCondition"/>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QLabel" name="labelIgnoreCount">
<property name="text">
<string>Ignore count:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditIgnoreCount"/>
</item>
<item row="3" column="0">
<item row="2" column="0">
<widget class="QLabel" name="labelThreadSpec">
<property name="text">
<string>Thread specification:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditThreadSpec"/>
</item>
</layout>
......
......@@ -283,10 +283,10 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
if (mi.row() >= size())
return QVariant();
const BreakpointData *data = at(mi.row());
BreakpointData *data = at(mi.row());
if (role == BreakpointRole)
return qulonglong(data);
return qVariantFromValue(data);
if (role == BreakpointUseFullPathRole)
return data->useFullPath;
......
......@@ -64,54 +64,76 @@ class BreakpointDialog : public QDialog, public Ui::BreakpointDialog
{
Q_OBJECT
public:
explicit BreakpointDialog(QWidget *parent, BreakpointData *data)
: QDialog(parent)
{
setupUi(this);
comboBoxType->insertItem(0, tr("File and Line Number"));
comboBoxType->insertItem(1, tr("Function Name"));
comboBoxType->insertItem(2, tr("Function \"main()\""));
comboBoxType->insertItem(3, tr("Address"));
pathChooserFileName->lineEdit()->setText(data->fileName);
pathChooserFileName->setExpectedKind(Utils::PathChooser::File);
lineEditLineNumber->setText(QByteArray::number(data->lineNumber));
lineEditFunction->setText(data->funcName);
lineEditCondition->setText(data->condition);
lineEditIgnoreCount->setText(QByteArray::number(data->ignoreCount));
checkBoxUseFullPath->setChecked(data->useFullPath);
if (data->address)
lineEditAddress->setText("0x" + QByteArray::number(data->address, 16));
int initialType = 0;
if (!data->funcName.isEmpty())
initialType = lineEditFunction->text() == "main" ? 2 : 1;
if (data->address)
initialType = 3;
typeChanged(initialType);
connect(comboBoxType, SIGNAL(activated(int)), SLOT(typeChanged(int)));
}
explicit BreakpointDialog(QWidget *parent);
bool showDialog(BreakpointData *data);
public slots:
void typeChanged(int index)
{
const bool isLineVisible = index == 0;
const bool isFunctionVisible = index == 1;
const bool isAddressVisible = index == 3;
labelFileName->setEnabled(isLineVisible);
pathChooserFileName->setEnabled(isLineVisible);
labelLineNumber->setEnabled(isLineVisible);
lineEditLineNumber->setEnabled(isLineVisible);
labelUseFullPath->setEnabled(isLineVisible);
checkBoxUseFullPath->setEnabled(isLineVisible);
labelFunction->setEnabled(isFunctionVisible);
lineEditFunction->setEnabled(isFunctionVisible);
labelAddress->setEnabled(isAddressVisible);
lineEditAddress->setEnabled(isAddressVisible);
if (index == 2)
lineEditFunction->setText("main");
}
void typeChanged(int index);
};
BreakpointDialog::BreakpointDialog(QWidget *parent) : QDialog(parent)
{
setupUi(this);
comboBoxType->insertItem(0, tr("File and Line Number"));
comboBoxType->insertItem(1, tr("Function Name"));
comboBoxType->insertItem(2, tr("Function \"main()\""));
comboBoxType->insertItem(3, tr("Address"));
pathChooserFileName->setExpectedKind(Utils::PathChooser::File);
connect(comboBoxType, SIGNAL(activated(int)), SLOT(typeChanged(int)));
lineEditIgnoreCount->setValidator(new QIntValidator(0, 2147483647, lineEditIgnoreCount));
}
bool BreakpointDialog::showDialog(BreakpointData *data)
{
pathChooserFileName->setPath(data->fileName);
lineEditLineNumber->setText(QString::number(data->lineNumber));
lineEditFunction->setText(data->funcName);
lineEditCondition->setText(QString::fromUtf8(data->condition));
lineEditIgnoreCount->setText(QString::number(data->ignoreCount));
checkBoxUseFullPath->setChecked(data->useFullPath);
lineEditThreadSpec->setText(QString::fromUtf8(data->threadSpec));
if (data->address)
lineEditAddress->setText(QString::fromAscii("0x%1").arg(data->address, 0, 16));
int initialType = 0;
if (!data->funcName.isEmpty())
initialType = data->funcName == QLatin1String("main") ? 2 : 1;
if (data->address)
initialType = 3;
typeChanged(initialType);
if (exec() != QDialog::Accepted)
return false;
data->lineNumber = lineEditLineNumber->text().toInt();
data->useFullPath = checkBoxUseFullPath->isChecked();
data->address = lineEditAddress->text().toULongLong(0, 0);
data->funcName = lineEditFunction->text();
data->fileName = pathChooserFileName->path();
data->condition = lineEditCondition->text().toUtf8();
data->ignoreCount = lineEditIgnoreCount->text().toInt();
data->threadSpec = lineEditThreadSpec->text().toUtf8();
return true;
}
void BreakpointDialog::typeChanged(int index)
{
const bool isLineVisible = index == 0;
const bool isFunctionVisible = index == 1;
const bool isAddressVisible = index == 3;
labelFileName->setEnabled(isLineVisible);
pathChooserFileName->setEnabled(isLineVisible);
labelLineNumber->setEnabled(isLineVisible);
lineEditLineNumber->setEnabled(isLineVisible);
labelUseFullPath->setEnabled(isLineVisible);
checkBoxUseFullPath->setEnabled(isLineVisible);
labelFunction->setEnabled(isFunctionVisible);
lineEditFunction->setEnabled(isFunctionVisible);
labelAddress->setEnabled(isAddressVisible);
lineEditAddress->setEnabled(isAddressVisible);
if (index == 2)
lineEditFunction->setText(QLatin1String("main"));
}
///////////////////////////////////////////////////////////////////////
//
// BreakWindow
......@@ -268,12 +290,6 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *toggleEnabledAction = new QAction(str5, &menu);
toggleEnabledAction->setEnabled(si.size() > 0);
const bool fullpath = si.isEmpty()
|| idx2.data(BreakpointEnabledRole).toBool();
const QString str6 = fullpath ? tr("Use Short Path") : tr("Use Full Path");
QAction *pathAction = new QAction(str6, &menu);
pathAction->setEnabled(si.size() > 0);
QAction *addBreakpointAction =
new QAction(tr("Add Breakpoint..."), this);
QAction *breakAtThrowAction =
......@@ -286,7 +302,6 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(editBreakpointAction);
menu.addAction(associateBreakpointAction);
menu.addAction(toggleEnabledAction);
menu.addAction(pathAction);
menu.addSeparator();
menu.addAction(deleteAllAction);
menu.addAction(deleteByFileAction);
......@@ -328,8 +343,6 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
setModelData(RequestSynchronizeBreakpointsRole);
else if (act == toggleEnabledAction)
setBreakpointsEnabled(si, !enabled);
else if (act == pathAction)
setBreakpointsFullPath(si, !fullpath);
else if (act == addBreakpointAction)
addBreakpoint();
else if (act == breakAtThrowAction)
......@@ -378,19 +391,8 @@ void BreakWindow::deleteBreakpoints(QList<int> list)
bool BreakWindow::editBreakpoint(BreakpointData *data)
{
BreakpointDialog dialog(this, data);
if (dialog.exec() == QDialog::Rejected)
return false;
bool ok = false;
data->lineNumber = dialog.lineEditLineNumber->text().toInt();
data->useFullPath = dialog.checkBoxUseFullPath->isChecked();
data->address = dialog.lineEditAddress->text().toULongLong(&ok, 0);
data->funcName = dialog.lineEditFunction->text();
data->fileName = dialog.pathChooserFileName->lineEdit()->text();
data->condition = dialog.lineEditCondition->text().toUtf8();
data->ignoreCount = dialog.lineEditIgnoreCount->text().toInt();
data->threadSpec = dialog.lineEditThreadSpec->text().toUtf8();
return true;
BreakpointDialog dialog(this);
return dialog.showDialog(data);
}
void BreakWindow::addBreakpoint()
......@@ -405,8 +407,9 @@ void BreakWindow::addBreakpoint()
void BreakWindow::editBreakpoints(const QModelIndexList &list)
{
if (list.size() == 1) {
QVariant var = model()->data(list.at(0), BreakpointRole);
BreakpointData *data = (BreakpointData *)var.toULongLong();
const QVariant dataV = model()->data(list.at(0), BreakpointRole);
QTC_ASSERT(qVariantCanConvert<BreakpointData *>(dataV), return );
BreakpointData *data = qvariant_cast<BreakpointData *>(dataV);
if (editBreakpoint(data))
data->reinsertBreakpoint();
return;
......@@ -420,8 +423,6 @@ void BreakWindow::editBreakpoints(const QModelIndexList &list)
QTC_ASSERT(!list.isEmpty(), return);
QModelIndex idx = list.front();
dlg.setWindowTitle(tr("Edit Breakpoint Properties"));
ui.lineEditFunction->hide();
ui.labelFunction->hide();
QAbstractItemModel *m = model();
ui.lineEditCondition->setText(
m->data(idx, BreakpointConditionRole).toString());
......
......@@ -333,18 +333,6 @@ DebuggerSettings *DebuggerSettings::instance()
item->setText(tr("Synchronize Breakpoints"));
instance->insertItem(SynchronizeBreakpoints, item);
item = new SavedAction(instance);
item->setText(tr("Use Precise Breakpoints"));
item->setToolTip(tr("Selecting this causes breakpoint synchronization "
"being done after each step. This results in up-to-date breakpoint "
"information on whether a breakpoint has been resolved after "
"loading shared libraries, but slows down stepping."));
item->setCheckable(true);
item->setDefaultValue(false);
item->setValue(false);
item->setSettingsKey(debugModeGroup, QLatin1String("UsePreciseBreakpoints"));
instance->insertItem(UsePreciseBreakpoints, item);
item = new SavedAction(instance);
item->setText(tr("Adjust Breakpoint Locations"));
item->setToolTip(tr("Not all source code lines generate "
......
......@@ -142,7 +142,6 @@ enum DebuggerActionCode
AdjustBreakpointLocations,
NoPluginBreakpoints,
SelectedPluginBreakpointsPattern,
UsePreciseBreakpoints,
BreakOnThrow,
BreakOnCatch
};
......
......@@ -572,7 +572,6 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent)
m_group.insert(theDebuggerAction(SortStructMembers), 0);
m_group.insert(theDebuggerAction(LogTimeStamps), 0);
m_group.insert(theDebuggerAction(VerboseLog), 0);
m_group.insert(theDebuggerAction(UsePreciseBreakpoints), 0);
m_group.insert(theDebuggerAction(BreakOnThrow), 0);
m_group.insert(theDebuggerAction(BreakOnCatch), 0);
#ifdef Q_OS_WIN
......
......@@ -1396,10 +1396,6 @@ void GdbEngine::handleStop1(const GdbMi &data)
if (m_modulesListOutdated)
reloadModulesInternal();
// This needs to be done before fullName() may need it.
if (m_sourcesListOutdated && theDebuggerBoolSetting(UsePreciseBreakpoints))
reloadSourceFilesInternal();
if (m_breakListOutdated) {
reloadBreakListInternal();
} else {
......@@ -2487,31 +2483,6 @@ void GdbEngine::attemptBreakpointSynchronization()
return;
}
// For best results, we rely on an up-to-date fullname mapping.
// The listing completion will retrigger us, so no futher action is needed.
if (m_sourcesListOutdated && theDebuggerBoolSetting(UsePreciseBreakpoints)) {
if (state() == InferiorRunOk) {
// FIXME: this is a hack
// The hack solves the problem that we want both commands
// (reloadSourceFiles and reloadBreakList) to be executed
// within the same stop-executecommand-continue cycle.
// Just calling reloadSourceFiles and reloadBreakList doesn't work
// in this case, because a) stopping the executable is asynchronous,
// b) we wouldn't want to stop-exec-continue twice
m_sourcesListUpdating = true;
GdbCommand cmd;
cmd.command = "-file-list-exec-source-files";
cmd.flags = NoFlags;
cmd.callback = &GdbEngine::handleQuerySources;
cmd.callbackName = "";
m_commandsToRunOnTemporaryBreak.append(cmd);
} else {
reloadSourceFilesInternal();
}
reloadBreakListInternal();
return;
}
if (m_breakListOutdated) {
reloadBreakListInternal();
return;
......
......@@ -83,8 +83,6 @@ QWidget *GdbOptionsPage::createPage(QWidget *parent)
m_ui.environmentEdit);
m_group.insert(theDebuggerAction(AdjustBreakpointLocations),
m_ui.checkBoxAdjustBreakpointLocations);
m_group.insert(theDebuggerAction(UsePreciseBreakpoints),
m_ui.checkBoxUsePreciseBreakpoints);
m_group.insert(theDebuggerAction(GdbWatchdogTimeout),
m_ui.spinBoxGdbWatchdogTimeout);
......
......@@ -2,14 +2,6 @@
<ui version="4.0">
<class>GdbOptionsPage</class>
<widget class="QWidget" name="GdbOptionsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>480</width>
<height>475</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBoxLocations">
......@@ -92,26 +84,13 @@ on slow machines. In this case, the value should be increased.</string>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxUsePreciseBreakpoints">
<property name="toolTip">
<string>When this option is checked, the debugger plugin attempts
to extract full path information for all source files from gdb. This is a
slow process but enables setting breakpoints in files with the same file
name in different directories.</string>
</property>
<property name="text">
<string>Use full path information to set breakpoints</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxEnableReverseDebugging">
<property name="text">
<string>Enable reverse debugging</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxSkipKnownFrames">
<property name="toolTip">
<string>When this option is checked, 'Step Into' compresses several steps into one in certain situations, leading to 'less noisy' debugging. So will, e.g., the atomic
......@@ -122,14 +101,14 @@ name in different directories.</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxUseMessageBoxForSignals">
<property name="text">
<string>Show a message box when receiving a signal</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxAdjustBreakpointLocations">
<property name="text">
<string>Adjust Breakpoint Locations</string>
......
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