This is the mail archive of the gcc-patches@gcc.gnu.org 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: correctly handle the CFA in DWARF2 unwinding (with attachment)


Argh...attach the patch this time.  Original message reproduced below:

This patch fixes GCC's DWARF2 unwinder to handle adjustments to the CFA
inside DW_CFA_{remember,restore}_state pairs.  Previously, when faced
with DWARF2 unwind information such as:

A:
    DW_CFA_remember_state
    ... /* restore registers */
    DW_CFA_def_cfa_offset: 8
    ...
    DW_CFA_restore_state
B:

The CFA offset at point 'B' would be 8, rather than what the CFA offset
was at point 'A'.  With this patch, the CFA offset at 'B' is whatever it
was at 'A', as it should be.

The patch merely shuffles around some CFA-related fields in the unwind
state to ensure those fields are processed properly by the unwinder.
There are no testcases provided with this patch, mainly because GCC
doesn't generate the relevant DWARF2 information.  We have a patch here
at Rice that does generate the DW_CFA_{remember,restore}_state opcodes
and therefore needed this patch for correctness.  This patch is being
submitted separately because we believe this patch is non-controversial
and standalone.  We will be submitting the second patch for review
shortly.

Tested with a bootstrap and `make -k check' on x86_64-pc-linux-gnu.  No
regressions.

2006-01-11  Nathan Froyd  <froydnj@cs.rice.edu>

	* gcc/unwind-dw2.h: Move cfa-related variables into
	struct frame_state_reg_info to ensure that the CFA is properly
	handled when executing DW_CFA_{remember,restore}_state.
	* gcc/unwind-dw2.c, gcc/config/alpha/linux-unwind.h,
	gcc/config/alpha/vms-unwind.h, gcc/config/s390/tpf-unwind.h
	gcc/config/s390/linux-unwind.h, gcc/config/sparc/linux-unwind.h
	gcc/config/i386/linux-unwind.h, gcc/config/sh/linux-unwind.h
	gcc/config/rs6000/linux-unwind.h,
	gcc/config/rs6000/darwin-fallback.c, gcc/config/pa/linux-unwind.h,
	gcc/config/pa/hpux-unwind.h, gcc/config/mips/linux-unwind.h:
	Modify to use new cfa_* fields.
-- 
Nathan | From Man's effeminate slackness it begins.  --Paradise Lost

The last good thing written in C was Franz Schubert's Symphony Number 9.
                                               --Erwin Dieterich

Attachment: unwinder-cfa-state.patch
Description: Text document


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