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

[XenPPC] [xenppc-unstable] [ppc] gpproxy cleanups



# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Node ID 4cab8bf721101f377a459a1b8ac7da6c6e241a52
# Parent  e6c7667c97eda1ba63ca749f102f87328e8375a1
[ppc] gpproxy cleanups
- remove unused variable
- correct set/get_register() error-handling
- add todo comment for better error-checking in cmd_set_reg() packet parsing
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 tools/gpproxy/gdbremote.py |    3 +++
 tools/gpproxy/powerpc.py   |   22 +++++++++-------------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff -r e6c7667c97ed -r 4cab8bf72110 tools/gpproxy/gdbremote.py
--- a/tools/gpproxy/gdbremote.py        Thu Jul 06 06:47:16 2006 -0400
+++ b/tools/gpproxy/gdbremote.py        Thu Jul 06 15:35:47 2006 -0500
@@ -302,9 +302,12 @@ class GDBRemoteHandler(SocketServer.Base
 
        def cmd_set_reg(self, pkt, replypkt):
                self.ack()
+
+               # XXX better error-checking here
                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
 
diff -r e6c7667c97ed -r 4cab8bf72110 tools/gpproxy/powerpc.py
--- a/tools/gpproxy/powerpc.py  Thu Jul 06 06:47:16 2006 -0400
+++ b/tools/gpproxy/powerpc.py  Thu Jul 06 15:35:47 2006 -0500
@@ -21,18 +21,14 @@ class PowerPC:
 class PowerPC:
        def __init__(self, target):
                self.target = target
+
                # initialize REGS array
-               i = 0
 
-               # GPRs
-               for j in range(32):
-                       REGS.append("r%s" % j)
-                       i += 1
+               for i in range(32):
+                       REGS.append("r%s" % i)
 
-               # FPRs
-               for j in range(32):
-                       REGS.append("fr%s" % j)
-                       i += 1
+               for i in range(32):
+                       REGS.append("fr%s" % i)
 
                REGS.append("pc")
                REGS.append("msr")
@@ -45,15 +41,15 @@ class PowerPC:
        def get_register(self, num):
                try:
                        regname = REGS[num]
-               except:
-                       return "x" # unfetchable
+               except IndexError:
+                       return "E16" # unfetchable
                return self.target.get_register(regname)
 
        def set_register(self, num, val):
                try:
                        regname = REGS[num]
-               except:
-                       return "x" # unfetchable
+               except IndexError:
+                       return "E16" # unfetchable
                self.target.set_register(regname, val)
                return "OK"
 

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.