From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12143 invoked by alias); 5 Apr 2004 21:57:54 -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 12119 invoked from network); 5 Apr 2004 21:57:47 -0000 Received: from unknown (HELO esds.vss.fsi.com) (66.136.174.212) by sources.redhat.com with SMTP; 5 Apr 2004 21:57:47 -0000 Received: from thing1.vss.fsi.com (thing1.vss.fsi.com [198.51.29.21]) by esds.vss.fsi.com (8.11.6+Sun/8.9.1) with ESMTP id i35LvkB27158; Mon, 5 Apr 2004 16:57:46 -0500 (CDT) Received: from localhost (ford@localhost) by thing1.vss.fsi.com (8.11.6+Sun/8.11.6) with ESMTP id i35LvkG17114; Mon, 5 Apr 2004 16:57:46 -0500 (CDT) X-Authentication-Warning: thing1-200.fsi.com: ford owned process doing -bs Date: Mon, 05 Apr 2004 21:57:00 -0000 From: Brian Ford X-X-Sender: ford@thing1-200 To: Jim Blandy cc: Eli Zaretskii , gdb-patches@sources.redhat.com Subject: Re: [PATCH] i386_stab_reg_to_regnum (4 <-> 5, ebp <-> esp) In-Reply-To: Message-ID: References: <8011-Fri02Apr2004094123+0300-eliz@gnu.org> <2719-Fri02Apr2004213907+0300-eliz@gnu.org> <6654-Sat03Apr2004110513+0300-eliz@gnu.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2004-04/txt/msg00128.txt.bz2 On Mon, 5 Apr 2004, Jim Blandy wrote: > Eli, here is a program you can use to see whether DJGPP's GCC and > the current GDB disagree on how to number %ebp and %esp. Thank you. Thank you. Thank you. Did I say thank you? > One of the reasons people would tend not to notice if %ebp and %esp > are misnumbered in STABS is that they almost never occur. Dwarf 2 > emits explicit location expressions to specify the "frame base" for a > function; these expressions usually refer to %esp or %ebp. In STABS, > however, stack-based variables are simply marked as "LSYMS" or > "PSYMS", whose locations are given as offsets relative to some > implicit base that the debugger just has to know. I expected as much since I never saw a problem in Cygwin before I tried to add DWARF 2 support. I just didn't know how these functions were used well enough to find a simple test case. > So the only way to get those register numbers to appear at all is to > get a variable allocated to them. You'll never get a variable > allocated to %esp. And you'll never get a varable allocated to %ebp > unless you compile with -fomit-frame-pointer. So, if I compile the > attached program with GCC 3.3 passing -O -fomit-frame-pointer, 'n' > gets allocated to %ebp. FWIW, this does show the problem clearly on Cygwin. ford@fordpc ~ $ gcc -g -O -fomit-frame-pointer frameless.c -o frameless_stab.exe ford@fordpc ~ $ gdb frameless_stab.exe GNU gdb 2003-09-20-cvs (cygwin-special) Copyright 2003 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-cygwin"... (gdb) b foo Breakpoint 1 at 0x401050: file frameless.c, line 6. (gdb) r 2 Starting program: /home/ford/frameless_stab.exe 2 Breakpoint 1, foo (n=0) at frameless.c:6 6 { (gdb) n 8 register int a = n * 1; (gdb) info address n Symbol "n" is a variable in register esp. (gdb) p n $1 = 2289692 (gdb) p $esp $2 = (void *) 0x22f01c (gdb) p $ebp $3 = (void *) 0x2 (gdb) -- Brian Ford Senior Realtime Software Engineer VITAL - Visual Simulation Systems FlightSafety International Phone: 314-551-8460 Fax: 314-551-8444