Added load option to set anal.bb.maxsize

This commit is contained in:
mandlebro 2018-03-07 12:02:39 +00:00 committed by xarkes
parent 8a73abf63f
commit b0c3d438d1
6 changed files with 60 additions and 2 deletions

View File

@ -105,6 +105,8 @@ void AnalThread::run()
core->setEndianness(optionsDialog->getSelectedEndianness() == OptionsDialog::Endianness::Big); core->setEndianness(optionsDialog->getSelectedEndianness() == OptionsDialog::Endianness::Big);
} }
core->setBBSize(optionsDialog->getSelectedBBSize());
// use prj.simple as default as long as regular projects are broken // use prj.simple as default as long as regular projects are broken
core->setConfig("prj.simple", true); core->setConfig("prj.simple", true);

View File

@ -599,6 +599,11 @@ void CutterCore::setEndianness(bool big)
setConfig("cfg.bigendian", big); setConfig("cfg.bigendian", big);
} }
void CutterCore::setBBSize(int size)
{
setConfig("anal.bb.maxsize", size);
}
void CutterCore::setDefaultCPU() void CutterCore::setDefaultCPU()
{ {
if (!default_arch.isEmpty()) if (!default_arch.isEmpty())

View File

@ -318,6 +318,8 @@ public:
void setDefaultCPU(); void setDefaultCPU();
void setCPU(QString arch, QString cpu, int bits, bool temporary = false); void setCPU(QString arch, QString cpu, int bits, bool temporary = false);
void setEndianness(bool big); void setEndianness(bool big);
void setBBSize(int size);
RAnalFunction *functionAt(ut64 addr); RAnalFunction *functionAt(ut64 addr);
QString cmdFunctionAt(QString addr); QString cmdFunctionAt(QString addr);
QString cmdFunctionAt(RVA addr); QString cmdFunctionAt(RVA addr);

View File

@ -42,6 +42,7 @@ OptionsDialog::OptionsDialog(MainWindow *main):
ui->bitsComboBox->setToolTip(core->cmd("e? asm.bits").trimmed()); ui->bitsComboBox->setToolTip(core->cmd("e? asm.bits").trimmed());
ui->entry_analbb->setToolTip(core->cmd("e? anal.bb.maxsize").trimmed());
for (auto plugin : core->getRBinPluginDescriptions("bin")) for (auto plugin : core->getRBinPluginDescriptions("bin"))
ui->formatComboBox->addItem(plugin.name, QVariant::fromValue(plugin)); ui->formatComboBox->addItem(plugin.name, QVariant::fromValue(plugin));
@ -113,6 +114,16 @@ int OptionsDialog::getSelectedBits()
return 0; return 0;
} }
int OptionsDialog::getSelectedBBSize()
{
QString sel_bbsize = ui->entry_analbb->text();
bool ok;
int bbsize = sel_bbsize.toInt(&ok);
if (ok)
return bbsize;
return 1024;
}
OptionsDialog::Endianness OptionsDialog::getSelectedEndianness() OptionsDialog::Endianness OptionsDialog::getSelectedEndianness()
{ {
switch(ui->endiannessComboBox->currentIndex()) switch(ui->endiannessComboBox->currentIndex())

View File

@ -53,13 +53,14 @@ private:
void setInteractionEnabled(bool enabled); void setInteractionEnabled(bool enabled);
public: public:
enum class Endianness { Auto, Little, Big }; enum class Endianness { Auto, Little, Big };
std::unique_ptr<Ui::OptionsDialog> ui; std::unique_ptr<Ui::OptionsDialog> ui;
QString getSelectedArch(); QString getSelectedArch();
QString getSelectedCPU(); QString getSelectedCPU();
int getSelectedBits(); int getSelectedBits();
int getSelectedBBSize();
Endianness getSelectedEndianness(); Endianness getSelectedEndianness();
QString getSelectedOS(); QString getSelectedOS();
QTimer analTimer; QTimer analTimer;

View File

@ -900,6 +900,43 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="3" column="0">
<widget class="QLabel" name="analbbLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>BasicBlock maxsize:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="entry_analbb">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>1024</string>
</property>
<property name="frame">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>