From 07e059b5a9cbdeab8bf2980e07e79f892a2da854 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Tue, 2 Dec 2008 07:57:38 +0000 Subject: Implement -list-thread-groups --available * Makefile.in (XMLFILES): Add osdata.dtd. (SFILES): Add osdata.c. (COMMON_OBS): Add osdata.o. * linux-nat.c: Include pwd.h, sys/types.h, gdb_dirent.h and xml-support.h. (linux_nat_xfer_osdata): New function. (linux_xfer_partial): Handle TARGET_OBJECT_OSDATA. * osdata.c: New file. * osdata.h: New file. * remote.c (PACKET_qXfer_osdata): New packet enum. (remote_protocol_features): Add "qXfer:osdata:read". (remote_read_qxfer): Handle TARGET_OBJECT_OSDATA. (extended_remote_can_run): New. (init_extended_remote_ops): Set to_can_run to extended_remote_can_run. (_initialize_remote): Add packet config command for "qXfer:osdata:read". * xml-support.c (obstack_xml_printf): New function. * xml-support.h (obstack_xml_printf): Declare. * target.c (target_get_osdata): New function. * target.h (enum target_object): Add TARGET_OBJECT_OSDATA. (target_os_data): Declare. * features/osdata.dtd: New file. * mi/mi-main.c (mi_list_thread_groups): Handle the --available option. --- gdb/gdbserver/server.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'gdb/gdbserver/server.c') diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index f8059e4..33db8a7 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -768,6 +768,38 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) 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')) @@ -792,6 +824,10 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) if (transport_is_reliable) strcat (own_buf, ";QStartNoAckMode+"); + + if (the_target->qxfer_osdata != NULL) + strcat (own_buf, ";qXfer:osdata:read+"); + return; } -- cgit v1.1