From a79c713915ac06f43f14bab42911be2cb4ec182f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 4 Apr 2009 11:49:23 +0000 Subject: * unwind-dw2.h (_Unwind_FrameState): Add REG_UNDEFINED enum value. * unwind-dw2.c (execute_cfa_program): Set how to REG_UNDEFINED instead of REG_UNSAVED for DW_CFA_undefined. (uw_update_context_1): Handle REG_UNDEFINED the same as REG_UNSAVED. (uw_update_context): If RA column is REG_UNDEFINED, mark it as outermost frame. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_4-branch@145536 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/unwind-dw2.c | 29 +++++++++++++++++++++++------ gcc/unwind-dw2.h | 5 +++-- 3 files changed, 35 insertions(+), 8 deletions(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a2f8a28aebc..8a7d21cd96d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2009-04-04 Jakub Jelinek + + * unwind-dw2.h (_Unwind_FrameState): Add REG_UNDEFINED enum value. + * unwind-dw2.c (execute_cfa_program): Set how to REG_UNDEFINED + instead of REG_UNSAVED for DW_CFA_undefined. + (uw_update_context_1): Handle REG_UNDEFINED the same as REG_UNSAVED. + (uw_update_context): If RA column is REG_UNDEFINED, mark it as + outermost frame. + 2009-04-02 Ira Rosen PR tree-optimization/39595 diff --git a/gcc/unwind-dw2.c b/gcc/unwind-dw2.c index 3845467e44c..6df1ffa55a6 100644 --- a/gcc/unwind-dw2.c +++ b/gcc/unwind-dw2.c @@ -1,6 +1,6 @@ /* DWARF2 exception handling and frame unwind runtime interface routines. Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2008 Free Software Foundation, Inc. + 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -943,12 +943,16 @@ execute_cfa_program (const unsigned char *insn_ptr, fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN(reg)].how = REG_UNSAVED; break; - case DW_CFA_undefined: case DW_CFA_same_value: insn_ptr = read_uleb128 (insn_ptr, ®); fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN(reg)].how = REG_UNSAVED; break; + case DW_CFA_undefined: + insn_ptr = read_uleb128 (insn_ptr, ®); + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN(reg)].how = REG_UNDEFINED; + break; + case DW_CFA_nop: break; @@ -1319,6 +1323,7 @@ uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs) switch (fs->regs.reg[i].how) { case REG_UNSAVED: + case REG_UNDEFINED: break; case REG_SAVED_OFFSET: @@ -1387,10 +1392,22 @@ uw_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs) { uw_update_context_1 (context, fs); - /* Compute the return address now, since the return address column - can change from frame to frame. */ - context->ra = __builtin_extract_return_addr - (_Unwind_GetPtr (context, fs->retaddr_column)); + /* In general this unwinder doesn't make any distinction between + undefined and same_value rule. Call-saved registers are assumed + to have same_value rule by default and explicit undefined + rule is handled like same_value. The only exception is + DW_CFA_undefined on retaddr_column which is supposed to + mark outermost frame in DWARF 3. */ + if (fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (fs->retaddr_column)].how + == REG_UNDEFINED) + /* uw_frame_state_for uses context->ra == 0 check to find outermost + stack frame. */ + context->ra = 0; + else + /* Compute the return address now, since the return address column + can change from frame to frame. */ + context->ra = __builtin_extract_return_addr + (_Unwind_GetPtr (context, fs->retaddr_column)); } static void diff --git a/gcc/unwind-dw2.h b/gcc/unwind-dw2.h index db3a1ab222c..7f643c5ec9d 100644 --- a/gcc/unwind-dw2.h +++ b/gcc/unwind-dw2.h @@ -1,5 +1,5 @@ /* DWARF2 frame unwind data structure. - Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -55,7 +55,8 @@ typedef struct REG_SAVED_REG, REG_SAVED_EXP, REG_SAVED_VAL_OFFSET, - REG_SAVED_VAL_EXP + REG_SAVED_VAL_EXP, + REG_UNDEFINED } how; } reg[DWARF_FRAME_REGISTERS+1]; -- cgit v1.2.3