patches/gcc/4.4.2/330-libmudflap-susv3-legacy.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
parent 1544 2228ea3f6b79
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@1393
     1
diff -durN gcc-4.4.0.orig/libmudflap/mf-hooks2.c gcc-4.4.0/libmudflap/mf-hooks2.c
yann@1393
     2
--- gcc-4.4.0.orig/libmudflap/mf-hooks2.c	2009-04-10 01:23:07.000000000 +0200
yann@1393
     3
+++ gcc-4.4.0/libmudflap/mf-hooks2.c	2009-05-27 21:39:00.000000000 +0200
yann@1393
     4
@@ -421,7 +421,7 @@
yann@1393
     5
 {
yann@1393
     6
   TRACE ("%s\n", __PRETTY_FUNCTION__);
yann@1393
     7
   MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
yann@1393
     8
-  bzero (s, n);
yann@1393
     9
+  memset (s, 0, n);
yann@1393
    10
 }
yann@1393
    11
 
yann@1393
    12
 
yann@1393
    13
@@ -431,7 +431,7 @@
yann@1393
    14
   TRACE ("%s\n", __PRETTY_FUNCTION__);
yann@1393
    15
   MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
yann@1393
    16
   MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
yann@1393
    17
-  bcopy (src, dest, n);
yann@1393
    18
+  memmove (dest, src, n);
yann@1393
    19
 }
yann@1393
    20
 
yann@1393
    21
 
yann@1393
    22
@@ -441,7 +441,7 @@
yann@1393
    23
   TRACE ("%s\n", __PRETTY_FUNCTION__);
yann@1393
    24
   MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
yann@1393
    25
   MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
yann@1393
    26
-  return bcmp (s1, s2, n);
yann@1393
    27
+  return n == 0 ? 0 : memcmp (s1, s2, n);
yann@1393
    28
 }
yann@1393
    29
 
yann@1393
    30
 
yann@1393
    31
@@ -450,7 +450,7 @@
yann@1393
    32
   size_t n = strlen (s);
yann@1393
    33
   TRACE ("%s\n", __PRETTY_FUNCTION__);
yann@1393
    34
   MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
yann@1393
    35
-  return index (s, c);
yann@1393
    36
+  return strchr (s, c);
yann@1393
    37
 }
yann@1393
    38
 
yann@1393
    39
 
yann@1393
    40
@@ -459,7 +459,7 @@
yann@1393
    41
   size_t n = strlen (s);
yann@1393
    42
   TRACE ("%s\n", __PRETTY_FUNCTION__);
yann@1393
    43
   MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
yann@1393
    44
-  return rindex (s, c);
yann@1393
    45
+  return strrchr (s, c);
yann@1393
    46
 }
yann@1393
    47
 
yann@1393
    48
 /* XXX:  stpcpy, memccpy */