Merge branch 'master' into utf8_support
This commit is contained in:
commit
cc3fd3952f
|
@ -340,68 +340,37 @@ extern "C" DLL_EXPORT bool _dbg_getregdump(REGDUMP* regdump)
|
|||
memset(regdump, 0, sizeof(REGDUMP));
|
||||
return true;
|
||||
}
|
||||
REGDUMP r;
|
||||
|
||||
REGDUMP & r = *regdump;
|
||||
|
||||
#ifdef _WIN64
|
||||
r.cax = GetContextDataEx(hActiveThread, UE_RAX);
|
||||
#else
|
||||
r.cax = (duint)GetContextDataEx(hActiveThread, UE_EAX);
|
||||
#endif // _WIN64
|
||||
#ifdef _WIN64
|
||||
r.ccx = GetContextDataEx(hActiveThread, UE_RCX);
|
||||
#else
|
||||
r.ccx = (duint)GetContextDataEx(hActiveThread, UE_ECX);
|
||||
#endif // _WIN64
|
||||
#ifdef _WIN64
|
||||
r.cdx = GetContextDataEx(hActiveThread, UE_RDX);
|
||||
#else
|
||||
r.cdx = (duint)GetContextDataEx(hActiveThread, UE_EDX);
|
||||
#endif // _WIN64
|
||||
#ifdef _WIN64
|
||||
r.cbx = GetContextDataEx(hActiveThread, UE_RBX);
|
||||
#else
|
||||
r.cbx = (duint)GetContextDataEx(hActiveThread, UE_EBX);
|
||||
#endif // _WIN64
|
||||
#ifdef _WIN64
|
||||
r.cbp = GetContextDataEx(hActiveThread, UE_RBP);
|
||||
#else
|
||||
r.cbp = (duint)GetContextDataEx(hActiveThread, UE_EBP);
|
||||
#endif // _WIN64
|
||||
#ifdef _WIN64
|
||||
r.csi = GetContextDataEx(hActiveThread, UE_RSI);
|
||||
#else
|
||||
r.csi = (duint)GetContextDataEx(hActiveThread, UE_ESI);
|
||||
#endif // _WIN64
|
||||
#ifdef _WIN64
|
||||
r.cdi = GetContextDataEx(hActiveThread, UE_RDI);
|
||||
#else
|
||||
r.cdi = (duint)GetContextDataEx(hActiveThread, UE_EDI);
|
||||
#endif // _WIN64
|
||||
#ifdef _WIN64
|
||||
r.r8 = GetContextDataEx(hActiveThread, UE_R8);
|
||||
#endif // _WIN64
|
||||
#ifdef _WIN64
|
||||
r.r9 = GetContextDataEx(hActiveThread, UE_R9);
|
||||
#endif // _WIN64
|
||||
#ifdef _WIN64
|
||||
r.r10 = GetContextDataEx(hActiveThread, UE_R10);
|
||||
#endif // _WIN64
|
||||
#ifdef _WIN64
|
||||
r.r11 = GetContextDataEx(hActiveThread, UE_R11);
|
||||
#endif // _WIN64
|
||||
#ifdef _WIN64
|
||||
r.r12 = GetContextDataEx(hActiveThread, UE_R12);
|
||||
#endif // _WIN64
|
||||
#ifdef _WIN64
|
||||
r.r13 = GetContextDataEx(hActiveThread, UE_R13);
|
||||
#endif // _WIN64
|
||||
#ifdef _WIN64
|
||||
r.r14 = GetContextDataEx(hActiveThread, UE_R14);
|
||||
#endif // _WIN64
|
||||
#ifdef _WIN64
|
||||
r.r15 = GetContextDataEx(hActiveThread, UE_R15);
|
||||
#endif // _WIN64
|
||||
r.csp = (duint)GetContextDataEx(hActiveThread, UE_CSP);
|
||||
r.cip = (duint)GetContextDataEx(hActiveThread, UE_CIP);
|
||||
#else
|
||||
r.cax = GetContextDataEx(hActiveThread, UE_EAX);
|
||||
r.ccx = GetContextDataEx(hActiveThread, UE_ECX);
|
||||
r.cdx = GetContextDataEx(hActiveThread, UE_EDX);
|
||||
r.cbx = GetContextDataEx(hActiveThread, UE_EBX);
|
||||
r.cbp = GetContextDataEx(hActiveThread, UE_EBP);
|
||||
r.csi = GetContextDataEx(hActiveThread, UE_ESI);
|
||||
r.cdi = GetContextDataEx(hActiveThread, UE_EDI);
|
||||
#endif
|
||||
|
||||
r.csp = GetContextDataEx(hActiveThread, UE_CSP);
|
||||
r.cip = GetContextDataEx(hActiveThread, UE_CIP);
|
||||
r.eflags = (unsigned int)GetContextDataEx(hActiveThread, UE_EFLAGS);
|
||||
r.gs = (unsigned short)(GetContextDataEx(hActiveThread, UE_SEG_GS) & 0xFFFF);
|
||||
r.fs = (unsigned short)(GetContextDataEx(hActiveThread, UE_SEG_FS) & 0xFFFF);
|
||||
|
@ -409,12 +378,12 @@ extern "C" DLL_EXPORT bool _dbg_getregdump(REGDUMP* regdump)
|
|||
r.ds = (unsigned short)(GetContextDataEx(hActiveThread, UE_SEG_DS) & 0xFFFF);
|
||||
r.cs = (unsigned short)(GetContextDataEx(hActiveThread, UE_SEG_CS) & 0xFFFF);
|
||||
r.ss = (unsigned short)(GetContextDataEx(hActiveThread, UE_SEG_SS) & 0xFFFF);
|
||||
r.dr0 = (duint)GetContextDataEx(hActiveThread, UE_DR0);
|
||||
r.dr1 = (duint)GetContextDataEx(hActiveThread, UE_DR1);
|
||||
r.dr2 = (duint)GetContextDataEx(hActiveThread, UE_DR2);
|
||||
r.dr3 = (duint)GetContextDataEx(hActiveThread, UE_DR3);
|
||||
r.dr6 = (duint)GetContextDataEx(hActiveThread, UE_DR6);
|
||||
r.dr7 = (duint)GetContextDataEx(hActiveThread, UE_DR7);
|
||||
r.dr0 = GetContextDataEx(hActiveThread, UE_DR0);
|
||||
r.dr1 = GetContextDataEx(hActiveThread, UE_DR1);
|
||||
r.dr2 = GetContextDataEx(hActiveThread, UE_DR2);
|
||||
r.dr3 = GetContextDataEx(hActiveThread, UE_DR3);
|
||||
r.dr6 = GetContextDataEx(hActiveThread, UE_DR6);
|
||||
r.dr7 = GetContextDataEx(hActiveThread, UE_DR7);
|
||||
duint cflags = r.eflags;
|
||||
r.flags.c = valflagfromstring(cflags, "cf");
|
||||
r.flags.p = valflagfromstring(cflags, "pf");
|
||||
|
@ -425,7 +394,7 @@ extern "C" DLL_EXPORT bool _dbg_getregdump(REGDUMP* regdump)
|
|||
r.flags.i = valflagfromstring(cflags, "if");
|
||||
r.flags.d = valflagfromstring(cflags, "df");
|
||||
r.flags.o = valflagfromstring(cflags, "of");
|
||||
memcpy(regdump, &r, sizeof(REGDUMP));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -793,66 +793,88 @@ void CPUDisassembly::assembleAt()
|
|||
{
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
int_t wRVA = getInitialSelection();
|
||||
uint_t wVA = rvaToVa(wRVA);
|
||||
QString addr_text = QString("%1").arg(wVA, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
|
||||
QByteArray wBuffer;
|
||||
|
||||
int_t wMaxByteCountToRead = 16 * 2;
|
||||
|
||||
//TODO: fix size problems
|
||||
int_t size = getSize();
|
||||
if(!size)
|
||||
size = wRVA;
|
||||
|
||||
// Bounding
|
||||
wMaxByteCountToRead = wMaxByteCountToRead > (size - wRVA) ? (size - wRVA) : wMaxByteCountToRead;
|
||||
|
||||
wBuffer.resize(wMaxByteCountToRead);
|
||||
|
||||
mMemPage->read(reinterpret_cast<byte_t*>(wBuffer.data()), wRVA, wMaxByteCountToRead);
|
||||
|
||||
QBeaEngine disasm;
|
||||
Instruction_t instr = disasm.DisassembleAt(reinterpret_cast<byte_t*>(wBuffer.data()), wMaxByteCountToRead, 0, 0, wVA);
|
||||
|
||||
QString actual_inst = instr.instStr;
|
||||
bool assembly_error = false;
|
||||
do
|
||||
{
|
||||
LineEditDialog mLineEdit(this);
|
||||
mLineEdit.setText(actual_inst);
|
||||
mLineEdit.setWindowTitle("Assemble at " + addr_text);
|
||||
mLineEdit.setCheckBoxText("&Fill with NOP's");
|
||||
mLineEdit.enableCheckBox(true);
|
||||
mLineEdit.setCheckBox(ConfigBool("Disassembler", "FillNOPs"));
|
||||
if(mLineEdit.exec() != QDialog::Accepted)
|
||||
return;
|
||||
Config()->setBool("Disassembler", "FillNOPs", mLineEdit.bChecked);
|
||||
int_t wRVA = getInitialSelection();
|
||||
uint_t wVA = rvaToVa(wRVA);
|
||||
QString addr_text = QString("%1").arg(wVA, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
|
||||
char error[MAX_ERROR_SIZE] = "";
|
||||
if(!DbgFunctions()->AssembleAtEx(wVA, mLineEdit.editText.toUtf8().constData(), error, mLineEdit.bChecked))
|
||||
QByteArray wBuffer;
|
||||
|
||||
int_t wMaxByteCountToRead = 16 * 2;
|
||||
|
||||
//TODO: fix size problems
|
||||
int_t size = getSize();
|
||||
if(!size)
|
||||
size = wRVA;
|
||||
|
||||
// Bounding
|
||||
wMaxByteCountToRead = wMaxByteCountToRead > (size - wRVA) ? (size - wRVA) : wMaxByteCountToRead;
|
||||
|
||||
wBuffer.resize(wMaxByteCountToRead);
|
||||
|
||||
mMemPage->read(reinterpret_cast<byte_t*>(wBuffer.data()), wRVA, wMaxByteCountToRead);
|
||||
|
||||
QBeaEngine disasm;
|
||||
Instruction_t instr = disasm.DisassembleAt(reinterpret_cast<byte_t*>(wBuffer.data()), wMaxByteCountToRead, 0, 0, wVA);
|
||||
|
||||
QString actual_inst = instr.instStr;
|
||||
|
||||
bool assembly_error;
|
||||
do
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Critical, "Error!", "Failed to assemble instruction \"" + mLineEdit.editText + "\" (" + error + ")");
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
||||
msg.setParent(this, Qt::Dialog);
|
||||
msg.setWindowFlags(msg.windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||
msg.exec();
|
||||
actual_inst = mLineEdit.editText;
|
||||
assembly_error = true;
|
||||
assembly_error = false;
|
||||
|
||||
LineEditDialog mLineEdit(this);
|
||||
mLineEdit.setText(actual_inst);
|
||||
mLineEdit.setWindowTitle("Assemble at " + addr_text);
|
||||
mLineEdit.setCheckBoxText("&Fill with NOP's");
|
||||
mLineEdit.enableCheckBox(true);
|
||||
mLineEdit.setCheckBox(ConfigBool("Disassembler", "FillNOPs"));
|
||||
if(mLineEdit.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
//if the instruction its unkown or is the old instruction or empty (easy way to skip from GUI) skipping
|
||||
if(mLineEdit.editText == QString("???") || mLineEdit.editText.toLower() == instr.instStr.toLower() || mLineEdit.editText == QString(""))
|
||||
break;
|
||||
|
||||
Config()->setBool("Disassembler", "FillNOPs", mLineEdit.bChecked);
|
||||
|
||||
char error[MAX_ERROR_SIZE] = "";
|
||||
if(!DbgFunctions()->AssembleAtEx(wVA, mLineEdit.editText.toUtf8().constData(), error, mLineEdit.bChecked))
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Critical, "Error!", "Failed to assemble instruction \"" + mLineEdit.editText + "\" (" + error + ")");
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
||||
msg.setParent(this, Qt::Dialog);
|
||||
msg.setWindowFlags(msg.windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||
msg.exec();
|
||||
actual_inst = mLineEdit.editText;
|
||||
assembly_error = true;
|
||||
}
|
||||
}
|
||||
while(assembly_error);
|
||||
|
||||
//select next instruction after assembling
|
||||
setSingleSelection(wRVA);
|
||||
|
||||
int_t botRVA = getTableOffset();
|
||||
int_t topRVA = getInstructionRVA(getTableOffset(), getNbrOfLineToPrint() - 1);
|
||||
|
||||
int_t wInstrSize = getInstructionRVA(wRVA, 1) - wRVA - 1;
|
||||
|
||||
expandSelectionUpTo(wRVA + wInstrSize);
|
||||
selectNext(false);
|
||||
|
||||
if(getSelectionStart() < botRVA)
|
||||
setTableOffset(getSelectionStart());
|
||||
else if(getSelectionEnd() >= topRVA)
|
||||
setTableOffset(getInstructionRVA(getSelectionEnd(), -getNbrOfLineToPrint() + 2));
|
||||
|
||||
//refresh view
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
while(assembly_error);
|
||||
|
||||
//select next instruction after assembling
|
||||
setSingleSelection(wRVA);
|
||||
int_t wInstrSize = getInstructionRVA(wRVA, 1) - wRVA - 1;
|
||||
expandSelectionUpTo(wRVA + wInstrSize);
|
||||
selectNext(false);
|
||||
//refresh view
|
||||
GuiUpdateAllViews();
|
||||
|
||||
assembleAt();
|
||||
while(1);
|
||||
}
|
||||
|
||||
void CPUDisassembly::gotoExpression()
|
||||
|
|
|
@ -11,7 +11,10 @@ CPUInfoBox::CPUInfoBox(StdTable* parent) : StdTable(parent)
|
|||
setCellContent(0, 0, "");
|
||||
setCellContent(1, 0, "");
|
||||
setCellContent(2, 0, "");
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
horizontalScrollBar()->setStyleSheet("QScrollBar:horizontal{border:1px solid grey;background:#f1f1f1;height:10px}QScrollBar::handle:horizontal{background:#aaa;min-width:20px;margin:1px}QScrollBar::add-line:horizontal,QScrollBar::sub-line:horizontal{width:0;height:0}");
|
||||
|
||||
int height = getHeight();
|
||||
setMaximumHeight(height);
|
||||
setMinimumHeight(height);
|
||||
|
@ -22,7 +25,7 @@ CPUInfoBox::CPUInfoBox(StdTable* parent) : StdTable(parent)
|
|||
|
||||
int CPUInfoBox::getHeight()
|
||||
{
|
||||
return (getRowHeight() + 1) * 3;
|
||||
return ((getRowHeight() + 1) * 3) + 10;
|
||||
}
|
||||
|
||||
void CPUInfoBox::setInfoLine(int line, QString text)
|
||||
|
|
|
@ -32,10 +32,16 @@ CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
|
|||
connect(mDisas, SIGNAL(selectionChanged(int_t)), mInfo, SLOT(disasmSelectionChanged(int_t)));
|
||||
|
||||
mGeneralRegs = new RegistersView(0);
|
||||
mGeneralRegs->setFixedWidth(1000);
|
||||
|
||||
QScrollArea* scrollArea = new QScrollArea;
|
||||
scrollArea->setWidget(mGeneralRegs);
|
||||
|
||||
scrollArea->horizontalScrollBar()->setStyleSheet("QScrollBar:horizontal{border:1px solid grey;background:#f1f1f1;height:10px}QScrollBar::handle:horizontal{background:#aaa;min-width:20px;margin:1px}QScrollBar::add-line:horizontal,QScrollBar::sub-line:horizontal{width:0;height:0}");
|
||||
scrollArea->verticalScrollBar()->setStyleSheet("QScrollBar:vertical{border:1px solid grey;background:#f1f1f1;width:10px}QScrollBar::handle:vertical{background:#aaa;min-height:20px;margin:1px}QScrollBar::add-line:vertical,QScrollBar::sub-line:vertical{width:0;height:0}");
|
||||
|
||||
//TODO: add more tabs
|
||||
mRegsTab = new QTabWidget(this);
|
||||
mRegsTab->addTab(mGeneralRegs, "General");
|
||||
mRegsTab->addTab(scrollArea, "General");
|
||||
|
||||
ui->mTopRightFrameLayout->addWidget(mRegsTab);
|
||||
|
||||
|
|
|
@ -200,6 +200,8 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
|
||||
bClose = false;
|
||||
mCloseDialog = new CloseDialog(this);
|
||||
|
||||
mCpuWidget->mDisas->setFocus();
|
||||
}
|
||||
|
||||
DWORD WINAPI MainWindow::closeThread(void* ptr)
|
||||
|
@ -530,6 +532,8 @@ void MainWindow::openFile()
|
|||
updateMRUMenu();
|
||||
saveMRUList();
|
||||
}
|
||||
|
||||
mCpuWidget->mDisas->setFocus();
|
||||
}
|
||||
|
||||
void MainWindow::execPause()
|
||||
|
@ -554,6 +558,8 @@ void MainWindow::restartDebugging()
|
|||
Sleep(400);
|
||||
}
|
||||
DbgCmdExec(QString().sprintf("init \"%s\"", filename).toUtf8().constData());
|
||||
|
||||
mCpuWidget->mDisas->setFocus();
|
||||
}
|
||||
|
||||
void MainWindow::displayBreakpointWidget()
|
||||
|
@ -925,6 +931,8 @@ void MainWindow::displayAttach()
|
|||
{
|
||||
AttachDialog attach(this);
|
||||
attach.exec();
|
||||
|
||||
mCpuWidget->mDisas->setFocus();
|
||||
}
|
||||
|
||||
void MainWindow::detach()
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
#include "Configuration.h"
|
||||
#include "WordEditDialog.h"
|
||||
|
||||
RegistersView::RegistersView(QWidget* parent) : QAbstractScrollArea(parent), mVScrollOffset(0)
|
||||
|
||||
RegistersView::RegistersView(QWidget* parent) : QScrollArea(parent), mVScrollOffset(0)
|
||||
{
|
||||
// precreate ContextMenu Actions
|
||||
wCM_Increment = new QAction(tr("Increment"), this);
|
||||
|
@ -361,6 +362,7 @@ void RegistersView::keyPressEvent(QKeyEvent* event)
|
|||
wCM_Modify->trigger();
|
||||
}
|
||||
|
||||
/*
|
||||
void RegistersView::wheelEvent(QWheelEvent* event)
|
||||
{
|
||||
int numDegrees = event->delta() / 8;
|
||||
|
@ -384,6 +386,7 @@ void RegistersView::wheelEvent(QWheelEvent* event)
|
|||
emit refresh();
|
||||
event->accept();
|
||||
}
|
||||
*/
|
||||
|
||||
QSize RegistersView::sizeHint() const
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef REGISTERSVIEW_H
|
||||
#define REGISTERSVIEW_H
|
||||
|
||||
#include <QAbstractScrollArea>
|
||||
#include <QScrollArea>
|
||||
#include <QSet>
|
||||
#include <QMap>
|
||||
#include "Bridge.h"
|
||||
|
@ -13,7 +13,7 @@ namespace Ui
|
|||
class RegistersView;
|
||||
}
|
||||
|
||||
class RegistersView : public QAbstractScrollArea
|
||||
class RegistersView : public QScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -76,7 +76,7 @@ protected:
|
|||
virtual void mouseDoubleClickEvent(QMouseEvent* event);
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void keyPressEvent(QKeyEvent* event);
|
||||
virtual void wheelEvent(QWheelEvent* event);
|
||||
//virtual void wheelEvent(QWheelEvent* event);
|
||||
|
||||
// use-in-class-only methods
|
||||
void drawRegister(QPainter* p, REGISTER_NAME reg, uint_t value);
|
||||
|
|
Loading…
Reference in New Issue