Skip to content

Commit 369addf

Browse files
committed
Return pc register when requesting registers
1 parent 8bb65aa commit 369addf

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/main/java/be/ugent/topl/mio/GdbStub.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import be.ugent.topl.mio.debugger.Debugger;
44
import be.ugent.topl.mio.sourcemap.SourceMap;
5-
import be.ugent.topl.mio.woodstate.Checkpoint;
65
import be.ugent.topl.mio.woodstate.Frame;
76
import be.ugent.topl.mio.woodstate.WOODDumpResponse;
87

@@ -35,9 +34,6 @@ public GdbStub(Debugger debugger, String binaryLocation) {
3534
});
3635
}
3736

38-
// Dummy register file (16 x 32-bit)
39-
static int[] regs = new int[16];
40-
4137
private static final char[] HEX = "0123456789abcdef".toCharArray();
4238
private String toHex(byte[] data, int offset, int length) {
4339
StringBuilder sb = new StringBuilder(length * 2);
@@ -98,10 +94,6 @@ public void start() throws IOException {
9894

9995
byte[] wasmData = Files.readAllBytes(Path.of(binaryLocation));
10096

101-
for (int i = 0; i < regs.length; i++) {
102-
regs[i] = 0x11111111 * (i + 1);
103-
}
104-
10597
ServerSocket server = new ServerSocket(1234);
10698
System.out.println("Waiting for GDB on port 1234...");
10799
Socket sock = server.accept();
@@ -395,9 +387,7 @@ private int checksum(byte[] data) {
395387

396388
private String encodeRegs() {
397389
StringBuilder sb = new StringBuilder();
398-
for (int r : regs) {
399-
sb.append(String.format("%08x", r));
400-
}
390+
sb.append(String.format("%08x", getCurrentState().getPc()));
401391
return sb.toString();
402392
}
403393
}

0 commit comments

Comments
 (0)