config/global/logging.in
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 1801 ac0755f0e6ab
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 # Options specific to logging
     2 
     3 comment "Logging"
     4 
     5 choice
     6     bool
     7     prompt "Maximum log level to see:"
     8     default LOG_INFO if !DEBUG_CT
     9     default LOG_DEBUG if DEBUG_CT
    10 
    11 config LOG_ERROR
    12     bool
    13     prompt "ERROR"
    14     help
    15       The build will be silent.
    16       Only if there is an error will you see a message.
    17 
    18 config LOG_WARN
    19     bool
    20     prompt "WARN"
    21     help
    22       The same as above, plus warnings.
    23 
    24 config LOG_INFO
    25     bool
    26     prompt "INFO"
    27     help
    28       The same as above, plus informational messages (main steps).
    29 
    30 config LOG_EXTRA
    31     bool
    32     prompt "EXTRA"
    33     help
    34       The same as above, plus extra messages (sub-steps).
    35 
    36 config LOG_ALL
    37     bool
    38     prompt "ALL"
    39     help
    40       The same as above, plus all components build messages (very noisy!).
    41 
    42 config LOG_DEBUG
    43     bool
    44     prompt "DEBUG"
    45     help
    46       The same as above, plus lots of crosstool-NG debug information.
    47 
    48 endchoice
    49 
    50 config LOG_LEVEL_MAX
    51     string
    52     default "ERROR"   if LOG_ERROR
    53     default "WARN"    if LOG_WARN
    54     default "INFO"    if LOG_INFO
    55     default "EXTRA"   if LOG_EXTRA
    56     default "ALL"     if LOG_ALL
    57     default "DEBUG"   if LOG_DEBUG
    58 
    59 config LOG_SEE_TOOLS_WARN
    60     bool
    61     prompt "Warnings from the tools' builds"
    62     depends on ! LOG_ERROR
    63     help
    64       Treat warnings from the different tools as crosstool-NG warnings.
    65       If you say 'y' here, then those warnings will be prefixed with
    66       '[WARN ]' instead of the default '[ALL  ]'.
    67 
    68       You can safely say 'n' here. Those warnings will anyway be
    69       recorded in the log file (provided you configured one).
    70 
    71       Tools error will always be logged as crosstool-NG errors.
    72 
    73 config LOG_PROGRESS_BAR
    74     bool
    75     prompt "Progress bar"
    76     default y
    77     depends on ! LOG_ALL && ! LOG_DEBUG
    78     help
    79       If you say 'y' here, you'll be able to see the elapsed time.
    80       
    81       As a bonus, you'll also get a rotating bar (/-\|) showing you
    82       that the build is not stalled (the bar rotates 1/4 every 10 lines
    83       of components build log).
    84 
    85       Note that the elapsed time can stall for a little while if a
    86       component has long commands, as the elapsed time is only updated
    87       each line.
    88 
    89 config LOG_TO_FILE
    90     bool
    91     prompt "Log to a file"
    92     default y
    93     help
    94       Save *full* logs to a file. Even log levels you didn't specify above
    95       will be available in this file. The log file will be named build.log
    96       and stored in the toolchain prefix dir (set above).
    97 
    98       Definitely, say Y.
    99 
   100 config LOG_FILE_COMPRESS
   101     bool
   102     prompt "Compress the log file"
   103     default y
   104     depends on LOG_TO_FILE
   105     help
   106       Compress the log file once the toolchain is successfully built.