qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [patch] gdb-stub support for Alpha


From: Vince Weaver
Subject: [Qemu-devel] [patch] gdb-stub support for Alpha
Date: Wed, 3 Dec 2008 13:16:59 -0500 (EST)

Hello

the patch below enables gdb-stub support for Alpha.

It currently has two problems, hopefully someone who knows a bit more
about how gdb-stub works can be of help.

1).  When single-stepping through a branch, it double-steps after
     each branch instruction

2).  When viewing floating-point registers, the value displayed
     as being in the register is the integer equivelent of the
     value, not the actual floating point value.

     For example, if the value in the register is 197.0,
     the hex vale for the raw value is shown as
     0xc5 instead of 0x4068a0000000000

Vince

Index: target-alpha/translate.c
===================================================================
--- target-alpha/translate.c    (revision 5854)
+++ target-alpha/translate.c    (working copy)
@@ -2407,10 +2407,15 @@
          * generation
          */
         if (((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) ||
-            (env->singlestep_enabled) ||
             num_insns >= max_insns) {
             break;
         }
+
+        if (env->singlestep_enabled) {
+          gen_excp(&ctx, EXCP_DEBUG, 0);
+          break;
+       }
+
 #if defined (DO_SINGLE_STEP)
         break;
 #endif
Index: gdbstub.c
===================================================================
--- gdbstub.c   (revision 5854)
+++ gdbstub.c   (working copy)
@@ -990,6 +990,50 @@

     return 4;
 }
+#elif defined (TARGET_ALPHA)
+
+#define NUM_CORE_REGS 65
+
+static int cpu_gdb_read_register(CPUState *env, uint8_t *mem_buf, int n)
+{
+    if (n < 31) {
+       GET_REGL(env->ir[n]);
+    }
+    else if (n == 31) {
+       GET_REGL(0);
+    }
+    else if (n<63) {
+       GET_REGL(env->fir[n-32]);
+    }
+    else if (n<64) {
+       GET_REGL(0);
+    }
+    else {
+       GET_REGL(env->pc);
+    }
+
+    return 0;
+}
+
+static int cpu_gdb_write_register(CPUState *env, uint8_t *mem_buf, int n)
+{
+    target_ulong tmp;
+    tmp = ldtul_p(mem_buf);
+
+    if (n < 31) {
+       env->ir[n] = tmp;
+    }
+
+    if (n > 31 && n < 63) {
+       env->fir[n - 32] = ldfl_p(mem_buf);
+    }
+
+    if (n == 64 ) {
+       env->pc=tmp;
+    }
+
+    return 8;
+}
 #else

 #define NUM_CORE_REGS 0
@@ -1277,6 +1321,8 @@
             s->c_cpu->active_tc.PC = addr;
 #elif defined (TARGET_CRIS)
             s->c_cpu->pc = addr;
+#elif defined (TARGET_ALPHA)
+           s->c_cpu->pc = addr;
 #endif
         }
         gdb_continue(s);
@@ -1313,6 +1359,8 @@
             s->c_cpu->active_tc.PC = addr;
 #elif defined (TARGET_CRIS)
             s->c_cpu->pc = addr;
+#elif defined (TARGET_ALPHA)
+           s->c_cpu->pc = addr;
 #endif
         }
         cpu_single_step(s->c_cpu, sstep_flags);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]