Skip to contentSkip to conversation

mips64 gdbstub broken

Qemu-devel Paul Brook 1 participant 1 message Nov 10, 2007

lore
Share & tools
lore

Paul Brook

author
#0 lore raw

A recent CVS commit ("Fix gdb stub for MIPS64.") looks incorrect:

gdbstub.c 25 Oct 2007 21:30:37 -0000 1.67 line 567

Quoted 10 lines

diff -u -r1.66 -r1.67

gdbstub.c 25 Oct 2007 21:30:37 -0000 1.67 renamed from gdbstub.c 8 Oct 2007 13:16:14 -0000 1.66 +1 -1
@@ -563,7 +563,7 @@
         ptr += sizeof(target_ulong);
       }
 
-    *(target_ulong *)ptr = tswapl(env->CP0_Status);
+    *(target_ulong *)ptr = (int32_t)tswap32(env->CP0_Status);
     ptr += sizeof(target_ulong);

This is obviously bogus. The new value sent to gdb will depend on the host endianness.

I suspect what you meant to do is

  *(target_ulong *)ptr = tswapl((int32_t)env->CP0_Status);

i.e. sign extended to a target-endian 64-bit value. This is consistent with the implementation of cpu_gdb_write_registers.

Could you confirm?

Paul