From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7zg6-0006Zt-Lx for qemu-devel@nongnu.org; Thu, 25 Jun 2015 01:26:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7zg1-0005M6-6r for qemu-devel@nongnu.org; Thu, 25 Jun 2015 01:26:22 -0400 Received: from thoth.sbs.de ([192.35.17.2]:53437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7zg0-0005L6-TZ for qemu-devel@nongnu.org; Thu, 25 Jun 2015 01:26:17 -0400 Message-ID: <558B90F3.8050807@siemens.com> Date: Thu, 25 Jun 2015 07:26:11 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <9D3E5517712EFA419C6B9C50EDC1282C6E69A38C@PUMAIL01.pu.imgtec.org> In-Reply-To: <9D3E5517712EFA419C6B9C50EDC1282C6E69A38C@PUMAIL01.pu.imgtec.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Implement Xfer:auxv:read in gdb stub List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bhushan Attarde , "qemu-devel@nongnu.org" Cc: Yongbok Kim , Jaydeep Patil 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 > --- > 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