[RFA] New option "trust-readonly-sections"

Andrew Cagney ac131313@cygnus.com
Thu Jan 24 10:52:00 GMT 2002


> *************** 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, &current_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





More information about the Gdb-patches mailing list