X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=run-test-gdb.sh;h=fd75fa8f73726d6f7e06e5cfc5a536f7506c4ae6;hb=bd9f9d3fd6fbcff0112a7bf48ab9284da9576b11;hp=34dc2ba112dc8262a7f5a4824ced48dee0b2d6d9;hpb=494e197e719a49fba726d90f668c2d96c02c744b;p=senf.git diff --git a/run-test-gdb.sh b/run-test-gdb.sh index 34dc2ba..fd75fa8 100755 --- a/run-test-gdb.sh +++ b/run-test-gdb.sh @@ -8,9 +8,6 @@ # This script will run the .test.bin test driver within gdb and will # create a backtrace for every exception caught by the test driver. # -# NOTE: If your unit test (excplicitly) writes output to stderr, this -# output will be lost -# # NOTE: This works by setting a breakpoint in the std::exception # constructor. This is, where the backtrace is created from. If you do # some funky manipulations with your exceptions, the backtrace might @@ -38,26 +35,55 @@ EOF # correctly (cought before the reach the unit test driver). It will # also truncate the backtrace at the first stackframe within the unit # test subsystem since we are only interested in the user code. -gdb -batch -x .run-test-gdb.cmd ./.test.bin 2>/dev/null | perl -e ' +gdb -batch -x .run-test-gdb.cmd ./.test.bin 2>&1 | perl -e ' + $mode=0; + $silent=0; while () { - if (/^$/) { - $_=; - if (/^Breakpoint 1, exception/) { + if ($mode==0) { + if (/^$/) { + $mode=1; + } else { + print; + } + } + elsif ($mode==1) { + if (/^(Breakpoint 1, exception|Program received signal )/) { + $mode=2; @l=(); - while () { - last unless /^#?[0-9]|^ /; - push @l,$_ if /^#/; - $l[$#l] .= $_ if /^ /; - } + } else { + print "\n"; + print; + $mode=0; + } + } + elsif ($mode==2) { + if (/^(#?[0-9]| )/) { + push @l,$_ if /^#/; + $l[$#l] .= $_ if @l && /^ /; + } elsif (/^(Current language: auto;|\[Switching to Thread)/) { + ; + } else { + $mode=0; if (/: fatal error in /) { + print "\n"; for (@l[1..$#l]) { - last if /^#[0-9]+ +0x[0-9a-f]+ in boost::unit_test/; - print; + last if /^#[0-9]+ +0x[0-9a-f]+ in boost::unit_test::ut_detail::invoker/; + if ($silent) { + unless (/at \/usr\/lib\/gcc\//) { + print; + $silent=0; + } + } else { + print unless /in \?\?/; + $silent=1 if /__gnu_debug::/; + } } + print; + print "\n"; + } else { + redo; } } - else { print "\n"; } } - print; } -' \ No newline at end of file +'