From c047d6ddbd550d8e73e6289a11a2d89c72ab1ee5 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Mon, 2 Jan 2012 20:58:23 +0100 Subject: [PATCH] winedbg: In x86_64 backend, now recognize 'rep ret' as a valid function return instruction. --- programs/winedbg/be_x86_64.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c index 253b4ac781c..7dbd301fa6e 100644 --- a/programs/winedbg/be_x86_64.c +++ b/programs/winedbg/be_x86_64.c @@ -300,7 +300,15 @@ static unsigned be_x86_64_is_step_over_insn(const void* insn) static unsigned be_x86_64_is_function_return(const void* insn) { BYTE c; - return dbg_read_memory(insn, &c, sizeof(c)) && ((c == 0xC2) || (c == 0xC3)); + + /* sigh... amd64 for prefetch optimization requires 'rep ret' in some cases */ + if (!dbg_read_memory(insn, &c, sizeof(c))) return FALSE; + if (c == 0xF3) /* REP */ + { + insn = (const char*)insn + 1; + if (!dbg_read_memory(insn, &c, sizeof(c))) return FALSE; + } + return c == 0xC2 /* ret */ || c == 0xC3 /* ret NN */; } static unsigned be_x86_64_is_break_insn(const void* insn)