1
0
Fork 0

Merge branch 'torusrxxx-patch0000008a' into development

This commit is contained in:
Duncan Ogilvie 2018-06-11 03:15:03 +02:00
commit 94035a530a
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
9 changed files with 69 additions and 21 deletions

View File

@ -31,6 +31,7 @@ bool _dbg_animatecommand(const char* command)
{
if(command) // Animate command
{
GuiAddStatusBarMessage(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Animation started. Use the \"pause\" command to stop animation.")));
strcpy_s(animate_command, command);
if(hAnimateThread == nullptr)
{

View File

@ -31,7 +31,10 @@ void BreakpointMenu::build(MenuBuilder* builder)
if(selection == 0)
return false;
BPXTYPE bpType = DbgGetBpxTypeAt(selection);
if((bpType & bp_normal) == bp_normal)
if((bpType & bp_normal) == bp_normal || (bpType & bp_hardware) == bp_hardware)
editSoftwareBreakpointAction->setText(tr("Edit"));
else
editSoftwareBreakpointAction->setText(tr("Set Conditional Breakpoint"));
menu->addAction(editSoftwareBreakpointAction);
menu->addAction(toggleBreakpointAction);
@ -119,7 +122,20 @@ void BreakpointMenu::toggleInt3BPActionSlot()
void BreakpointMenu::editSoftBpActionSlot()
{
Breakpoints::editBP(bp_normal, ToHexString(mGetSelection()), (QWidget*)parent());
auto selection = mGetSelection();
if(selection == 0)
return;
BPXTYPE bpType = DbgGetBpxTypeAt(selection);
if((bpType & bp_hardware) == bp_hardware)
Breakpoints::editBP(bp_hardware, ToHexString(selection), dynamic_cast<QWidget*>(parent()));
else if((bpType & bp_normal) == bp_normal)
Breakpoints::editBP(bp_normal, ToHexString(selection), dynamic_cast<QWidget*>(parent()));
else
{
DbgCmdExecDirect(QString("bp %1").arg(ToHexString(selection)).toUtf8().constData()); //Blocking call
if(!Breakpoints::editBP(bp_normal, ToHexString(selection), dynamic_cast<QWidget*>(parent())))
Breakpoints::removeBP(bp_normal, selection);
}
}
void BreakpointMenu::toggleHwBpActionSlot()

View File

@ -1059,6 +1059,11 @@ void DisassemblerGraphView::renderFunction(Function & func)
//Create render nodes
this->blocks.clear();
if(func.entry == 0)
{
this->ready = false;
return;
}
for(Block & block : func.blocks)
{
this->blocks[block.entry] = DisassemblerBlock(block);

View File

@ -10,13 +10,26 @@ EditBreakpointDialog::EditBreakpointDialog(QWidget* parent, const BRIDGEBP & bp)
{
ui->setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint | Qt::MSWindowsFixedSizeDialogHint);
if(bp.type == bp_dll)
switch(bp.type)
{
setWindowTitle(QString(tr("Edit Breakpoint %1")).arg(QString(bp.mod)));
}
else
{
setWindowTitle(QString(tr("Edit Breakpoint %1")).arg(getSymbolicName(bp.addr)));
case bp_dll:
setWindowTitle(tr("Edit DLL Breakpoint %1").arg(QString(bp.mod)));
break;
case bp_normal:
setWindowTitle(tr("Edit Breakpoint %1").arg(getSymbolicName(bp.addr)));
break;
case bp_hardware:
setWindowTitle(tr("Edit Hardware Breakpoint %1").arg(getSymbolicName(bp.addr)));
break;
case bp_memory:
setWindowTitle(tr("Edit Memory Breakpoint %1").arg(getSymbolicName(bp.addr)));
break;
case bp_exception:
setWindowTitle(tr("Edit Exception Breakpoint %1").arg(getSymbolicName(bp.addr)));
break;
default:
setWindowTitle(tr("Edit Breakpoint %1").arg(getSymbolicName(bp.addr)));
break;
}
setWindowIcon(DIcon("breakpoint.png"));
loadFromBp();

View File

@ -415,32 +415,42 @@ void MainWindow::setupStatusBar()
void MainWindow::setupLanguagesMenu()
{
QDir translationsDir(QString("%1/../translations/").arg(QCoreApplication::applicationDirPath()));
QMenu* languageMenu;
if(tr("Languages") == QString("Languages"))
languageMenu = new QMenu(QString("Languages"));
else
languageMenu = new QMenu(tr("Languages") + QString(" Languages"), this);
languageMenu->setIcon(DIcon("codepage.png"));
QLocale enUS(QLocale::English, QLocale::UnitedStates);
QString wCurrentLocale(currentLocale);
QAction* action_enUS = new QAction(QString("[%1] %2 - %3").arg(enUS.name()).arg(enUS.nativeLanguageName()).arg(enUS.nativeCountryName()), languageMenu);
connect(action_enUS, SIGNAL(triggered()), this, SLOT(chooseLanguage()));
action_enUS->setCheckable(true);
action_enUS->setChecked(false);
languageMenu->addAction(action_enUS);
connect(languageMenu, SIGNAL(aboutToShow()), this, SLOT(setupLanguagesMenu2())); //Load this menu later, since it requires directory scanning.
ui->menuOptions->addMenu(languageMenu);
}
void MainWindow::setupLanguagesMenu2()
{
QMenu* languageMenu = dynamic_cast<QMenu*>(sender()); //The only sender is languageMenu
QAction* action_enUS = languageMenu->actions()[0]; //There is only one action "action_enUS" created by setupLanguagesMenu()
QDir translationsDir(QString("%1/../translations/").arg(QCoreApplication::applicationDirPath()));
QString wCurrentLocale(currentLocale);
if(!translationsDir.exists())
{
// translations dir do not exist
action_enUS->setChecked(true);
ui->menuOptions->addMenu(languageMenu);
disconnect(languageMenu, SIGNAL(aboutToShow()), this, 0);
return;
}
if(wCurrentLocale == QString("en_US"))
action_enUS->setChecked(true);
QStringList filter;
filter << "x64dbg_*.qm";
QFileInfoList fileList = translationsDir.entryInfoList(filter, QDir::Readable | QDir::Files, QDir::Size);
QFileInfoList fileList = translationsDir.entryInfoList(filter, QDir::Readable | QDir::Files, QDir::Size); //Search for all translations
auto allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry);
for(auto i : fileList)
{
@ -458,7 +468,7 @@ void MainWindow::setupLanguagesMenu()
}
}
}
ui->menuOptions->addMenu(languageMenu);
disconnect(languageMenu, SIGNAL(aboutToShow()), this, 0); //Done. Let's disconnect it to prevent it from initializing twice.
}
void MainWindow::closeEvent(QCloseEvent* event)

