This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc] Do not read from the executable if ptrace fails
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: drow at false dot org (Daniel Jacobowitz)
- Cc: brobecker at adacore dot com (Joel Brobecker), gdb-patches at sourceware dot org, alex00882007 at gmail dot com (Alex)
- Date: Mon, 23 Jul 2007 23:24:56 +0200 (CEST)
- Subject: Re: [rfc] Do not read from the executable if ptrace fails
Daniel Jacobowitz wrote:
> > This used to work (probably accidentally?), but is broken by
> > this patch. Any suggestions how to fix it? Should the overlay
> > logic from xfer_memory be moved to memory_xfer_partial, maybe?
>
> That sounds reasonable. What about if we check for an unmapped
> overlay address at the same point we handle trust_readonly?
Like so? Tested on spu-elf, fixes the overlay test case.
Bye,
Ulrich
ChangeLog:
* target.c (memory_xfer_partial): Accesses to unmapped overlay
sections should always go to the executable file.
Index: gdb/target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.144
diff -c -p -r1.144 target.c
*** gdb/target.c 1 Jul 2007 22:35:55 -0000 1.144
--- gdb/target.c 23 Jul 2007 20:39:33 -0000
*************** memory_xfer_partial (struct target_ops *
*** 1017,1022 ****
--- 1017,1030 ----
return xfer_memory (memaddr, readbuf, len, 0, NULL, ops);
}
+ /* Likewise for accesses to unmapped overlay sections. */
+ if (readbuf != NULL && overlay_debugging)
+ {
+ asection *section = find_pc_overlay (memaddr);
+ if (pc_in_unmapped_range (memaddr, section))
+ return xfer_memory (memaddr, readbuf, len, 0, NULL, ops);
+ }
+
/* Try GDB's internal data cache. */
region = lookup_mem_region (memaddr);
/* region->hi == 0 means there's no upper bound. */
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com