From 9f1d5a74460a4d3ce7fbfa11d8cebd17286c2f1f Mon Sep 17 00:00:00 2001 From: Adam Sacarny Date: Fri, 10 Sep 1999 13:53:20 +0000 Subject: [PATCH] Now works around wine never exiting the debugger. Should put bug reports in the right place now. --- tools/bug_report.pl | 100 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 85 insertions(+), 15 deletions(-) diff --git a/tools/bug_report.pl b/tools/bug_report.pl index 13386216ffa..c7e2a6b1fec 100755 --- a/tools/bug_report.pl +++ b/tools/bug_report.pl @@ -1,11 +1,13 @@ #!/usr/bin/perl ##Wine Quick Debug Report Maker Thingy (WQDRMK) -##By Adam the Jazz Guy -##(c) 1998 +##By Adam Sacarny +##(c) 1998-1999 ##Do not say this is yours without my express permisson, or I will ##hunt you down and kill you like the savage animal I am. ##Released under the WINE licence ##Changelog: +##August 29, 1999 - Work around for debugger exit (or lack thereof) +## - Should now put debugging output in correct place ##April 19, 1999 - Much nicer way to select wine's location ## - Option to disable creation of a debugging output ## - Now places debugging output where it was started @@ -77,7 +79,7 @@ if ($debuglevel < 3) { }; print do_var($var2); } -print "Enter the formatted debug output (The first file):\n"; +print "Enter filename for the formatted debug output (The first file):\n"; $outfile=; chomp $outfile; $var23 = qq{ @@ -88,7 +90,7 @@ while ($outfile =~ /^(\s)*$/) { $outfile=; chomp $outfile; } -print "Enter the file for the full debug output (The second file):\n"; +print "Enter the filename for the full debug output (The second file):\n"; $dbgoutfile=; chomp $dbgoutfile; while ($dbgoutfile =~ /^(\s)*$/) { @@ -96,6 +98,22 @@ while ($dbgoutfile =~ /^(\s)*$/) { $dbgoutfile=; chomp $dbgoutfile; } +$var31 = qq{ +Since you will only be creating the formatted report, I will need a +temporary place to put the full output. +You may not enter "no file" for this. +Enter the filename for the temporary file: +}; +if ($outfile ne "no file" and $dbgoutfile eq "no file") { + print do_var($var31); + $tmpoutfile=; + chomp $tmpoutfile; + while (($tmpoutfile =~ /^(\s)*$/) or ($tmpoutfile eq "no file")) { + print do_var($var23); + $tmpoutfile=; + chomp $tmpoutfile; + } +} print "Looking for wine...\n"; $whereis=`whereis wine`; chomp $whereis; @@ -420,18 +438,70 @@ $dir=$1; use Cwd; $nowdir=getcwd; chdir($dir); -if ($outfile eq "no file" and $dbgoutfile ne "no file") { - system("echo quit|$wineloc -debugmsg $debugopts $extraops \"$program\" $outflags $nowdir/$dbgoutfile"); - system("gzip $nowdir/$dbgoutfile"); +if (!($outfile =~ /\//) and $outfile ne "no file") { + $outfile = "$nowdir/$outfile"; } -elsif ($outfile ne "no file" and $dbgoutfile ne "no file") { - system("echo quit|$wineloc -debugmsg $debugopts $extraops \"$program\" $outflags $nowdir/$dbgoutfile"); - $lastlines=`tail -n $lastnlines $nowdir/$dbgoutfile`; - system("gzip $nowdir/$dbgoutfile"); - &generate_outfile; +if (!($dbgoutfile =~ /\//) and $dbgoutfile ne "no file") { + $dbgoutfile = "$nowdir/$dbgoutfile"; } -elsif ($outfile ne "no file" and $dbgoutfile eq "no file"){ - $lastlines=`echo quit|$wineloc -debugmsg $debugopts $extraops "$program" 2>&1 | tail -n $lastnlines`; +if (!($tmpoutfile =~ /\//)) { + $tmpoutfile = "$nowdir/$tmpoutfile"; +} +$SIG{CHLD}=$SIG{CLD}=sub { wait }; +if ($dbgoutfile ne "no file") { + unlink("$dbgoutfile"); + if ($pid=fork()) { + } + elsif (defined $pid) { + close(0);close(1);close(2); + exec "echo quit | $wineloc -debugmsg $debugopts $extraops \"$program\" > $dbgoutfile 2>&1"; + } + else { + die "couldn't fork"; + } + while (kill(0, $pid)) { + sleep(5); + $last = `tail -n 5 $dbgoutfile | grep Wine-dbg`; + if ($last =~ /Wine-dbg/) { + kill "TERM", $pid; + break; + } + } + if ($outfile ne "no file") { + $lastlines=`tail -n $lastnlines $dbgoutfile`; + system("gzip $dbgoutfile"); + &generate_outfile; + } + else { + system("gzip $dbgoutfile"); + } +} +elsif ($outfile ne "no file" and $dbgoutfile eq "no file") { + if ($pid=fork()) { + } + elsif (defined $pid) { + close(0);close(1);close(2); + exec "echo quit | $wineloc -debugmsg $debugopts $extraops \"$program\" 2>&1| tee $tmpoutfile | tail -n $lastnlines > $outfile"; + } + else { + die "couldn't fork"; + } + print "$outfile $tmpoutfile"; + while (kill(0, $pid)) { + sleep(5); + $last = `tail -n 5 $tmpoutfile | grep Wine-dbg`; + if ($last =~ /Wine-dbg/) { + kill "TERM", $pid; + break; + } + } + unlink($tmpoutfile); + open(OUTFILE, "$outfile"); + while () { + $lastlines .= $_; + } + close(OUTFILE); + unlink($outfile); &generate_outfile; } else { @@ -446,7 +516,7 @@ else { system("$wineloc -debugmsg $debugmsg $extraops \"$program\""); } sub generate_outfile { -open(OUTFILE,">$nowdir"."\/"."$outfile"); +open(OUTFILE,">$outfile"); print OUTFILE <