This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] New option "trust-readonly-sections"
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: Michael Snyder <msnyder at cygnus dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Thu, 24 Jan 2002 13:52:22 -0500
- Subject: Re: [RFA] New option "trust-readonly-sections"
- References: <200201240323.g0O3NI905339@reddwarf.cygnus.com>
> *************** do_xfer_memory (CORE_ADDR memaddr, char
> *** 857,862 ****
> --- 859,883 ----
> 0. */
> errno = 0;
>
> + if (!write && trust_readonly)
> + {
> + /* User-settable option, "trust-readonly". If true, then
> + memory from any SEC_READONLY bfd section may be read
> + directly from the bfd file. */
> +
> + struct section_table *secp;
> +
> + for (secp = current_target.to_sections;
> + secp < current_target.to_sections_end;
> + secp++)
> + {
> + /* FIXME: take it only if it's entirely within the section. */
> + if (memaddr >= secp->addr && memaddr + len <= secp->endaddr)
> + return xfer_memory (memaddr, myaddr, len, 0,
> + attrib, ¤t_target);
My understanding of do_xfer_memory() is that it is allowed to do partial
transfers. Hence, here, if the data doesn't all lie in the section, it
is safe to truncate the transfer and return the number of bytes transfered.
Andrew