From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30598 invoked by alias); 5 Feb 2002 19:58:10 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 30519 invoked from network); 5 Feb 2002 19:58:08 -0000 Received: from unknown (HELO zwingli.cygnus.com) (208.245.165.35) by sources.redhat.com with SMTP; 5 Feb 2002 19:58:08 -0000 Received: by zwingli.cygnus.com (Postfix, from userid 442) id BE4495E9DE; Tue, 5 Feb 2002 14:59:39 -0500 (EST) To: Daniel Jacobowitz Cc: gdb-patches@sources.redhat.com Subject: Re: RFA: Recognize bottom of stack on Linux References: <200202040206.VAA21952@zenia.red-bean.com> <20020203222111.A17644@nevyn.them.org> From: Jim Blandy Date: Tue, 05 Feb 2002 11:58:00 -0000 In-Reply-To: <20020203222111.A17644@nevyn.them.org> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-02/txt/msg00129.txt.bz2 Daniel Jacobowitz writes: > On Sun, Feb 03, 2002 at 09:06:36PM -0500, Jim Blandy wrote: > > > > Now, some folks feel that GDB should show the whole stack, including > > _start, __libc_start_main, and anything else that's there. However, > > this isn't the way GDB has ever traditionally behaved on native > > targets. So this patch makes GDB's backtraces end after main. > > > > 2002-02-03 Jim Blandy > > > > * i386-linux-tdep.c (i386_linux_frame_chain): Stop the frame chain > > after `main', not just after the compilation unit containing the > > entry point. > > Shouldn't we use func_frame_chain_valid instead of > file_frame_chain_valid instead of duplicating this? > > I don't understand why that function doesn't have more callers. It > seems that at least all non-embedded targets, or at the very least all > Linux targets, should use it. The following works fine for me, too: 2002-02-05 Jim Blandy * i386-linux-tdep.c (i386_linux_frame_chain): Use func_frame_chain_valid, instead of plain inside_entry_file. Index: gdb/i386-linux-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/i386-linux-tdep.c,v retrieving revision 1.10 diff -c -r1.10 i386-linux-tdep.c *** gdb/i386-linux-tdep.c 2001/12/10 22:04:10 1.10 --- gdb/i386-linux-tdep.c 2002/02/05 19:55:03 *************** *** 342,348 **** if (frame->signal_handler_caller || FRAMELESS_SIGNAL (frame)) return frame->frame; ! if (! inside_entry_file (frame->pc)) return read_memory_unsigned_integer (frame->frame, 4); return 0; --- 342,356 ---- if (frame->signal_handler_caller || FRAMELESS_SIGNAL (frame)) return frame->frame; ! /* On Linux, the entry point is called _start, but that invokes ! something called __libc_start_main, which calls main. So if we ! want the stack to end at main (as it does for GDB's other ! targets), the `PC in entry point function' rule triggers too late ! to get us the right result; we've already included ! __libc_start_main in the backtrace, which we don't want. ! func_frame_chain_valid checks both for `main', and for the entry ! point function. */ ! if (func_frame_chain_valid (1, frame)) return read_memory_unsigned_integer (frame->frame, 4); return 0;