qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] gdb: Fix gdb error
@ 2013-08-11 18:14 Aneesh Kumar K.V
  2013-08-12  8:48 ` Andreas Färber
  0 siblings, 1 reply; 4+ messages in thread
From: Aneesh Kumar K.V @ 2013-08-11 18:14 UTC (permalink / raw)
  To: qemu-devel, Andreas Färber; +Cc: aliguori, Aneesh Kumar K.V

From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>

Don't update the global register count if not requested.
Without this patch a remote gdb session gives

(gdb) target remote localhost:1234
Remote debugging using localhost:1234
Remote 'g' packet reply is too long:
0000000028000084c000000000ccba50c000000000c ...
....
...
(gdb)

This is a regression introduce by a0e372f0c49ac01faeaeb73a6e8f50e8ac615f34

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 gdbstub.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index 1af25a6..4b58a1e 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -598,6 +598,12 @@ void gdb_register_coprocessor(CPUState *cpu,
 {
     GDBRegisterState *s;
     GDBRegisterState **p;
+    static int last_reg;
+    CPUClass *cc = CPU_GET_CLASS(cpu);
+
+    if (!last_reg) {
+        last_reg = cc->gdb_num_core_regs;
+    }
 
     p = &cpu->gdb_regs;
     while (*p) {
@@ -608,19 +614,21 @@ void gdb_register_coprocessor(CPUState *cpu,
     }
 
     s = g_new0(GDBRegisterState, 1);
-    s->base_reg = cpu->gdb_num_regs;
+    s->base_reg = last_reg;
     s->num_regs = num_regs;
     s->get_reg = get_reg;
     s->set_reg = set_reg;
     s->xml = xml;
 
     /* Add to end of list.  */
-    cpu->gdb_num_regs += num_regs;
+    last_reg += num_regs;
     *p = s;
     if (g_pos) {
         if (g_pos != s->base_reg) {
             fprintf(stderr, "Error: Bad gdb register numbering for '%s'\n"
                     "Expected %d got %d\n", xml, g_pos, s->base_reg);
+        } else {
+            cpu->gdb_num_regs = last_reg;
         }
     }
 }
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-12 17:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-11 18:14 [Qemu-devel] [PATCH] gdb: Fix gdb error Aneesh Kumar K.V
2013-08-12  8:48 ` Andreas Färber
2013-08-12  9:17   ` Aneesh Kumar K.V
2013-08-12 17:40     ` Andreas Färber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).