GUI: various changes with number -> string conversion
This commit is contained in:
parent
2665ba2a4d
commit
5d23c58e6f
|
@ -300,7 +300,7 @@ void HexDump::copyRvaSlot()
|
||||||
duint base = DbgFunctions()->ModBaseFromAddr(addr);
|
duint base = DbgFunctions()->ModBaseFromAddr(addr);
|
||||||
if(base)
|
if(base)
|
||||||
{
|
{
|
||||||
QString addrText = QString("%1").arg(addr - base, 0, 16, QChar('0')).toUpper();
|
QString addrText = ToHexString(addr - base);
|
||||||
Bridge::CopyToClipboard(addrText);
|
Bridge::CopyToClipboard(addrText);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -118,9 +118,9 @@ void CPUDisassembly::addFollowReferenceMenuItem(QString name, dsint value, QMenu
|
||||||
newAction->setFont(QFont("Courier New", 8));
|
newAction->setFont(QFont("Courier New", 8));
|
||||||
menu->addAction(newAction);
|
menu->addAction(newAction);
|
||||||
if(isFollowInCPU)
|
if(isFollowInCPU)
|
||||||
newAction->setObjectName(QString("CPU|") + QString("%1").arg(value, sizeof(dsint) * 2, 16, QChar('0')).toUpper());
|
newAction->setObjectName(QString("CPU|") + ToPtrString(value));
|
||||||
else
|
else
|
||||||
newAction->setObjectName(QString(isReferences ? "REF|" : "DUMP|") + QString("%1").arg(value, sizeof(dsint) * 2, 16, QChar('0')).toUpper());
|
newAction->setObjectName(QString(isReferences ? "REF|" : "DUMP|") + ToPtrString(value));
|
||||||
|
|
||||||
connect(newAction, SIGNAL(triggered()), this, SLOT(followActionSlot()));
|
connect(newAction, SIGNAL(triggered()), this, SLOT(followActionSlot()));
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ void CPUDisassembly::setupFollowReferenceMenu(dsint wVA, QMenu* menu, bool isRef
|
||||||
addFollowReferenceMenuItem(tr("&Address: ") + segment + QString(arg.mnemonic).toUpper().trimmed(), arg.value, menu, isReferences, isFollowInCPU);
|
addFollowReferenceMenuItem(tr("&Address: ") + segment + QString(arg.mnemonic).toUpper().trimmed(), arg.value, menu, isReferences, isFollowInCPU);
|
||||||
if(arg.value != arg.constant)
|
if(arg.value != arg.constant)
|
||||||
{
|
{
|
||||||
QString constant = QString("%1").arg(arg.constant, 1, 16, QChar('0')).toUpper();
|
QString constant = ToHexString(arg.constant);
|
||||||
if(DbgMemIsValidReadPtr(arg.constant))
|
if(DbgMemIsValidReadPtr(arg.constant))
|
||||||
addFollowReferenceMenuItem(tr("&Constant: ") + constant, arg.constant, menu, isReferences, isFollowInCPU);
|
addFollowReferenceMenuItem(tr("&Constant: ") + constant, arg.constant, menu, isReferences, isFollowInCPU);
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ void CPUDisassembly::setupFollowReferenceMenu(dsint wVA, QMenu* menu, bool isRef
|
||||||
for(int i = 0; i < instr.argcount; i++)
|
for(int i = 0; i < instr.argcount; i++)
|
||||||
{
|
{
|
||||||
const DISASM_ARG arg = instr.arg[i];
|
const DISASM_ARG arg = instr.arg[i];
|
||||||
QString constant = QString("%1").arg(arg.constant, 1, 16, QChar('0')).toUpper();
|
QString constant = ToHexString(arg.constant);
|
||||||
if(DbgMemIsValidReadPtr(arg.constant))
|
if(DbgMemIsValidReadPtr(arg.constant))
|
||||||
addFollowReferenceMenuItem(tr("Address: ") + constant, arg.constant, menu, isReferences, isFollowInCPU);
|
addFollowReferenceMenuItem(tr("Address: ") + constant, arg.constant, menu, isReferences, isFollowInCPU);
|
||||||
else if(arg.constant)
|
else if(arg.constant)
|
||||||
|
@ -821,7 +821,7 @@ void CPUDisassembly::setCommentSlot()
|
||||||
return;
|
return;
|
||||||
duint wVA = rvaToVa(getInitialSelection());
|
duint wVA = rvaToVa(getInitialSelection());
|
||||||
LineEditDialog mLineEdit(this);
|
LineEditDialog mLineEdit(this);
|
||||||
QString addr_text = QString("%1").arg(wVA, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(wVA);
|
||||||
char comment_text[MAX_COMMENT_SIZE] = "";
|
char comment_text[MAX_COMMENT_SIZE] = "";
|
||||||
if(DbgGetCommentAt((duint)wVA, comment_text))
|
if(DbgGetCommentAt((duint)wVA, comment_text))
|
||||||
{
|
{
|
||||||
|
@ -896,8 +896,8 @@ void CPUDisassembly::toggleArgumentSlot()
|
||||||
duint argument_end = 0;
|
duint argument_end = 0;
|
||||||
if(!DbgArgumentOverlaps(start, end))
|
if(!DbgArgumentOverlaps(start, end))
|
||||||
{
|
{
|
||||||
QString start_text = QString("%1").arg(start, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString start_text = ToPtrString(start);
|
||||||
QString end_text = QString("%1").arg(end, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString end_text = ToPtrString(end);
|
||||||
|
|
||||||
QString cmd = "argumentadd " + start_text + "," + end_text;
|
QString cmd = "argumentadd " + start_text + "," + end_text;
|
||||||
DbgCmdExec(cmd.toUtf8().constData());
|
DbgCmdExec(cmd.toUtf8().constData());
|
||||||
|
@ -909,7 +909,7 @@ void CPUDisassembly::toggleArgumentSlot()
|
||||||
if(DbgArgumentGet(i, &argument_start, &argument_end))
|
if(DbgArgumentGet(i, &argument_start, &argument_end))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QString start_text = QString("%1").arg(argument_start, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString start_text = ToPtrString(argument_start);
|
||||||
|
|
||||||
QString cmd = "argumentdel " + start_text;
|
QString cmd = "argumentdel " + start_text;
|
||||||
DbgCmdExec(cmd.toUtf8().constData());
|
DbgCmdExec(cmd.toUtf8().constData());
|
||||||
|
@ -1092,7 +1092,7 @@ void CPUDisassembly::followActionSlot()
|
||||||
DbgCmdExec(QString().sprintf("dump \"%s\"", action->objectName().mid(5).toUtf8().constData()).toUtf8().constData());
|
DbgCmdExec(QString().sprintf("dump \"%s\"", action->objectName().mid(5).toUtf8().constData()).toUtf8().constData());
|
||||||
else if(action->objectName().startsWith("REF|"))
|
else if(action->objectName().startsWith("REF|"))
|
||||||
{
|
{
|
||||||
QString addrText = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
QString value = action->objectName().mid(4);
|
QString value = action->objectName().mid(4);
|
||||||
DbgCmdExec(QString("findref \"" + value + "\", " + addrText).toUtf8().constData());
|
DbgCmdExec(QString("findref \"" + value + "\", " + addrText).toUtf8().constData());
|
||||||
emit displayReferencesWidget();
|
emit displayReferencesWidget();
|
||||||
|
@ -1116,9 +1116,9 @@ void CPUDisassembly::gotoNextSlot()
|
||||||
|
|
||||||
void CPUDisassembly::findReferencesSlot()
|
void CPUDisassembly::findReferencesSlot()
|
||||||
{
|
{
|
||||||
QString addrStart = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrStart = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
QString addrEnd = QString("%1").arg(rvaToVa(getSelectionEnd()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrEnd = ToPtrString(rvaToVa(getSelectionEnd()));
|
||||||
QString addrDisasm = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrDisasm = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("findrefrange " + addrStart + ", " + addrEnd + ", " + addrDisasm).toUtf8().constData());
|
DbgCmdExec(QString("findrefrange " + addrStart + ", " + addrEnd + ", " + addrDisasm).toUtf8().constData());
|
||||||
emit displayReferencesWidget();
|
emit displayReferencesWidget();
|
||||||
}
|
}
|
||||||
|
@ -1244,7 +1244,7 @@ void CPUDisassembly::binaryEditSlot()
|
||||||
mMemPage->read(data, selStart, selSize);
|
mMemPage->read(data, selStart, selSize);
|
||||||
hexEdit.mHexEdit->setData(QByteArray((const char*)data, selSize));
|
hexEdit.mHexEdit->setData(QByteArray((const char*)data, selSize));
|
||||||
delete [] data;
|
delete [] data;
|
||||||
hexEdit.setWindowTitle(tr("Edit code at %1").arg(rvaToVa(selStart), sizeof(dsint) * 2, 16, QChar('0')).toUpper());
|
hexEdit.setWindowTitle(tr("Edit code at %1").arg(ToPtrString(rvaToVa(selStart))));
|
||||||
if(hexEdit.exec() != QDialog::Accepted)
|
if(hexEdit.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
dsint dataSize = hexEdit.mHexEdit->data().size();
|
dsint dataSize = hexEdit.mHexEdit->data().size();
|
||||||
|
@ -1262,7 +1262,7 @@ void CPUDisassembly::binaryFillSlot()
|
||||||
hexEdit.showKeepSize(false);
|
hexEdit.showKeepSize(false);
|
||||||
hexEdit.mHexEdit->setOverwriteMode(false);
|
hexEdit.mHexEdit->setOverwriteMode(false);
|
||||||
dsint selStart = getSelectionStart();
|
dsint selStart = getSelectionStart();
|
||||||
hexEdit.setWindowTitle(tr("Fill code at %1").arg(rvaToVa(selStart), sizeof(dsint) * 2, 16, QChar('0')).toUpper());
|
hexEdit.setWindowTitle(tr("Fill code at %1").arg(ToPtrString(rvaToVa(selStart))));
|
||||||
if(hexEdit.exec() != QDialog::Accepted)
|
if(hexEdit.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
QString pattern = hexEdit.mHexEdit->pattern();
|
QString pattern = hexEdit.mHexEdit->pattern();
|
||||||
|
@ -1387,7 +1387,7 @@ void CPUDisassembly::copySelectionSlot(bool copyBytes)
|
||||||
{
|
{
|
||||||
if(j)
|
if(j)
|
||||||
bytes += " ";
|
bytes += " ";
|
||||||
bytes += QString("%1").arg((unsigned char)(instBuffer.at(i).dump.at(j)), 2, 16, QChar('0')).toUpper();
|
bytes += ToByteString((unsigned char)(instBuffer.at(i).dump.at(j)));
|
||||||
}
|
}
|
||||||
QString disassembly;
|
QString disassembly;
|
||||||
for(const auto & token : instBuffer.at(i).tokens.tokens)
|
for(const auto & token : instBuffer.at(i).tokens.tokens)
|
||||||
|
@ -1416,7 +1416,7 @@ void CPUDisassembly::copySelectionNoBytesSlot()
|
||||||
|
|
||||||
void CPUDisassembly::copyAddressSlot()
|
void CPUDisassembly::copyAddressSlot()
|
||||||
{
|
{
|
||||||
QString addrText = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
Bridge::CopyToClipboard(addrText);
|
Bridge::CopyToClipboard(addrText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1426,7 +1426,7 @@ void CPUDisassembly::copyRvaSlot()
|
||||||
duint base = DbgFunctions()->ModBaseFromAddr(addr);
|
duint base = DbgFunctions()->ModBaseFromAddr(addr);
|
||||||
if(base)
|
if(base)
|
||||||
{
|
{
|
||||||
QString addrText = QString("%1").arg(addr - base, 0, 16, QChar('0')).toUpper();
|
QString addrText = ToHexString(addr - base);
|
||||||
Bridge::CopyToClipboard(addrText);
|
Bridge::CopyToClipboard(addrText);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1492,7 +1492,7 @@ void CPUDisassembly::findCommandSlot()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString addr_text = QString("%1").arg(va, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(va);
|
||||||
|
|
||||||
dsint size = mMemPage->getSize();
|
dsint size = mMemPage->getSize();
|
||||||
DbgCmdExec(QString("findasm \"%1\", %2, .%3, %4").arg(mLineEdit.editText).arg(addr_text).arg(size).arg(refFindType).toUtf8().constData());
|
DbgCmdExec(QString("findasm \"%1\", %2, .%3, %4").arg(mLineEdit.editText).arg(addr_text).arg(size).arg(refFindType).toUtf8().constData());
|
||||||
|
|
|
@ -423,7 +423,7 @@ void CPUDump::setLabelSlot()
|
||||||
|
|
||||||
duint wVA = rvaToVa(getSelectionStart());
|
duint wVA = rvaToVa(getSelectionStart());
|
||||||
LineEditDialog mLineEdit(this);
|
LineEditDialog mLineEdit(this);
|
||||||
QString addr_text = QString("%1").arg(wVA, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(wVA);
|
||||||
char label_text[MAX_COMMENT_SIZE] = "";
|
char label_text[MAX_COMMENT_SIZE] = "";
|
||||||
if(DbgGetLabelAt((duint)wVA, SEG_DEFAULT, label_text))
|
if(DbgGetLabelAt((duint)wVA, SEG_DEFAULT, label_text))
|
||||||
mLineEdit.setText(QString(label_text));
|
mLineEdit.setText(QString(label_text));
|
||||||
|
@ -1132,111 +1132,111 @@ void CPUDump::selectionSet(const SELECTIONDATA* selection)
|
||||||
|
|
||||||
void CPUDump::memoryAccessSingleshootSlot()
|
void CPUDump::memoryAccessSingleshootSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bpm " + addr_text + ", 0, a").toUtf8().constData());
|
DbgCmdExec(QString("bpm " + addr_text + ", 0, a").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::memoryAccessRestoreSlot()
|
void CPUDump::memoryAccessRestoreSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bpm " + addr_text + ", 1, a").toUtf8().constData());
|
DbgCmdExec(QString("bpm " + addr_text + ", 1, a").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::memoryWriteSingleshootSlot()
|
void CPUDump::memoryWriteSingleshootSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bpm " + addr_text + ", 0, w").toUtf8().constData());
|
DbgCmdExec(QString("bpm " + addr_text + ", 0, w").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::memoryWriteRestoreSlot()
|
void CPUDump::memoryWriteRestoreSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bpm " + addr_text + ", 1, w").toUtf8().constData());
|
DbgCmdExec(QString("bpm " + addr_text + ", 1, w").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::memoryExecuteSingleshootSlot()
|
void CPUDump::memoryExecuteSingleshootSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bpm " + addr_text + ", 0, x").toUtf8().constData());
|
DbgCmdExec(QString("bpm " + addr_text + ", 0, x").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::memoryExecuteRestoreSlot()
|
void CPUDump::memoryExecuteRestoreSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bpm " + addr_text + ", 1, x").toUtf8().constData());
|
DbgCmdExec(QString("bpm " + addr_text + ", 1, x").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::memoryRemoveSlot()
|
void CPUDump::memoryRemoveSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bpmc " + addr_text).toUtf8().constData());
|
DbgCmdExec(QString("bpmc " + addr_text).toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::hardwareAccess1Slot()
|
void CPUDump::hardwareAccess1Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", r, 1").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", r, 1").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::hardwareAccess2Slot()
|
void CPUDump::hardwareAccess2Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", r, 2").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", r, 2").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::hardwareAccess4Slot()
|
void CPUDump::hardwareAccess4Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", r, 4").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", r, 4").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::hardwareAccess8Slot()
|
void CPUDump::hardwareAccess8Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", r, 8").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", r, 8").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::hardwareWrite1Slot()
|
void CPUDump::hardwareWrite1Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", w, 1").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", w, 1").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::hardwareWrite2Slot()
|
void CPUDump::hardwareWrite2Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", w, 2").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", w, 2").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::hardwareWrite4Slot()
|
void CPUDump::hardwareWrite4Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", w, 4").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", w, 4").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::hardwareWrite8Slot()
|
void CPUDump::hardwareWrite8Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", w, 8").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", w, 8").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::hardwareExecuteSlot()
|
void CPUDump::hardwareExecuteSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", x").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", x").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::hardwareRemoveSlot()
|
void CPUDump::hardwareRemoveSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("bphwc " + addr_text).toUtf8().constData());
|
DbgCmdExec(QString("bphwc " + addr_text).toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::findReferencesSlot()
|
void CPUDump::findReferencesSlot()
|
||||||
{
|
{
|
||||||
QString addrStart = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrStart = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
QString addrEnd = QString("%1").arg(rvaToVa(getSelectionEnd()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrEnd = ToPtrString(rvaToVa(getSelectionEnd()));
|
||||||
QString addrDisasm = QString("%1").arg(mDisas->rvaToVa(mDisas->getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrDisasm = ToPtrString(mDisas->rvaToVa(mDisas->getSelectionStart()));
|
||||||
DbgCmdExec(QString("findrefrange " + addrStart + ", " + addrEnd + ", " + addrDisasm).toUtf8().constData());
|
DbgCmdExec(QString("findrefrange " + addrStart + ", " + addrEnd + ", " + addrDisasm).toUtf8().constData());
|
||||||
emit displayReferencesWidget();
|
emit displayReferencesWidget();
|
||||||
}
|
}
|
||||||
|
@ -1268,7 +1268,7 @@ void CPUDump::binaryFillSlot()
|
||||||
hexEdit.showKeepSize(false);
|
hexEdit.showKeepSize(false);
|
||||||
hexEdit.mHexEdit->setOverwriteMode(false);
|
hexEdit.mHexEdit->setOverwriteMode(false);
|
||||||
dsint selStart = getSelectionStart();
|
dsint selStart = getSelectionStart();
|
||||||
hexEdit.setWindowTitle(tr("Fill data at %1").arg(rvaToVa(selStart), sizeof(dsint) * 2, 16, QChar('0')).toUpper());
|
hexEdit.setWindowTitle(tr("Fill data at %1").arg(ToPtrString(rvaToVa(selStart))));
|
||||||
if(hexEdit.exec() != QDialog::Accepted)
|
if(hexEdit.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
QString pattern = hexEdit.mHexEdit->pattern();
|
QString pattern = hexEdit.mHexEdit->pattern();
|
||||||
|
@ -1355,7 +1355,7 @@ void CPUDump::findPattern()
|
||||||
dsint addr = rvaToVa(getSelectionStart());
|
dsint addr = rvaToVa(getSelectionStart());
|
||||||
if(hexEdit.entireBlock())
|
if(hexEdit.entireBlock())
|
||||||
addr = DbgMemFindBaseAddr(addr, 0);
|
addr = DbgMemFindBaseAddr(addr, 0);
|
||||||
QString addrText = QString("%1").arg(addr, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(addr);
|
||||||
DbgCmdExec(QString("findall " + addrText + ", " + hexEdit.mHexEdit->pattern() + ", &data&").toUtf8().constData());
|
DbgCmdExec(QString("findall " + addrText + ", " + hexEdit.mHexEdit->pattern() + ", &data&").toUtf8().constData());
|
||||||
emit displayReferencesWidget();
|
emit displayReferencesWidget();
|
||||||
}
|
}
|
||||||
|
@ -1392,8 +1392,8 @@ void CPUDump::followDataDumpSlot()
|
||||||
|
|
||||||
void CPUDump::selectionUpdatedSlot()
|
void CPUDump::selectionUpdatedSlot()
|
||||||
{
|
{
|
||||||
QString selStart = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString selStart = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
QString selEnd = QString("%1").arg(rvaToVa(getSelectionEnd()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString selEnd = ToPtrString(rvaToVa(getSelectionEnd()));
|
||||||
QString info = tr("Dump");
|
QString info = tr("Dump");
|
||||||
char mod[MAX_MODULE_SIZE] = "";
|
char mod[MAX_MODULE_SIZE] = "";
|
||||||
if(DbgFunctions()->ModNameFromAddr(rvaToVa(getSelectionStart()), mod, true))
|
if(DbgFunctions()->ModNameFromAddr(rvaToVa(getSelectionStart()), mod, true))
|
||||||
|
@ -1406,7 +1406,7 @@ void CPUDump::yaraSlot()
|
||||||
YaraRuleSelectionDialog yaraDialog(this);
|
YaraRuleSelectionDialog yaraDialog(this);
|
||||||
if(yaraDialog.exec() == QDialog::Accepted)
|
if(yaraDialog.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
QString addrText = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(rvaToVa(getSelectionStart()));
|
||||||
DbgCmdExec(QString("yara \"%0\",%1").arg(yaraDialog.getSelectedFile()).arg(addrText).toUtf8().constData());
|
DbgCmdExec(QString("yara \"%0\",%1").arg(yaraDialog.getSelectedFile()).arg(addrText).toUtf8().constData());
|
||||||
emit displayReferencesWidget();
|
emit displayReferencesWidget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,11 +232,11 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
|
||||||
// Module RVA
|
// Module RVA
|
||||||
curRva = parVA - modbase;
|
curRva = parVA - modbase;
|
||||||
if(modbase)
|
if(modbase)
|
||||||
info += QString(":$%1 ").arg(curRva, 0, 16, QChar('0')).toUpper();
|
info += QString(":$%1 ").arg(ToHexString(curRva));
|
||||||
|
|
||||||
// File offset
|
// File offset
|
||||||
curOffset = DbgFunctions()->VaToFileOffset(parVA);
|
curOffset = DbgFunctions()->VaToFileOffset(parVA);
|
||||||
info += QString("#%1 ").arg(curOffset, 0, 16, QChar('0')).toUpper();
|
info += QString("#%1 ").arg(ToHexString(curOffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function/label name
|
// Function/label name
|
||||||
|
@ -321,7 +321,7 @@ void CPUInfoBox::setupFollowMenu(QMenu* menu, duint wVA)
|
||||||
addFollowMenuItem(menu, tr("&Address: ") + segment + QString(arg.mnemonic).toUpper().trimmed(), arg.value);
|
addFollowMenuItem(menu, tr("&Address: ") + segment + QString(arg.mnemonic).toUpper().trimmed(), arg.value);
|
||||||
if(arg.value != arg.constant)
|
if(arg.value != arg.constant)
|
||||||
{
|
{
|
||||||
QString constant = QString("%1").arg(arg.constant, 1, 16, QChar('0')).toUpper();
|
QString constant = QString("%1").arg(ToHexString(arg.constant));
|
||||||
if(DbgMemIsValidReadPtr(arg.constant))
|
if(DbgMemIsValidReadPtr(arg.constant))
|
||||||
addFollowMenuItem(menu, tr("&Constant: ") + constant, arg.constant);
|
addFollowMenuItem(menu, tr("&Constant: ") + constant, arg.constant);
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ void CPUInfoBox::setupWatchMenu(QMenu* menu, duint wVA)
|
||||||
addWatchMenuItem(menu, tr("&Address: ") + segment + QString(arg.mnemonic).toUpper().trimmed(), arg.value);
|
addWatchMenuItem(menu, tr("&Address: ") + segment + QString(arg.mnemonic).toUpper().trimmed(), arg.value);
|
||||||
if(arg.value != arg.constant)
|
if(arg.value != arg.constant)
|
||||||
{
|
{
|
||||||
QString constant = QString("%1").arg(arg.constant, 1, 16, QChar('0')).toUpper();
|
QString constant = QString("%1").arg(ToHexString(arg.constant));
|
||||||
if(DbgMemIsValidReadPtr(arg.constant))
|
if(DbgMemIsValidReadPtr(arg.constant))
|
||||||
addWatchMenuItem(menu, tr("&Constant: ") + constant, arg.constant);
|
addWatchMenuItem(menu, tr("&Constant: ") + constant, arg.constant);
|
||||||
}
|
}
|
||||||
|
|
|
@ -389,17 +389,17 @@ void CPUSideBar::mouseReleaseEvent(QMouseEvent* e)
|
||||||
{
|
{
|
||||||
case bp_enabled:
|
case bp_enabled:
|
||||||
// breakpoint exists and is enabled --> disable breakpoint
|
// breakpoint exists and is enabled --> disable breakpoint
|
||||||
wCmd = "bd " + QString("%1").arg(wVA, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
wCmd = "bd " + ToPtrString(wVA);
|
||||||
DbgCmdExec(wCmd.toUtf8().constData());
|
DbgCmdExec(wCmd.toUtf8().constData());
|
||||||
break;
|
break;
|
||||||
case bp_disabled:
|
case bp_disabled:
|
||||||
// is disabled --> delete
|
// is disabled --> delete
|
||||||
wCmd = "bc " + QString("%1").arg(wVA, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
wCmd = "bc " + ToPtrString(wVA);
|
||||||
DbgCmdExec(wCmd.toUtf8().constData());
|
DbgCmdExec(wCmd.toUtf8().constData());
|
||||||
break;
|
break;
|
||||||
case bp_non_existent:
|
case bp_non_existent:
|
||||||
// no breakpoint was found --> create breakpoint
|
// no breakpoint was found --> create breakpoint
|
||||||
wCmd = "bp " + QString("%1").arg(wVA, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
wCmd = "bp " + ToPtrString(wVA);
|
||||||
DbgCmdExec(wCmd.toUtf8().constData());
|
DbgCmdExec(wCmd.toUtf8().constData());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -822,7 +822,7 @@ void CPUStack::followDisasmSlot()
|
||||||
if(mMemPage->read((byte_t*)&selectedData, getInitialSelection(), sizeof(duint)))
|
if(mMemPage->read((byte_t*)&selectedData, getInitialSelection(), sizeof(duint)))
|
||||||
if(DbgMemIsValidReadPtr(selectedData)) //data is a pointer
|
if(DbgMemIsValidReadPtr(selectedData)) //data is a pointer
|
||||||
{
|
{
|
||||||
QString addrText = QString("%1").arg(selectedData, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(selectedData);
|
||||||
DbgCmdExec(QString("disasm " + addrText).toUtf8().constData());
|
DbgCmdExec(QString("disasm " + addrText).toUtf8().constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -833,7 +833,7 @@ void CPUStack::followDumpPtrSlot()
|
||||||
if(mMemPage->read((byte_t*)&selectedData, getInitialSelection(), sizeof(duint)))
|
if(mMemPage->read((byte_t*)&selectedData, getInitialSelection(), sizeof(duint)))
|
||||||
if(DbgMemIsValidReadPtr(selectedData)) //data is a pointer
|
if(DbgMemIsValidReadPtr(selectedData)) //data is a pointer
|
||||||
{
|
{
|
||||||
QString addrText = QString("%1").arg(selectedData, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(selectedData);
|
||||||
DbgCmdExec(QString("dump " + addrText).toUtf8().constData());
|
DbgCmdExec(QString("dump " + addrText).toUtf8().constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -861,7 +861,7 @@ void CPUStack::followStackSlot()
|
||||||
if(mMemPage->read((byte_t*)&selectedData, getInitialSelection(), sizeof(duint)))
|
if(mMemPage->read((byte_t*)&selectedData, getInitialSelection(), sizeof(duint)))
|
||||||
if(DbgMemIsValidReadPtr(selectedData)) //data is a pointer
|
if(DbgMemIsValidReadPtr(selectedData)) //data is a pointer
|
||||||
{
|
{
|
||||||
QString addrText = QString("%1").arg(selectedData, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(selectedData);
|
||||||
DbgCmdExec(QString("sdump " + addrText).toUtf8().constData());
|
DbgCmdExec(QString("sdump " + addrText).toUtf8().constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -898,7 +898,7 @@ void CPUStack::binaryFillSlot()
|
||||||
hexEdit.showKeepSize(false);
|
hexEdit.showKeepSize(false);
|
||||||
hexEdit.mHexEdit->setOverwriteMode(false);
|
hexEdit.mHexEdit->setOverwriteMode(false);
|
||||||
dsint selStart = getSelectionStart();
|
dsint selStart = getSelectionStart();
|
||||||
hexEdit.setWindowTitle(tr("Fill data at %1").arg(rvaToVa(selStart), sizeof(dsint) * 2, 16, QChar('0')).toUpper());
|
hexEdit.setWindowTitle(tr("Fill data at %1").arg(ToPtrString(rvaToVa(selStart))));
|
||||||
if(hexEdit.exec() != QDialog::Accepted)
|
if(hexEdit.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
QString pattern = hexEdit.mHexEdit->pattern();
|
QString pattern = hexEdit.mHexEdit->pattern();
|
||||||
|
@ -961,85 +961,85 @@ void CPUStack::binaryPasteIgnoreSizeSlot()
|
||||||
// Copied from "CPUDump.cpp".
|
// Copied from "CPUDump.cpp".
|
||||||
void CPUStack::hardwareAccess1Slot()
|
void CPUStack::hardwareAccess1Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", r, 1").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", r, 1").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUStack::hardwareAccess2Slot()
|
void CPUStack::hardwareAccess2Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", r, 2").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", r, 2").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUStack::hardwareAccess4Slot()
|
void CPUStack::hardwareAccess4Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", r, 4").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", r, 4").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUStack::hardwareAccess8Slot()
|
void CPUStack::hardwareAccess8Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", r, 8").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", r, 8").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUStack::hardwareWrite1Slot()
|
void CPUStack::hardwareWrite1Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", w, 1").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", w, 1").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUStack::hardwareWrite2Slot()
|
void CPUStack::hardwareWrite2Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", w, 2").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", w, 2").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUStack::hardwareWrite4Slot()
|
void CPUStack::hardwareWrite4Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", w, 4").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", w, 4").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUStack::hardwareWrite8Slot()
|
void CPUStack::hardwareWrite8Slot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("bphws " + addr_text + ", w, 8").toUtf8().constData());
|
DbgCmdExec(QString("bphws " + addr_text + ", w, 8").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUStack::hardwareRemoveSlot()
|
void CPUStack::hardwareRemoveSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("bphwc " + addr_text).toUtf8().constData());
|
DbgCmdExec(QString("bphwc " + addr_text).toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUStack::memoryAccessSingleshootSlot()
|
void CPUStack::memoryAccessSingleshootSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("bpm " + addr_text + ", 0, a").toUtf8().constData());
|
DbgCmdExec(QString("bpm " + addr_text + ", 0, a").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUStack::memoryAccessRestoreSlot()
|
void CPUStack::memoryAccessRestoreSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("bpm " + addr_text + ", 1, a").toUtf8().constData());
|
DbgCmdExec(QString("bpm " + addr_text + ", 1, a").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUStack::memoryWriteSingleshootSlot()
|
void CPUStack::memoryWriteSingleshootSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("bpm " + addr_text + ", 0, w").toUtf8().constData());
|
DbgCmdExec(QString("bpm " + addr_text + ", 0, w").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUStack::memoryWriteRestoreSlot()
|
void CPUStack::memoryWriteRestoreSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("bpm " + addr_text + ", 1, w").toUtf8().constData());
|
DbgCmdExec(QString("bpm " + addr_text + ", 1, w").toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUStack::memoryRemoveSlot()
|
void CPUStack::memoryRemoveSlot()
|
||||||
{
|
{
|
||||||
QString addr_text = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addr_text = ToPtrString(rvaToVa(getInitialSelection()));
|
||||||
DbgCmdExec(QString("bpmc " + addr_text).toUtf8().constData());
|
DbgCmdExec(QString("bpmc " + addr_text).toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1054,7 +1054,7 @@ void CPUStack::findPattern()
|
||||||
dsint addr = rvaToVa(getSelectionStart());
|
dsint addr = rvaToVa(getSelectionStart());
|
||||||
if(hexEdit.entireBlock())
|
if(hexEdit.entireBlock())
|
||||||
addr = DbgMemFindBaseAddr(addr, 0);
|
addr = DbgMemFindBaseAddr(addr, 0);
|
||||||
QString addrText = QString("%1").arg(addr, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(addr);
|
||||||
DbgCmdExec(QString("findall " + addrText + ", " + hexEdit.mHexEdit->pattern() + ", &data&").toUtf8().constData());
|
DbgCmdExec(QString("findall " + addrText + ", " + hexEdit.mHexEdit->pattern() + ", &data&").toUtf8().constData());
|
||||||
emit displayReferencesWidget();
|
emit displayReferencesWidget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "GotoDialog.h"
|
#include "GotoDialog.h"
|
||||||
#include "ValidateExpressionThread.h"
|
#include "ValidateExpressionThread.h"
|
||||||
#include "ui_GotoDialog.h"
|
#include "ui_GotoDialog.h"
|
||||||
|
#include "StringUtil.h"
|
||||||
|
|
||||||
GotoDialog::GotoDialog(QWidget* parent, bool allowInvalidExpression, bool allowInvalidAddress)
|
GotoDialog::GotoDialog(QWidget* parent, bool allowInvalidExpression, bool allowInvalidAddress)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
|
@ -93,7 +94,7 @@ void GotoDialog::expressionChanged(bool validExpression, bool validPointer, dsin
|
||||||
{
|
{
|
||||||
duint offset = value;
|
duint offset = value;
|
||||||
duint va = DbgFunctions()->FileOffsetToVa(modName.toUtf8().constData(), offset);
|
duint va = DbgFunctions()->FileOffsetToVa(modName.toUtf8().constData(), offset);
|
||||||
QString addrText = QString(" %1").arg(va, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = QString(" %1").arg(ToPtrString(va));
|
||||||
if(va || allowInvalidAddress)
|
if(va || allowInvalidAddress)
|
||||||
{
|
{
|
||||||
ui->labelError->setText(tr("<font color='#00DD00'><b>Correct expression! -> </b></font>") + addrText);
|
ui->labelError->setText(tr("<font color='#00DD00'><b>Correct expression! -> </b></font>") + addrText);
|
||||||
|
@ -110,7 +111,7 @@ void GotoDialog::expressionChanged(bool validExpression, bool validPointer, dsin
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
duint addr = value;
|
duint addr = value;
|
||||||
QString addrText = QString(" %1").arg(addr, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = QString(" %1").arg(ToPtrString(addr));
|
||||||
if(!validPointer && !allowInvalidAddress)
|
if(!validPointer && !allowInvalidAddress)
|
||||||
{
|
{
|
||||||
ui->labelError->setText(tr("<font color='red'><b>Invalid memory address...</b></font>") + addrText);
|
ui->labelError->setText(tr("<font color='red'><b>Invalid memory address...</b></font>") + addrText);
|
||||||
|
@ -135,9 +136,9 @@ void GotoDialog::expressionChanged(bool validExpression, bool validPointer, dsin
|
||||||
addrText = QString(label);
|
addrText = QString(label);
|
||||||
}
|
}
|
||||||
else if(DbgGetModuleAt(addr, module) && !QString(label).startsWith("JMP.&"))
|
else if(DbgGetModuleAt(addr, module) && !QString(label).startsWith("JMP.&"))
|
||||||
addrText = QString(module) + "." + QString("%1").arg(addr, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
addrText = QString(module) + "." + ToPtrString(addr);
|
||||||
else
|
else
|
||||||
addrText = QString("%1").arg(addr, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
addrText = ToPtrString(addr);
|
||||||
ui->labelError->setText(tr("<font color='#00DD00'><b>Correct expression! -> </b></font>") + addrText);
|
ui->labelError->setText(tr("<font color='#00DD00'><b>Correct expression! -> </b></font>") + addrText);
|
||||||
setOkEnabled(true);
|
setOkEnabled(true);
|
||||||
expressionText = expression;
|
expressionText = expression;
|
||||||
|
|
|
@ -965,13 +965,13 @@ void MainWindow::setLastException(unsigned int exceptionCode)
|
||||||
|
|
||||||
void MainWindow::findStrings()
|
void MainWindow::findStrings()
|
||||||
{
|
{
|
||||||
DbgCmdExec(QString("strref " + QString("%1").arg(mCpuWidget->getDisasmWidget()->getSelectedVa(), sizeof(dsint) * 2, 16, QChar('0')).toUpper()).toUtf8().constData());
|
DbgCmdExec(QString("strref " + ToPtrString(mCpuWidget->getDisasmWidget()->getSelectedVa())).toUtf8().constData());
|
||||||
displayReferencesWidget();
|
displayReferencesWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::findModularCalls()
|
void MainWindow::findModularCalls()
|
||||||
{
|
{
|
||||||
DbgCmdExec(QString("modcallfind " + QString("%1").arg(mCpuWidget->getDisasmWidget()->getSelectedVa(), sizeof(dsint) * 2, 16, QChar('0')).toUpper()).toUtf8().constData());
|
DbgCmdExec(QString("modcallfind " + ToPtrString(mCpuWidget->getDisasmWidget()->getSelectedVa())).toUtf8().constData());
|
||||||
displayReferencesWidget();
|
displayReferencesWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1166,7 +1166,7 @@ void MainWindow::runSelection()
|
||||||
if(!DbgIsDebugging())
|
if(!DbgIsDebugging())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString command = "bp " + QString("%1").arg(mCpuWidget->getDisasmWidget()->getSelectedVa(), sizeof(dsint) * 2, 16, QChar('0')).toUpper() + ", ss";
|
QString command = "bp " + ToPtrString(mCpuWidget->getDisasmWidget()->getSelectedVa()) + ", ss";
|
||||||
if(DbgCmdExecDirect(command.toUtf8().constData()))
|
if(DbgCmdExecDirect(command.toUtf8().constData()))
|
||||||
DbgCmdExecDirect("run");
|
DbgCmdExecDirect("run");
|
||||||
}
|
}
|
||||||
|
|
|
@ -548,7 +548,7 @@ void MemoryMapView::findPatternSlot()
|
||||||
duint addr = getCellContent(getInitialSelection(), 0).toULongLong(0, 16);
|
duint addr = getCellContent(getInitialSelection(), 0).toULongLong(0, 16);
|
||||||
if(hexEdit.entireBlock())
|
if(hexEdit.entireBlock())
|
||||||
addr = 0;
|
addr = 0;
|
||||||
QString addrText = QString("%1").arg(addr, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(addr);
|
||||||
DbgCmdExec(QString("findmemall " + addrText + ", \"" + hexEdit.mHexEdit->pattern() + "\", &data&").toUtf8().constData());
|
DbgCmdExec(QString("findmemall " + addrText + ", \"" + hexEdit.mHexEdit->pattern() + "\", &data&").toUtf8().constData());
|
||||||
emit showReferences();
|
emit showReferences();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "Imports.h"
|
#include "Imports.h"
|
||||||
#include "PageMemoryRights.h"
|
#include "PageMemoryRights.h"
|
||||||
#include "ui_PageMemoryRights.h"
|
#include "ui_PageMemoryRights.h"
|
||||||
|
#include "StringUtil.h"
|
||||||
|
|
||||||
PageMemoryRights::PageMemoryRights(QWidget* parent) : QDialog(parent), ui(new Ui::PageMemoryRights)
|
PageMemoryRights::PageMemoryRights(QWidget* parent) : QDialog(parent), ui(new Ui::PageMemoryRights)
|
||||||
{
|
{
|
||||||
|
@ -36,7 +37,7 @@ void PageMemoryRights::RunAddrSize(duint addrin, duint sizein, QString pagetypei
|
||||||
for(duint i = 0; i < nr_pages; i++)
|
for(duint i = 0; i < nr_pages; i++)
|
||||||
{
|
{
|
||||||
actual_addr = addr + (i * PAGE_SIZE);
|
actual_addr = addr + (i * PAGE_SIZE);
|
||||||
tableWidget->setItem(i, 0, new QTableWidgetItem(QString("%1").arg(actual_addr, sizeof(duint) * 2, 16, QChar('0')).toUpper()));
|
tableWidget->setItem(i, 0, new QTableWidgetItem(ToPtrString(actual_addr)));
|
||||||
if(DbgFunctions()->GetPageRights(actual_addr, rights))
|
if(DbgFunctions()->GetPageRights(actual_addr, rights))
|
||||||
tableWidget->setItem(i, 1, new QTableWidgetItem(QString(rights)));
|
tableWidget->setItem(i, 1, new QTableWidgetItem(QString(rights)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ void PatchDialog::groupToggle()
|
||||||
if(!groupStart)
|
if(!groupStart)
|
||||||
return;
|
return;
|
||||||
QString color = enabled ? "#00DD00" : "red";
|
QString color = enabled ? "#00DD00" : "red";
|
||||||
QString addrText = QString("%1").arg(groupStart, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(groupStart);
|
||||||
QString title = "<font color='" + color + "'><b>" + QString().sprintf("%d:", group) + addrText + "</b></font>";
|
QString title = "<font color='" + color + "'><b>" + QString().sprintf("%d:", group) + addrText + "</b></font>";
|
||||||
mGroupSelector->setGroupTitle(title);
|
mGroupSelector->setGroupTitle(title);
|
||||||
DbgCmdExecDirect(QString("disasm " + addrText).toUtf8().constData());
|
DbgCmdExecDirect(QString("disasm " + addrText).toUtf8().constData());
|
||||||
|
@ -209,7 +209,7 @@ void PatchDialog::groupPrevious()
|
||||||
return;
|
return;
|
||||||
group--;
|
group--;
|
||||||
QString color = isGroupEnabled(curPatchList, group) ? "#00DD00" : "red";
|
QString color = isGroupEnabled(curPatchList, group) ? "#00DD00" : "red";
|
||||||
QString addrText = QString("%1").arg(getGroupAddress(curPatchList, group), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(getGroupAddress(curPatchList, group));
|
||||||
QString title = "<font color='" + color + "'><b>" + QString().sprintf("%d:", group) + addrText + "</b></font>";
|
QString title = "<font color='" + color + "'><b>" + QString().sprintf("%d:", group) + addrText + "</b></font>";
|
||||||
mGroupSelector->setGroupTitle(title);
|
mGroupSelector->setGroupTitle(title);
|
||||||
mGroupSelector->setGroup(group);
|
mGroupSelector->setGroup(group);
|
||||||
|
@ -234,7 +234,7 @@ void PatchDialog::groupNext()
|
||||||
return;
|
return;
|
||||||
group++;
|
group++;
|
||||||
QString color = isGroupEnabled(curPatchList, group) ? "#00DD00" : "red";
|
QString color = isGroupEnabled(curPatchList, group) ? "#00DD00" : "red";
|
||||||
QString addrText = QString("%1").arg(getGroupAddress(curPatchList, group), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(getGroupAddress(curPatchList, group));
|
||||||
QString title = "<font color='" + color + "'><b>" + QString().sprintf("%d:", group) + addrText + "</b></font>";
|
QString title = "<font color='" + color + "'><b>" + QString().sprintf("%d:", group) + addrText + "</b></font>";
|
||||||
mGroupSelector->setGroupTitle(title);
|
mGroupSelector->setGroupTitle(title);
|
||||||
mGroupSelector->setGroup(group);
|
mGroupSelector->setGroup(group);
|
||||||
|
@ -259,7 +259,7 @@ void PatchDialog::on_listModules_itemSelectionChanged()
|
||||||
for(int i = 0; i < patchList.size(); i++)
|
for(int i = 0; i < patchList.size(); i++)
|
||||||
{
|
{
|
||||||
const DBGPATCHINFO curPatch = patchList.at(i).patch;
|
const DBGPATCHINFO curPatch = patchList.at(i).patch;
|
||||||
QString addrText = QString("%1").arg(curPatch.addr, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(curPatch.addr);
|
||||||
QListWidgetItem* item = new QListWidgetItem(QString().sprintf("%d", patchList.at(i).status.group).rightJustified(4, ' ', true) + "|" + addrText + QString().sprintf(":%.2X->%.2X", curPatch.oldbyte, curPatch.newbyte), ui->listPatches);
|
QListWidgetItem* item = new QListWidgetItem(QString().sprintf("%d", patchList.at(i).status.group).rightJustified(4, ' ', true) + "|" + addrText + QString().sprintf(":%.2X->%.2X", curPatch.oldbyte, curPatch.newbyte), ui->listPatches);
|
||||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||||
Qt::CheckState state = patchList.at(i).status.checked ? Qt::Checked : Qt::Unchecked;
|
Qt::CheckState state = patchList.at(i).status.checked ? Qt::Checked : Qt::Unchecked;
|
||||||
|
@ -304,7 +304,7 @@ void PatchDialog::on_listPatches_itemChanged(QListWidgetItem* item) //checkbox c
|
||||||
}
|
}
|
||||||
int group = mGroupSelector->group();
|
int group = mGroupSelector->group();
|
||||||
QString color = isGroupEnabled(curPatchList, group) ? "#00DD00" : "red";
|
QString color = isGroupEnabled(curPatchList, group) ? "#00DD00" : "red";
|
||||||
QString addrText = QString("%1").arg(getGroupAddress(curPatchList, group), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(getGroupAddress(curPatchList, group));
|
||||||
QString title = "<font color='" + color + "'><b>" + QString().sprintf("%d:", group) + addrText + "</b></font>";
|
QString title = "<font color='" + color + "'><b>" + QString().sprintf("%d:", group) + addrText + "</b></font>";
|
||||||
mGroupSelector->setGroupTitle(title);
|
mGroupSelector->setGroupTitle(title);
|
||||||
mGroupSelector->setPreviousEnabled(hasPreviousGroup(curPatchList, group));
|
mGroupSelector->setPreviousEnabled(hasPreviousGroup(curPatchList, group));
|
||||||
|
@ -395,7 +395,7 @@ void PatchDialog::on_listPatches_itemSelectionChanged()
|
||||||
dsint groupStart = getGroupAddress(curPatchList, patch.status.group);
|
dsint groupStart = getGroupAddress(curPatchList, patch.status.group);
|
||||||
if(!groupStart)
|
if(!groupStart)
|
||||||
return;
|
return;
|
||||||
QString addrText = QString("%1").arg(groupStart, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(groupStart);
|
||||||
DbgCmdExecDirect(QString("disasm " + addrText).toUtf8().constData());
|
DbgCmdExecDirect(QString("disasm " + addrText).toUtf8().constData());
|
||||||
DbgCmdExecDirect(QString("dump " + addrText).toUtf8().constData());
|
DbgCmdExecDirect(QString("dump " + addrText).toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
@ -415,7 +415,7 @@ void PatchDialog::on_btnPickGroups_clicked()
|
||||||
|
|
||||||
int group = mGroupSelector->group();
|
int group = mGroupSelector->group();
|
||||||
QString color = isGroupEnabled(curPatchList, group) ? "#00DD00" : "red";
|
QString color = isGroupEnabled(curPatchList, group) ? "#00DD00" : "red";
|
||||||
QString addrText = QString("%1").arg(getGroupAddress(curPatchList, group), sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(getGroupAddress(curPatchList, group));
|
||||||
QString title = "<font color='" + color + "'><b>" + QString().sprintf("%d:", group) + addrText + "</b></font>";
|
QString title = "<font color='" + color + "'><b>" + QString().sprintf("%d:", group) + addrText + "</b></font>";
|
||||||
mGroupSelector->setGroupTitle(title);
|
mGroupSelector->setGroupTitle(title);
|
||||||
mGroupSelector->setPreviousEnabled(hasPreviousGroup(curPatchList, group));
|
mGroupSelector->setPreviousEnabled(hasPreviousGroup(curPatchList, group));
|
||||||
|
@ -661,7 +661,7 @@ void PatchDialog::saveAs1337(const QString & filename)
|
||||||
lines.push_back(">" + i.key());
|
lines.push_back(">" + i.key());
|
||||||
bModPlaced = true;
|
bModPlaced = true;
|
||||||
}
|
}
|
||||||
QString addrText = QString("%1").arg(curPatchList.at(j).patch.addr - modbase, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
QString addrText = ToPtrString(curPatchList.at(j).patch.addr - modbase);
|
||||||
lines.push_back(addrText + QString().sprintf(":%.2X->%.2X", curPatchList.at(j).patch.oldbyte, curPatchList.at(j).patch.newbyte));
|
lines.push_back(addrText + QString().sprintf(":%.2X->%.2X", curPatchList.at(j).patch.oldbyte, curPatchList.at(j).patch.newbyte));
|
||||||
patches++;
|
patches++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,9 @@ void SEHChainView::updateSEHChain()
|
||||||
setRowCount(sehchain.total);
|
setRowCount(sehchain.total);
|
||||||
for(duint i = 0; i < sehchain.total; i++)
|
for(duint i = 0; i < sehchain.total; i++)
|
||||||
{
|
{
|
||||||
QString cellText = QString("%1").arg(sehchain.records[i].addr, sizeof(duint) * 2, 16, QChar('0')).toUpper();
|
QString cellText = ToPtrString(sehchain.records[i].addr);
|
||||||
setCellContent(i, 0, cellText);
|
setCellContent(i, 0, cellText);
|
||||||
cellText = QString("%1").arg(sehchain.records[i].handler, sizeof(duint) * 2, 16, QChar('0')).toUpper();
|
cellText = ToPtrString(sehchain.records[i].handler);
|
||||||
setCellContent(i, 1, cellText);
|
setCellContent(i, 1, cellText);
|
||||||
|
|
||||||
char label[MAX_LABEL_SIZE] = "";
|
char label[MAX_LABEL_SIZE] = "";
|
||||||
|
|
|
@ -234,7 +234,7 @@ void SymbolView::cbSymbolEnum(SYMBOLINFO* symbol, void* user)
|
||||||
StdTable* symbolList = (StdTable*)user;
|
StdTable* symbolList = (StdTable*)user;
|
||||||
dsint index = symbolList->getRowCount();
|
dsint index = symbolList->getRowCount();
|
||||||
symbolList->setRowCount(index + 1);
|
symbolList->setRowCount(index + 1);
|
||||||
symbolList->setCellContent(index, 0, QString("%1").arg(symbol->addr, sizeof(dsint) * 2, 16, QChar('0')).toUpper());
|
symbolList->setCellContent(index, 0, ToPtrString(symbol->addr));
|
||||||
if(symbol->decoratedSymbol)
|
if(symbol->decoratedSymbol)
|
||||||
{
|
{
|
||||||
symbolList->setCellContent(index, 2, symbol->decoratedSymbol);
|
symbolList->setCellContent(index, 2, symbol->decoratedSymbol);
|
||||||
|
@ -473,11 +473,11 @@ void SymbolView::toggleBreakpoint()
|
||||||
|
|
||||||
if((wBpType & bp_normal) == bp_normal)
|
if((wBpType & bp_normal) == bp_normal)
|
||||||
{
|
{
|
||||||
wCmd = "bc " + QString("%1").arg(wVA, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
wCmd = "bc " + ToPtrString(wVA);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wCmd = "bp " + QString("%1").arg(wVA, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
wCmd = "bp " + ToPtrString(wVA);
|
||||||
}
|
}
|
||||||
|
|
||||||
DbgCmdExec(wCmd.toUtf8().constData());
|
DbgCmdExec(wCmd.toUtf8().constData());
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "WordEditDialog.h"
|
#include "WordEditDialog.h"
|
||||||
#include "ui_WordEditDialog.h"
|
#include "ui_WordEditDialog.h"
|
||||||
#include "ValidateExpressionThread.h"
|
#include "ValidateExpressionThread.h"
|
||||||
|
#include "StringUtil.h"
|
||||||
|
|
||||||
WordEditDialog::WordEditDialog(QWidget* parent)
|
WordEditDialog::WordEditDialog(QWidget* parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
|
@ -103,7 +104,7 @@ void WordEditDialog::expressionChanged(bool validExpression, bool validPointer,
|
||||||
saveCursorPositions();
|
saveCursorPositions();
|
||||||
|
|
||||||
// Byte edit line
|
// Byte edit line
|
||||||
ui->hexLineEdit->setText(QString("%1").arg(hexWord, sizeof(duint) * 2, 16, QChar('0')).toUpper());
|
ui->hexLineEdit->setText(ToPtrString(hexWord));
|
||||||
// Signed edit
|
// Signed edit
|
||||||
ui->signedLineEdit->setText(QString::number((dsint)mWord));
|
ui->signedLineEdit->setText(QString::number((dsint)mWord));
|
||||||
// Unsigned edit
|
// Unsigned edit
|
||||||
|
@ -126,7 +127,7 @@ void WordEditDialog::on_signedLineEdit_textEdited(const QString & arg1)
|
||||||
{
|
{
|
||||||
ui->signedLineEdit->setStyleSheet("");
|
ui->signedLineEdit->setStyleSheet("");
|
||||||
ui->btnOk->setEnabled(true);
|
ui->btnOk->setEnabled(true);
|
||||||
ui->expressionLineEdit->setText(QString("%1").arg((duint)value, sizeof(duint) * 2, 16, QChar('0')).toUpper());
|
ui->expressionLineEdit->setText(ToPtrString((duint)value));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -142,7 +143,7 @@ void WordEditDialog::on_unsignedLineEdit_textEdited(const QString & arg1)
|
||||||
{
|
{
|
||||||
ui->unsignedLineEdit->setStyleSheet("");
|
ui->unsignedLineEdit->setStyleSheet("");
|
||||||
ui->btnOk->setEnabled(true);
|
ui->btnOk->setEnabled(true);
|
||||||
ui->expressionLineEdit->setText(QString("%1").arg((duint)value, sizeof(duint) * 2, 16, QChar('0')).toUpper());
|
ui->expressionLineEdit->setText(ToPtrString((duint)value));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,19 +21,19 @@ void Breakpoints::setBP(BPXTYPE type, duint va)
|
||||||
{
|
{
|
||||||
case bp_normal:
|
case bp_normal:
|
||||||
{
|
{
|
||||||
wCmd = "bp " + QString("%1").arg(va, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
wCmd = "bp " + ToPtrString(va);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case bp_hardware:
|
case bp_hardware:
|
||||||
{
|
{
|
||||||
wCmd = "bph " + QString("%1").arg(va, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
wCmd = "bph " + ToPtrString(va);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case bp_memory:
|
case bp_memory:
|
||||||
{
|
{
|
||||||
wCmd = "bpm " + QString("%1").arg(va, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
|
wCmd = "bpm " + ToPtrString(va);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,7 @@
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include "Imports.h"
|
#include "Imports.h"
|
||||||
|
|
||||||
const QChar HexAlphabet[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
inline QString ToPtrString(duint Address)
|
||||||
|
|
||||||
static QString ToPtrString(duint Address)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// This function exists because of how QT handles
|
// This function exists because of how QT handles
|
||||||
|
@ -20,57 +18,23 @@ static QString ToPtrString(duint Address)
|
||||||
// ((int32)0xFFFF0000) == 0xFFFFFFFFFFFF0000 with sign extension
|
// ((int32)0xFFFF0000) == 0xFFFFFFFFFFFF0000 with sign extension
|
||||||
//
|
//
|
||||||
|
|
||||||
duint mask = 0xF;
|
char temp[32];
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
QChar temp[16];
|
sprintf_s(temp, "%016llX", Address);
|
||||||
for(int i = 0; i < 16; i += 2)
|
#else
|
||||||
{
|
sprintf_s(temp, "%08X", Address);
|
||||||
temp[15 - i] = HexAlphabet[(Address & mask) >> (i << 2)];
|
#endif // _WIN64
|
||||||
mask <<= 4;
|
return QString(temp);
|
||||||
temp[14 - i] = HexAlphabet[(Address & mask) >> ((i << 2) + 4)];
|
|
||||||
#else //x86
|
|
||||||
QChar temp[8];
|
|
||||||
for(int i = 0; i < 8; i++)
|
|
||||||
{
|
|
||||||
temp[7 - i] = HexAlphabet[(Address & mask) >> (i << 2)];
|
|
||||||
mask <<= 4;
|
|
||||||
temp[6 - i] = HexAlphabet[(Address & mask) >> ((i << 2) + 4)];
|
|
||||||
#endif //_WIN64
|
|
||||||
mask <<= 4;
|
|
||||||
}
|
|
||||||
#ifdef _WIN64
|
|
||||||
return QString(temp, 16);
|
|
||||||
#else //x86
|
|
||||||
return QString(temp, 8);
|
|
||||||
#endif //_WIN64
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString ToLongLongHexString(unsigned long long Value)
|
inline QString ToLongLongHexString(unsigned long long Value)
|
||||||
{
|
{
|
||||||
char temp[32];
|
char temp[32];
|
||||||
sprintf_s(temp, "%llX", Value);
|
sprintf_s(temp, "%llX", Value);
|
||||||
return QString(temp);
|
return QString(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString ToByteString(unsigned char Value)
|
inline QString ToHexString(duint Value)
|
||||||
{
|
|
||||||
QChar temp[2];
|
|
||||||
temp[1] = HexAlphabet[Value & 0xF];
|
|
||||||
temp[0] = HexAlphabet[(Value & 0xF0) >> 4];
|
|
||||||
return QString(temp, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString ToWordString(unsigned short Value)
|
|
||||||
{
|
|
||||||
QChar temp[4];
|
|
||||||
temp[3] = HexAlphabet[Value & 0xF];
|
|
||||||
temp[2] = HexAlphabet[(Value & 0xF0) >> 4];
|
|
||||||
temp[1] = HexAlphabet[(Value & 0xF00) >> 8];
|
|
||||||
temp[0] = HexAlphabet[(Value & 0xF000) >> 12];
|
|
||||||
return QString(temp, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString ToHexString(duint Value)
|
|
||||||
{
|
{
|
||||||
char temp[32];
|
char temp[32];
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
|
@ -81,7 +45,7 @@ static QString ToHexString(duint Value)
|
||||||
return QString(temp);
|
return QString(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString ToDecString(dsint Value)
|
inline QString ToDecString(dsint Value)
|
||||||
{
|
{
|
||||||
char temp[32];
|
char temp[32];
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
|
@ -92,8 +56,22 @@ static QString ToDecString(dsint Value)
|
||||||
return QString(temp);
|
return QString(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline QString ToByteString(unsigned char Value)
|
||||||
|
{
|
||||||
|
char temp[4];
|
||||||
|
sprintf_s(temp, "%02X", Value);
|
||||||
|
return QString(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QString ToWordString(unsigned short Value)
|
||||||
|
{
|
||||||
|
char temp[4];
|
||||||
|
sprintf_s(temp, "%04X", Value);
|
||||||
|
return QString(temp);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static QString ToFloatingString(void* buffer)
|
inline QString ToFloatingString(void* buffer)
|
||||||
{
|
{
|
||||||
auto value = *(T*)buffer;
|
auto value = *(T*)buffer;
|
||||||
std::stringstream wFloatingStr;
|
std::stringstream wFloatingStr;
|
||||||
|
@ -102,18 +80,18 @@ static QString ToFloatingString(void* buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static QString ToIntegralString(void* buffer)
|
inline QString ToIntegralString(void* buffer)
|
||||||
{
|
{
|
||||||
auto value = *(T*)buffer;
|
auto value = *(T*)buffer;
|
||||||
return ToLongLongHexString(value);
|
return ToLongLongHexString(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString ToFloatString(void* buffer)
|
inline QString ToFloatString(void* buffer)
|
||||||
{
|
{
|
||||||
return ToFloatingString<float>(buffer);
|
return ToFloatingString<float>(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString ToDoubleString(void* buffer)
|
inline QString ToDoubleString(void* buffer)
|
||||||
{
|
{
|
||||||
return ToFloatingString<double>(buffer);
|
return ToFloatingString<double>(buffer);
|
||||||
}
|
}
|
||||||
|
@ -124,13 +102,13 @@ QString ToDateString(const QDate & date);
|
||||||
|
|
||||||
QString GetDataTypeString(void* buffer, duint size, ENCODETYPE type);
|
QString GetDataTypeString(void* buffer, duint size, ENCODETYPE type);
|
||||||
|
|
||||||
static QDate GetCompileDate()
|
inline QDate GetCompileDate()
|
||||||
{
|
{
|
||||||
return QLocale("en_US").toDate(QString(__DATE__).simplified(), "MMM d yyyy");
|
return QLocale("en_US").toDate(QString(__DATE__).simplified(), "MMM d yyyy");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static T & ArchValue(T & x32value, T & x64value)
|
inline T & ArchValue(T & x32value, T & x64value)
|
||||||
{
|
{
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
Q_UNUSED(x32value);
|
Q_UNUSED(x32value);
|
||||||
|
@ -142,7 +120,7 @@ static T & ArchValue(T & x32value, T & x64value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format : d:hh:mm:ss.1234567
|
// Format : d:hh:mm:ss.1234567
|
||||||
static QString FILETIMEToTime(const FILETIME & time)
|
inline QString FILETIMEToTime(const FILETIME & time)
|
||||||
{
|
{
|
||||||
// FILETIME is in 100ns
|
// FILETIME is in 100ns
|
||||||
quint64 time100ns = (quint64)time.dwHighDateTime << 32 | (quint64)time.dwLowDateTime;
|
quint64 time100ns = (quint64)time.dwHighDateTime << 32 | (quint64)time.dwLowDateTime;
|
||||||
|
|
Loading…
Reference in New Issue