2 ##Wine Quick Debug Report Maker Thingy (WQDRMK)
5 ##Do not say this is yours without my express permisson, or I will
6 ##hunt you down and kill you like the savage animal I am.
7 ##Released under the WINE licence
9 ##August 29, 1999 - Work around for debugger exit (or lack thereof)
10 ## - Should now put debugging output in correct place
11 ##April 19, 1999 - Much nicer way to select wine's location
12 ## - Option to disable creation of a debugging output
13 ## - Now places debugging output where it was started
14 ##April 4, 1999 - Sanity check for file locations/wine strippedness
15 ## - Various code cleanups/fixes
16 ##March 21, 1999 - Bash 2.0 STDERR workaround (Thanks Ryan Cumming!)
17 ##March 1, 1999 - Check for stripped build
18 ##February 3, 1999 - Fix to chdir to the program's directory
19 ##February 1, 1999 - Cleaned up code
20 ##January 26, 1999 - Fixed various bugs...
21 ## - Made newbie mode easier
22 ##January 25, 1999 - Initial Release
23 ## -------------------------------------------
24 ##| IRCNET/UNDERNET: jazzfan AOL: Jazzrock12 |
25 ##| E-MAIL: magicbox@bestweb.net ICQ: 19617831|
26 ##| Utah Jazz Page @ http://www.gojazz.net |
27 ##| Wine Builds @ http://www.gojazz.net/wine |
28 ## -------------------------------------------
34 open STDERR
, ">&SAVEERR"; open STDERR
, ">&STDOUT";
35 $ENV{'SHELL'}="/bin/bash";
37 Enter your level of WINE expertise
: 1-newbie
2-intermediate
3-advanced
39 1 - Makes a debug report as
defined in the WINE documentation
. Best
40 for new WINE users
. If you
're not sure what -debugmsg is, then use
42 2 - Makes a debug report that is more customizable (Example: you can
43 choose what -debugmsg 's to
use). You are asked more
44 questions
in this mode
. May intimidate newbies
.
45 3 - Just like
2, but
not corner cutting
. Assumes you know what you
're
46 doing so it leaves out the long descriptions.
51 until ($debuglevel == 1 or $debuglevel == 2 or $debuglevel == 3) {
52 print "Enter a number from 1-3!\n";
56 if ($debuglevel < 3) {
58 This program will make a debug report for WINE developers. It does this
59 in two files. The first one has everything asked for by the bugreports
60 guide. The second has *all* of the debug output (This can go to
61 thousands of lines). To (hopefully) get the bug fixed, attach the first
62 file to a messsage sent to the comp.emulators.ms-windows.wine newsgroup.
63 The developers might ask you for "the last XX number of lines from the
64 report". If so, run the command:
65 gzip -d (output file)|tail -n (number of lines) > outfile
67 If you do not want to create one of the files, just type in "no file"
71 } elsif ($debuglevel =~ 3) {
73 This program will output to two files:
74 1. Formatted debug report you might want to post to the newsgroup
75 2. File with ALL the debug output (It will later be compressed with
76 gzip, so leave off the trailing .gz)
77 If you do not want to create one of the files, just type in "no file"
82 print "Enter filename for the formatted debug output (The first file):\n";
86 I don
't think you typed in the right filename. Let's try again
.
88 while ($outfile =~ /^(\s)*$/) {
93 print "Enter the filename for the full debug output (The second file):\n";
96 while ($dbgoutfile =~ /^(\s)*$/) {
102 Since you will only be creating the formatted report
, I will need a
103 temporary place to put the full output
.
104 You may
not enter
"no file" for this
.
105 Enter the filename
for the temporary file
:
107 if ($outfile ne "no file" and $dbgoutfile eq "no file") {
108 print do_var
($var31);
111 while (($tmpoutfile =~ /^(\s)*$/) or ($tmpoutfile eq "no file")) {
112 print do_var
($var23);
117 print "Looking for wine...\n";
118 $whereis=`whereis wine`;
120 print "Choose one of the following options:\n";
121 $whereis =~ s/^wine\: //;
122 @locations = split(/\s/,$whereis);
123 print "1. Unlisted (I'll prompt you for a new location\n";
124 print "2. Unsure (I'll use #3, that's probably it)\n";
126 foreach $location (@locations) {
128 print "$i. $location\n";
131 print "Enter the number that corresponds to wine's location:";
134 $yes = 1 if $wineloc == 1 or $wineloc == 2;
136 foreach $location (@locations) {
137 $yes = 1 if $wineloc eq $i++;
139 while ($yes ne "1") {
140 print "Enter the number the corresponds to wine's location:";
144 foreach $location (@locations) {
145 $yes = 1 if $wineloc eq $i++;
150 Enter the full path to wine
(Example
: /usr/bin
/wine
):
153 Please enter the full path to wine
. A full path is the
154 directories leading up to a program
's location, and then the
155 program. For example, if you had the program "wine" in the
156 directory "/usr/bin", you would type in "/usr/bin/wine". Now
159 print do_var($var25) if $debuglevel == 3;
160 print do_var($var26) if $debuglevel < 3;
163 while ($wineloc =~ /^(\s)*$/) {
164 print do_var($var23);
169 elsif ($wineloc == 2) {
170 $wineloc=$locations[0];
173 $wineloc=$locations[$wineloc-3];
177 print "Checking if $wineloc is stripped...\n";
178 $ifstrip = `nm $wineloc 2>&1`;
179 while ($ifstrip =~ /no symbols/) {
181 Your wine is stripped! You probably downloaded it off of the internet.
182 If you have another location of wine that may be used, enter it now.
183 Otherwise, hit control-c and download an unstripped version, then re-run
184 this script. Note: stripped versions make useless debug reports
186 print do_var($var24);
188 $ifstrip = `nm $wineloc 2>&1`;
190 while ($ifstrip =~ /not recognized/) {
192 Looks like you gave me something that isn't a wine binary
(It could be a
193 text file
). Try again
.
195 print do_var
($var26);
197 print "Checking if $wineloc is stripped...\n";
198 $ifstrip = `nm $wineloc 2>&1`;
201 What version of windows are you using with wine?
0-None
, 1-Win3
.x
,
202 2-Win95
, 3-Win98
, 4-WinNT3
.5x
, 5-WinNT4
.x
, 6-WinNT5
.x
, 7-Other
(Enter
207 until ($winver == 0 or $winver == 1 or $winver == 2 or $winver == 3 or $winver == 4 or $winver == 5 or $winver == 6 or $winver == 7) {
209 No
! Enter a number from
0 to
7 that corresponds to your windows version
!
216 $winver="None Installed";
217 } elsif ($winver =~ 1) {
218 $winver="Windows 3.x";
219 } elsif ($winver =~ 2) {
220 $winver="Windows 95";
221 } elsif ($winver =~ 3) {
222 $winver="Windows 98";
223 } elsif ($winver =~ 4) {
224 $winver="Windows NT 3.5x";
225 } elsif ($winver =~ 5) {
226 $winver="Windows NT 4.x";
227 } elsif ($winver =~ 6) {
228 $winver="Windows NT 5.x";
229 } elsif ($winver =~ 7) {
230 print "OK. What version of Windows are you using?\n";
234 if ($debuglevel < 3) {
236 Enter the full path to the program you want to run
. Remember what you
237 were told before
- a full path is the directories leading up to the
238 program
and then the program
's name, like /dos/windows/sol.exe, not
243 if ($debuglevel =~ 3) {
245 Enter the full path to the program you want to run (Example:
246 /dos/windows/sol.exe, NOT sol.exe):
252 while ($program =~ /^(\s)*$/) {
253 print do_var($var23);
259 Enter the name, version, and manufacturer of the program (Example:
260 Netscape Navigator 4.5):
266 Enter 0 if your program is 16 bit (Windows 3.x), 1 if your program is 32
267 bit (Windows 9x, NT3.x and up), or 2 if you are unsure:
269 print do_var($var10);
272 until ($progbits == 0 or $progbits == 1 or $progbits == 2) {
273 print "You must enter 0, 1 or 2!\n";
277 if ($progbits =~ 0) {
279 } elsif ($progbits =~ 1) {
284 if ($debuglevel > 1) {
285 if ($debuglevel =~ 2) {
287 Enter any extra debug options. Default is +relay - If you don't
288 know what options to
use, just hit enter
, and I
'll use those (Example, the
289 developer tells you to re-run with -debugmsg +dosfs,+module you would type
290 in +dosfs,+module). Hit enter if you're
not sure what to
do:
292 print do_var
($var11);
293 } elsif ($debuglevel =~ 3) {
295 Enter any debug options you would like to
use. Just enter parts after
296 -debugmsg
. Default is
+relay
:
298 print do_var
($var12);
302 if ($debugopts =~ /-debugmsg /) {
303 ($crap, $debugopts) = split / /,$debugopts;
305 if ($debugopts =~ /^\s*$/) {
308 } elsif ($debuglevel =~ 1) {
309 $debugopts = "+relay";
311 if ($debuglevel > 1) {
312 if ($debuglevel =~ 2) {
314 How many trailing lines of debugging info
do you want to include
in the report
315 you
're going to submit (First file)? If a developer asks you to include
316 the last 1000 lines, enter 1000 here. Default is 200, which is reached by
317 pressing enter. (If you're
not sure
, just hit enter
):
319 print do_var
($var13);
320 } elsif ($debuglevel =~ 3) {
322 Enter how many lines of trailing debugging output you want
in your nice
323 formatted report
. Default is
200:
325 print do_var
($var14);
329 if ($lastnlines =~ /^\s*$/) {
332 } elsif ($debuglevel =~ 1) {
335 if ($debuglevel > 1) {
337 Enter any extra options you want to pass to WINE
. Strongly recommended you
340 print do_var
($var15);
343 } elsif ($debuglevel =~ 1) {
344 $extraops="-managed";
346 print "Enter your distribution name (Example: Redhat 5.0):\n";
349 if ($debuglevel > 1) {
350 if ($debuglevel =~ 2) {
352 When you ran
./configure to build wine
, were there any special options
353 you used to
do so
(Example
: --enable
-dll
)? If you didn
't use any special
354 options or didn't compile WINE on your own
, just hit enter
:
356 print do_var
($var16);
357 } elsif ($debuglevel =~ 3) {
359 Enter any special options you used
when running
./configure
for WINE
360 (Default is none
, use if you didn
't compile wine yourself):
362 print do_var($var17);
366 if ($configopts =~ /^\s*$/) {
369 } elsif ($debuglevel =~ 1) {
372 if ($debuglevel > 1) {
373 if ($debuglevel =~ 2) {
375 Is your wine version CVS or from a .tar.gz file? As in... did you download it
376 off a website/ftpsite or did you/have you run cvs on it to update it?
377 For CVS: YYMMDD, where YY is the year (99), MM is the month (01), and DD
378 is the day (14), that you last updated it (Example: 990114).
379 For tar.gz: Just hit enter and I'll figure out the version
for you
:
381 print do_var
($var18);
382 } elsif ($debuglevel =~ 3) {
384 Is your wine from CVS? Enter the
last CVS update date
for it here
, in
385 YYMMDD form
(If it
's from a tarball, just hit enter):
387 print do_var($var19);
391 if ($winever =~ /[0-9]+/) {
395 $winever = `$wineloc -v 2>&1`;
398 } elsif ($debuglevel =~ 1) {
399 $winever=`$wineloc -v 2>&1`;
402 $gccver=`gcc -v 2>&1`;
403 ($leftover,$gccver) = split /\n/,$gccver;
407 $kernelver=`uname -r`;
411 $wineneeds=`ldd $wineloc`;
412 if ($debuglevel < 3) {
414 OK, now I'm going to run WINE
. I will
close it
for you once the wine
415 debugger comes up
. NOTE
: You won
't see ANY debug messages. Don't
416 worry
, they are being output to a file
. Since there are so many
, it
's
417 not a good idea to have them all output to a terminal (Speed slowdown
419 WINE will still run much slower than normal, because there will be so
420 many debug messages being output to file.
422 print do_var($var20);
423 } elsif ($debuglevel =~ 3) {
425 OK, now it's
time to run WINE
. I will
close down WINE
for you after
426 the debugger is finished doing its thing
.
428 print do_var
($var21);
430 $bashver=qw("/bin/bash -version");
431 if ($bashver =~ /2\./) { $outflags = "2>" }
432 else { $outflags = ">\&" }
433 print "Hit enter to start wine!\n";
441 if (!($outfile =~ /\//) and $outfile ne "no file") {
442 $outfile = "$nowdir/$outfile";
444 if (!($dbgoutfile =~ /\//) and $dbgoutfile ne "no file") {
445 $dbgoutfile = "$nowdir/$dbgoutfile";
447 if (!($tmpoutfile =~ /\//)) {
448 $tmpoutfile = "$nowdir/$tmpoutfile";
450 $SIG{CHLD
}=$SIG{CLD
}=sub { wait };
451 if ($dbgoutfile ne "no file") {
452 unlink("$dbgoutfile");
455 elsif (defined $pid) {
456 close(0);close(1);close(2);
457 exec "echo quit | $wineloc -debugmsg $debugopts $extraops \"$program\" > $dbgoutfile 2>&1";
462 while (kill(0, $pid)) {
464 $last = `tail -n 5 $dbgoutfile | grep Wine-dbg`;
465 if ($last =~ /Wine-dbg/) {
470 if ($outfile ne "no file") {
471 $lastlines=`tail -n $lastnlines $dbgoutfile`;
472 system("gzip $dbgoutfile");
476 system("gzip $dbgoutfile");
479 elsif ($outfile ne "no file" and $dbgoutfile eq "no file") {
482 elsif (defined $pid) {
483 close(0);close(1);close(2);
484 exec "echo quit | $wineloc -debugmsg $debugopts $extraops \"$program\" 2>&1| tee $tmpoutfile | tail -n $lastnlines > $outfile";
489 print "$outfile $tmpoutfile";
490 while (kill(0, $pid)) {
492 $last = `tail -n 5 $tmpoutfile | grep Wine-dbg`;
493 if ($last =~ /Wine-dbg/) {
499 open(OUTFILE
, "$outfile");
509 I guess you don
't want me to make any debugging output. I'll
send
510 it to your terminal
. This will be a
*lot
* of output
-- hit enter to
511 continue, control
-c to quit
.
512 Repeat
: this will be a lot of output
!
514 print do_var
($var27);
516 system("$wineloc -debugmsg $debugmsg $extraops \"$program\"");
518 sub generate_outfile
{
519 open(OUTFILE
,">$outfile");
521 Auto-generated debug report by Wine Quick Debug Report Maker Thingy:
522 WINE Version: $winever
523 Windows Version: $winver
525 Kernel Version: $kernelver
530 Program Type: $progbits
531 Debug Options: -debugmsg $debugopts
532 Other Extra Commands Passed: $extraops
533 Extra ./configure Commands: $configopts
536 Last $lastnlines lines of debug output follows:
538 I have a copy of the full debug report, if it is needed.
543 Great
! We
're finished making the debug report. Do whatever with it.
546 The filename for the formatted report is:
550 The filename for the compressed full debug is:
552 Note that it is $dbgoutfile.gz, since I compressed it with gzip for you.
555 Having problems with the script? Tell the wine newsgroup
556 (comp.emulators.ms-windows.wine).
558 print do_var($var22);
559 print do_var($var28) if $outfile ne "no file";
560 print do_var($var29) if $dbgoutfile ne "no file";
561 print do_var($var30);