This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Force DW_CFA_def_cfa after DW_CFA_def_cfa_expression if no longer indirect


DW_CFA_def_cfa_register after DW_CFA_def_cfa_expression is ambiguous,
it is unclear what offset is actually in effect.
GCC as producer seems to assume the offset in that case is something
get_cfa_from_loc_descr computes from the location expression (if
there is DW_OP_plus_uconst after deref, then it is the offset),
apparently e.g. libgcc unwinder assumes in that case offset is inherited
from DW_CFA_def_cfa or DW_CFA_def_cfa_offset{,_sf} valid before
the DW_CFA_def_cfa_expression.

The following patch just forces DW_CFA_def_cfa so it is obvious what
register and offset are in effect.

Ok for trunk/4.5/4.4?

2010-04-23  Jakub Jelinek  <>

	* dwarf2out.c (def_cfa_1): After DW_CFA_def_cfa_expression
	force using DW_CFA_def_cfa instead of DW_CFA_def_cfa_register
	or DW_CFA_def_cfa_offset{,_sf}.

--- gcc/dwarf2out.c.jj	2010-04-19 14:51:47.000000000 +0200
+++ gcc/dwarf2out.c	2010-04-23 09:33:58.000000000 +0200
@@ -1040,7 +1040,7 @@ def_cfa_1 (const char *label, dw_cfa_loc
   cfi = new_cfi ();
-  if (loc.reg == old_cfa.reg && !loc.indirect)
+  if (loc.reg == old_cfa.reg && !loc.indirect && !old_cfa.indirect)
       /* Construct a "DW_CFA_def_cfa_offset <offset>" instruction, indicating
 	 the CFA register did not change but the offset did.  The data
@@ -1056,7 +1056,8 @@ def_cfa_1 (const char *label, dw_cfa_loc
 #ifndef MIPS_DEBUGGING_INFO  /* SGI dbx thinks this means no offset.  */
   else if (loc.offset == old_cfa.offset
 	   && old_cfa.reg != INVALID_REGNUM
-	   && !loc.indirect)
+	   && !loc.indirect
+	   && !old_cfa.indirect)
       /* Construct a "DW_CFA_def_cfa_register <register>" instruction,
 	 indicating the CFA register has changed to <register> but the


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]