gdbstub/helpers: Introduce ldtul_$endian_p() helpers
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Fri, 4 Oct 2024 09:00:35 +0000 (11:00 +0200)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 15 Oct 2024 14:55:09 +0000 (11:55 -0300)
Introduce ldtul_le_p() and ldtul_be_p() to use directly
in place of ldtul_p() when a target endianness is fixed.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20241010175246.15779-3-philmd@linaro.org>

include/gdbstub/helpers.h

index 26140ef1ac09113e1dd1694245ecb46868d308bd..6f7cc48adcb92c748f2a3589ec6aa43827da920a 100644 (file)
@@ -95,9 +95,13 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)
 #if TARGET_LONG_BITS == 64
 #define gdb_get_regl(buf, val) gdb_get_reg64(buf, val)
 #define ldtul_p(addr) ldq_p(addr)
+#define ldtul_le_p(addr) ldq_le_p(addr)
+#define ldtul_be_p(addr) ldq_be_p(addr)
 #else
 #define gdb_get_regl(buf, val) gdb_get_reg32(buf, val)
 #define ldtul_p(addr) ldl_p(addr)
+#define ldtul_le_p(addr) ldl_le_p(addr)
+#define ldtul_be_p(addr) ldl_be_p(addr)
 #endif
 
 #endif /* _GDBSTUB_HELPERS_H_ */