patches/glibc/ports-2.12.1/120-i386-x86_64-revert-clone-cfi.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Dec 13 23:32:39 2011 +0100 (2011-12-13)
branch1.13
changeset 2847 c0bf2319af08
permissions -rw-r--r--
scripts: fix dumping execution backtrace

Dumping the backtrace has been broken since changeset #652e56d6d35a:
scripts: execute each steps in a subshell

We can spawn sub-sub-shells in some cases.

The way the fault handler works is to dump the backtrace, but to avoid
printing it once for every sub-shell (which could get quite confusing),
it simply exits when it detects that it is being run in a sub-shell,
leaving to the top-level shell the work to dump the backtrace.

Because each step is executed in its own sub-shell, the variable arrays
that contain the step name, the source file and line number, are lost
when exiting the per-step sub-shell.

Hence, the backtrace is currently limited to printing only the top-level
main procedure of the shell.

Fix this thus:
- when dumping the bckatraces for the steps & the functions, remember
it was dumped, and only dump it if it was not already dumped
- at the top-level shell, print the hints

Also, rename the top-level step label.

Reported-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
(transplanted from 4193d6e6a17430a177fa88c287879c2c35e319f3)
yann@2437
     1
revert cfi additions to clone on i386/x86_64 to workaround problems in
yann@2437
     2
gcc's unwinder code.  this is not a bug in glibc, it triggers problems
yann@2437
     3
elsewhere.  this cfi code does not gain us a whole lot anyways.
yann@2437
     4
yann@2437
     5
http://gcc.gnu.org/ml/gcc/2006-12/msg00293.html
yann@2437
     6
yann@2437
     7
Index: sysdeps/unix/sysv/linux/i386/clone.S
yann@2437
     8
===================================================================
yann@2437
     9
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/i386/clone.S,v
yann@2437
    10
retrieving revision 1.27
yann@2437
    11
retrieving revision 1.26
yann@2437
    12
diff -u -p -r1.27 -r1.26
yann@2437
    13
yann@2437
    14
diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/i386/clone.S glibc-2.12.1/sysdeps/unix/sysv/linux/i386/clone.S
yann@2437
    15
--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/i386/clone.S	2006-12-04 00:12:36.000000000 +0100
yann@2437
    16
+++ glibc-2.12.1/sysdeps/unix/sysv/linux/i386/clone.S	2009-11-13 00:49:45.000000000 +0100
yann@2437
    17
@@ -120,9 +120,6 @@
yann@2437
    18
 	ret
yann@2437
    19
 
yann@2437
    20
 L(thread_start):
yann@2437
    21
-	cfi_startproc;
yann@2437
    22
-	/* Clearing frame pointer is insufficient, use CFI.  */
yann@2437
    23
-	cfi_undefined (eip);
yann@2437
    24
 	/* Note: %esi is zero.  */
yann@2437
    25
 	movl	%esi,%ebp	/* terminate the stack frame */
yann@2437
    26
 #ifdef RESET_PID
yann@2437
    27
@@ -155,7 +152,6 @@
yann@2437
    28
 	jmp	L(haspid)
yann@2437
    29
 	.previous
yann@2437
    30
 #endif
yann@2437
    31
-	cfi_endproc;
yann@2437
    32
 
yann@2437
    33
 	cfi_startproc
yann@2437
    34
 PSEUDO_END (BP_SYM (__clone))
yann@2437
    35
diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/x86_64/clone.S glibc-2.12.1/sysdeps/unix/sysv/linux/x86_64/clone.S
yann@2437
    36
--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/x86_64/clone.S	2006-12-04 00:12:36.000000000 +0100
yann@2437
    37
+++ glibc-2.12.1/sysdeps/unix/sysv/linux/x86_64/clone.S	2009-11-13 00:49:45.000000000 +0100
yann@2437
    38
@@ -89,9 +89,6 @@
yann@2437
    39
 	ret
yann@2437
    40
 
yann@2437
    41
 L(thread_start):
yann@2437
    42
-	cfi_startproc;
yann@2437
    43
-	/* Clearing frame pointer is insufficient, use CFI.  */
yann@2437
    44
-	cfi_undefined (rip);
yann@2437
    45
 	/* Clear the frame pointer.  The ABI suggests this be done, to mark
yann@2437
    46
 	   the outermost frame obviously.  */
yann@2437
    47
 	xorl	%ebp, %ebp
yann@2437
    48
@@ -116,7 +113,6 @@
yann@2437
    49
 	/* Call exit with return value from function call. */
yann@2437
    50
 	movq	%rax, %rdi
yann@2437
    51
 	call	HIDDEN_JUMPTARGET (_exit)
yann@2437
    52
-	cfi_endproc;
yann@2437
    53
 
yann@2437
    54
 	cfi_startproc;
yann@2437
    55
 PSEUDO_END (BP_SYM (__clone))