From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 20:37:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E518106566C; Sun, 7 Nov 2010 20:37:26 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1242F8FC13; Sun, 7 Nov 2010 20:37:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7KbPxL078599; Sun, 7 Nov 2010 20:37:25 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7KbPmg078597; Sun, 7 Nov 2010 20:37:25 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201011072037.oA7KbPmg078597@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 7 Nov 2010 20:37:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214947 - head/contrib/gdb/gdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 20:37:26 -0000 Author: gonzo Date: Sun Nov 7 20:37:25 2010 New Revision: 214947 URL: http://svn.freebsd.org/changeset/base/214947 Log: Calculate offset from frame top for registers saved on a stack frame. Modified: head/contrib/gdb/gdb/mips-tdep.c Modified: head/contrib/gdb/gdb/mips-tdep.c ============================================================================== --- head/contrib/gdb/gdb/mips-tdep.c Sun Nov 7 20:33:39 2010 (r214946) +++ head/contrib/gdb/gdb/mips-tdep.c Sun Nov 7 20:37:25 2010 (r214947) @@ -1495,6 +1495,7 @@ mips_mdebug_frame_cache (struct frame_in int kernel_trap; /* What registers have been saved? Bitmasks. */ unsigned long gen_mask, float_mask; + long reg_offset; if ((*this_cache) != NULL) return (*this_cache); @@ -1513,6 +1514,8 @@ mips_mdebug_frame_cache (struct frame_in /* Extract the frame's base. */ cache->base = (frame_unwind_register_signed (next_frame, NUM_REGS + PROC_FRAME_REG (proc_desc)) + PROC_FRAME_OFFSET (proc_desc) - PROC_FRAME_ADJUST (proc_desc)); + /* Save registers offset from scratching by following find_proc_desc call */ + reg_offset = PROC_REG_OFFSET (proc_desc); kernel_trap = PROC_REG_MASK (proc_desc) & 1; gen_mask = kernel_trap ? 0xFFFFFFFF : PROC_REG_MASK (proc_desc); @@ -1567,8 +1570,7 @@ mips_mdebug_frame_cache (struct frame_in /* Fill in the offsets for the registers which gen_mask says were saved. */ { - CORE_ADDR reg_position = (cache->base - + PROC_REG_OFFSET (proc_desc)); + CORE_ADDR reg_position = (cache->base + reg_offset); int ireg; for (ireg = MIPS_NUMREGS - 1; gen_mask; --ireg, gen_mask <<= 1) if (gen_mask & 0x80000000) @@ -2162,15 +2164,18 @@ restart: { PROC_REG_MASK (&temp_proc_desc) |= 1 << reg; set_reg_offset (temp_saved_regs, reg, sp + low_word); + /* Do we have registers offset yet? */ + if (!PROC_REG_OFFSET (&temp_proc_desc)) + PROC_REG_OFFSET (&temp_proc_desc) = low_word - PROC_FRAME_OFFSET (&temp_proc_desc); } else if ((high_word & 0xFFE0) == 0xffa0) /* sd reg,offset($sp) */ { - /* Irix 6.2 N32 ABI uses sd instructions for saving $gp and $ra, - but the register size used is only 32 bits. Make the address - for the saved register point to the lower 32 bits. */ PROC_REG_MASK (&temp_proc_desc) |= 1 << reg; set_reg_offset (temp_saved_regs, reg, - sp + low_word + 8 - mips_regsize (current_gdbarch)); + sp + low_word); + /* Do we have registers offset yet? */ + if (!PROC_REG_OFFSET (&temp_proc_desc)) + PROC_REG_OFFSET (&temp_proc_desc) = low_word - PROC_FRAME_OFFSET (&temp_proc_desc); } else if (high_word == 0x27be) /* addiu $30,$sp,size */ {