[PATCH v2 05/25] gdbstub/helpers: Introduce ldtul_$endian_p() helpers

Philippe Mathieu-Daudé posted 25 patches 1 month, 3 weeks ago
[PATCH v2 05/25] gdbstub/helpers: Introduce ldtul_$endian_p() helpers
Posted by Philippe Mathieu-Daudé 1 month, 3 weeks ago
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>
---
 include/gdbstub/helpers.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h
index fd83e366a51..e783d166865 100644
--- a/include/gdbstub/helpers.h
+++ b/include/gdbstub/helpers.h
@@ -99,5 +99,7 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)
 #endif
 
 #define ldtul_p(addr) ldn_p(addr, TARGET_LONG_SIZE)
+#define ldtul_le_p(addr) ldn_le_p(addr, TARGET_LONG_SIZE)
+#define ldtul_be_p(addr) ldn_be_p(addr, TARGET_LONG_SIZE)
 
 #endif /* _GDBSTUB_HELPERS_H_ */
-- 
2.45.2


Re: [PATCH v2 05/25] gdbstub/helpers: Introduce ldtul_$endian_p() helpers
Posted by Richard Henderson 1 month, 3 weeks ago
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> 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>
> ---
>   include/gdbstub/helpers.h | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h
> index fd83e366a51..e783d166865 100644
> --- a/include/gdbstub/helpers.h
> +++ b/include/gdbstub/helpers.h
> @@ -99,5 +99,7 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)
>   #endif
>   
>   #define ldtul_p(addr) ldn_p(addr, TARGET_LONG_SIZE)
> +#define ldtul_le_p(addr) ldn_le_p(addr, TARGET_LONG_SIZE)
> +#define ldtul_be_p(addr) ldn_be_p(addr, TARGET_LONG_SIZE)

I'd be happier if these were defined in the preceeding ifdef for now.


r~