debugger: fix use of multi-line breakpoint commands.

A (slightly customized) textedit is more appropriate than
a line edit.

Change-Id: I53bd8a6a623c670579b0633359e5722ee8ceba3e
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2012-08-20 18:47:51 +02:00
parent 5064933944
commit 12dd0587fc
6 changed files with 304 additions and 569 deletions

View File

@@ -1,104 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Debugger::Internal::BreakCondition</class>
<widget class="QDialog" name="Debugger::Internal::BreakCondition">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>283</width>
<height>141</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="labelCondition">
<property name="text">
<string>&amp;Condition:</string>
</property>
<property name="buddy">
<cstring>lineEditCondition</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditCondition"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelIgnoreCount">
<property name="text">
<string>&amp;Ignore count:</string>
</property>
<property name="buddy">
<cstring>spinBoxIgnoreCount</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxIgnoreCount"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelThreadSpec">
<property name="text">
<string>&amp;Thread specification:</string>
</property>
<property name="buddy">
<cstring>lineEditThreadSpec</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditThreadSpec"/>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Debugger::Internal::BreakCondition</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Debugger::Internal::BreakCondition</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -1,335 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Debugger::Internal::BreakpointDialog</class>
<widget class="QDialog" name="Debugger::Internal::BreakpointDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>543</width>
<height>440</height>
</rect>
</property>
<property name="windowTitle">
<string>Edit Breakpoint Properties</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBoxBasic">
<property name="title">
<string>Basic</string>
</property>
<layout class="QFormLayout" name="basicFormLayout">
<item row="0" column="0">
<widget class="QLabel" name="labelType">
<property name="text">
<string>Breakpoint &amp;type:</string>
</property>
<property name="buddy">
<cstring>comboBoxType</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxType"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelFileName">
<property name="text">
<string>&amp;File name:</string>
</property>
<property name="buddy">
<cstring>pathChooserFileName</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Utils::PathChooser" name="pathChooserFileName"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelLineNumber">
<property name="text">
<string>&amp;Line number:</string>
</property>
<property name="buddy">
<cstring>lineEditLineNumber</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditLineNumber"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelEnabled">
<property name="text">
<string>&amp;Enabled:</string>
</property>
<property name="buddy">
<cstring>checkBoxEnabled</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="checkBoxEnabled">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelAddress">
<property name="text">
<string>&amp;Address:</string>
</property>
<property name="buddy">
<cstring>lineEditAddress</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEditAddress"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelExpression">
<property name="text">
<string>&amp;Expression:</string>
</property>
<property name="buddy">
<cstring>lineEditExpression</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEditExpression"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="labelFunction">
<property name="text">
<string>Fun&amp;ction:</string>
</property>
<property name="buddy">
<cstring>lineEditFunction</cstring>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEditFunction"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxAdvanced">
<property name="title">
<string>Advanced</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QFormLayout" name="advancedFormLayout1">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelTracepoint">
<property name="text">
<string>T&amp;racepoint only:</string>
</property>
<property name="buddy">
<cstring>checkBoxTracepoint</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="checkBoxTracepoint">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelUseFullPath">
<property name="text">
<string>Pat&amp;h:</string>
</property>
<property name="buddy">
<cstring>comboBoxPathUsage</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelModule">
<property name="text">
<string>&amp;Module:</string>
</property>
<property name="buddy">
<cstring>lineEditModule</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditModule"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelCommand">
<property name="text">
<string>&amp;Command:</string>
</property>
<property name="buddy">
<cstring>lineEditCommand</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditCommand"/>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxPathUsage">
<item>
<property name="text">
<string>Use Engine Default</string>
</property>
</item>
<item>
<property name="text">
<string>Use Full Path</string>
</property>
</item>
<item>
<property name="text">
<string>Use File Name</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelMessage">
<property name="text">
<string>&amp;Message:</string>
</property>
<property name="buddy">
<cstring>lineEditMessage</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEditMessage"/>
</item>
</layout>
</item>
<item>
<layout class="QFormLayout" name="conditionFormLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelCondition">
<property name="text">
<string>C&amp;ondition:</string>
</property>
<property name="buddy">
<cstring>lineEditCondition</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditCondition"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelIgnoreCount">
<property name="text">
<string>&amp;Ignore count:</string>
</property>
<property name="buddy">
<cstring>spinBoxIgnoreCount</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxIgnoreCount"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelThreadSpec">
<property name="text">
<string>&amp;Thread specification:</string>
</property>
<property name="buddy">
<cstring>lineEditThreadSpec</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditThreadSpec"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Debugger::Internal::BreakpointDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Debugger::Internal::BreakpointDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -34,23 +34,44 @@
#include "debuggerengine.h" #include "debuggerengine.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggercore.h" #include "debuggercore.h"
#include "ui_breakpoint.h"
#include "ui_breakcondition.h"
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h> #include <utils/savedaction.h>
#include <QDebug>
#include <QAction> #include <QAction>
#include <QApplication>
#include <QButtonGroup>
#include <QCheckBox>
#include <QComboBox>
#include <QDebug>
#include <QDialog>
#include <QDialogButtonBox>
#include <QFormLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QIntValidator> #include <QIntValidator>
#include <QKeyEvent> #include <QKeyEvent>
#include <QLabel>
#include <QLineEdit>
#include <QMenu> #include <QMenu>
#include <QSpacerItem>
#include <QSpinBox>
#include <QTextEdit>
#include <QVariant>
#include <QVBoxLayout>
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
class SmallTextEdit : public QTextEdit
{
public:
explicit SmallTextEdit(QWidget *parent) : QTextEdit(parent) {}
QSize sizeHint() const { return QSize(QTextEdit::sizeHint().width(), 100); }
QSize minimumSizeHint() const { return sizeHint(); }
};
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
@@ -87,28 +108,51 @@ private:
BreakpointType type() const; BreakpointType type() const;
unsigned m_enabledParts; unsigned m_enabledParts;
Ui::BreakpointDialog m_ui;
BreakpointParameters m_savedParameters; BreakpointParameters m_savedParameters;
BreakpointType m_previousType; BreakpointType m_previousType;
bool m_firstTypeChange; bool m_firstTypeChange;
QLabel *m_labelType;
QComboBox *m_comboBoxType;
QLabel *m_labelFileName;
Utils::PathChooser *m_pathChooserFileName;
QLabel *m_labelLineNumber;
QLineEdit *m_lineEditLineNumber;
QLabel *m_labelEnabled;
QCheckBox *m_checkBoxEnabled;
QLabel *m_labelAddress;
QLineEdit *m_lineEditAddress;
QLabel *m_labelExpression;
QLineEdit *m_lineEditExpression;
QLabel *m_labelFunction;
QLineEdit *m_lineEditFunction;
QLabel *m_labelTracepoint;
QCheckBox *m_checkBoxTracepoint;
QLabel *m_labelUseFullPath;
QLabel *m_labelModule;
QLineEdit *m_lineEditModule;
QLabel *m_labelCommands;
QTextEdit *m_textEditCommands;
QComboBox *m_comboBoxPathUsage;
QLabel *m_labelMessage;
QLineEdit *m_lineEditMessage;
QLabel *m_labelCondition;
QLineEdit *m_lineEditCondition;
QLabel *m_labelIgnoreCount;
QSpinBox *m_spinBoxIgnoreCount;
QLabel *m_labelThreadSpec;
QLineEdit *m_lineEditThreadSpec;
QDialogButtonBox *m_buttonBox;
}; };
BreakpointDialog::BreakpointDialog(BreakpointModelId id, QWidget *parent) BreakpointDialog::BreakpointDialog(BreakpointModelId id, QWidget *parent)
: QDialog(parent), m_enabledParts(~0), m_previousType(UnknownType), : QDialog(parent), m_enabledParts(~0), m_previousType(UnknownType),
m_firstTypeChange(true) m_firstTypeChange(true)
{ {
m_ui.setupUi(this); setWindowTitle(tr("Edit Breakpoint Properties", 0, QApplication::UnicodeUTF8));
m_ui.comboBoxType->setMaxVisibleItems(20);
if (id.isValid()) { QGroupBox *groupBoxBasic = new QGroupBox(tr("Basic"), this);
if (DebuggerEngine *engine = breakHandler()->engine(id)) {
if (!engine->hasCapability(BreakConditionCapability))
m_enabledParts &= ~ConditionPart;
if (!engine->hasCapability(BreakModuleCapability))
m_enabledParts &= ~ModulePart;
if (!engine->hasCapability(TracePointCapability))
m_enabledParts &= ~TracePointPart;
}
}
// Match BreakpointType (omitting unknown type). // Match BreakpointType (omitting unknown type).
QStringList types; QStringList types;
types << tr("File name and line number") types << tr("File name and line number")
@@ -124,25 +168,44 @@ BreakpointDialog::BreakpointDialog(BreakpointModelId id, QWidget *parent)
<< tr("Break on data access at address given by expression") << tr("Break on data access at address given by expression")
<< tr("Break on QML signal emit") << tr("Break on QML signal emit")
<< tr("Break when JavaScript exception is thrown"); << tr("Break when JavaScript exception is thrown");
QTC_ASSERT(types.size() == BreakpointAtJavaScriptThrow, return); QTC_ASSERT(types.size() == BreakpointAtJavaScriptThrow, return);
m_ui.comboBoxType->addItems(types); m_comboBoxType = new QComboBox(groupBoxBasic);
m_ui.pathChooserFileName->setExpectedKind(Utils::PathChooser::File); m_comboBoxType->setMaxVisibleItems(20);
connect(m_ui.comboBoxType, SIGNAL(activated(int)), SLOT(typeChanged(int))); m_comboBoxType->addItems(types);
const QString moduleToolTip = m_labelType = new QLabel(tr("Breakpoint &type:"), groupBoxBasic);
tr("Specifying the module (base name of the library or executable)\n" m_labelType->setBuddy(m_comboBoxType);
"for function or file type breakpoints can significantly speed up\n"
"debugger start-up times (CDB, LLDB)."); m_pathChooserFileName = new Utils::PathChooser(groupBoxBasic);
m_ui.labelModule->setToolTip(moduleToolTip); m_pathChooserFileName->setExpectedKind(Utils::PathChooser::File);
m_ui.lineEditModule->setToolTip(moduleToolTip); m_labelFileName = new QLabel(tr("&File name:"), groupBoxBasic);
const QString commandToolTip = m_labelFileName->setBuddy(m_pathChooserFileName);
tr("Debugger command to be executed when the breakpoint is hit.\n"
"GDB allows for specifying a sequence of commands separated by " m_lineEditLineNumber = new QLineEdit(groupBoxBasic);
"the delimiter '\\n'."); m_labelLineNumber = new QLabel(tr("&Line number:"), groupBoxBasic);
m_ui.lineEditCommand->setToolTip(commandToolTip); m_labelLineNumber->setBuddy(m_lineEditLineNumber);
m_ui.labelCommand->setToolTip(commandToolTip);
m_ui.spinBoxIgnoreCount->setMinimum(0); m_checkBoxEnabled = new QCheckBox(groupBoxBasic);
m_ui.spinBoxIgnoreCount->setMaximum(2147483647); m_labelEnabled = new QLabel(tr("&Enabled:"), groupBoxBasic);
m_labelEnabled->setBuddy(m_checkBoxEnabled);
m_lineEditAddress = new QLineEdit(groupBoxBasic);
m_labelAddress = new QLabel(tr("&Address:"), groupBoxBasic);
m_labelAddress->setBuddy(m_lineEditAddress);
m_lineEditExpression = new QLineEdit(groupBoxBasic);
m_labelExpression = new QLabel(tr("&Expression:"), groupBoxBasic);
m_labelExpression->setBuddy(m_lineEditExpression);
m_lineEditFunction = new QLineEdit(groupBoxBasic);
m_labelFunction = new QLabel(tr("Fun&ction:"), groupBoxBasic);
m_labelFunction->setBuddy(m_lineEditFunction);
QGroupBox *groupBoxAdvanced = new QGroupBox(tr("Advanced"), this);
m_checkBoxTracepoint = new QCheckBox(groupBoxAdvanced);
m_labelTracepoint = new QLabel(tr("T&racepoint only:"), groupBoxAdvanced);
m_labelTracepoint->setBuddy(m_checkBoxTracepoint);
const QString pathToolTip = const QString pathToolTip =
tr("<html><head/><body><p>Determines how the path is specified " tr("<html><head/><body><p>Determines how the path is specified "
"when setting breakpoints:</p><ul>" "when setting breakpoints:</p><ul>"
@@ -157,15 +220,112 @@ BreakpointDialog::BreakpointDialog(BreakpointModelId id, QWidget *parent)
"It is the engine default for GDB as using full paths can " "It is the engine default for GDB as using full paths can "
"be slow with this engine.</li>" "be slow with this engine.</li>"
"</ul></body></html>"); "</ul></body></html>");
m_ui.labelUseFullPath->setToolTip(pathToolTip); m_comboBoxPathUsage = new QComboBox(groupBoxAdvanced);
m_ui.comboBoxPathUsage->setToolTip(pathToolTip); m_comboBoxPathUsage->addItem(tr("Use Engine Default"));
m_comboBoxPathUsage->addItem(tr("Use Full Path"));
m_comboBoxPathUsage->addItem(tr("Use File Name"));
m_comboBoxPathUsage->setToolTip(pathToolTip);
m_labelUseFullPath = new QLabel(tr("Pat&h:"), groupBoxAdvanced);
m_labelUseFullPath->setBuddy(m_comboBoxPathUsage);
m_labelUseFullPath->setToolTip(pathToolTip);
const QString moduleToolTip =
tr("Specifying the module (base name of the library or executable)\n"
"for function or file type breakpoints can significantly speed up\n"
"debugger start-up times (CDB, LLDB).");
m_lineEditModule = new QLineEdit(groupBoxAdvanced);
m_lineEditModule->setToolTip(moduleToolTip);
m_labelModule = new QLabel(tr("&Module:"), groupBoxAdvanced);
m_labelModule->setBuddy(m_lineEditModule);
m_labelModule->setToolTip(moduleToolTip);
const QString commandsToolTip =
tr("Debugger commands to be executed when the breakpoint is hit.\n"
"This feature is only available for GDB.");
m_textEditCommands = new SmallTextEdit(groupBoxAdvanced);
m_textEditCommands->setToolTip(commandsToolTip);
m_labelCommands = new QLabel(tr("&Commands:"), groupBoxAdvanced);
m_labelCommands->setBuddy(m_textEditCommands);
m_labelCommands->setToolTip(commandsToolTip);
m_lineEditMessage = new QLineEdit(groupBoxAdvanced);
m_labelMessage = new QLabel(tr("&Message:"), groupBoxAdvanced);
m_labelMessage->setBuddy(m_lineEditMessage);
m_lineEditCondition = new QLineEdit(groupBoxAdvanced);
m_labelCondition = new QLabel(tr("C&ondition:"), groupBoxAdvanced);
m_labelCondition->setBuddy(m_lineEditCondition);
m_spinBoxIgnoreCount = new QSpinBox(groupBoxAdvanced);
m_spinBoxIgnoreCount->setMinimum(0);
m_spinBoxIgnoreCount->setMaximum(2147483647);
m_labelIgnoreCount = new QLabel(tr("&Ignore count:"), groupBoxAdvanced);
m_labelIgnoreCount->setBuddy(m_spinBoxIgnoreCount);
m_lineEditThreadSpec = new QLineEdit(groupBoxAdvanced);
m_labelThreadSpec = new QLabel(tr("&Thread specification:"), groupBoxAdvanced);
m_labelThreadSpec->setBuddy(m_lineEditThreadSpec);
m_buttonBox = new QDialogButtonBox(this);
m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
if (id.isValid()) {
if (DebuggerEngine *engine = breakHandler()->engine(id)) {
if (!engine->hasCapability(BreakConditionCapability))
m_enabledParts &= ~ConditionPart;
if (!engine->hasCapability(BreakModuleCapability))
m_enabledParts &= ~ModulePart;
if (!engine->hasCapability(TracePointCapability))
m_enabledParts &= ~TracePointPart;
}
}
QFormLayout *basicLayout = new QFormLayout(groupBoxBasic);
basicLayout->addRow(m_labelType, m_comboBoxType);
basicLayout->addRow(m_labelFileName, m_pathChooserFileName);
basicLayout->addRow(m_labelLineNumber, m_lineEditLineNumber);
basicLayout->addRow(m_labelEnabled, m_checkBoxEnabled);
basicLayout->addRow(m_labelAddress, m_lineEditAddress);
basicLayout->addRow(m_labelExpression, m_lineEditExpression);
basicLayout->addRow(m_labelFunction, m_lineEditFunction);
QFormLayout *advancedLeftLayout = new QFormLayout();
advancedLeftLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
advancedLeftLayout->addRow(m_labelCondition, m_lineEditCondition);
advancedLeftLayout->addRow(m_labelIgnoreCount, m_spinBoxIgnoreCount);
advancedLeftLayout->addRow(m_labelThreadSpec, m_lineEditThreadSpec);
advancedLeftLayout->addRow(m_labelUseFullPath, m_comboBoxPathUsage);
advancedLeftLayout->addRow(m_labelModule, m_lineEditModule);
QFormLayout *advancedRightLayout = new QFormLayout();
advancedRightLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
advancedRightLayout->addRow(m_labelCommands, m_textEditCommands);
advancedRightLayout->addRow(m_labelTracepoint, m_checkBoxTracepoint);
advancedRightLayout->addRow(m_labelMessage, m_lineEditMessage);
QHBoxLayout *horizontalLayout = new QHBoxLayout(groupBoxAdvanced);
horizontalLayout->addLayout(advancedLeftLayout);
horizontalLayout->addSpacing(15);
horizontalLayout->addLayout(advancedRightLayout);
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
verticalLayout->addWidget(groupBoxBasic);
verticalLayout->addSpacing(10);
verticalLayout->addWidget(groupBoxAdvanced);
verticalLayout->addSpacing(10);
verticalLayout->addWidget(m_buttonBox);
verticalLayout->setStretchFactor(groupBoxAdvanced, 10);
connect(m_comboBoxType, SIGNAL(activated(int)), SLOT(typeChanged(int)));
connect(m_buttonBox, SIGNAL(accepted()), SLOT(accept()));
connect(m_buttonBox, SIGNAL(rejected()), SLOT(reject()));
} }
void BreakpointDialog::setType(BreakpointType type) void BreakpointDialog::setType(BreakpointType type)
{ {
const int comboIndex = type - 1; // Skip UnknownType. const int comboIndex = type - 1; // Skip UnknownType.
if (comboIndex != m_ui.comboBoxType->currentIndex() || m_firstTypeChange) { if (comboIndex != m_comboBoxType->currentIndex() || m_firstTypeChange) {
m_ui.comboBoxType->setCurrentIndex(comboIndex); m_comboBoxType->setCurrentIndex(comboIndex);
typeChanged(comboIndex); typeChanged(comboIndex);
m_firstTypeChange = false; m_firstTypeChange = false;
} }
@@ -173,7 +333,7 @@ void BreakpointDialog::setType(BreakpointType type)
BreakpointType BreakpointDialog::type() const BreakpointType BreakpointDialog::type() const
{ {
const int type = m_ui.comboBoxType->currentIndex() + 1; // Skip unknown type. const int type = m_comboBoxType->currentIndex() + 1; // Skip unknown type.
return static_cast<BreakpointType>(type); return static_cast<BreakpointType>(type);
} }
@@ -194,153 +354,152 @@ BreakpointParameters BreakpointDialog::parameters() const
void BreakpointDialog::setPartsEnabled(unsigned partsMask) void BreakpointDialog::setPartsEnabled(unsigned partsMask)
{ {
partsMask &= m_enabledParts; partsMask &= m_enabledParts;
m_ui.labelFileName->setEnabled(partsMask & FileAndLinePart); m_labelFileName->setEnabled(partsMask & FileAndLinePart);
m_ui.pathChooserFileName->setEnabled(partsMask & FileAndLinePart); m_pathChooserFileName->setEnabled(partsMask & FileAndLinePart);
m_ui.labelLineNumber->setEnabled(partsMask & FileAndLinePart); m_labelLineNumber->setEnabled(partsMask & FileAndLinePart);
m_ui.lineEditLineNumber->setEnabled(partsMask & FileAndLinePart); m_lineEditLineNumber->setEnabled(partsMask & FileAndLinePart);
m_ui.labelUseFullPath->setEnabled(partsMask & FileAndLinePart); m_labelUseFullPath->setEnabled(partsMask & FileAndLinePart);
m_ui.comboBoxPathUsage->setEnabled(partsMask & FileAndLinePart); m_comboBoxPathUsage->setEnabled(partsMask & FileAndLinePart);
m_labelFunction->setEnabled(partsMask & FunctionPart);
m_lineEditFunction->setEnabled(partsMask & FunctionPart);
m_ui.labelFunction->setEnabled(partsMask & FunctionPart); m_labelAddress->setEnabled(partsMask & AddressPart);
m_ui.lineEditFunction->setEnabled(partsMask & FunctionPart); m_lineEditAddress->setEnabled(partsMask & AddressPart);
m_labelExpression->setEnabled(partsMask & ExpressionPart);
m_lineEditExpression->setEnabled(partsMask & ExpressionPart);
m_ui.labelAddress->setEnabled(partsMask & AddressPart); m_labelCondition->setEnabled(partsMask & ConditionPart);
m_ui.lineEditAddress->setEnabled(partsMask & AddressPart); m_lineEditCondition->setEnabled(partsMask & ConditionPart);
m_ui.labelExpression->setEnabled(partsMask & ExpressionPart); m_labelIgnoreCount->setEnabled(partsMask & IgnoreCountPart);
m_ui.lineEditExpression->setEnabled(partsMask & ExpressionPart); m_spinBoxIgnoreCount->setEnabled(partsMask & IgnoreCountPart);
m_labelThreadSpec->setEnabled(partsMask & ThreadSpecPart);
m_lineEditThreadSpec->setEnabled(partsMask & ThreadSpecPart);
m_ui.labelCondition->setEnabled(partsMask & ConditionPart); m_labelModule->setEnabled(partsMask & ModulePart);
m_ui.lineEditCondition->setEnabled(partsMask & ConditionPart); m_lineEditModule->setEnabled(partsMask & ModulePart);
m_ui.labelIgnoreCount->setEnabled(partsMask & IgnoreCountPart);
m_ui.spinBoxIgnoreCount->setEnabled(partsMask & IgnoreCountPart);
m_ui.labelThreadSpec->setEnabled(partsMask & ThreadSpecPart);
m_ui.lineEditThreadSpec->setEnabled(partsMask & ThreadSpecPart);
m_ui.labelModule->setEnabled(partsMask & ModulePart); m_labelTracepoint->setEnabled(partsMask & TracePointPart);
m_ui.lineEditModule->setEnabled(partsMask & ModulePart); m_checkBoxTracepoint->setEnabled(partsMask & TracePointPart);
m_ui.labelTracepoint->setEnabled(partsMask & TracePointPart); m_labelCommands->setEnabled(partsMask & TracePointPart);
m_ui.checkBoxTracepoint->setEnabled(partsMask & TracePointPart); m_textEditCommands->setEnabled(partsMask & TracePointPart);
m_ui.labelCommand->setEnabled(partsMask & TracePointPart); m_labelMessage->setEnabled(partsMask & TracePointPart);
m_ui.lineEditCommand->setEnabled(partsMask & TracePointPart); m_lineEditMessage->setEnabled(partsMask & TracePointPart);
m_ui.labelMessage->setEnabled(partsMask & TracePointPart);
m_ui.lineEditMessage->setEnabled(partsMask & TracePointPart);
} }
void BreakpointDialog::clearOtherParts(unsigned partsMask) void BreakpointDialog::clearOtherParts(unsigned partsMask)
{ {
const unsigned invertedPartsMask = ~partsMask; const unsigned invertedPartsMask = ~partsMask;
if (invertedPartsMask & FileAndLinePart) { if (invertedPartsMask & FileAndLinePart) {
m_ui.pathChooserFileName->setPath(QString()); m_pathChooserFileName->setPath(QString());
m_ui.lineEditLineNumber->clear(); m_lineEditLineNumber->clear();
m_ui.comboBoxPathUsage->setCurrentIndex(BreakpointPathUsageEngineDefault); m_comboBoxPathUsage->setCurrentIndex(BreakpointPathUsageEngineDefault);
} }
if (invertedPartsMask & FunctionPart) if (invertedPartsMask & FunctionPart)
m_ui.lineEditFunction->clear(); m_lineEditFunction->clear();
if (invertedPartsMask & AddressPart) if (invertedPartsMask & AddressPart)
m_ui.lineEditAddress->clear(); m_lineEditAddress->clear();
if (invertedPartsMask & ExpressionPart) if (invertedPartsMask & ExpressionPart)
m_ui.lineEditExpression->clear(); m_lineEditExpression->clear();
if (invertedPartsMask & ConditionPart) if (invertedPartsMask & ConditionPart)
m_ui.lineEditCondition->clear(); m_lineEditCondition->clear();
if (invertedPartsMask & IgnoreCountPart) if (invertedPartsMask & IgnoreCountPart)
m_ui.spinBoxIgnoreCount->clear(); m_spinBoxIgnoreCount->clear();
if (invertedPartsMask & ThreadSpecPart) if (invertedPartsMask & ThreadSpecPart)
m_ui.lineEditThreadSpec->clear(); m_lineEditThreadSpec->clear();
if (invertedPartsMask & ModulePart) if (invertedPartsMask & ModulePart)
m_ui.lineEditModule->clear(); m_lineEditModule->clear();
if (invertedPartsMask & TracePointPart) { if (invertedPartsMask & TracePointPart) {
m_ui.checkBoxTracepoint->setChecked(false); m_checkBoxTracepoint->setChecked(false);
m_ui.lineEditCommand->clear(); m_textEditCommands->clear();
m_ui.lineEditMessage->clear(); m_lineEditMessage->clear();
} }
} }
void BreakpointDialog::getParts(unsigned partsMask, BreakpointParameters *data) const void BreakpointDialog::getParts(unsigned partsMask, BreakpointParameters *data) const
{ {
data->enabled = m_ui.checkBoxEnabled->isChecked(); data->enabled = m_checkBoxEnabled->isChecked();
if (partsMask & FileAndLinePart) { if (partsMask & FileAndLinePart) {
data->lineNumber = m_ui.lineEditLineNumber->text().toInt(); data->lineNumber = m_lineEditLineNumber->text().toInt();
data->pathUsage = static_cast<BreakpointPathUsage>(m_ui.comboBoxPathUsage->currentIndex()); data->pathUsage = static_cast<BreakpointPathUsage>(m_comboBoxPathUsage->currentIndex());
data->fileName = m_ui.pathChooserFileName->path(); data->fileName = m_pathChooserFileName->path();
} }
if (partsMask & FunctionPart) if (partsMask & FunctionPart)
data->functionName = m_ui.lineEditFunction->text(); data->functionName = m_lineEditFunction->text();
if (partsMask & AddressPart) if (partsMask & AddressPart)
data->address = m_ui.lineEditAddress->text().toULongLong(0, 0); data->address = m_lineEditAddress->text().toULongLong(0, 0);
if (partsMask & ExpressionPart) if (partsMask & ExpressionPart)
data->expression = m_ui.lineEditExpression->text(); data->expression = m_lineEditExpression->text();
if (partsMask & ConditionPart) if (partsMask & ConditionPart)
data->condition = m_ui.lineEditCondition->text().toUtf8(); data->condition = m_lineEditCondition->text().toUtf8();
if (partsMask & IgnoreCountPart) if (partsMask & IgnoreCountPart)
data->ignoreCount = m_ui.spinBoxIgnoreCount->text().toInt(); data->ignoreCount = m_spinBoxIgnoreCount->text().toInt();
if (partsMask & ThreadSpecPart) if (partsMask & ThreadSpecPart)
data->threadSpec = data->threadSpec =
BreakHandler::threadSpecFromDisplay(m_ui.lineEditThreadSpec->text()); BreakHandler::threadSpecFromDisplay(m_lineEditThreadSpec->text());
if (partsMask & ModulePart) if (partsMask & ModulePart)
data->module = m_ui.lineEditModule->text(); data->module = m_lineEditModule->text();
if (partsMask & TracePointPart) { if (partsMask & TracePointPart) {
data->tracepoint = m_ui.checkBoxTracepoint->isChecked(); data->tracepoint = m_checkBoxTracepoint->isChecked();
data->command = m_ui.lineEditCommand->text().trimmed(); data->command = m_textEditCommands->toPlainText().trimmed();
data->message = m_ui.lineEditMessage->text(); data->message = m_lineEditMessage->text();
} }
} }
void BreakpointDialog::setParts(unsigned mask, const BreakpointParameters &data) void BreakpointDialog::setParts(unsigned mask, const BreakpointParameters &data)
{ {
m_ui.checkBoxEnabled->setChecked(data.enabled); m_checkBoxEnabled->setChecked(data.enabled);
m_ui.comboBoxPathUsage->setCurrentIndex(data.pathUsage); m_comboBoxPathUsage->setCurrentIndex(data.pathUsage);
m_ui.lineEditCommand->setText(data.command); m_textEditCommands->setPlainText(data.command);
m_ui.lineEditMessage->setText(data.message); m_lineEditMessage->setText(data.message);
if (mask & FileAndLinePart) { if (mask & FileAndLinePart) {
m_ui.pathChooserFileName->setPath(data.fileName); m_pathChooserFileName->setPath(data.fileName);
m_ui.lineEditLineNumber->setText(QString::number(data.lineNumber)); m_lineEditLineNumber->setText(QString::number(data.lineNumber));
} }
if (mask & FunctionPart) if (mask & FunctionPart)
m_ui.lineEditFunction->setText(data.functionName); m_lineEditFunction->setText(data.functionName);
if (mask & AddressPart) { if (mask & AddressPart) {
if (data.address) { if (data.address) {
m_ui.lineEditAddress->setText( m_lineEditAddress->setText(
QString::fromLatin1("0x%1").arg(data.address, 0, 16)); QString::fromLatin1("0x%1").arg(data.address, 0, 16));
} else { } else {
m_ui.lineEditAddress->clear(); m_lineEditAddress->clear();
} }
} }
if (mask & ExpressionPart) { if (mask & ExpressionPart) {
if (!data.expression.isEmpty()) { if (!data.expression.isEmpty()) {
m_ui.lineEditExpression->setText(data.expression); m_lineEditExpression->setText(data.expression);
} else { } else {
m_ui.lineEditExpression->clear(); m_lineEditExpression->clear();
} }
} }
if (mask & ConditionPart) if (mask & ConditionPart)
m_ui.lineEditCondition->setText(QString::fromUtf8(data.condition)); m_lineEditCondition->setText(QString::fromUtf8(data.condition));
if (mask & IgnoreCountPart) if (mask & IgnoreCountPart)
m_ui.spinBoxIgnoreCount->setValue(data.ignoreCount); m_spinBoxIgnoreCount->setValue(data.ignoreCount);
if (mask & ThreadSpecPart) if (mask & ThreadSpecPart)
m_ui.lineEditThreadSpec-> m_lineEditThreadSpec->
setText(BreakHandler::displayFromThreadSpec(data.threadSpec)); setText(BreakHandler::displayFromThreadSpec(data.threadSpec));
if (mask & ModulePart) if (mask & ModulePart)
m_ui.lineEditModule->setText(data.module); m_lineEditModule->setText(data.module);
if (mask & TracePointPart) if (mask & TracePointPart)
m_ui.checkBoxTracepoint->setChecked(data.tracepoint); m_checkBoxTracepoint->setChecked(data.tracepoint);
} }
void BreakpointDialog::typeChanged(int) void BreakpointDialog::typeChanged(int)
@@ -406,7 +565,7 @@ void BreakpointDialog::typeChanged(int)
setPartsEnabled(0); setPartsEnabled(0);
break; break;
case BreakpointAtMain: case BreakpointAtMain:
m_ui.lineEditFunction->setText(QLatin1String("main")); // Just for display m_lineEditFunction->setText(QLatin1String("main")); // Just for display
clearOtherParts(0); clearOtherParts(0);
setPartsEnabled(0); setPartsEnabled(0);
break; break;
@@ -449,35 +608,54 @@ bool BreakpointDialog::showDialog(BreakpointParameters *data,
class MultiBreakPointsDialog : public QDialog class MultiBreakPointsDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
MultiBreakPointsDialog(QWidget *parent = 0); MultiBreakPointsDialog(QWidget *parent = 0);
QString condition() const { return m_ui.lineEditCondition->text(); } QString condition() const { return m_lineEditCondition->text(); }
int ignoreCount() const { return m_ui.spinBoxIgnoreCount->value(); } int ignoreCount() const { return m_spinBoxIgnoreCount->value(); }
int threadSpec() const int threadSpec() const
{ return BreakHandler::threadSpecFromDisplay(m_ui.lineEditThreadSpec->text()); } { return BreakHandler::threadSpecFromDisplay(m_lineEditThreadSpec->text()); }
void setCondition(const QString &c) { m_ui.lineEditCondition->setText(c); } void setCondition(const QString &c) { m_lineEditCondition->setText(c); }
void setIgnoreCount(int i) { m_ui.spinBoxIgnoreCount->setValue(i); } void setIgnoreCount(int i) { m_spinBoxIgnoreCount->setValue(i); }
void setThreadSpec(int t) void setThreadSpec(int t)
{ return m_ui.lineEditThreadSpec->setText(BreakHandler::displayFromThreadSpec(t)); } { return m_lineEditThreadSpec->setText(BreakHandler::displayFromThreadSpec(t)); }
private: private:
Ui::BreakCondition m_ui; QLineEdit *m_lineEditCondition;
QSpinBox *m_spinBoxIgnoreCount;
QLineEdit *m_lineEditThreadSpec;
QDialogButtonBox *m_buttonBox;
}; };
MultiBreakPointsDialog::MultiBreakPointsDialog(QWidget *parent) : MultiBreakPointsDialog::MultiBreakPointsDialog(QWidget *parent) :
QDialog(parent) QDialog(parent)
{ {
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui.setupUi(this);
setWindowTitle(tr("Edit Breakpoint Properties")); setWindowTitle(tr("Edit Breakpoint Properties"));
m_ui.spinBoxIgnoreCount->setMinimum(0);
m_ui.spinBoxIgnoreCount->setMaximum(2147483647); m_lineEditCondition = new QLineEdit(this);
if (!debuggerCore()->currentEngine()->hasCapability(BreakConditionCapability)) { m_spinBoxIgnoreCount = new QSpinBox(this);
m_ui.labelCondition->setEnabled(false); m_spinBoxIgnoreCount->setMinimum(0);
m_ui.lineEditCondition->setEnabled(false); m_spinBoxIgnoreCount->setMaximum(2147483647);
} m_lineEditThreadSpec = new QLineEdit(this);
m_buttonBox = new QDialogButtonBox(this);
m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
QFormLayout *formLayout = new QFormLayout;
if (debuggerCore()->currentEngine()->hasCapability(BreakConditionCapability))
formLayout->addRow(tr("&Condition:"), m_lineEditCondition);
formLayout->addRow(tr("&Ignore count:"), m_spinBoxIgnoreCount);
formLayout->addRow(tr("&Thread specification:"), m_lineEditThreadSpec);
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
verticalLayout->addLayout(formLayout);
verticalLayout->addWidget(m_buttonBox);
QObject::connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
QObject::connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
} }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////

View File

@@ -132,8 +132,6 @@ SOURCES += \
localsandexpressionswindow.cpp localsandexpressionswindow.cpp
FORMS += \ FORMS += \
breakcondition.ui \
breakpoint.ui \
localsandexpressionsoptionspage.ui \ localsandexpressionsoptionspage.ui \
commonoptionspage.ui commonoptionspage.ui

View File

@@ -33,8 +33,6 @@ QtcPlugin {
] ]
files: [ files: [
"breakcondition.ui",
"breakpoint.ui",
"debugger.qrc", "debugger.qrc",
"debuggerprofileconfigwidget.cpp", "debuggerprofileconfigwidget.cpp",
"debuggerprofileconfigwidget.h", "debuggerprofileconfigwidget.h",

View File

@@ -3177,7 +3177,7 @@ void GdbEngine::changeBreakpoint(BreakpointModelId id)
} }
if (data.command != response.command) { if (data.command != response.command) {
QByteArray breakCommand = "-break-commands " + bpnr; QByteArray breakCommand = "-break-commands " + bpnr;
foreach (const QString &command, data.command.split(QLatin1String("\\n"))) { foreach (const QString &command, data.command.split(QLatin1String("\n"))) {
if (!command.isEmpty()) { if (!command.isEmpty()) {
breakCommand.append(" \""); breakCommand.append(" \"");
breakCommand.append(command.toLatin1()); breakCommand.append(command.toLatin1());