This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


> *************** 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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]