From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6424 invoked by alias); 25 Jul 2006 16:09:20 -0000 Received: (qmail 6186 invoked by uid 22791); 25 Jul 2006 16:09:18 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Tue, 25 Jul 2006 16:09:16 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1G5PT8-0003hF-CT; Tue, 25 Jul 2006 12:09:14 -0400 Date: Tue, 25 Jul 2006 16:20:00 -0000 From: Daniel Jacobowitz To: Greg Law Cc: gdb@sourceware.org Subject: Re: bfinish writes to random addresses. Message-ID: <20060725160914.GA14110@nevyn.them.org> Mail-Followup-To: Greg Law , gdb@sourceware.org References: <44C63B23.7060306@undo-software.com> <20060725154115.GA13191@nevyn.them.org> <44C6405A.50502@undo-software.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44C6405A.50502@undo-software.com> User-Agent: Mutt/1.5.11+cvs20060403 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-07/txt/msg00178.txt.bz2 On Tue, Jul 25, 2006 at 05:01:30PM +0100, Greg Law wrote: > I guess one option would be to use a hardware breakpoint when setting > breakpoints based on such "derived" addresses. At least that way it's > non-destructive if gdb gets it wrong. Every address where GDB sets any breakpoint is "derived" in that sense. And there aren't very many hardware breakpoints, if any. > Having gdb check the return address looks like a sensible code address > might also be worthwhile. Of course this will not fix all cases, > especially if the calculated return address happens to point into the > middle of an instruction. But hopefully in reality most things that > look like pointers to code will actually be pointers to code, and so > properly aligned, and the breakpoint will just go to the wrong place, > rather than clobbering random data. ... Properly aligned? You're talking about %ebp so I assume you're talking about x86, and instructions have no alignment on this architecture. Warning when returning from something with a symbol to something without a symbol is an interesting suggestion. Does anyone else have comments? Should this warn? (gdb) bt #0 foo() #1 0x4000000 in ??? (gdb) finish -- Daniel Jacobowitz CodeSourcery