GP-4415: Lots of lldb trace-rmi fixes

Breakpoint Enabled atribute.
Test fixes on macOS and Linux.
Re-work value conversion a bit.
shlexify commands.
Add method display names.
This commit is contained in:
Dan
2024-03-22 08:56:59 -04:00
parent 523f6e4cbe
commit eb5bf458a4
22 changed files with 1828 additions and 1222 deletions

View File

@@ -19,8 +19,7 @@ import java.util.Objects;
import ghidra.app.plugin.core.debug.service.tracermi.TraceRmiPlugin;
import ghidra.app.script.GhidraScript;
import ghidra.app.services.TraceRmiService;
import ghidra.debug.api.tracermi.TraceRmiAcceptor;
import ghidra.debug.api.tracermi.TraceRmiConnection;
import ghidra.debug.api.tracermi.*;
public class ListenTraceRmiScript extends GhidraScript {
@@ -42,8 +41,18 @@ public class ListenTraceRmiScript extends GhidraScript {
TraceRmiConnection connection = acceptor.accept();
println("Connection from " + connection.getRemoteAddress());
while (askYesNo("Execute?", "Execute 'echo test'?")) {
connection.getMethods().get("execute").invoke(Map.of("cmd", "echo test"));
RemoteMethod execute = connection.getMethods().get("execute");
if (execute == null) {
printerr("No execute method!");
}
while (true) {
String cmd = askString("Execute", "command?");
try {
execute.invoke(Map.of("cmd", cmd));
}
catch (TraceRmiError e) {
printerr(e.getMessage());
}
}
}
}

View File

@@ -92,7 +92,11 @@ class Receiver(Thread):
dbg_seq = 0
while not self._is_shutdown:
#print("Receiving message")
reply = recv_delimited(self.client.s, bufs.RootMessage(), dbg_seq)
try:
reply = recv_delimited(self.client.s, bufs.RootMessage(), dbg_seq)
except BaseException as e:
self._is_shutdown = True
return
#print(f"Got one: {reply.WhichOneof('msg')}")
dbg_seq += 1
try:
@@ -333,6 +337,14 @@ class Trace(object):
return self.client._delete_bytes(self.id, snap, range)
def put_registers(self, space, values, snap=None):
"""
TODO
values is a dictionary, where each key is a a register name, and the
value is a byte array. No matter the target architecture, the value is
given in big-endian byte order.
"""
if snap is None:
snap = self.snap()
return self.client._put_registers(self.id, snap, space, values)