From 552d8e6aecf7e57b0a8a37d9f0c8c5b99de30cf4 Mon Sep 17 00:00:00 2001 From: Eladash Date: Fri, 23 Oct 2020 00:09:00 +0300 Subject: [PATCH] Debugger: Fix SignedHex It didnt take into account INTx_MIN. (UB for std::abs) --- rpcs3/Emu/CPU/CPUDisAsm.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rpcs3/Emu/CPU/CPUDisAsm.h b/rpcs3/Emu/CPU/CPUDisAsm.h index 04b109de17..03c32a8b3d 100644 --- a/rpcs3/Emu/CPU/CPUDisAsm.h +++ b/rpcs3/Emu/CPU/CPUDisAsm.h @@ -61,6 +61,13 @@ protected: static std::string SignedHex(T value) { const auto v = static_cast>(value); + + if (v == std::numeric_limits>::min()) + { + // for INTx_MIN + return fmt::format("-0x%x", v); + } + const auto av = std::abs(v); if (av < 10)