From aa691b87c2317cc90bbe4964d79e5a29c29f348e Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 25 Feb 2004 20:41:29 +0000 Subject: 2004-02-25 Roland McGrath * target.h (struct target_ops): New member `read_auxv'. * server.c (handle_query): Handle qPart:auxv:read: query using that. * linux-low.c (linux_read_auxv): New function. (linux_target_ops): Initialize `read_auxv' member to that. --- gdb/gdbserver/server.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'gdb/gdbserver/server.c') diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index dffff2e..b45b3f3 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -104,7 +104,7 @@ handle_query (char *own_buf) thread_ptr = thread_ptr->next; return; } - + if (strcmp ("qsThreadInfo", own_buf) == 0) { if (thread_ptr != NULL) @@ -119,7 +119,27 @@ handle_query (char *own_buf) return; } } - + + if (the_target->read_auxv != NULL + && strncmp ("qPart:auxv:read::", own_buf, 17) == 0) + { + char data[(PBUFSIZ - 1) / 2]; + CORE_ADDR ofs; + unsigned int len; + int n; + decode_m_packet (&own_buf[17], &ofs, &len); /* "OFS,LEN" */ + if (len > sizeof data) + len = sizeof data; + n = (*the_target->read_auxv) (ofs, data, len); + if (n == 0) + write_ok (own_buf); + else if (n < 0) + write_enn (own_buf); + else + convert_int_to_ascii (data, own_buf, n); + return; + } + /* Otherwise we didn't know what packet it was. Say we didn't understand it. */ own_buf[0] = 0; @@ -371,7 +391,7 @@ main (int argc, char *argv[]) detach_inferior (); write_ok (own_buf); putpkt (own_buf); - remote_close (); + remote_close (); /* If we are attached, then we can exit. Otherwise, we need to hang around doing nothing, until the child is gone. */ -- cgit v1.1