2 ##Wine Quick Debug Report Maker Thingy (WQDRMK)
3 ## Copyright (c) 1998-1999 Adam Sacarny jazz@cscweb.net ICQ: 19617831
4 ##Do not say this is yours without my express permisson, or I will
5 ##hunt you down and kill you like the savage animal I am.
7 ## Improvements by Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
10 ## A few improovements and updates here and there
11 ## Copyright 2003-2004 Ivan Leo Puoti
13 ## This library is free software; you can redistribute it and/or
14 ## modify it under the terms of the GNU Lesser General Public
15 ## License as published by the Free Software Foundation; either
16 ## version 2.1 of the License, or (at your option) any later version.
18 ## This library is distributed in the hope that it will be useful,
19 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 ## Lesser General Public License for more details.
23 ## You should have received a copy of the GNU Lesser General Public
24 ## License along with this library; if not, write to the Free Software
25 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 ##August 29, 1999 - Work around for debugger exit (or lack thereof)
29 ## - Should now put debugging output in correct place
30 ##April 19, 1999 - Much nicer way to select Wine's location
31 ## - Option to disable creation of a debugging output
32 ## - Now places debugging output where it was started
33 ##April 4, 1999 - Sanity check for file locations/wine strippedness
34 ## - Various code cleanups/fixes
35 ##March 21, 1999 - Bash 2.0 STDERR workaround (Thanks Ryan Cumming!)
36 ##March 1, 1999 - Check for stripped build
37 ##February 3, 1999 - Fix to chdir to the program's directory
38 ##February 1, 1999 - Cleaned up code
39 ##January 26, 1999 - Fixed various bugs...
40 ## - Made newbie mode easier
41 ##January 25, 1999 - Initial Release
48 open STDERR
, ">&SAVEERR"; open STDERR
, ">&STDOUT";
49 $ENV{'SHELL'}="/bin/bash";
51 What is your level of Wine expertise?
1-newbie
2-intermediate
3-advanced
53 1 - Makes a debug report as
defined in the Wine documentation
. Best
54 for new Wine users
. If you
're not sure what WINEDEBUG is, then
56 2 - Makes a debug report that is more customizable (Example: you can
57 choose what WINEDEBUG to use). You are asked more questions in
58 this mode. May intimidate newbies.
59 3 - Just like 2, but not corner cutting. Assumes you know what you're
60 doing so it leaves out the long descriptions
.
62 print do_var
($var0)."\n";
64 until ($debuglevel >= 1 and $debuglevel <= 3) {
65 print "Enter your level of Wine expertise (1-3): ";
70 if ($debuglevel < 3) {
72 This program will make a debug report
for Wine developers
. It generates
73 two files
. The first one has everything asked
for by the bugreports guide
;
74 the second has
*all
* of the debug output
, which can go to thousands of
76 To
(hopefully
) get the bug fixed
, report it to the project
77 bug tracking
system at http
://bugs
.winehq
.org
.
78 Attach the first file to the bug description
.
79 Also include detailed description of the problem
. The developers
80 might ask you
for "the last X lines from the report". If so
, just
81 provide the output of the following command
:
82 gzip
-d
(output file
) | tail
-n
(X
) > outfile
83 If you
do not want to create one of the files
, just specify
"no file".
86 } elsif ($debuglevel =~ 3) {
88 This program will output to two files
:
89 1. Formatted debug report you might want to post to the newsgroup
90 2. File with ALL the debug output
(It will later be compressed with
91 gzip
, so leave off the trailing
.gz
)
92 If you
do not want to create one of the files
, just type
in "no file"
98 print "\nFilename for the formatted debug report: ";
102 I don't think you typed
in the right filename
. Let
's try again.
104 while ($outfile =~ /^(\s)*$/) {
105 print do_var($var23);
110 print "Filename for full debug output: ";
111 my $dbgoutfile=<STDIN>;
113 while ($dbgoutfile =~ /^(\s)*$/) {
114 print do_var($var23);
120 Since you will only be creating the formatted report, I will need a
121 temporary place to put the full output.
122 You may not enter "no file" for this.
123 Enter the filename for the temporary file:
126 if ($outfile ne "no file" and $dbgoutfile eq "no file") {
127 print do_var($var31);
130 while (($tmpoutfile =~ /^(\s)*$/) or ($tmpoutfile eq "no file")) {
131 print do_var($var23);
137 my $whereis=`whereis wine`;
139 print "\nWhere is your copy of Wine located?\n\n";
140 $whereis =~ s/^wine\: //;
141 my @locations = split(/\s/,$whereis);
142 print "1 - Unlisted (I'll prompt you
for a new location
\n";
143 print "2 - Unsure
(I
'll use #3, that's probably it
)\n";
145 foreach my $location (@locations) {
147 print "$i - $location\n";
150 sub select_wineloc() {
154 print "Enter the number that corresponds to Wine
's location: ";
158 while ( ! ( $wineloc >=1 and $wineloc <= 2+@locations ) );
161 Enter the full path to wine (Example: /usr/bin/wine):
164 Please enter the full path to wine. A full path is the
165 directories leading up to a program's location
, and then the
166 program
. For example
, if you had the program
"wine" in the
167 directory
"/usr/bin", you would type
in "/usr/bin/wine". Now
170 print do_var
($var25) if $debuglevel == 3;
171 print do_var
($var26) if $debuglevel < 3;
174 while ($wineloc =~ /^(\s)*$/) {
175 print do_var
($var23);
180 elsif ($wineloc == 2) {
181 $wineloc=$locations[0];
184 $wineloc=$locations[$wineloc-3];
188 my $wineloc=select_wineloc
();
189 print "Checking if $wineloc is stripped...\n";
190 my $ifstrip = `nm $wineloc 2>&1`;
191 while ($ifstrip =~ /no symbols/) {
193 Your wine is stripped
! Stripped versions make useless debug reports
194 If you have another location of wine that may be used
, enter it now
.
195 Otherwise
, hit control
-c
and download an unstripped
(Debug
) version
, then re
-run
198 print do_var
($var24);
199 $wineloc=select_wineloc
();
200 $ifstrip = `nm $wineloc 2>&1`;
202 while ($ifstrip =~ /not recognized/) {
204 Looks like you gave me something that isn
't a Wine binary (It could be a
205 text file). Try again.
207 print do_var($var26);
208 $wineloc=select_wineloc();
209 print "Checking if $wineloc is stripped...\n";
210 $ifstrip = `nm $wineloc 2>&1`;
213 print "\nWhat version of Windows are you using with Wine?\n\n".
219 "5 - Windows NT 3.5x\n".
220 "6 - Windows NT4.x\n".
221 "7 - Windows 2000\n".
223 "9 - Windows Server 2003\n".
228 print "Enter the number that corresponds to your Windows version: ";
232 until ($winver >= 0 and $winver <= 10);
234 $winver="None Installed";
235 } elsif ($winver =~ 1) {
236 $winver="Windows 3.x";
237 } elsif ($winver =~ 2) {
238 $winver="Windows 95";
239 } elsif ($winver =~ 3) {
240 $winver="Windows 98";
241 } elsif ($winver =~ 4) {
242 $winver="Windows ME";
243 } elsif ($winver =~ 5) {
244 $winver="Windows NT 3.5x";
245 } elsif ($winver =~ 6) {
246 $winver="Windows NT 4.x";
247 } elsif ($winver =~ 7) {
248 $winver="Windows 2000";
249 } elsif ($winver =~ 8) {
250 $winver="Windows XP";
251 } elsif ($winver =~ 9) {
252 $winver="Windows Server 2003";
253 } elsif ($winver =~ 10) {
254 print "What version of Windows are you using? ";
258 if ($debuglevel < 3) {
260 Enter the full path to the program you want to run. Remember what you
261 were told before - a full path is the directories leading up to the
262 program and then the program's name
, like
/dos/windows
/sol
.exe
, not
267 if ($debuglevel =~ 3) {
269 Enter the full path to the program you want to run
(Example
:
270 /dos/windows
/sol
.exe
, NOT sol
.exe
):
276 while ($program =~ /^(\s)*$/) {
277 print do_var
($var23);
283 Enter the name
, version
, and manufacturer of the program
(Example
:
284 Netscape Navigator
4.5):
287 my $progname=<STDIN
>;
290 Enter
1 if your program is
16 bit
(Windows
3.x
), 2 if your program is
32
291 bit
(Windows
95, NT3
.x
and up
), or 3 if you are unsure
:
293 print do_var
($var10);
294 my $progbits=<STDIN
>;
296 until ($progbits == 1 or $progbits == 2 or $progbits == 3) {
297 print "You must enter 1, 2 or 3!\n";
301 if ($progbits =~ 1) {
303 } elsif ($progbits =~ 2) {
306 $progbits = "Unsure";
309 if ($debuglevel > 1) {
310 if ($debuglevel =~ 2) {
312 Enter any extra debug options
. Default is
+relay
- If you don
't
313 know what options to use, just hit enter, and I'll
use those
(Example
, the
314 developer tells you to re
-run with WINEDEBUG
=+dosfs
,+module you would type
315 in +dosfs
,+module
). Hit enter
if you
're not sure what to do:
317 print do_var($var11);
318 } elsif ($debuglevel =~ 3) {
320 Enter any debug options you would like to use. Just enter parts after
321 WINEDEBUG. Default is +relay:
323 print do_var($var12);
327 if ($debugopts =~ /--debugmsg /) {
328 $debugopts = (split / /,$debugopts)[1];
330 if ($debugopts =~ /WINEDEBUG= /) {
331 $debugopts = (split / /,$debugopts)[1];
333 if ($debugopts =~ /^\s*$/) {
336 } elsif ($debuglevel =~ 1) {
337 $debugopts = "+relay";
340 if ($debuglevel > 1) {
341 if ($debuglevel =~ 2) {
343 How many trailing lines of debugging info do you want to include in the report
344 you're going to submit
(First file
)? If a developer asks you to include
345 the
last 15000 lines
, enter
15000 here
. Default is
3000, which is reached by
346 pressing enter
. (If you
're not sure, just hit enter):
348 print do_var($var13);
349 } elsif ($debuglevel =~ 3) {
351 Enter how many lines of trailing debugging output you want in your nice
352 formatted report. Default is 3000:
354 print do_var($var14);
358 if ($lastnlines =~ /^\s*$/) {
361 } elsif ($debuglevel =~ 1) {
365 if ($debuglevel > 1) {
367 Enter any extra options you want to pass to Wine.
369 print do_var($var15);
372 } elsif ($debuglevel =~ 1) {
376 print "\nEnter the name of your distribution (Example: RedHat 9.0): ";
381 if ($debuglevel > 1) {
382 if ($debuglevel =~ 2) {
384 When you ran ./configure to build wine, were there any special options
385 you used to do so (Example: --enable-dll)? If you didn't
use any special
386 options
or didn
't compile Wine yourself, just hit enter:
388 print do_var($var16);
389 } elsif ($debuglevel =~ 3) {
391 Enter any special options you used when running ./configure for Wine
392 (Default is none, use if you didn't compile Wine yourself
):
394 print do_var
($var17);
398 if ($configopts =~ /^\s*$/) {
401 } elsif ($debuglevel =~ 1) {
405 if ($debuglevel > 1) {
406 if ($debuglevel =~ 2) {
408 Is your Wine version CVS
or from a
.tar
.gz
or RPM file? As
in... did you download it
409 off a website
/ftpsite or did you/have you run cvs on it to update it?
410 For CVS
: YYYYMMDD
, where YYYY is the year
(2004), MM is the month
(03), and DD
411 is the day
(09), that you
last updated it
(Example
: 20040309).
412 For tar
.gz
and RPM
: Just hit enter
and I
'll figure out the version for you:
414 print do_var($var18);
415 } elsif ($debuglevel =~ 3) {
417 Is your Wine from CVS? Enter the last CVS update date for it here, in
418 YYYYMMDD form (If it's from a tarball
or RPM
, just hit enter
):
420 print do_var
($var19);
424 if ($winever =~ /[0-9]+/) {
428 $winever = `$wineloc -v 2>&1`;
431 } elsif ($debuglevel =~ 1) {
432 $winever=`$wineloc -v 2>&1`;
435 my $gccver=`gcc -v 2>&1`;
436 $gccver = (split /\n/,$gccver)[1];
440 my $kernelver=`uname -r`;
442 my $ostype=`uname -s`;
444 my $wineneeds=`ldd $wineloc`;
445 if ($debuglevel < 3) {
447 OK
, now I
'm going to run Wine. I will close it for you once the Wine
448 debugger comes up. NOTE: You won't see ANY debug messages
. Don
't
449 worry, they are being output to a file. Since there are so many, it's
450 not a good idea to have them all output to a terminal
(Speed slowdown
452 Wine will still run much slower than normal
, because there will be so
453 many debug messages being output to file
.
455 print do_var
($var20);
456 } elsif ($debuglevel =~ 3) {
458 OK
, now it
's time to run Wine. I will close down Wine for you after
459 the debugger is finished doing its thing.
461 print do_var($var21);
463 print "Hit enter to start Wine!\n";
471 if (!($outfile =~ /\//) and $outfile ne "no file") {
472 $outfile = "$nowdir/$outfile";
474 if (!($dbgoutfile =~ /\//) and $dbgoutfile ne "no file") {
475 $dbgoutfile = "$nowdir/$dbgoutfile";
477 if (!($tmpoutfile =~ /\//)) {
478 $tmpoutfile = "$nowdir/$tmpoutfile";
480 $SIG{CHLD}=$SIG{CLD}=sub { wait };
482 sub generate_outfile();
483 if ($dbgoutfile ne "no file") {
484 unlink("$dbgoutfile");
488 elsif (defined $pid) {
489 close(0);close(1);close(2);
490 exec "echo quit | WINEDEBUG=$debugopts $wineloc $extraops \"$program\" > $dbgoutfile 2>&1";
495 while (kill(0, $pid)) {
497 my $last = `tail -n 5 $dbgoutfile | grep Wine-dbg`;
498 if ($last =~ /Wine-dbg/) {
503 if ($outfile ne "no file
") {
504 $lastlines=`tail -n $lastnlines $dbgoutfile`;
505 system("gzip
$dbgoutfile");
509 system("gzip
$dbgoutfile");
512 elsif ($outfile ne "no file
" and $dbgoutfile eq "no file
") {
516 elsif (defined $pid) {
517 close(0);close(1);close(2);
518 exec "echo quit
| WINEDEBUG
=$debugopts $wineloc $extraops \"$program\" 2>&1| tee
$tmpoutfile | tail
-n
$lastnlines > $outfile";
523 print "$outfile $tmpoutfile";
524 while (kill(0, $pid)) {
526 my $last = `tail -n 5 $tmpoutfile | grep Wine-dbg`;
527 if ($last =~ /Wine-dbg/) {
533 open(OUTFILE, "$outfile");
543 I guess you don't want me to make any debugging output
. I
'll send
544 it to your terminal. This will be a *lot* of output -- hit enter to
545 continue, control-c to quit.
546 Repeat: this will be a lot of output!
548 print do_var($var27);
550 system("$wineloc WINEDEBUG=$debugopts $extraops \"$program\"");
552 sub generate_outfile() {
553 open(OUTFILE,">$outfile");
555 Auto-generated debug report by Wine Quick Debug Report Maker Tool:
556 WINE Version: $winever
557 Windows Version: $winver
559 Kernel Version: $kernelver
564 Program Type: $progbits
565 Debug Options: WINEDEBUG=$debugopts
566 Other Extra Commands Passed: $extraops
567 Extra ./configure Commands: $configopts
570 Last $lastnlines lines of debug output follows:
572 I have a copy of the full debug report, if it is needed.
577 Great
! We
're finished making the debug report. Please go to http://bugs.winehq.org
578 and enter it as a new bug. Check that nobody has already reported the same bug!
581 The filename for the formatted report is:
585 The filename for the compressed full debug is:
587 Note that it is $dbgoutfile.gz, since I compressed it with gzip for you.
590 If you have any problems with this bug reporting tool,
591 please submit a bug report to Wine bugtracking system at http://bugs.winehq.org
592 or tell the Wine newsgroup (comp.emulators.ms-windows.wine).
594 print do_var($var22);
595 print do_var($var28) if $outfile ne "no file";
596 print do_var($var29) if $dbgoutfile ne "no file";
597 print do_var($var30);