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, attach the first file to a messsage
78 sent to the comp.emulators.ms-windows.wine newsgroup. The developers
79 might ask you for "the last X lines from the report". If so, just
80 provide the output of the following command:
81 gzip -d (output file) | tail -n (X) > outfile
82 If you do not want to create one of the files, just specify "no file".
85 } elsif ($debuglevel =~ 3) {
87 This program will output to two files:
88 1. Formatted debug report you might want to post to the newsgroup
89 2. File with ALL the debug output (It will later be compressed with
90 gzip, so leave off the trailing .gz)
91 If you do not want to create one of the files, just type in "no file"
97 print "\nFilename for the formatted debug report: ";
101 I don't think you typed in the right filename. Let's try again.
103 while ($outfile =~ /^(\s)*$/) {
104 print do_var($var23);
109 print "Filename for full debug output: ";
112 while ($dbgoutfile =~ /^(\s)*$/) {
113 print do_var($var23);
119 Since you will only be creating the formatted report, I will need a
120 temporary place to put the full output.
121 You may not enter "no file" for this.
122 Enter the filename for the temporary file:
124 if ($outfile ne "no file" and $dbgoutfile eq "no file") {
125 print do_var($var31);
128 while (($tmpoutfile =~ /^(\s)*$/) or ($tmpoutfile eq "no file")) {
129 print do_var($var23);
135 $whereis=`whereis wine`;
137 print "\nWhere is your copy of Wine located?\n\n";
138 $whereis =~ s/^wine\: //;
139 @locations = split(/\s/,$whereis);
140 print "1 - Unlisted (I'll prompt you for a new location\n";
141 print "2 - Unsure (I'll use #3, that's probably it)\n";
143 foreach $location (@locations) {
145 print "$i - $location\n";
151 print "Enter the number that corresponds to Wine's location: ";
155 while ( ! ( $wineloc >=1 and $wineloc <= 2+@locations ) );
158 Enter the full path to wine (Example: /usr/bin/wine):
161 Please enter the full path to wine. A full path is the
162 directories leading up to a program's location, and then the
163 program. For example, if you had the program "wine" in the
164 directory "/usr/bin", you would type in "/usr/bin/wine". Now
167 print do_var($var25) if $debuglevel == 3;
168 print do_var($var26) if $debuglevel < 3;
171 while ($wineloc =~ /^(\s)*$/) {
172 print do_var($var23);
177 elsif ($wineloc == 2) {
178 $wineloc=$locations[0];
181 $wineloc=$locations[$wineloc-3];
185 print "Checking if $wineloc is stripped...\n";
186 $ifstrip = `nm $wineloc 2>&1`;
187 while ($ifstrip =~ /no symbols/) {
189 Your wine is stripped! You probably downloaded it off of the internet.
190 If you have another location of wine that may be used, enter it now.
191 Otherwise, hit control-c and download an unstripped version, then re-run
192 this script. Note: stripped versions make useless debug reports
194 print do_var($var24);
196 $ifstrip = `nm $wineloc 2>&1`;
198 while ($ifstrip =~ /not recognized/) {
200 Looks like you gave me something that isn't a wine binary (It could be a
201 text file). Try again.
203 print do_var($var26);
205 print "Checking if $wineloc is stripped...\n";
206 $ifstrip = `nm $wineloc 2>&1`;
209 print "\nWhat version of windows are you using with wine?\n\n".
214 "4 - Windows NT 3.5x\n".
215 "5 - Windows NT4.x\n".
216 "6 - Windows 2000\n".
220 print "Enter the number that corresponds to your windows version: ";
224 until ($winver >= 0 and $winver <= 7);
226 $winver="None Installed";
227 } elsif ($winver =~ 1) {
228 $winver="Windows 3.x";
229 } elsif ($winver =~ 2) {
230 $winver="Windows 95";
231 } elsif ($winver =~ 3) {
232 $winver="Windows 98";
233 } elsif ($winver =~ 4) {
234 $winver="Windows NT 3.5x";
235 } elsif ($winver =~ 5) {
236 $winver="Windows NT 4.x";
237 } elsif ($winver =~ 6) {
238 $winver="Windows NT 5.x";
239 } elsif ($winver =~ 7) {
240 print "What version of Windows are you using? ";
244 if ($debuglevel < 3) {
246 Enter the full path to the program you want to run. Remember what you
247 were told before - a full path is the directories leading up to the
248 program and then the program's name, like /dos/windows/sol.exe, not
253 if ($debuglevel =~ 3) {
255 Enter the full path to the program you want to run (Example:
256 /dos/windows/sol.exe, NOT sol.exe):
262 while ($program =~ /^(\s)*$/) {
263 print do_var($var23);
269 Enter the name, version, and manufacturer of the program (Example:
270 Netscape Navigator 4.5):
276 Enter 0 if your program is 16 bit (Windows 3.x), 1 if your program is 32
277 bit (Windows 9x, NT3.x and up), or 2 if you are unsure:
279 print do_var($var10);
282 until ($progbits == 0 or $progbits == 1 or $progbits == 2) {
283 print "You must enter 0, 1 or 2!\n";
287 if ($progbits =~ 0) {
289 } elsif ($progbits =~ 1) {
294 if ($debuglevel > 1) {
295 if ($debuglevel =~ 2) {
297 Enter any extra debug options. Default is +relay - If you don't
298 know what options to use, just hit enter, and I'll use those (Example, the
299 developer tells you to re-run with -debugmsg +dosfs,+module you would type
300 in +dosfs,+module). Hit enter if you're not sure what to do:
302 print do_var($var11);
303 } elsif ($debuglevel =~ 3) {
305 Enter any debug options you would like to use. Just enter parts after
306 -debugmsg. Default is +relay:
308 print do_var($var12);
312 if ($debugopts =~ /-debugmsg /) {
313 ($crap, $debugopts) = split / /,$debugopts;
315 if ($debugopts =~ /^\s*$/) {
318 } elsif ($debuglevel =~ 1) {
319 $debugopts = "+relay";
321 if ($debuglevel > 1) {
322 if ($debuglevel =~ 2) {
324 How many trailing lines of debugging info do you want to include in the report
325 you're going to submit (First file)? If a developer asks you to include
326 the last 1000 lines, enter 1000 here. Default is 200, which is reached by
327 pressing enter. (If you're not sure, just hit enter):
329 print do_var($var13);
330 } elsif ($debuglevel =~ 3) {
332 Enter how many lines of trailing debugging output you want in your nice
333 formatted report. Default is 200:
335 print do_var($var14);
339 if ($lastnlines =~ /^\s*$/) {
342 } elsif ($debuglevel =~ 1) {
345 if ($debuglevel > 1) {
347 Enter any extra options you want to pass to WINE. Strongly recommended you
350 print do_var($var15);
353 } elsif ($debuglevel =~ 1) {
354 $extraops="-managed";
357 print "\nEnter the name of your distribution (Example: Redhat 6.1): ";
361 if ($debuglevel > 1) {
362 if ($debuglevel =~ 2) {
364 When you ran ./configure to build wine, were there any special options
365 you used to do so (Example: --enable-dll)? If you didn't use any special
366 options or didn't compile WINE on your own, just hit enter:
368 print do_var($var16);
369 } elsif ($debuglevel =~ 3) {
371 Enter any special options you used when running ./configure for WINE
372 (Default is none, use if you didn't compile wine yourself):
374 print do_var($var17);
378 if ($configopts =~ /^\s*$/) {
381 } elsif ($debuglevel =~ 1) {
384 if ($debuglevel > 1) {
385 if ($debuglevel =~ 2) {
387 Is your wine version CVS or from a .tar.gz file? As in... did you download it
388 off a website/ftpsite or did you/have you run cvs on it to update it?
389 For CVS: YYMMDD, where YY is the year (99), MM is the month (01), and DD
390 is the day (14), that you last updated it (Example: 990114).
391 For tar.gz: Just hit enter and I'll figure out the version for you:
393 print do_var($var18);
394 } elsif ($debuglevel =~ 3) {
396 Is your wine from CVS? Enter the last CVS update date for it here, in
397 YYMMDD form (If it's from a tarball, just hit enter):
399 print do_var($var19);
403 if ($winever =~ /[0-9]+/) {
407 $winever = `$wineloc -v 2>&1`;
410 } elsif ($debuglevel =~ 1) {
411 $winever=`$wineloc -v 2>&1`;
414 $gccver=`gcc -v 2>&1`;
415 ($leftover,$gccver) = split /\n/,$gccver;
419 $kernelver=`uname -r`;
423 $wineneeds=`ldd $wineloc`;
424 if ($debuglevel < 3) {
426 OK, now I'm going to run WINE. I will close it for you once the wine
427 debugger comes up. NOTE: You won't see ANY debug messages. Don't
428 worry, they are being output to a file. Since there are so many, it's
429 not a good idea to have them all output to a terminal (Speed slowdown
431 WINE will still run much slower than normal, because there will be so
432 many debug messages being output to file.
434 print do_var($var20);
435 } elsif ($debuglevel =~ 3) {
437 OK, now it's time to run WINE. I will close down WINE for you after
438 the debugger is finished doing its thing.
440 print do_var($var21);
442 $bashver=qw("/bin/bash -version");
443 if ($bashver =~ /2\./) { $outflags = "2>" }
444 else { $outflags = ">\&" }
445 print "Hit enter to start wine!\n";
453 if (!($outfile =~ /\//) and $outfile ne "no file") {
454 $outfile = "$nowdir/$outfile";
456 if (!($dbgoutfile =~ /\//) and $dbgoutfile ne "no file") {
457 $dbgoutfile = "$nowdir/$dbgoutfile";
459 if (!($tmpoutfile =~ /\//)) {
460 $tmpoutfile = "$nowdir/$tmpoutfile";
462 $SIG{CHLD}=$SIG{CLD}=sub { wait };
463 if ($dbgoutfile ne "no file") {
464 unlink("$dbgoutfile");
467 elsif (defined $pid) {
468 close(0);close(1);close(2);
469 exec "echo quit | $wineloc -debugmsg $debugopts $extraops \"$program\" > $dbgoutfile 2>&1";
474 while (kill(0, $pid)) {
476 $last = `tail -n 5 $dbgoutfile | grep Wine-dbg`;
477 if ($last =~ /Wine-dbg/) {
482 if ($outfile ne "no file") {
483 $lastlines=`tail -n $lastnlines $dbgoutfile`;
484 system("gzip $dbgoutfile");
488 system("gzip $dbgoutfile");
491 elsif ($outfile ne "no file" and $dbgoutfile eq "no file") {
494 elsif (defined $pid) {
495 close(0);close(1);close(2);
496 exec "echo quit | $wineloc -debugmsg $debugopts $extraops \"$program\" 2>&1| tee $tmpoutfile | tail -n $lastnlines > $outfile";
501 print "$outfile $tmpoutfile";
502 while (kill(0, $pid)) {
504 $last = `tail -n 5 $tmpoutfile | grep Wine-dbg`;
505 if ($last =~ /Wine-dbg/) {
511 open(OUTFILE, "$outfile");
521 I guess you don't want me to make any debugging output. I'll send
522 it to your terminal. This will be a *lot* of output -- hit enter to
523 continue, control-c to quit.
524 Repeat: this will be a lot of output!
526 print do_var($var27);
528 system("$wineloc -debugmsg $debugmsg $extraops \"$program\"");
530 sub generate_outfile {
531 open(OUTFILE,">$outfile");
533 Auto-generated debug report by Wine Quick Debug Report Maker Thingy:
534 WINE Version: $winever
535 Windows Version: $winver
537 Kernel Version: $kernelver
542 Program Type: $progbits
543 Debug Options: -debugmsg $debugopts
544 Other Extra Commands Passed: $extraops
545 Extra ./configure Commands: $configopts
548 Last $lastnlines lines of debug output follows:
550 I have a copy of the full debug report, if it is needed.
555 Great! We're finished making the debug report. Do whatever with it.
558 The filename for the formatted report is:
562 The filename for the compressed full debug is:
564 Note that it is $dbgoutfile.gz, since I compressed it with gzip for you.
567 Having problems with the script? Tell the wine newsgroup
568 (comp.emulators.ms-windows.wine).
570 print do_var($var22);
571 print do_var($var28) if $outfile ne "no file";
572 print do_var($var29) if $dbgoutfile ne "no file";
573 print do_var($var30);