From 5be9fa2f0f6004b2ce2ab8d85d415fa4a2bc249e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Thu, 13 Jan 2022 21:16:31 +0100 Subject: [PATCH] [RzIL] Update flags on init and step --- librz/analysis/p/analysis_bf.c | 2 +- librz/bin/p/bin_bf.c | 2 +- librz/core/cil.c | 2 ++ test/db/cmd/cmd_aez | 16 ++++++++++++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/librz/analysis/p/analysis_bf.c b/librz/analysis/p/analysis_bf.c index a6ad61adb2..9449914762 100644 --- a/librz/analysis/p/analysis_bf.c +++ b/librz/analysis/p/analysis_bf.c @@ -414,7 +414,7 @@ RzAnalysisPlugin rz_analysis_plugin_bf = { .desc = "brainfuck code analysis plugin", .license = "LGPL3", .arch = "bf", - .bits = 8, + .bits = 64, // RzIL emulation of bf and the reg definitions above use 64bit values .op = &bf_op, .get_reg_profile = get_reg_profile, .rzil_init = bf_init_rzil, diff --git a/librz/bin/p/bin_bf.c b/librz/bin/p/bin_bf.c index 4b0f1ea214..24c2fe5d08 100644 --- a/librz/bin/p/bin_bf.c +++ b/librz/bin/p/bin_bf.c @@ -37,7 +37,7 @@ static RzBinInfo *info(RzBinFile *bf) { ret->machine = strdup("brainfuck"); ret->arch = strdup("bf"); ret->has_va = 1; - ret->bits = 32; // 16? + ret->bits = 64; // RzIL emulation of bf uses 64bit values ret->big_endian = 0; ret->dbg_info = 0; /* TODO: move this somewhere else */ diff --git a/librz/core/cil.c b/librz/core/cil.c index c45825ff60..750d9e9743 100644 --- a/librz/core/cil.c +++ b/librz/core/cil.c @@ -417,6 +417,7 @@ RZ_IPI void rz_core_analysis_rzil_reinit(RzCore *core) { if (core->analysis->rzil) { // initialize the program counter with the current offset rz_reg_set_value_by_role(core->analysis->reg, RZ_REG_NAME_PC, core->offset); + rz_core_reg_update_flags(core); } } @@ -639,6 +640,7 @@ RZ_IPI void rz_core_rzil_step(RzCore *core) { RZ_LOG_ERROR("RzIL: stepping failed.\n"); } rz_il_vm_sync_to_reg(vm, analysis->reg); + rz_core_reg_update_flags(core); } else { RZ_LOG_ERROR("RzIL: invalid instruction or lifting not implemented at address 0x%08" PFMT64x "\n", addr); } diff --git a/test/db/cmd/cmd_aez b/test/db/cmd/cmd_aez index 885bcaf788..350eee234e 100644 --- a/test/db/cmd/cmd_aez +++ b/test/db/cmd/cmd_aez @@ -48,6 +48,7 @@ ar pc=0x54 aezs 1 aezv ar +f @F:registers EOF EXPECT=<