Bug 473687

Summary: Implement qDefaultExecAndArgs and qMachineId for vgdb
Product: [Developer tools] valgrind Reporter: Mark Wielaard <mark>
Component: generalAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal CC: ahajkova
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Mark Wielaard 2023-08-23 14:29:34 UTC
qDefaultExecAndArgs and qMachineId are proposed new gdb remote packets described in this gdb patch series:
https://inbox.sourceware.org/gdb-patches/cover.1692200989.git.aburgess@redhat.com/

The implementation of qDefaultExecAndArgs is trivial (since we don't have any, we just return "U"):

diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c
index c024ffca6..59c9bb4b4 100644
--- a/coregrind/vgdb.c
+++ b/coregrind/vgdb.c
@@ -1354,6 +1354,7 @@ void do_multi_mode(int check_trials, int in_port)
 #define QENVIRONMENTUNSET "QEnvironmentUnset"
 #define QSETWORKINGDIR "QSetWorkingDir"
 #define QTSTATUS "qTStatus"
+#define QDEFAULTEXECANDARGS "qDefaultExecAndArgs"
        
        if (strncmp(QSUPPORTED, buf, strlen(QSUPPORTED)) == 0) {
           DEBUG(1, "CASE %s\n", QSUPPORTED);
@@ -1600,6 +1601,10 @@ void do_multi_mode(int check_trials, int in_port)
           DEBUG(1, "Got qfThreadInfo\n");
           /* There are no threads yet, reply 'l' end of list. */
           send_packet ("l", noackmode);
+       } else if (strcmp(QDEFAULTEXECANDARGS, buf) == 0) {
+          DEBUG(1, "Got qDefaultExecAndArgs\n");
+          /* We don't have any.  */
+          send_packet ("U", noackmode);
        } else if (buf[0] != '\0') {
           // We didn't understand.
           DEBUG(1, "Unknown packet received: '%s'\n", buf);

This immediately makes run/start work without having to set remote exec-file.

qMachineId is a bit more complicated, but would automatically set sysroot to /