Now works around wine never exiting the debugger.

Should put bug reports in the right place now.
This commit is contained in:
Adam Sacarny 1999-09-10 13:53:20 +00:00 committed by Alexandre Julliard
parent 66e8c4eef8
commit 9f1d5a7446
1 changed files with 85 additions and 15 deletions

View File

@ -1,11 +1,13 @@
#!/usr/bin/perl #!/usr/bin/perl
##Wine Quick Debug Report Maker Thingy (WQDRMK) ##Wine Quick Debug Report Maker Thingy (WQDRMK)
##By Adam the Jazz Guy ##By Adam Sacarny
##(c) 1998 ##(c) 1998-1999
##Do not say this is yours without my express permisson, or I will ##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. ##hunt you down and kill you like the savage animal I am.
##Released under the WINE licence ##Released under the WINE licence
##Changelog: ##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 ##April 19, 1999 - Much nicer way to select wine's location
## - Option to disable creation of a debugging output ## - Option to disable creation of a debugging output
## - Now places debugging output where it was started ## - Now places debugging output where it was started
@ -77,7 +79,7 @@ if ($debuglevel < 3) {
}; };
print do_var($var2); 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=<STDIN>; $outfile=<STDIN>;
chomp $outfile; chomp $outfile;
$var23 = qq{ $var23 = qq{
@ -88,7 +90,7 @@ while ($outfile =~ /^(\s)*$/) {
$outfile=<STDIN>; $outfile=<STDIN>;
chomp $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=<STDIN>; $dbgoutfile=<STDIN>;
chomp $dbgoutfile; chomp $dbgoutfile;
while ($dbgoutfile =~ /^(\s)*$/) { while ($dbgoutfile =~ /^(\s)*$/) {
@ -96,6 +98,22 @@ while ($dbgoutfile =~ /^(\s)*$/) {
$dbgoutfile=<STDIN>; $dbgoutfile=<STDIN>;
chomp $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=<STDIN>;
chomp $tmpoutfile;
while (($tmpoutfile =~ /^(\s)*$/) or ($tmpoutfile eq "no file")) {
print do_var($var23);
$tmpoutfile=<STDIN>;
chomp $tmpoutfile;
}
}
print "Looking for wine...\n"; print "Looking for wine...\n";
$whereis=`whereis wine`; $whereis=`whereis wine`;
chomp $whereis; chomp $whereis;
@ -420,18 +438,70 @@ $dir=$1;
use Cwd; use Cwd;
$nowdir=getcwd; $nowdir=getcwd;
chdir($dir); chdir($dir);
if ($outfile eq "no file" and $dbgoutfile ne "no file") { if (!($outfile =~ /\//) and $outfile ne "no file") {
system("echo quit|$wineloc -debugmsg $debugopts $extraops \"$program\" $outflags $nowdir/$dbgoutfile"); $outfile = "$nowdir/$outfile";
system("gzip $nowdir/$dbgoutfile");
} }
elsif ($outfile ne "no file" and $dbgoutfile ne "no file") { if (!($dbgoutfile =~ /\//) and $dbgoutfile ne "no file") {
system("echo quit|$wineloc -debugmsg $debugopts $extraops \"$program\" $outflags $nowdir/$dbgoutfile"); $dbgoutfile = "$nowdir/$dbgoutfile";
$lastlines=`tail -n $lastnlines $nowdir/$dbgoutfile`; }
system("gzip $nowdir/$dbgoutfile"); 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; &generate_outfile;
} }
else {
system("gzip $dbgoutfile");
}
}
elsif ($outfile ne "no file" and $dbgoutfile eq "no file") { elsif ($outfile ne "no file" and $dbgoutfile eq "no file") {
$lastlines=`echo quit|$wineloc -debugmsg $debugopts $extraops "$program" 2>&1 | tail -n $lastnlines`; 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 (<OUTFILE>) {
$lastlines .= $_;
}
close(OUTFILE);
unlink($outfile);
&generate_outfile; &generate_outfile;
} }
else { else {
@ -446,7 +516,7 @@ else {
system("$wineloc -debugmsg $debugmsg $extraops \"$program\""); system("$wineloc -debugmsg $debugmsg $extraops \"$program\"");
} }
sub generate_outfile { sub generate_outfile {
open(OUTFILE,">$nowdir"."\/"."$outfile"); open(OUTFILE,">$outfile");
print OUTFILE <<EOM; print OUTFILE <<EOM;
Auto-generated debug report by Wine Quick Debug Report Maker Thingy: Auto-generated debug report by Wine Quick Debug Report Maker Thingy:
WINE Version: $winever WINE Version: $winever