mirror of
https://github.com/qemu/qemu.git
synced 2026-04-05 21:46:25 +00:00
gdbstub/helpers: Convert gdb_get_regl() macro to inlined helper
Rather than checking TARGET_LONG_BITS at build time, check target_long_bits() at runtime. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20260219191955.83815-38-philmd@linaro.org>
This commit is contained in:
@@ -88,6 +88,20 @@ static inline int gdb_get_zeroes(GByteArray *array, size_t len)
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdb_get_regl: append @val in @buf using 32 or 64-bit, depending on target
|
||||
*
|
||||
* This function is legacy and deprecated, thus should not be used in new code.
|
||||
*/
|
||||
static inline int gdb_get_regl(GByteArray *buf, uint64_t val)
|
||||
{
|
||||
if (target_long_bits() == 64) {
|
||||
return gdb_get_reg64(buf, val);
|
||||
} else {
|
||||
return gdb_get_reg32(buf, val);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdb_get_reg_ptr: get pointer to start of last element
|
||||
* @len: length of element
|
||||
@@ -101,12 +115,4 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)
|
||||
return buf->data + buf->len - len;
|
||||
}
|
||||
|
||||
#ifdef COMPILING_PER_TARGET
|
||||
#if TARGET_LONG_BITS == 64
|
||||
#define gdb_get_regl(buf, val) gdb_get_reg64(buf, val)
|
||||
#else
|
||||
#define gdb_get_regl(buf, val) gdb_get_reg32(buf, val)
|
||||
#endif
|
||||
#endif /* COMPILING_PER_TARGET */
|
||||
|
||||
#endif /* _GDBSTUB_HELPERS_H_ */
|
||||
|
||||
Reference in New Issue
Block a user