# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 17f7a426b2cddbc9b347157a49edfa921cf58867
# Parent be9fe905334a4b9bcc6238d0490630449077e2c5
[ppc] gpproxy improvements
The patch:
- Allows for GDB to set a register
- Fixes "fr*" numbering to be 0 to 31
- Properly returns "x" packet in repsonse to a "p" packet when the
requested register is "unfetchable", this part not described in
the manuals but is described in the GDB source code.
Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
tools/gpproxy/gdbremote.py | 17 +++++++++++++----
tools/gpproxy/powerpc.py | 17 ++++++++++++++---
tools/gpproxy/riscwatch.py | 8 ++++++++
3 files changed, 35 insertions(+), 7 deletions(-)
diff -r be9fe905334a -r 17f7a426b2cd tools/gpproxy/gdbremote.py
--- a/tools/gpproxy/gdbremote.py Thu Jul 06 06:39:09 2006 -0400
+++ b/tools/gpproxy/gdbremote.py Thu Jul 06 06:44:19 2006 -0400
@@ -30,10 +30,11 @@ HANDLERS = {
"?": "cmd_question",
"c": "cmd_continue",
"C": "cmd_continue_sig",
- "g": "cmd_regs",
+ "g": "cmd_get_regs",
"m": "cmd_memory",
"M": "cmd_memory",
- "p": "cmd_reg",
+ "p": "cmd_get_reg",
+ "P": "cmd_set_reg",
"q": "cmd_query",
"s": "cmd_step",
"z": "cmd_breakpoint",
@@ -256,7 +257,7 @@ class GDBRemoteHandler(SocketServer.Base
replypkt.payload = state
return True
- def cmd_regs(self, pkt, replypkt):
+ def cmd_get_regs(self, pkt, replypkt):
regset = self.arch.get_registers()
data = "".join(regset)
replypkt.payload = data
@@ -294,9 +295,17 @@ class GDBRemoteHandler(SocketServer.Base
return True
- def cmd_reg(self, pkt, replypkt):
+ def cmd_get_reg(self, pkt, replypkt):
self.ack()
replypkt.payload = self.arch.get_register(int(pkt.payload, 16))
+ return True
+
+ def cmd_set_reg(self, pkt, replypkt):
+ self.ack()
+ num_end = pkt.payload.find("=")
+ num = int(pkt.payload[:num_end], 16)
+ val = int(pkt.payload[num_end + 1:], 16)
+ replypkt.payload = self.arch.set_register(num, val)
return True
def cmd_step(self, pkt, replypkt):
diff -r be9fe905334a -r 17f7a426b2cd tools/gpproxy/powerpc.py
--- a/tools/gpproxy/powerpc.py Thu Jul 06 06:39:09 2006 -0400
+++ b/tools/gpproxy/powerpc.py Thu Jul 06 06:44:19 2006 -0400
@@ -26,12 +26,12 @@ class PowerPC:
# GPRs
for j in range(32):
- REGS.append("r%s" % i)
+ REGS.append("r%s" % j)
i += 1
# FPRs
for j in range(32):
- REGS.append("fr%s" % i)
+ REGS.append("fr%s" % j)
i += 1
REGS.append("pc")
@@ -43,8 +43,19 @@ class PowerPC:
REGS.append("fpscr")
def get_register(self, num):
- regname = REGS[num]
+ try:
+ regname = REGS[num]
+ except:
+ return "x" # unfetchable
return self.target.get_register(regname)
+
+ def set_register(self, num, val):
+ try:
+ regname = REGS[num]
+ except:
+ return "x" # unfetchable
+ self.target.set_register(regname, val)
+ return "OK"
def get_registers(self):
"""Returns the array of target registers in proper GDB
arch-specific
diff -r be9fe905334a -r 17f7a426b2cd tools/gpproxy/riscwatch.py
--- a/tools/gpproxy/riscwatch.py Thu Jul 06 06:39:09 2006 -0400
+++ b/tools/gpproxy/riscwatch.py Thu Jul 06 06:44:19 2006 -0400
@@ -150,6 +150,14 @@ class RISCWatchSession:
return "0000000000000000"
return m.group(1)
+ def set_register(self, name, val):
+ reg = translate_regname(name)
+ result = self._command("reg %s=%x" % (reg, val))
+ m = ERRVAL.match(result)
+ if m:
+ raise IOError(m.group(2))
+ return True
+
def set_memory(self, addr, len, val):
assert len < 32
result = self._command("m -d%d %x=%x" % (len, addr, val))
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|