Problem with shell func backtracing and BB_VERBOSE_LOGS
The recent changes to improve the logging for failing shell functions Does not seem to work correctly when BB_VERBOSE_LOGS is enabled.
The following is an example of a build failure with BB_VERBOSE_LOGS enabled:
| ninja: build stopped: subcommand failed.
| ++ bb_bash_debug_handler
| ++ local line=1
| ++ '[' 1 -eq 1 ']'
| ++ return
| + bb_bash_exit_handler 'ninja -v -j 16'
| ++ bb_bash_debug_handler
| ++ local line=14
| ++ '[' 14 -eq 1 ']'
| ++ '[' bb_bash_exit_handler '!=' bb_bash_exit_handler ']'
| ++ bb_bash_debug_handler
| ++ local line=15
| ++ '[' 15 -eq 1 ']'
| ++ '[' bb_bash_exit_handler '!=' bb_bash_exit_handler ']'
| + ret=1
| ++ bb_bash_debug_handler
| ++ local line=16
| ++ '[' 16 -eq 1 ']'
| ++ '[' bb_bash_exit_handler '!=' bb_bash_exit_handler ']'
| + trap '' DEBUG
| + '[' 1 '!=' 0 ']'
| + echo 'WARNING: <builddir>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.5204:157 exit 1 from '\''ninja -v -j 16'\'''
| WARNING: <builddir>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.5204:157 exit 1 from 'ninja -v -j 16'
| + echo 'WARNING: Backtrace (BB generated script): '
| WARNING: Backtrace (BB generated script):
| ++ seq 1 3
| + for i in $(seq 1 $((${#FUNCNAME[@]} - 1)))
| + '[' 1 -eq 1 ']'
| + echo -e ' #1: meson_do_compile, <builddir>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.5204, line 157'
| #1: meson_do_compile, <builddir>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.5204, line 157
| + for i in $(seq 1 $((${#FUNCNAME[@]} - 1)))
| + '[' 2 -eq 1 ']'
| + echo -e ' #2: do_compile, <builddir>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.5204, line 152'
| #2: do_compile, <builddir>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.5204, line 152
| + for i in $(seq 1 $((${#FUNCNAME[@]} - 1)))
| + '[' 3 -eq 1 ']'
| + echo -e ' #3: main, <builddir>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.5204, line 162'
| #3: main, <builddir>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.5204, line 162
| + exit 1
|
| Backtrace (metadata-relative locations):
| #1: meson_do_compile, <workdir>/meta/classes/meson.bbclass, line 180
| #1: meson_do_compile, <workdir>/meta/classes/meson.bbclass, line 180
| #2: do_compile, autogenerated, line 2
| #2: do_compile, autogenerated, line 2
| #3: main, <workdir>/meta/classes/meson.bbclass, line 185And the following is the same build failure, but without BB_VERBOSE_LOGS:
| ninja: build stopped: subcommand failed. | WARNING: <builddir>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.6232:157 exit 1 from 'ninja -v -j 16' | WARNING: Backtrace (BB generated script): | #1: meson_do_compile, <builddir>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.6232, line 157 | #2: do_compile, <builddir>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.6232, line 152 | #3: main, <builddir>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.6232, line 161 | | Backtrace (metadata-relative locations): | #1: meson_do_compile, <workdir>/meta/classes/meson.bbclass, line 180 | #2: do_compile, autogenerated, line 2
As can be seen, the frames are reported twice when BB_VERBOSE_LOGS is enabled. Also interesting is that the third frame is reported when BB_VERBOSE_LOGS is enabled (though only once).
//Peter
Quoted 26 lines
| Backtrace (metadata-relative locations): | #1: meson_do_compile, <workdir>/meta/classes/meson.bbclass, line 180 | #1: meson_do_compile, <workdir>/meta/classes/meson.bbclass, line 180 | #2: do_compile, autogenerated, line 2 | #2: do_compile, autogenerated, line 2 | #3: main, <workdir>/meta/classes/meson.bbclass, line 185And the following is the same build failure, but without
BB_VERBOSE_LOGS:| ninja: build stopped: subcommand failed.
| WARNING: <builddir>/tmp/work/cortexa9hf-neon-poky-linux- gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.6232:157 exit 1 from 'ninja -v -j 16'
| WARNING: Backtrace (BB generated script):
| #1:meson_do_compile, <builddir>/tmp/work/cortexa9hf-neon-poky-
linux-gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.6232, line 157
| #2:do_compile, <builddir>/tmp/work/cortexa9hf-neon-poky-linux-
gnueabi/<recipe>/1.1.24-r0/temp/run.do_compile.6232, line 152| #3: main, | <builddir>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/<recipe>/1.1.24 | -r0/temp/run.do_compile.6232, line 161 | | Backtrace (metadata-relative locations): | #1: meson_do_compile, <workdir>/meta/classes/meson.bbclass, line 180 | #2: do_compile, autogenerated, line 2
Quoted 3 lines
As can be seen, the frames are reported twice when
BB_VERBOSE_LOGSis enabled. Also interesting is that the third frame is reported whenBB_VERBOSE_LOGSis enabled (though only once).
I definitely am curious about this last bit though. I wonder if my regular expression in build.py that looks for backtrace frames needs tweaking.
Chris