From 78dff27a0c4a2f6f3796cce84f341503ae67b679 Mon Sep 17 00:00:00 2001 From: pancake Date: Tue, 19 Jan 2021 04:07:23 +0100 Subject: [PATCH] Fix wrong variable name when using ESP as base register ##disasm --- libr/core/disasm.c | 2 +- test/db/anal/vars | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/libr/core/disasm.c b/libr/core/disasm.c index 4a37f5cf09616..67d952ed581a3 100644 --- a/libr/core/disasm.c +++ b/libr/core/disasm.c @@ -1635,7 +1635,7 @@ static ut32 tmp_get_realsize (RAnalFunction *f) { } static void ds_show_functions_argvar(RDisasmState *ds, RAnalFunction *fcn, RAnalVar *var, const char *base, bool is_var, char sign) { - int delta = var->kind == 'b' ? R_ABS (var->delta + fcn->bp_off) : R_ABS (var->delta); + int delta = var->kind == 'b' ? R_ABS (var->delta + fcn->bp_off) : R_ABS (var->delta - ((var->kind=='s')?8:0)); const char *pfx = is_var ? "var" : "arg"; char *constr = r_anal_var_get_constraints_readable (var); r_cons_printf ("%s%s %s%s%s%s %s%s%s%s@ %s%c0x%x", COLOR_ARG (ds, color_func_var), pfx, diff --git a/test/db/anal/vars b/test/db/anal/vars index 8c7430558b3bd..536797c8710ad 100644 --- a/test/db/anal/vars +++ b/test/db/anal/vars @@ -326,3 +326,33 @@ afvW var_4h 0x27 EOF RUN + +NAME=Labe07 stack vars +FILE=bins/pe/Lab07_01.exe +CMDS=<