From 70c06462a15093dacfe90aac23b313912ab686c2 Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 27 May 2024 19:59:55 +0200 Subject: [PATCH] Fix arch selection when loading no files `--` with r2 -a -- ##tools --- libr/main/radare2.c | 9 +++++++++ test/db/cmd/bug_arch | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 test/db/cmd/bug_arch diff --git a/libr/main/radare2.c b/libr/main/radare2.c index 14e70e416e954..64e68e93da88d 100644 --- a/libr/main/radare2.c +++ b/libr/main/radare2.c @@ -1703,6 +1703,15 @@ R_API int r_main_radare2(int argc, const char **argv) { free (f); } } else { + if (mr.asmarch) { + r_config_set (r->config, "asm.arch", mr.asmarch); + } + if (mr.asmbits) { + r_config_set (r->config, "asm.bits", mr.asmbits); + } + if (mr.asmos) { + r_config_set (r->config, "asm.os", mr.asmos); + } r_core_block_read (r); } { diff --git a/test/db/cmd/bug_arch b/test/db/cmd/bug_arch new file mode 100644 index 0000000000000..10407f685ee8b --- /dev/null +++ b/test/db/cmd/bug_arch @@ -0,0 +1,26 @@ +NAME=-a bug +FILE=-- +ARGS=-a ppc -b32 +CMDS=<