aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2006-02-04 22:08:04 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2006-02-04 22:08:04 +0000
commit658f32fda265f363b18b912ad3560eebeeb28b64 (patch)
treefb40a2b7673d57f55dfc5ac1a79cb20828a95882 /gcc/dwarf2out.c
parent5460aa9c92db4858927d7a7c2118e71d7c90aa6d (diff)
downloadgcc-658f32fda265f363b18b912ad3560eebeeb28b64.zip
gcc-658f32fda265f363b18b912ad3560eebeeb28b64.tar.gz
gcc-658f32fda265f363b18b912ad3560eebeeb28b64.tar.bz2
re PR debug/24444 (invalid register in debug info)
PR debug/24444 * config/ia64/ia64.c: Include debug.h. (MAX_ARTIFICIAL_LABEL_BYTES): New. (ia64_label_after_insn, ia64_dwarf2out_def_steady_cfa): New. (IA64_CHANGE_CFA_IN_EPILOGUE): Define to 0. (process_epilogue, process_set, process_for_unwind_directive): Output unwind info only if requested. Add CFA info if requested. Add new arguments as needed. Adjust callers. * config/ia64/ia64.h (ARG_POINTER_CFA_OFFSET): Override incorrect default. (DWARF2_FRAME_INFO): Define to zero. * config/ia64/unwind-ia64.c: Remove code that compensated for the CFA offset error fixed above. * config/ia64/t-ia64 (ia64.o): Depend on debug.h. * dwarf2out.c (DWARF2_FRAME_INFO): Define default. (dwarf2out_do_frame): Require nonzero DWARF2_UNWIND_INFO for -funwind-tables and -fexceptions to enable frame info. (dwarf2out_frame_init): Define initial CFA even if DWARF2_UNWIND_INFO is disabled. Call initial_return_save if DWARF2_UNWIND_INFO is nonzero, not just defined. (dwarf2out_frame_finish): Output non-EH call frame info only if DWARF2_FRAME_INFO is nonzero. (convert_cfa_to_loc_list, compute_frame_pointer_to_cfa_displacement): Define even if unwind info is not supported. (gen_subprogram_die): Use the above unconditionally. Remove legacy alternate code. * toplev.c (compile_file): Compile in call to dwarf2out_frame_finish if DWARF2_DEBUGGING_INFO is defined. (lang_dependent_init): Ditto for dwarf2out_frame_init. From-SVN: r110594
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c46
1 files changed, 20 insertions, 26 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 3cffc4e..78afb5a 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -90,20 +90,31 @@ static void dwarf2out_source_line (unsigned int, const char *);
DW_CFA_... = DWARF2 CFA call frame instruction
DW_TAG_... = DWARF2 DIE tag */
+#ifndef DWARF2_FRAME_INFO
+# ifdef DWARF2_DEBUGGING_INFO
+# define DWARF2_FRAME_INFO \
+ (write_symbols == DWARF2_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG)
+# else
+# define DWARF2_FRAME_INFO 0
+# endif
+#endif
+
/* Decide whether we want to emit frame unwind information for the current
translation unit. */
int
dwarf2out_do_frame (void)
{
+ /* We want to emit correct CFA location expressions or lists, so we
+ have to return true if we're going to output debug info, even if
+ we're not going to output frame or unwind info. */
return (write_symbols == DWARF2_DEBUG
|| write_symbols == VMS_AND_DWARF2_DEBUG
-#ifdef DWARF2_FRAME_INFO
|| DWARF2_FRAME_INFO
-#endif
#ifdef DWARF2_UNWIND_INFO
- || flag_unwind_tables
- || (flag_exceptions && ! USING_SJLJ_EXCEPTIONS)
+ || (DWARF2_UNWIND_INFO
+ && (flag_unwind_tables
+ || (flag_exceptions && ! USING_SJLJ_EXCEPTIONS)))
#endif
);
}
@@ -2586,10 +2597,12 @@ dwarf2out_frame_init (void)
/* Generate the CFA instructions common to all FDE's. Do it now for the
sake of lookup_cfa. */
-#ifdef DWARF2_UNWIND_INFO
/* On entry, the Canonical Frame Address is at SP. */
dwarf2out_def_cfa (NULL, STACK_POINTER_REGNUM, INCOMING_FRAME_SP_OFFSET);
- initial_return_save (INCOMING_RETURN_ADDR_RTX);
+
+#ifdef DWARF2_UNWIND_INFO
+ if (DWARF2_UNWIND_INFO)
+ initial_return_save (INCOMING_RETURN_ADDR_RTX);
#endif
}
@@ -2597,12 +2610,7 @@ void
dwarf2out_frame_finish (void)
{
/* Output call frame information. */
- if (write_symbols == DWARF2_DEBUG
- || write_symbols == VMS_AND_DWARF2_DEBUG
-#ifdef DWARF2_FRAME_INFO
- || DWARF2_FRAME_INFO
-#endif
- )
+ if (DWARF2_FRAME_INFO)
output_call_frame_info (0);
#ifndef TARGET_UNWIND_INFO
@@ -10326,7 +10334,6 @@ tree_add_const_value_attribute (dw_die_ref var_die, tree decl)
add_const_value_attribute (var_die, rtl);
}
-#ifdef DWARF2_UNWIND_INFO
/* Convert the CFI instructions for the current function into a location
list. This is used for DW_AT_frame_base when we targeting a dwarf2
consumer that does not support the dwarf3 DW_OP_call_frame_cfa. */
@@ -10433,7 +10440,6 @@ compute_frame_pointer_to_cfa_displacement (void)
frame_pointer_cfa_offset = -offset;
}
-#endif
/* Generate a DW_AT_name attribute given some string value to be included as
the value of the attribute. */
@@ -11668,7 +11674,6 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
add_AT_fde_ref (subr_die, DW_AT_MIPS_fde, current_funcdef_fde);
#endif
-#ifdef DWARF2_UNWIND_INFO
/* We define the "frame base" as the function's CFA. This is more
convenient for several reasons: (1) It's stable across the prologue
and epilogue, which makes it better than just a frame pointer,
@@ -11695,17 +11700,6 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
debugger about. We'll need to adjust all frame_base references
by this displacement. */
compute_frame_pointer_to_cfa_displacement ();
-#else
- /* For targets which support DWARF2, but not DWARF2 call-frame info,
- we just use the stack pointer or frame pointer. */
- /* ??? Should investigate getting better info via callbacks, or else
- by interpreting the IA-64 unwind info. */
- {
- rtx fp_reg
- = frame_pointer_needed ? hard_frame_pointer_rtx : stack_pointer_rtx;
- add_AT_loc (subr_die, DW_AT_frame_base, reg_loc_descriptor (fp_reg));
- }
-#endif
if (cfun->static_chain_decl)
add_AT_location_description (subr_die, DW_AT_static_link,