bit more memdump debugging on qemu sim
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 1 Jun 2021 13:12:49 +0000 (14:12 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 1 Jun 2021 13:12:49 +0000 (14:12 +0100)
src/openpower/decoder/isa/caller.py
src/openpower/decoder/isa/pypowersim.py
src/openpower/simulator/qemu.py
src/test/basic_pypowersim/Makefile

index 427ad4ff457b55c1fdb2865fe7f9e876c65b60bf..86446f03c266602337432da672198779994cfe2d 100644 (file)
@@ -1233,7 +1233,7 @@ class ISACaller:
             self.last_st_addr = self.mem.last_st_addr
         if int_op in [MicrOp.OP_LOAD.value,
                      ]:
-            self.last_st_addr = self.mem.last_st_addr
+            self.last_ld_addr = self.mem.last_ld_addr
         log ("op", int_op, MicrOp.OP_STORE.value, MicrOp.OP_LOAD.value,
                    self.last_st_addr, self.last_ld_addr)
 
index 690f3eca567b3d41ea6b5d3d011c7399cec82ef5..0f2ed5fcc4169d02ca4177a227b3cf8eabec1826 100644 (file)
@@ -229,8 +229,9 @@ def run_tst(args, generator, qemu,
                 addr = simulator.last_st_addr & ~0x7 # align
                 sim_data = simulator.mem.ld(addr, 8, swap=False)
                 qdata = qemu.get_mem(addr, 8)[0]
-                log ("last st", simulator.last_st_addr, sim_data, qdata)
-                if sim_data !=qdata :
+                log ("last st", hex(simulator.last_st_addr),
+                                hex(sim_data), hex(qdata))
+                if sim_data != qdata:
                     log("expect mem %x, %x got %x" % (addr, qdata, sim_data))
             if _pc is None:
                 break
@@ -360,10 +361,13 @@ def run_simulation():
             write_data(simulator.mem, fname, offs, length)
             if qemu:
                 qmem = qemu.get_mem(offs, length)
+                log("qemu mem", hex(offs), length)
                 for i, mem in enumerate(qmem):
                     log(hex(offs+i*8), hex(mem))
-                for reg, val in qemu._get_registers().items():
-                    log ("qemu reg", reg, hex(val))
+        if qemu:
+            log("final complete qemu reg dump")
+            for reg, val in qemu._get_registers().items():
+                log ("qemu reg", reg, hex(val))
 
         # cleanup
         if qemu:
index 4fbaecb1d5ef27269944ef8b85af115821b5b6d7..9e1b6f6a732f550713d0361deb7243a28989360a 100644 (file)
@@ -94,7 +94,7 @@ class QemuController:
     def get_mem(self, addr, nbytes):
         res = self.gdb.write("-data-read-memory %d u 1 1 %d" %
                              (addr, nbytes))
-        #print ("get_mem", res)
+        print ("get_mem", res)
         for x in res:
             if(x["type"] == "result"):
                 l = list(map(int, x['payload']['memory'][0]['data']))
index bcce302cd7fc67df80700dd4061be68bedbf5c73..1ec2e996bc0e05545275dc5befc7288cf2f9d788 100644 (file)
@@ -8,7 +8,10 @@ all: sim
 sim: kernel.bin
        echo -n -e \\0060\\0000\\0061\\0000 > test.bin
        echo -n -e \\0060\\0000\\0061\\0000 >> test.bin
-       pypowersim -q --load test.bin:0 -g gpr.list -i kernel.bin
+       pypowersim -q --load test.bin:0 \
+                  --dump testout.bin:0:8 \
+                  --dump testout2.bin:0x20000100:8 \
+                -g gpr.list -i kernel.bin
 
 clean:
        rm *.o *.elf *.bin