This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH v9 21/29] record-btrace: provide xfer_partial target method
- From: "Metzger, Markus T" <markus dot t dot metzger at intel dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: "jan dot kratochvil at redhat dot com" <jan dot kratochvil at redhat dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Mon, 13 Jan 2014 12:36:10 +0000
- Subject: RE: [PATCH v9 21/29] record-btrace: provide xfer_partial target method
- Authentication-results: sourceware.org; auth=none
- References: <1387471499-29444-1-git-send-email-markus dot t dot metzger at intel dot com> <1387471499-29444-22-git-send-email-markus dot t dot metzger at intel dot com> <52B34555 dot 8040200 at redhat dot com> <A78C989F6D9628469189715575E55B230AA3B9AE at IRSMSX104 dot ger dot corp dot intel dot com> <A78C989F6D9628469189715575E55B230AA3B9DE at IRSMSX104 dot ger dot corp dot intel dot com> <52B4688E dot 2090603 at redhat dot com>
> -----Original Message-----
> From: Pedro Alves [mailto:palves@redhat.com]
> Sent: Friday, December 20, 2013 4:56 PM
> Can you show the patchlet you did, and the before/after gdb
> output though? I'd be better to see that, and have any possible
> follow up discussion discussion here now, rather than fractured
> to a potential repost of the series.
Here's the current version of the function:
static LONGEST
record_btrace_xfer_partial (struct target_ops *ops, enum target_object object,
const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf, ULONGEST offset,
LONGEST len)
{
struct target_ops *t;
/* Filter out requests that don't make sense during replay. */
if (!record_btrace_allow_memory_access && record_btrace_is_replaying ())
{
switch (object)
{
case TARGET_OBJECT_MEMORY:
{
struct target_section *section;
/* We do not allow writing memory in general. */
if (writebuf != NULL)
return TARGET_XFER_E_UNAVAILABLE;
/* We allow reading readonly memory. */
section = target_section_by_addr (ops, offset);
if (section != NULL)
{
/* Check if the section we found is readonly. */
if ((bfd_get_section_flags (section->the_bfd_section->owner,
section->the_bfd_section)
& SEC_READONLY) != 0)
{
/* Truncate the request to fit into this section. */
len = min (len, section->endaddr - offset);
break;
}
}
return TARGET_XFER_E_UNAVAILABLE;
}
}
}
/* Forward the request. */
for (ops = ops->beneath; ops != NULL; ops = ops->beneath)
if (ops->to_xfer_partial != NULL)
return ops->to_xfer_partial (ops, object, annex, readbuf, writebuf,
offset, len);
return TARGET_XFER_E_UNAVAILABLE;
}
And here's the new GDB output:
(gdb) print glob
Memory at address 0x601030 unavailable.
This used to be:
(gdb) print glob
This record target does not record memory.
Regards,
Markus.
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052