This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

readelf: skip 'S' character in CFI 'z' augmentation strings


The 'readelf' program fails to process 'z' augmentation strings using
the 'S' character, making it unable to display valid FDEs.

A 'z' CFI augmentation string can include an 'S' character, indicating
that the frame is a signal handler. When unwinding an ordinary stack
frame, the PC recovered for the caller is usually that of the
instruction after the call, which causes difficulties if the call is
the last instruction of the function --- presumably to a function the
compiler knows will never return. The 'S' augmentation character
allows unwinders to avoid performing this hack when unwinding from a
signal handler.

The Linux Standards Base 4.0 doesn't mention 'S', but this isn't too
surprising --- the section describing the .eh_frame augmentations
still has simple copy-editing problems and serious omissions unfixed
since LSB 3.0.  The best documentation for 'S' appears to be:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26208

Because readelf doesn't recognize 'S', it may fail to process other
augmentation string characters necessary to parse the FDE, like 'R'.
This patch fixes that.
The 'readelf' program fails to process 'z' augmentation strings using
the 'S' character, making it unable to display valid FDEs.

A 'z' CFI augmentation string can include an 'S' character, indicating
that the frame is a signal handler. When unwinding an ordinary stack
frame, the PC recovered for the caller is usually that of the
instruction after the call, which causes difficulties if the call is
the last instruction of the function --- presumably to a function the
compiler knows will never return. The 'S' augmentation character
allows unwinders to avoid performing this hack when unwinding from a
signal handler.

The Linux Standards Base 4.0 doesn't mention 'S', but this isn't too
surprising --- the section describing the .eh_frame augmentations
still has simple copy-editing problems and serious omissions unfixed
since LSB 3.0.  The best documentation for 'S' appears to be:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26208

Because readelf doesn't recognize 'S', it may fail to process other
augmentation string characters necessary to parse the FDE, like 'R'.
This patch fixes that.


Index: binutils/ChangeLog
===================================================================
RCS file: /cvs/src/src/binutils/ChangeLog,v
retrieving revision 1.1610
diff -u -r1.1610 ChangeLog
--- binutils/ChangeLog	2 Feb 2010 12:37:39 -0000	1.1610
+++ binutils/ChangeLog	8 Feb 2010 09:49:06 -0000
@@ -1,3 +1,8 @@
+2010-02-08  Jim Blandy  <jimb@red-bean.com>
+
+	* dwarf.c (display_debug_frames): Skip the 'S' character in CFI
+	'z' augmentation strings.
+
 2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* readelf.c (get_note_type): Handle NT_X86_XSTATE.
Index: binutils/dwarf.c
===================================================================
RCS file: /cvs/src/src/binutils/dwarf.c,v
retrieving revision 1.61
diff -u -r1.61 dwarf.c
--- binutils/dwarf.c	14 Jan 2010 09:19:56 -0000	1.61
+++ binutils/dwarf.c	8 Feb 2010 09:49:06 -0000
@@ -4114,6 +4114,8 @@
 		    q += 1 + size_of_encoded_value (*q);
 		  else if (*p == 'R')
 		    fc->fde_encoding = *q++;
+                  else if (*p == 'S')
+                    ;
 		  else
 		    break;
 		  p++;

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