[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Implement Xfer:auxv:read in gdb stub
From: |
Bhushan Attarde |
Subject: |
Re: [Qemu-devel] Implement Xfer:auxv:read in gdb stub |
Date: |
Thu, 25 Jun 2015 06:07:57 +0000 |
Hi Jan,
Thanks for the review.
I will resubmit the patch with suggested changes.
Regards,
Bhushan
-----Original Message-----
From: Jan Kiszka [mailto:address@hidden
Sent: 25 June 2015 10:56
To: Bhushan Attarde; address@hidden
Cc: Yongbok Kim; Jaydeep Patil
Subject: Re: Implement Xfer:auxv:read in gdb stub
On 2015-06-24 08:34, Bhushan Attarde wrote:
> This patch implements support for "Xfer:auxv:read" to provide
> auxiliary vector information to clients which relies on it.
>
> For example: AT_ENTRY in auxiliary vector provides the entry point
> information.
> Client can use this information to compare it with entry point
> mentioned in executable to calculate load offset and then update the
> load addresses accordingly.
>
>
> Signed-off-by: Bhushan Attarde <address@hidden>
> ---
> diff --git a/gdbstub.c b/gdbstub.c
> index cea2a84..e7db84a 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -1153,6 +1153,7 @@ static int gdb_handle_packet(GDBState *s, const char
> *line_buf)
> if (cc->gdb_core_xml_file != NULL) {
> pstrcat(buf, sizeof(buf), ";qXfer:features:read+");
> }
> + pstrcat(buf, sizeof(buf), ";qXfer:auxv:read+");
Is this code block restricted to CONFIG_USER_ONLY? It should be because the
feature implementation is. Sorry, too lazy to check the full context, and the
patch doesn't tell it.
Jan
> put_packet(s, buf);
> break;
> }
> @@ -1199,6 +1200,50 @@ static int gdb_handle_packet(GDBState *s, const char
> *line_buf)
> put_packet_binary(s, buf, len + 1);
> break;
> }
> +#ifdef CONFIG_USER_ONLY
> + if (strncmp(p, "Xfer:auxv:read:", 15) == 0) {
> + TaskState *ts = s->c_cpu->opaque;
> + target_ulong auxv = ts->info->saved_auxv;
> + target_ulong auxv_len = ts->info->auxv_len;
> + char *ptr;
> +
> + p += 15;
> + while (*p && *p != ':') {
> + p++;
> + }
> + p++;
> +
> + addr = strtoul(p, (char **)&p, 16);
> + if (*p == ',') {
> + p++;
> + }
> + len = strtoul(p, (char **)&p, 16);
> +
> + ptr = lock_user(VERIFY_READ, auxv, auxv_len, 0);
> + if (ptr == NULL) {
> + break;
> + }
> +
> + if (addr > len) {
> + snprintf(buf, sizeof(buf), "E00");
> + put_packet(s, buf);
> + break;
> + }
> + if (len > (MAX_PACKET_LENGTH - 5) / 2) {
> + len = (MAX_PACKET_LENGTH - 5) / 2;
> + }
> + if (len < auxv_len - addr) {
> + buf[0] = 'm';
> + len = memtox(buf + 1, ptr + addr, len);
> + } else {
> + buf[0] = 'l';
> + len = memtox(buf + 1, ptr + addr, auxv_len - addr);
> + }
> + put_packet_binary(s, buf, len + 1);
> + unlock_user(ptr, auxv, len);
> + break;
> + }
> +#endif /* !CONFIG_USER_ONLY */
> if (is_query_packet(p, "Attached", ':')) {
> put_packet(s, GDB_ATTACHED);
> break;
>
>
>
>
--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center
Embedded Linux