Weird conversion of gdb.log to GDB commands.
authorjkratoch <>
Fri, 19 Jun 2009 20:15:48 +0000 (20:15 +0000)
committerjkratoch <>
Fri, 19 Jun 2009 20:15:48 +0000 (20:15 +0000)
bin/gdblogtocmd [new file with mode: 0755]

diff --git a/bin/gdblogtocmd b/bin/gdblogtocmd
new file mode 100755 (executable)
index 0000000..47fb016
--- /dev/null
@@ -0,0 +1,25 @@
+#! /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;