2 ##Wine Quick Debug Report Maker Thingy (WQDRMK)
3 ## Copyright (c) 1998-1999 Adam Sacarny
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 ## This library is free software; you can redistribute it and/or
11 ## modify it under the terms of the GNU Lesser General Public
12 ## License as published by the Free Software Foundation; either
13 ## version 2.1 of the License, or (at your option) any later version.
15 ## This library is distributed in the hope that it will be useful,
16 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ## Lesser General Public License for more details.
20 ## You should have received a copy of the GNU Lesser General Public
21 ## License along with this library; if not, write to the Free Software
22 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 ##August 29, 1999 - Work around for debugger exit (or lack thereof)
26 ## - Should now put debugging output in correct place
27 ##April 19, 1999 - Much nicer way to select Wine's location
28 ## - Option to disable creation of a debugging output
29 ## - Now places debugging output where it was started
30 ##April 4, 1999 - Sanity check for file locations/wine strippedness
31 ## - Various code cleanups/fixes
32 ##March 21, 1999 - Bash 2.0 STDERR workaround (Thanks Ryan Cumming!)
33 ##March 1, 1999 - Check for stripped build
34 ##February 3, 1999 - Fix to chdir to the program's directory
35 ##February 1, 1999 - Cleaned up code
36 ##January 26, 1999 - Fixed various bugs...
37 ## - Made newbie mode easier
38 ##January 25, 1999 - Initial Release
39 ## -------------------------------------------
40 ##| IRCNET/UNDERNET: jazzfan AOL: Jazzrock12 |
41 ##| E-MAIL: magicbox@bestweb.net ICQ: 19617831|
42 ##| Utah Jazz Page @ http://www.gojazz.net |
43 ##| Wine Builds @ http://www.gojazz.net/wine |
44 ## -------------------------------------------
50 open STDERR
, ">&SAVEERR"; open STDERR
, ">&STDOUT";
51 $ENV{'SHELL'}="/bin/bash";
53 What is your level of Wine expertise?
1-newbie
2-intermediate
3-advanced
55 1 - Makes a debug report as
defined in the Wine documentation
. Best
56 for new Wine users
. If you
're not sure what -debugmsg is, then
58 2 - Makes a debug report that is more customizable (Example: you can
59 choose what -debugmsg 's to
use). You are asked more questions
in
60 this mode
. May intimidate newbies
.
61 3 - Just like
2, but
not corner cutting
. Assumes you know what you
're
62 doing so it leaves out the long descriptions.
64 print do_var($var0)."\n";
65 until ($debuglevel >= 1 and $debuglevel <= 3) {
66 print "Enter your level of Wine expertise (1-3): ";
71 if ($debuglevel < 3) {
73 This program will make a debug report for Wine developers. It generates
74 two files. The first one has everything asked for by the bugreports guide;
75 the second has *all* of the debug output, which can go to thousands of
77 To (hopefully) get the bug fixed, report it to the project
78 bug tracking system at http://bugs.winehq.com.
79 Attach the first file to the bug description.
80 Also include detailed description of the problem. The developers
81 might ask you for "the last X lines from the report". If so, just
82 provide the output of the following command:
83 gzip -d (output file) | tail -n (X) > outfile
84 If you do not want to create one of the files, just specify "no file".
87 } elsif ($debuglevel =~ 3) {
89 This program will output to two files:
90 1. Formatted debug report you might want to post to the newsgroup
91 2. File with ALL the debug output (It will later be compressed with
92 gzip, so leave off the trailing .gz)
93 If you do not want to create one of the files, just type in "no file"
99 print "\nFilename for the formatted debug report: ";
103 I don
't think you typed in the right filename. Let's try again
.
105 while ($outfile =~ /^(\s)*$/) {
106 print do_var
($var23);
111 print "Filename for full debug output: ";
114 while ($dbgoutfile =~ /^(\s)*$/) {
115 print do_var
($var23);
121 Since you will only be creating the formatted report
, I will need a
122 temporary place to put the full output
.
123 You may
not enter
"no file" for this
.
124 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 $whereis=`whereis wine`;
139 print "\nWhere is your copy of Wine located?\n\n";
140 $whereis =~ s/^wine\: //;
141 @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 $location (@locations) {
147 print "$i - $location\n";
153 print "Enter the number that corresponds to Wine's location: ";
157 while ( ! ( $wineloc >=1 and $wineloc <= 2+@locations ) );
160 Enter the full path to wine
(Example
: /usr/bin
/wine
):
163 Please enter the full path to wine
. A full path is the
164 directories leading up to a program
's location, and then the
165 program. For example, if you had the program "wine" in the
166 directory "/usr/bin", you would type in "/usr/bin/wine". Now
169 print do_var($var25) if $debuglevel == 3;
170 print do_var($var26) if $debuglevel < 3;
173 while ($wineloc =~ /^(\s)*$/) {
174 print do_var($var23);
179 elsif ($wineloc == 2) {
180 $wineloc=$locations[0];
183 $wineloc=$locations[$wineloc-3];
187 print "Checking if $wineloc is stripped...\n";
188 $ifstrip = `nm $wineloc 2>&1`;
189 while ($ifstrip =~ /no symbols/) {
191 Your wine is stripped! You probably downloaded it off of the internet.
192 If you have another location of wine that may be used, enter it now.
193 Otherwise, hit control-c and download an unstripped version, then re-run
194 this script. Note: stripped versions make useless debug reports
196 print do_var($var24);
198 $ifstrip = `nm $wineloc 2>&1`;
200 while ($ifstrip =~ /not recognized/) {
202 Looks like you gave me something that isn't a Wine binary
(It could be a
203 text file
). Try again
.
205 print do_var
($var26);
207 print "Checking if $wineloc is stripped...\n";
208 $ifstrip = `nm $wineloc 2>&1`;
211 print "\nWhat version of Windows are you using with Wine?\n\n".
216 "4 - Windows NT 3.5x\n".
217 "5 - Windows NT4.x\n".
218 "6 - Windows 2000\n".
223 print "Enter the number that corresponds to your Windows version: ";
227 until ($winver >= 0 and $winver <= 7);
229 $winver="None Installed";
230 } elsif ($winver =~ 1) {
231 $winver="Windows 3.x";
232 } elsif ($winver =~ 2) {
233 $winver="Windows 95";
234 } elsif ($winver =~ 3) {
235 $winver="Windows 98";
236 } elsif ($winver =~ 4) {
237 $winver="Windows NT 3.5x";
238 } elsif ($winver =~ 5) {
239 $winver="Windows NT 4.x";
240 } elsif ($winver =~ 6) {
241 $winver="Windows 2000";
242 } elsif ($winver =~ 7) {
243 $winver="Windows XP";
244 } elsif ($winver =~ 8) {
245 print "What version of Windows are you using? ";
249 if ($debuglevel < 3) {
251 Enter the full path to the program you want to run
. Remember what you
252 were told before
- a full path is the directories leading up to the
253 program
and then the program
's name, like /dos/windows/sol.exe, not
258 if ($debuglevel =~ 3) {
260 Enter the full path to the program you want to run (Example:
261 /dos/windows/sol.exe, NOT sol.exe):
267 while ($program =~ /^(\s)*$/) {
268 print do_var($var23);
274 Enter the name, version, and manufacturer of the program (Example:
275 Netscape Navigator 4.5):
281 Enter 0 if your program is 16 bit (Windows 3.x), 1 if your program is 32
282 bit (Windows 9x, NT3.x and up), or 2 if you are unsure:
284 print do_var($var10);
287 until ($progbits == 0 or $progbits == 1 or $progbits == 2) {
288 print "You must enter 0, 1 or 2!\n";
292 if ($progbits =~ 0) {
294 } elsif ($progbits =~ 1) {
299 if ($debuglevel > 1) {
300 if ($debuglevel =~ 2) {
302 Enter any extra debug options. Default is +relay - If you don't
303 know what options to
use, just hit enter
, and I
'll use those (Example, the
304 developer tells you to re-run with -debugmsg +dosfs,+module you would type
305 in +dosfs,+module). Hit enter if you're
not sure what to
do:
307 print do_var
($var11);
308 } elsif ($debuglevel =~ 3) {
310 Enter any debug options you would like to
use. Just enter parts after
311 -debugmsg
. Default is
+relay
:
313 print do_var
($var12);
317 if ($debugopts =~ /-debugmsg /) {
318 ($crap, $debugopts) = split / /,$debugopts;
320 if ($debugopts =~ /^\s*$/) {
323 } elsif ($debuglevel =~ 1) {
324 $debugopts = "+relay";
326 if ($debuglevel > 1) {
327 if ($debuglevel =~ 2) {
329 How many trailing lines of debugging info
do you want to include
in the report
330 you
're going to submit (First file)? If a developer asks you to include
331 the last 15000 lines, enter 15000 here. Default is 3000, which is reached by
332 pressing enter. (If you're
not sure
, just hit enter
):
334 print do_var
($var13);
335 } elsif ($debuglevel =~ 3) {
337 Enter how many lines of trailing debugging output you want
in your nice
338 formatted report
. Default is
3000:
340 print do_var
($var14);
344 if ($lastnlines =~ /^\s*$/) {
347 } elsif ($debuglevel =~ 1) {
350 if ($debuglevel > 1) {
352 Enter any extra options you want to pass to Wine
.
354 print do_var
($var15);
357 } elsif ($debuglevel =~ 1) {
361 print "\nEnter the name of your distribution (Example: RedHat 6.1): ";
365 if ($debuglevel > 1) {
366 if ($debuglevel =~ 2) {
368 When you ran
./configure to build wine
, were there any special options
369 you used to
do so
(Example
: --enable
-dll
)? If you didn
't use any special
370 options or didn't compile Wine on your own
, just hit enter
:
372 print do_var
($var16);
373 } elsif ($debuglevel =~ 3) {
375 Enter any special options you used
when running
./configure
for Wine
376 (Default is none
, use if you didn
't compile Wine yourself):
378 print do_var($var17);
382 if ($configopts =~ /^\s*$/) {
385 } elsif ($debuglevel =~ 1) {
388 if ($debuglevel > 1) {
389 if ($debuglevel =~ 2) {
391 Is your Wine version CVS or from a .tar.gz file? As in... did you download it
392 off a website/ftpsite or did you/have you run cvs on it to update it?
393 For CVS: YYMMDD, where YY is the year (99), MM is the month (01), and DD
394 is the day (14), that you last updated it (Example: 990114).
395 For tar.gz: Just hit enter and I'll figure out the version
for you
:
397 print do_var
($var18);
398 } elsif ($debuglevel =~ 3) {
400 Is your Wine from CVS? Enter the
last CVS update date
for it here
, in
401 YYMMDD form
(If it
's from a tarball, just hit enter):
403 print do_var($var19);
407 if ($winever =~ /[0-9]+/) {
411 $winever = `$wineloc -v 2>&1`;
414 } elsif ($debuglevel =~ 1) {
415 $winever=`$wineloc -v 2>&1`;
418 $gccver=`gcc -v 2>&1`;
419 ($leftover,$gccver) = split /\n/,$gccver;
423 $kernelver=`uname -r`;
427 $wineneeds=`ldd $wineloc`;
428 if ($debuglevel < 3) {
430 OK, now I'm going to run Wine
. I will
close it
for you once the Wine
431 debugger comes up
. NOTE
: You won
't see ANY debug messages. Don't
432 worry
, they are being output to a file
. Since there are so many
, it
's
433 not a good idea to have them all output to a terminal (Speed slowdown
435 Wine will still run much slower than normal, because there will be so
436 many debug messages being output to file.
438 print do_var($var20);
439 } elsif ($debuglevel =~ 3) {
441 OK, now it's
time to run Wine
. I will
close down Wine
for you after
442 the debugger is finished doing its thing
.
444 print do_var
($var21);
446 $bashver=qw("/bin/bash -version");
447 if ($bashver =~ /2\./) { $outflags = "2>" }
448 else { $outflags = ">\&" }
449 print "Hit enter to start Wine!\n";
457 if (!($outfile =~ /\//) and $outfile ne "no file") {
458 $outfile = "$nowdir/$outfile";
460 if (!($dbgoutfile =~ /\//) and $dbgoutfile ne "no file") {
461 $dbgoutfile = "$nowdir/$dbgoutfile";
463 if (!($tmpoutfile =~ /\//)) {
464 $tmpoutfile = "$nowdir/$tmpoutfile";
466 $SIG{CHLD
}=$SIG{CLD
}=sub { wait };
467 if ($dbgoutfile ne "no file") {
468 unlink("$dbgoutfile");
471 elsif (defined $pid) {
472 close(0);close(1);close(2);
473 exec "echo quit | $wineloc -debugmsg $debugopts $extraops \"$program\" > $dbgoutfile 2>&1";
478 while (kill(0, $pid)) {
480 $last = `tail -n 5 $dbgoutfile | grep Wine-dbg`;
481 if ($last =~ /Wine-dbg/) {
486 if ($outfile ne "no file") {
487 $lastlines=`tail -n $lastnlines $dbgoutfile`;
488 system("gzip $dbgoutfile");
492 system("gzip $dbgoutfile");
495 elsif ($outfile ne "no file" and $dbgoutfile eq "no file") {
498 elsif (defined $pid) {
499 close(0);close(1);close(2);
500 exec "echo quit | $wineloc -debugmsg $debugopts $extraops \"$program\" 2>&1| tee $tmpoutfile | tail -n $lastnlines > $outfile";
505 print "$outfile $tmpoutfile";
506 while (kill(0, $pid)) {
508 $last = `tail -n 5 $tmpoutfile | grep Wine-dbg`;
509 if ($last =~ /Wine-dbg/) {
515 open(OUTFILE
, "$outfile");
525 I guess you don
't want me to make any debugging output. I'll
send
526 it to your terminal
. This will be a
*lot
* of output
-- hit enter to
527 continue, control
-c to quit
.
528 Repeat
: this will be a lot of output
!
530 print do_var
($var27);
532 system("$wineloc -debugmsg $debugmsg $extraops \"$program\"");
534 sub generate_outfile
{
535 open(OUTFILE
,">$outfile");
537 Auto-generated debug report by Wine Quick Debug Report Maker Thingy:
538 WINE Version: $winever
539 Windows Version: $winver
541 Kernel Version: $kernelver
546 Program Type: $progbits
547 Debug Options: -debugmsg $debugopts
548 Other Extra Commands Passed: $extraops
549 Extra ./configure Commands: $configopts
552 Last $lastnlines lines of debug output follows:
554 I have a copy of the full debug report, if it is needed.
559 Great
! We
're finished making the debug report. Do whatever with it.
562 The filename for the formatted report is:
566 The filename for the compressed full debug is:
568 Note that it is $dbgoutfile.gz, since I compressed it with gzip for you.
571 Having problems with the script?
572 Submit a bug report to Wine bugtracking system at http://bugs.winehq.com or
573 tell the Wine newsgroup (comp.emulators.ms-windows.wine).
575 print do_var($var22);
576 print do_var($var28) if $outfile ne "no file";
577 print do_var($var29) if $dbgoutfile ne "no file";
578 print do_var($var30);