#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
unsigned long cont_thread;
unsigned long general_thread;
/* TERMINAL_FD's original foreground group. */
pid_t old_foreground_pgrp;
-/* Set if you want to disable optional thread related packets support
- in gdbserver, for the sake of testing GDB against stubs that don't
- support them. */
-int disable_packet_vCont;
-int disable_packet_Tthread;
-int disable_packet_qC;
-int disable_packet_qfThreadInfo;
-
/* Hand back terminal ownership to the original foreground group. */
static void
}
#endif
+/* Set if you want to disable optional thread related packets support
+ in gdbserver, for the sake of testing GDB against stubs that don't
+ support them. */
+int disable_packet_vCont;
+int disable_packet_Tthread;
+int disable_packet_qC;
+int disable_packet_qfThreadInfo;
+
static int
target_running (void)
{
return;
}
+ if (strcmp (own_buf, "QStartNoAckMode") == 0)
+ {
+ if (remote_debug)
+ {
+ fprintf (stderr, "[noack mode enabled]\n");
+ fflush (stderr);
+ }
+
+ noack_mode = 1;
+ write_ok (own_buf);
+ return;
+ }
+
/* Otherwise we didn't know what packet it was. Say we didn't
understand it. */
own_buf[0] = 0;
return;
}
+ if (the_target->qxfer_osdata != NULL
+ && strncmp ("qXfer:osdata:read:", own_buf, 18) == 0)
+ {
+ char *annex;
+ int n;
+ unsigned int len;
+ CORE_ADDR ofs;
+ unsigned char *workbuf;
+
+ strcpy (own_buf, "E00");
+ if (decode_xfer_read (own_buf + 18, &annex, &ofs, &len) < 0)
+ return;
+ if (len > PBUFSIZ - 2)
+ len = PBUFSIZ - 2;
+ workbuf = malloc (len + 1);
+ if (!workbuf)
+ return;
+
+ n = (*the_target->qxfer_osdata) (annex, workbuf, NULL, ofs, len + 1);
+ if (n < 0)
+ write_enn (own_buf);
+ else if (n > len)
+ *new_packet_len_p = write_qxfer_response
+ (own_buf, workbuf, len, 1);
+ else
+ *new_packet_len_p = write_qxfer_response
+ (own_buf, workbuf, n, 0);
+
+ free (workbuf);
+ return;
+ }
+
/* Protocol features query. */
if (strncmp ("qSupported", own_buf, 10) == 0
&& (own_buf[10] == ':' || own_buf[10] == '\0'))
qXfer:feature:read at all, we will never be re-queried. */
strcat (own_buf, ";qXfer:features:read+");
+ if (transport_is_reliable)
+ strcat (own_buf, ";QStartNoAckMode+");
+
+ if (the_target->qxfer_osdata != NULL)
+ strcat (own_buf, ";qXfer:osdata:read+");
+
return;
}
pid = strtol (own_buf + 8, NULL, 16);
if (pid != 0 && attach_inferior (pid, status, signal) == 0)
{
+ /* Don't report shared library events after attaching, even if
+ some libraries are preloaded. GDB will always poll the
+ library list. Avoids the "stopped by shared library event"
+ notice on the GDB side. */
+ dlls_changed = 0;
prepare_resume_reply (own_buf, *status, *signal);
return 1;
}
new_argc++;
}
- new_argv = malloc ((new_argc + 2) * sizeof (char *));
+ new_argv = calloc (new_argc + 2, sizeof (char *));
i = 0;
for (p = own_buf + strlen ("vRun;"); *p; p = next_p)
{
if (new_argv[0] == NULL)
{
+ /* GDB didn't specify a program to run. Use the program from the
+ last run with the new argument list. */
+
if (program_argv == NULL)
{
write_enn (own_buf);
while (1)
{
+ noack_mode = 0;
remote_open (port);
restart: