docs/6 - Toolchain types.txt
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 2563 e17f35b05539
child 2908 dcdb309b7967
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)
     1 File.........: 6 - Toolchain types.txt
     2 Copyright....: (C) 2010 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
     3 License......: Creative Commons Attribution Share Alike (CC-by-sa), v2.5
     4 
     5 
     6 Toolchain types  /
     7 ________________/
     8 
     9 
    10 There are four kinds of toolchains you could encounter.
    11 
    12 First off, you must understand the following: when it comes to compilers there
    13 are up to four machines involved:
    14   1) the machine configuring the toolchain components: the config machine
    15   2) the machine building the toolchain components:    the build machine
    16   3) the machine running the toolchain:                the host machine
    17   4) the machine the toolchain is generating code for: the target machine
    18 
    19 We can most of the time assume that the config machine and the build machine
    20 are the same. Most of the time, this will be true. The only time it isn't
    21 is if you're using distributed compilation (such as distcc). Let's forget
    22 this for the sake of simplicity.
    23 
    24 So we're left with three machines:
    25  - build
    26  - host
    27  - target
    28 
    29 Any toolchain will involve those three machines. You can be as pretty sure of
    30 this as "2 and 2 are 4". Here is how they come into play:
    31 
    32 1) build == host == target
    33     This is a plain native toolchain, targeting the exact same machine as the
    34     one it is built on, and running again on this exact same machine. You have
    35     to build such a toolchain when you want to use an updated component, such
    36     as a newer gcc for example.
    37     crosstool-NG calls it "native".
    38 
    39 2) build == host != target
    40     This is a classic cross-toolchain, which is expected to be run on the same
    41     machine it is compiled on, and generate code to run on a second machine,
    42     the target.
    43     crosstool-NG calls it "cross".
    44 
    45 3) build != host == target
    46     Such a toolchain is also a native toolchain, as it targets the same machine
    47     as it runs on. But it is build on another machine. You want such a
    48     toolchain when porting to a new architecture, or if the build machine is
    49     much faster than the host machine.
    50     crosstool-NG calls it "cross-native".
    51 
    52 4) build != host != target
    53     This one is called a canadian-toolchain (*), and is tricky. The three
    54     machines in play are different. You might want such a toolchain if you
    55     have a fast build machine, but the users will use it on another machine,
    56     and will produce code to run on a third machine.
    57     crosstool-NG calls it "canadian".
    58 
    59 crosstool-NG can build all these kinds of toolchains (or is aiming at it,
    60 anyway!)
    61 
    62 (*) The term Canadian Cross came about because at the time that these issues
    63     were all being hashed out, Canada had three national political parties.
    64     http://en.wikipedia.org/wiki/Cross_compiler