Set bits for analysis after loading the binary (#618)

This commit is contained in:
xarkes 2018-08-14 17:07:52 +02:00 committed by GitHub
parent bf07f2a002
commit f98a175c5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 8 deletions

View File

@ -26,8 +26,6 @@ void AnalTask::runTask()
log(tr("Loading Binary...\n"));
openFailed = false;
Core()->setCPU(options.arch, options.cpu, options.bits);
int perms = R_IO_READ | R_IO_EXEC;
if (options.writeEnabled)
perms |= R_IO_WRITE;
@ -54,6 +52,9 @@ void AnalTask::runTask()
}
}
// r_core_bin_load might change asm.bits, so let's set that after the bin is loaded
Core()->setCPU(options.arch, options.cpu, options.bits);
if (isInterrupted()) {
return;
}

View File

@ -609,8 +609,12 @@ void CutterCore::setConfig(const QString &k, const QVariant &v)
void CutterCore::setCPU(QString arch, QString cpu, int bits)
{
if (arch != nullptr) {
setConfig("asm.arch", arch);
}
if (cpu != nullptr) {
setConfig("asm.cpu", cpu);
}
setConfig("asm.bits", bits);
}

View File

@ -1068,15 +1068,13 @@ void HexdumpWidget::on_copySHA1_clicked()
void HexdumpWidget::selectHexPreview()
{
// Pre-select arch and bits in the hexdump sidebar
QString arch = Core()->cmd("e asm.arch").trimmed();
QString bits = Core()->cmd("e asm.bits").trimmed();
QString arch = Core()->getConfig("asm.arch");
QString bits = Core()->getConfig("asm.bits");
//int arch_index = ui->hexArchComboBox_2->findText(arch);
if (ui->parseArchComboBox->findText(arch) != -1) {
ui->parseArchComboBox->setCurrentIndex(ui->parseArchComboBox->findText(arch));
}
//int bits_index = ui->hexBitsComboBox_2->findText(bits);
if (ui->parseBitsComboBox->findText(bits) != -1) {
ui->parseBitsComboBox->setCurrentIndex(ui->parseBitsComboBox->findText(bits));
}