GUI: added advanced conditional trace dialog
This commit is contained in:
parent
d7c296f2e3
commit
f508a22157
|
@ -18,6 +18,7 @@ void HistoryLineEdit::loadSettings(QString sectionPrefix)
|
|||
mCmdHistory.append(entry);
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryLineEdit::saveSettings(QString sectionPrefix)
|
||||
{
|
||||
int i = 1;
|
||||
|
@ -33,6 +34,7 @@ void HistoryLineEdit::saveSettings(QString sectionPrefix)
|
|||
QString("Line%1").arg(i).toUtf8().constData(),
|
||||
"");
|
||||
}
|
||||
|
||||
void HistoryLineEdit::addLineToHistory(QString parLine)
|
||||
{
|
||||
mCmdHistory.prepend(parLine);
|
||||
|
@ -43,6 +45,17 @@ void HistoryLineEdit::addLineToHistory(QString parLine)
|
|||
mCmdIndex = -1;
|
||||
}
|
||||
|
||||
QString HistoryLineEdit::addHistoryClear()
|
||||
{
|
||||
auto str = text();
|
||||
if(str.length())
|
||||
{
|
||||
addLineToHistory(str);
|
||||
clear();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
void HistoryLineEdit::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
int wKey = event->key();
|
||||
|
|
|
@ -11,9 +11,11 @@ public:
|
|||
explicit HistoryLineEdit(QWidget* parent = 0);
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void addLineToHistory(QString parLine);
|
||||
QString addHistoryClear();
|
||||
void setFocus();
|
||||
void loadSettings(QString sectionPrefix);
|
||||
void saveSettings(QString sectionPrefix);
|
||||
|
||||
signals:
|
||||
void keyPressed(int parKey);
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "BrowseDialog.h"
|
||||
#include "CustomizeMenuDialog.h"
|
||||
#include "main.h"
|
||||
#include "SimpleTraceDialog.h"
|
||||
|
||||
QString MainWindow::windowTitle = "";
|
||||
|
||||
|
@ -348,6 +349,7 @@ MainWindow::MainWindow(QWidget* parent)
|
|||
|
||||
// Create updatechecker
|
||||
mUpdateChecker = new UpdateChecker(this);
|
||||
mSimpleTraceDialog = new SimpleTraceDialog(this);
|
||||
|
||||
// Setup close thread and dialog
|
||||
bCanClose = false;
|
||||
|
@ -769,18 +771,20 @@ void MainWindow::execTicnd()
|
|||
{
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
QString text;
|
||||
if(SimpleInputBox(this, tr("Enter trace into finishing condition."), "", text, tr("Example: eax == 0 && ebx == 0"), &DIcon("traceinto.png")))
|
||||
DbgCmdExec(QString("ticnd \"%1\"").arg(text).toUtf8().constData());
|
||||
mSimpleTraceDialog->setTraceCommand("TraceIntoConditional");
|
||||
mSimpleTraceDialog->setWindowTitle(tr("Trace into..."));
|
||||
mSimpleTraceDialog->setWindowIcon(DIcon("traceinto.png"));
|
||||
mSimpleTraceDialog->exec();
|
||||
}
|
||||
|
||||
void MainWindow::execTocnd()
|
||||
{
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
QString text;
|
||||
if(SimpleInputBox(this, tr("Enter trace over finishing condition."), "", text, tr("Example: eax == 0 && ebx == 0"), &DIcon("traceover.png")))
|
||||
DbgCmdExec(QString("tocnd \"%1\"").arg(text).toUtf8().constData());
|
||||
mSimpleTraceDialog->setTraceCommand("TraceOverConditional");
|
||||
mSimpleTraceDialog->setWindowTitle(tr("Trace over..."));
|
||||
mSimpleTraceDialog->setWindowIcon(DIcon("traceover.png"));
|
||||
mSimpleTraceDialog->exec();
|
||||
}
|
||||
|
||||
void MainWindow::displayMemMapWidget()
|
||||
|
|
|
@ -32,6 +32,7 @@ class TimeWastedCounter;
|
|||
class NotesManager;
|
||||
class SettingsDialog;
|
||||
class DisassemblerGraphView;
|
||||
class SimpleTraceDialog;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
@ -168,6 +169,7 @@ private:
|
|||
HandlesView* mHandlesView;
|
||||
NotesManager* mNotesManager;
|
||||
DisassemblerGraphView* mGraphView;
|
||||
SimpleTraceDialog* mSimpleTraceDialog;
|
||||
|
||||
DebugStatusLabel* mStatusLabel;
|
||||
LogStatusLabel* mLastLogLabel;
|
||||
|
|
|
@ -828,7 +828,10 @@
|
|||
<normaloff>:/icons/images/traceover.png</normaloff>:/icons/images/traceover.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Trace over until condition</string>
|
||||
<string>Trace over...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Trace over...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTicnd">
|
||||
|
@ -837,7 +840,10 @@
|
|||
<normaloff>:/icons/images/traceinto.png</normaloff>:/icons/images/traceinto.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Trace into until condition</string>
|
||||
<string>Trace into...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Trace into...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTRBit">
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
#include "SimpleTraceDialog.h"
|
||||
#include "ui_SimpleTraceDialog.h"
|
||||
#include "Bridge.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
SimpleTraceDialog::SimpleTraceDialog(QWidget* parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SimpleTraceDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint | Qt::MSWindowsFixedSizeDialogHint);
|
||||
duint setting;
|
||||
if(!BridgeSettingGetUint("Engine", "MaxTraceCount", &setting))
|
||||
setting = 50000;
|
||||
ui->spinMaxTraceCount->setValue(int(setting));
|
||||
ui->editBreakCondition->setPlaceholderText(tr("Example: eax == 0 && ebx == 0"));
|
||||
ui->editLogText->setPlaceholderText(tr("Example: 0x{p:cip} {i:cip}"));
|
||||
ui->editLogCondition->setPlaceholderText(tr("Example: eax == 0 && ebx == 0"));
|
||||
ui->editCommandText->setPlaceholderText(tr("Example: eax=4;StepOut"));
|
||||
ui->editCommandCondition->setPlaceholderText(tr("Example: eax == 0 && ebx == 0"));
|
||||
}
|
||||
|
||||
SimpleTraceDialog::~SimpleTraceDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SimpleTraceDialog::setTraceCommand(const QString & command)
|
||||
{
|
||||
mTraceCommand = command;
|
||||
}
|
||||
|
||||
static QString escapeText(QString str)
|
||||
{
|
||||
str.replace(QChar('\\'), QString("\\\\"));
|
||||
str.replace(QChar('"'), QString("\\\""));
|
||||
return str;
|
||||
}
|
||||
|
||||
void SimpleTraceDialog::on_btnOk_clicked()
|
||||
{
|
||||
auto logText = ui->editLogText->addHistoryClear();
|
||||
auto logCondition = ui->editLogCondition->addHistoryClear();
|
||||
if(!DbgCmdExecDirect(QString("TraceSetLog \"%1\", \"%2\"").arg(escapeText(logText), escapeText(logCondition)).toUtf8().constData()))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Error"), tr("Failed to set log text/condition!"));
|
||||
return;
|
||||
}
|
||||
auto commandText = ui->editCommandText->addHistoryClear();
|
||||
auto commandCondition = ui->editCommandCondition->addHistoryClear();
|
||||
if(!DbgCmdExecDirect(QString("TraceSetCommand \"%1\", \"%2\"").arg(escapeText(commandText), escapeText(commandCondition)).toUtf8().constData()))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Error"), tr("Failed to set command text/condition!"));
|
||||
return;
|
||||
}
|
||||
auto breakCondition = ui->editBreakCondition->addHistoryClear();
|
||||
auto maxTraceCount = ui->spinMaxTraceCount->value();
|
||||
if(!DbgCmdExecDirect(QString("%1 \"%2\", .%3").arg(mTraceCommand, escapeText(breakCondition)).arg(maxTraceCount).toUtf8().constData()))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Error"), tr("Failed to start trace!"));
|
||||
return;
|
||||
}
|
||||
accept();
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef SIMPLETRACEDIALOG_H
|
||||
#define SIMPLETRACEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class SimpleTraceDialog;
|
||||
}
|
||||
|
||||
class SimpleTraceDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SimpleTraceDialog(QWidget* parent = 0);
|
||||
~SimpleTraceDialog();
|
||||
void setTraceCommand(const QString & command);
|
||||
|
||||
private slots:
|
||||
void on_btnOk_clicked();
|
||||
|
||||
private:
|
||||
Ui::SimpleTraceDialog* ui;
|
||||
QString mTraceCommand;
|
||||
};
|
||||
|
||||
#endif // SIMPLETRACEDIALOG_H
|
|
@ -0,0 +1,202 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SimpleTraceDialog</class>
|
||||
<widget class="QDialog" name="SimpleTraceDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>502</width>
|
||||
<height>218</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblBreakCondition">
|
||||
<property name="text">
|
||||
<string>&Break Condition:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>editBreakCondition</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="HistoryLineEdit" name="editBreakCondition"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblLogText">
|
||||
<property name="text">
|
||||
<string>&Log Text:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>editLogText</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="HistoryLineEdit" name="editLogText"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblLogCondition">
|
||||
<property name="text">
|
||||
<string>Lo&g Condition:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>editLogCondition</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="HistoryLineEdit" name="editLogCondition"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblCommandText">
|
||||
<property name="text">
|
||||
<string>&Command Text:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>editCommandText</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="HistoryLineEdit" name="editCommandText"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblCommandCondition">
|
||||
<property name="text">
|
||||
<string>C&ommand Condition:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>editCommandCondition</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="HistoryLineEdit" name="editCommandCondition"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lblMaxTraceCount">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Maximum trace count:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinMaxTraceCount</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="spinMaxTraceCount">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2147483647</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnOk">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&OK</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnCancel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>C&ancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QLabel" name="lblHint">
|
||||
<property name="text">
|
||||
<string>Hint: History is available in every text field with the Up/Down arrows!</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>HistoryLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>HistoryLineEdit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>editBreakCondition</tabstop>
|
||||
<tabstop>editLogText</tabstop>
|
||||
<tabstop>editLogCondition</tabstop>
|
||||
<tabstop>editCommandText</tabstop>
|
||||
<tabstop>editCommandCondition</tabstop>
|
||||
<tabstop>spinMaxTraceCount</tabstop>
|
||||
<tabstop>btnOk</tabstop>
|
||||
<tabstop>btnCancel</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>btnCancel</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>SimpleTraceDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>497</x>
|
||||
<y>154</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>524</x>
|
||||
<y>153</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -345,8 +345,8 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
|
|||
defaultShortcuts.insert("DebugRtu", Shortcut(tr("Debug -> Run to user code"), "Alt+F9", true));
|
||||
defaultShortcuts.insert("DebugSkipNextInstruction", Shortcut(tr("Debug -> Skip next instruction"), "", true));
|
||||
defaultShortcuts.insert("DebugCommand", Shortcut(tr("Debug -> Command"), "Ctrl+Return", true));
|
||||
defaultShortcuts.insert("DebugTraceIntoConditional", Shortcut(tr("Debug -> Trace Into Conditional"), "", true));
|
||||
defaultShortcuts.insert("DebugTraceOverConditional", Shortcut(tr("Debug -> Trace Over Conditional"), "", true));
|
||||
defaultShortcuts.insert("DebugTraceIntoConditional", Shortcut(tr("Debug -> Trace into..."), "Ctrl+Alt+F7", true));
|
||||
defaultShortcuts.insert("DebugTraceOverConditional", Shortcut(tr("Debug -> Trace over..."), "Ctrl+Alt+F8", true));
|
||||
defaultShortcuts.insert("DebugEnableTraceRecordBit", Shortcut(tr("Debug -> Trace Record -> Bit"), "", true));
|
||||
defaultShortcuts.insert("DebugTraceRecordNone", Shortcut(tr("Debug -> Trace Record -> None"), "", true));
|
||||
defaultShortcuts.insert("DebugInstrUndo", Shortcut(tr("Debug -> Undo instruction"), "Alt+U", true));
|
||||
|
|
|
@ -173,7 +173,8 @@ SOURCES += \
|
|||
Src/Gui/LogStatusLabel.cpp \
|
||||
Src/Gui/DebugStatusLabel.cpp \
|
||||
Src/Utils/MenuBuilder.cpp \
|
||||
Src/Gui/CustomizeMenuDialog.cpp
|
||||
Src/Gui/CustomizeMenuDialog.cpp \
|
||||
Src/Gui/SimpleTraceDialog.cpp
|
||||
|
||||
|
||||
HEADERS += \
|
||||
|
@ -282,7 +283,8 @@ HEADERS += \
|
|||
Src/BasicView/LabeledSplitterDetachedWindow.h \
|
||||
Src/Gui/LogStatusLabel.h \
|
||||
Src/Gui/DebugStatusLabel.h \
|
||||
Src/Gui/CustomizeMenuDialog.h
|
||||
Src/Gui/CustomizeMenuDialog.h \
|
||||
Src/Gui/SimpleTraceDialog.h
|
||||
|
||||
|
||||
FORMS += \
|
||||
|
@ -319,7 +321,8 @@ FORMS += \
|
|||
Src/Gui/FavouriteTools.ui \
|
||||
Src/Gui/BrowseDialog.ui \
|
||||
Src/Gui/VirtualModDialog.ui \
|
||||
Src/Gui/CustomizeMenuDialog.ui
|
||||
Src/Gui/CustomizeMenuDialog.ui \
|
||||
Src/Gui/SimpleTraceDialog.ui
|
||||
|
||||
##
|
||||
## Libraries
|
||||
|
|
Loading…
Reference in New Issue