===================================================================
@@ -317,6 +317,8 @@ static GDBState *gdbserver_state;
bool gdb_has_xml;
+bool gdbstub_cross_endian;
+
#ifdef CONFIG_USER_ONLY
/* XXX: This is not thread safe. Do we care? */
static int gdbserver_fd = -1;
===================================================================
@@ -42,8 +42,13 @@ static inline int cpu_index(CPUState *cp
/* The GDB remote protocol transfers values in target byte order.
This means
* we can use the raw memory access routines to access the value
buffer.
* Conveniently, these also handle the case where the buffer is
mis-aligned.
+ *
+ * We do need to byte swap if the CPU isn't running in the QEMU
compiled
+ * target endian mode.
*/
+extern bool gdbstub_cross_endian;