Add -B option for Base Address (#2074)

This commit is contained in:
Florian Märkl 2020-02-27 20:12:50 +01:00 committed by GitHub
parent dd7e01be3a
commit e38ff14bac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -85,6 +85,11 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
QObject::tr("name"));
cmd_parser.addOption(formatOption);
QCommandLineOption baddrOption({"B", "base"},
QObject::tr("Load binary at a specific base address"),
QObject::tr("base address"));
cmd_parser.addOption(baddrOption);
QCommandLineOption scriptOption("i",
QObject::tr("Run script file"),
QObject::tr("file"));
@ -184,6 +189,13 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
InitialOptions options;
options.filename = args[0];
options.forceBinPlugin = cmd_parser.value(formatOption);
if (cmd_parser.isSet(baddrOption)) {
bool ok;
RVA baddr = cmd_parser.value(baddrOption).toULongLong(&ok, 0);
if (ok) {
options.binLoadAddr = baddr;
}
}
if (analLevelSpecified) {
switch (analLevel) {
case 0:

View File

@ -159,6 +159,10 @@ void InitialOptionsDialog::loadOptions(const InitialOptions &options)
ui->formatComboBox->setCurrentIndex(0);
}
if (options.binLoadAddr != RVA_INVALID) {
ui->entry_loadOffset->setText(RAddressString(options.binLoadAddr));
}
// TODO: all other options should also be applied to the ui
}