View File

@ -273,6 +273,8 @@ public:
static QString windowTitle;
private slots:
void setupLanguagesMenu2();
void on_actionFaq_triggered();
void on_actionReloadStylesheet_triggered();
void on_actionImportSettings_triggered();

View File

@ -19,7 +19,7 @@ SimpleTraceDialog::SimpleTraceDialog(QWidget* parent) :
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"));
ui->editSwitchCondition->setPlaceholderText(tr("Example: eax == 0 && ebx == 0"));
ui->editSwitchCondition->setPlaceholderText(tr("Example: mod.party(dis.branchdest(cip)) == 1"));
}
SimpleTraceDialog::~SimpleTraceDialog()

View File

@ -485,20 +485,20 @@ void Breakpoints::toggleBPByRemoving(BPXTYPE type, duint va)
}
}
void Breakpoints::editBP(BPXTYPE type, const QString & addrText, QWidget* widget)
bool Breakpoints::editBP(BPXTYPE type, const QString & addrText, QWidget* widget)
{
BRIDGEBP bridgebp;
if(type != bp_dll)
{
duint addr = addrText.toULongLong(nullptr, 16);
if(!DbgFunctions()->GetBridgeBp(type, addr, &bridgebp))
return;
return false;
}
else if(!DbgFunctions()->GetBridgeBp(type, reinterpret_cast<duint>(addrText.toUtf8().constData()), &bridgebp))
return;
return false;
EditBreakpointDialog dialog(widget, bridgebp);
if(dialog.exec() != QDialog::Accepted)
return;
return false;
auto bp = dialog.getBp();
auto exec = [](const QString & command)
{
@ -567,7 +567,8 @@ void Breakpoints::editBP(BPXTYPE type, const QString & addrText, QWidget* widget
exec(QString("SetExceptionBreakpointSingleshoot %1, %2").arg(addrText).arg(bp.singleshoot));
break;
default:
return;
return false;
}
GuiUpdateBreakpointsView();
return true;
}

View File

@ -32,7 +32,7 @@ public:
static void toggleBPByRemoving(BPXTYPE type, duint va);
static BPXSTATE BPState(BPXTYPE type, duint va);
static bool BPTrival(BPXTYPE type, duint va);
static void editBP(BPXTYPE type, const QString & addrText, QWidget* widget);
static bool editBP(BPXTYPE type, const QString & addrText, QWidget* widget);
};
#endif // BREAKPOINTS_H