#! /usr/bin/perl use strict; use warnings; undef $/; local $_=<>; tr/\r//d; my $G=qr/\Q(gdb) \E/; 1 while s/^(${G})(?:PASS|FAIL): .*?^((?!(?:command is |result is |output is |section |get_compiler_info))[a-z][^\n]+).*?(\n$G)/$1$2$3/mgs; s/^(?!$G).*\n//mg; s/^$G//mg; s/^kill\n//mg; #s/^set debug .*\n//mg; s/\n+PASS:.*\n*$//; $_=<<"EOH".$_; set confirm no set breakpoint pending on EOH my $n=0; s/^(.+)\n/"echo ".($n+=2).": $1\\n\n$1\n"/mge; $_.="\nquit"; print;