From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10997 invoked by alias); 2 Oct 2003 16:56:09 -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 10976 invoked from network); 2 Oct 2003 16:56:08 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 2 Oct 2003 16:56:08 -0000 Received: from drow by nevyn.them.org with local (Exim 4.22 #1 (Debian)) id 1A56kJ-0002zI-F6; Thu, 02 Oct 2003 12:56:07 -0400 Date: Thu, 02 Oct 2003 16:56:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Cc: dberlin@dberlin.org Subject: RFA: DW_AT_frame_base fix for complicated frames Message-ID: <20031002165606.GA22819@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com, dberlin@dberlin.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.1i X-SW-Source: 2003-10/txt/msg00031.txt.bz2 Does anyone remember a specific reason why this code was there? I don't, and I rewrote all of this stuff... I am 99.99% sure it's based on the unwind handling for saved registers, where we get either a register number or the address of a stack slot. But for frame bases that's not true: A subroutine or entry point entry may also have a DW_AT_frame_base attribute, whose value is a location description that computes the "frame base" for the subroutine or entry point. i.e. it computes the frame base. Not the address of the frame base. This memory read tends to find (on x86) the return address, and then we think the stack is at . Oopsie. OK? With this patch and some code Daniel Berlin and Joseph are working on, location lists actually work. I can see all the arguments in an -fomit-frame-pointer function from the beginning. It's really quite cool. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer 2003-10-02 Daniel Jacobowitz * dwarf2expr.c (execute_stack_op): Don't treat the frame base as a memory pointer. Index: dwarf2expr.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2expr.c,v retrieving revision 1.9 diff -u -p -r1.9 dwarf2expr.c --- dwarf2expr.c 22 Jul 2003 15:41:59 -0000 1.9 +++ dwarf2expr.c 2 Oct 2003 16:43:21 -0000 @@ -441,18 +441,6 @@ execute_stack_op (struct dwarf_expr_cont result = dwarf_expr_fetch (ctx, 0); if (ctx->in_reg) result = (ctx->read_reg) (ctx->baton, result); - else - { - char *buf = alloca (TARGET_ADDR_BIT / TARGET_CHAR_BIT); - int bytes_read; - - (ctx->read_mem) (ctx->baton, buf, result, - TARGET_ADDR_BIT / TARGET_CHAR_BIT); - result = dwarf2_read_address (buf, - buf + (TARGET_ADDR_BIT - / TARGET_CHAR_BIT), - &bytes_read); - } result = result + offset; ctx->stack_len = before_stack_len; ctx->in_reg = 0;