From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22867 invoked by alias); 23 Jul 2007 21:25:09 -0000 Received: (qmail 22855 invoked by uid 22791); 23 Jul 2007 21:25:08 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate2.de.ibm.com (HELO mtagate2.de.ibm.com) (195.212.29.151) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 23 Jul 2007 21:25:06 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.8/8.13.8) with ESMTP id l6NLP3c1088992 for ; Mon, 23 Jul 2007 21:25:03 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.4) with ESMTP id l6NLP2tP2277500 for ; Mon, 23 Jul 2007 23:25:02 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l6NLOuZF008030 for ; Mon, 23 Jul 2007 23:24:56 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id l6NLOuab008027; Mon, 23 Jul 2007 23:24:56 +0200 Message-Id: <200707232124.l6NLOuab008027@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 23 Jul 2007 23:24:56 +0200 Subject: Re: [rfc] Do not read from the executable if ptrace fails To: drow@false.org (Daniel Jacobowitz) Date: Mon, 23 Jul 2007 22:05:00 -0000 From: "Ulrich Weigand" Cc: brobecker@adacore.com (Joel Brobecker), gdb-patches@sourceware.org, alex00882007@gmail.com (Alex) In-Reply-To: <20070723191542.GA12138@caradoc.them.org> from "Daniel Jacobowitz" at Jul 23, 2007 03:15:42 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00247.txt.bz2 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