]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
gdbstub/helpers.h: allow header to be called from common code
authorPierrick Bouvier <pierrick.bouvier@linaro.org>
Fri, 9 Jan 2026 05:31:30 +0000 (21:31 -0800)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Mon, 12 Jan 2026 22:47:57 +0000 (23:47 +0100)
Target specific variants can't be used in common code, thus limit their
definition to COMPILING_PER_TARGET.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109053158.2800705-2-pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
include/gdbstub/helpers.h

index b685afac436384ceda16b69e3d5ae3b885faf702..197592036bf67befafd4c9775bc25d8b2c7bd52d 100644 (file)
 #ifndef _GDBSTUB_HELPERS_H_
 #define _GDBSTUB_HELPERS_H_
 
-#ifndef COMPILING_PER_TARGET
-#error "gdbstub helpers should only be included by target specific code"
-#endif
-
 #include "qemu/bswap.h"
 #include "qemu/target-info.h"
+
+#ifdef COMPILING_PER_TARGET
 #include "cpu-param.h"
+#endif
 
 /*
  * The GDB remote protocol transfers values in target byte order. As
@@ -102,6 +101,7 @@ 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)
 #define ldtul_p(addr) ldq_p(addr)
@@ -113,5 +113,6 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)
 #define ldtul_le_p(addr) ldl_le_p(addr)
 #define ldtul_be_p(addr) ldl_be_p(addr)
 #endif
+#endif /* COMPILING_PER_TARGET */
 
 #endif /* _GDBSTUB_HELPERS_H_ */