All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Bhushan Attarde <Bhushan.Attarde@imgtec.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Yongbok Kim <Yongbok.Kim@imgtec.com>,
	Jaydeep Patil <Jaydeep.Patil@imgtec.com>
Subject: Re: [Qemu-devel] Implement Xfer:auxv:read in gdb stub
Date: Thu, 25 Jun 2015 07:26:11 +0200	[thread overview]
Message-ID: <558B90F3.8050807@siemens.com> (raw)
In-Reply-To: <9D3E5517712EFA419C6B9C50EDC1282C6E69A38C@PUMAIL01.pu.imgtec.org>

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

  reply	other threads:[~2015-06-25  5:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24  6:34 [Qemu-devel] Implement Xfer:auxv:read in gdb stub Bhushan Attarde
2015-06-25  5:26 ` Jan Kiszka [this message]
2015-06-25  6:07   ` Bhushan Attarde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=558B90F3.8050807@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=Bhushan.Attarde@imgtec.com \
    --cc=Jaydeep.Patil@imgtec.com \
    --cc=Yongbok.Kim@imgtec.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.