- New implementation of SendMessage, ReceiveMessage, ReplyMessage functions
[wine] / tools / bug_report.pl
1 #!/usr/bin/perl
2 ##Wine Quick Debug Report Maker Thingy (WQDRMK)
3 ##By Adam the Jazz Guy
4 ##(c) 1998
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
8 ##Changelog: 
9 ##February 3, 1999 - Fix to chdir to the program's directory
10 ##February 1, 1999 - Cleaned up code
11 ##January 26, 1999 - Fixed various bugs...
12 ##                 - Made newbie mode easier
13 ##January 25, 1999 - Initial Release
14 ## -------------------------------------------
15 ##| IRCNET/UNDERNET: jazzfan AOL: Jazzrock12  |
16 ##| E-MAIL: magicbox@bestweb.net ICQ: 19617831|
17 ##|   Utah Jazz Page @ http://www.gojazz.net  |
18 ##|  Wine Builds @ http://www.gojazz.net/wine |
19 ## -------------------------------------------
20 sub do_var {
21         $var=$_[0];
22         $var =~ s/\t//g;
23         return $var;
24 }
25 open STDERR, ">&SAVEERR"; open STDERR, ">&STDOUT"; 
26 $ENV{'SHELL'}="/bin/bash";
27 $var0 = qq{
28         Enter your level of WINE expertise: 1-newbie 2-intermediate 3-advanced
29         
30         1 - Makes a debug report as defined in the WINE documentation. Best
31         for new WINE users. If you're not sure what -debugmsg is, then use
32         this mode.
33         2 - Makes a debug report that is more customizable (Example: you can
34         choose what -debugmsg 's to use). You are asked more
35         questions in this mode. May intimidate newbies.
36         3 - Just like 2, but not corner cutting. Assumes you know what you're
37         doing so it leaves out the long descriptions.
38 };
39 print do_var($var0);
40 $debuglevel=<STDIN>;
41 chomp $debuglevel;
42 until ($debuglevel < 4) {
43         print "Enter a number from 1-3!\n"; 
44         $debuglevel=<STDIN>;
45         chomp $debuglevel;
46
47 if ($debuglevel < 3) {
48         $var1 = qq{
49         This program will make a debug report for WINE developers. It does this
50         in two files. The first one has everything asked for by the bugreports
51         guide. The second has *all* of the debug output (This can go to
52         thousands of lines). To (hopefully) get the bug fixed, attach the first
53         file to a messsage sent to the comp.emulators.ms-windows.wine newsgroup.
54         The developers might ask you for "the last XX number of lines from the
55         report". If so, post the second file (It will be compressed with gzip 
56         later, so leave off the .gz). If you feel like it, post both files at the
57         same time. I don't care. 
58         };
59         print do_var($var1);
60 } elsif ($debuglevel =~ 3) {
61         $var2 = qq{
62         This program will output to two files:
63         1. Formatted debug report you might want to post to the newsgroup
64         2. File with ALL the debug output (It will later be compressed with
65         gzip, so leave off the trailing .gz)
66         };
67         print do_var($var2);
68 }
69 print "Enter the filename for this debug report (The first file):\n";
70 $outfile=<STDIN>;
71 chomp $outfile;
72 print "Enter the file for the debug output (The second file):\n";
73 $dbgoutfile=<STDIN>;
74 chomp $dbgoutfile;
75 if ($debuglevel =~ 1) {
76         print "Looking for wine...\n";
77         $wineloc=`which wine`;
78         chomp $wineloc;
79         if ($wineloc =~ "") {
80                 print "Couldn't find wine...\n";
81                 $var3 = qq{
82                 Enter the full path to wine. The path should look like
83                 /path/to/wine/wine. Get it? It's the directories leading up to the
84                 wine file, and then the actual wine file (Example: /home/wine/wine):
85                 };
86                 print do_var($var3);
87         $wineloc=<STDIN>;
88         chomp $wineloc; 
89         } else {
90                 print "Found wine: $wineloc\n"
91         } 
92 }
93 if ($debuglevel > 1) {
94         if ($debuglevel =~ 2) {
95                 $var4 = qq{
96                 Enter the full path to wine. The path should look like
97                 /path/to/wine/wine. Get it? It's the directories leading up to the
98                 wine file, and then the actual wine file (Example: /home/wine/wine):
99                 };
100                 print do_var($var4);
101         } elsif ($debuglevel =~ 3) {
102                 print "Enter the full path to wine (Example: /home/wine/wine):\n";
103         }
104         $wineloc=<STDIN>;
105         chomp $wineloc; 
106 }
107 $var5 = qq{
108 What version of windows are you using with wine? 0-None, 1-Win3.x,
109 2-Win95, 3-Win98, 4-WinNT3.5x, 5-WinNT4.x, 6-WinNT5.x, 7-Other (Enter
110 0-7):
111 };
112 print do_var($var5);
113 $winver=<STDIN>; 
114 until ($winver < 7) {
115         $var6 = qq{
116         No! Enter a number from 0 to 7 that corresponds to your windows version! 
117         };
118         print do_var($var6);
119         $winver=<STDIN>; 
120 }
121 chomp $winver; 
122 if ($winver =~ 0) { 
123         $winver="None Installed"; 
124 } elsif ($winver =~ 1) { 
125         $winver="Windows 3.x"; 
126 } elsif ($winver =~ 2) { 
127         $winver="Windows 95"; 
128 } elsif ($winver =~ 3) { 
129         $winver="Windows 98"; 
130 } elsif ($winver =~ 4) { 
131         $winver="Windows NT 3.5x"; 
132 } elsif ($winver =~ 5) { 
133         $winver="Windows NT 4.x"; 
134 } elsif ($winver =~ 6) { 
135         $winver="Windows NT 5.x"; 
136 } elsif ($winver =~ 7) { 
137         print "OK. What version of Windows are you using?\n";
138         $winver=<STDIN>; 
139         chomp $winver; 
140 }
141 if ($debuglevel < 3) {
142         $var7 = qq{
143         Enter the full path to the program you want to run. Remember what you
144         were told before - a full path is the directories leading up to the
145         program and then the program's name, like /dos/windows/sol.exe, not
146         sol.exe:
147         };
148         print do_var($var7);
149 }
150 if ($debuglevel =~ 3) {
151         $var8 = qq{
152         Enter the full path to the program you want to run (Example: 
153         /dos/windows/sol.exe, NOT sol.exe): 
154         };
155         print do_var($var8);
156
157 $program=<STDIN>;
158 chomp $program;
159 $var9 = qq{
160 Enter the name, version, and manufacturer of the program (Example:
161 Netscape Navigator 4.5):
162 };
163 print do_var($var9);
164 $progname=<STDIN>;
165 chomp $progname;
166 $var10 = qq{
167 Enter 0 if your program is 16 bit (Windows 3.x), 1 if your program is 32
168 bit (Windows 9x, NT3.x and up), or 2 if you are unsure:
169 };
170 print do_var($var10);
171 $progbits=<STDIN>;
172 chomp $progbits;
173 until ($progbits < 3) {
174         print "You must enter 0, 1 or 2!\n";
175         $progbits=<STDIN>;
176         chomp $progbits 
177 }
178 if ($progbits =~ 0) { 
179         $progbits=Win16
180 } elsif ($progbits =~ 1) { 
181         $progbits=Win32 
182 } else { 
183         $progbits = "Unsure" 
184
185 if ($debuglevel > 1) {
186         if ($debuglevel =~ 2) {
187                 $var11 = qq{
188                 Enter any extra debug options. Default is +relay - If you don't
189                 know what options to use, just hit enter, and I'll use those (Example, the
190                 developer tells you to re-run with -debugmsg +dosfs,+module you would type
191                 in +dosfs,+module). Hit enter if you're not sure what to do:
192                 };
193                 print do_var($var11);
194         } elsif ($debuglevel =~ 3) {
195                 $var12 = qq{
196                 Enter any debug options you would like to use. Just enter parts after
197                 -debugmsg. Default is +relay:
198                 };
199                 print do_var($var12);
200         }
201         $debugopts=<STDIN>;
202         chomp $debugopts;
203         if ($debugopts=~/-debugmsg /) {
204                 ($crap, $debugopts) = / /,$debugopts; 
205         }
206         if ($debugopts=~/^\s*$/) { 
207                 $debugopts="+relay"; 
208         } 
209 } elsif ($debuglevel =~ 1) {
210         $debugopts = "+relay"; 
211
212 if ($debuglevel > 1) {
213         if ($debuglevel =~ 2) {
214                 $var13 = qq{
215                 How many trailing lines of debugging info do you want to include in the report
216                 you're going to submit (First file)? If a developer asks you to include
217                 the last 200 lines, enter 200 here. Default is 100, which is reached by
218                 pressing enter. (If you're not sure, just hit enter):
219                 };
220                 print do_var($var13);
221         } elsif ($debuglevel =~ 3) {
222                 $var14 = qq{
223                 Enter how many lines of trailing debugging output you want in your nice
224                 formatted report. Default is 100:
225                 };
226                 print do_var($var14);
227         }
228         $lastnlines=<STDIN>;
229         chomp $lastnlines;
230         if ($lastnlines=~/^\s*$/) { 
231         $lastnlines=100; 
232         } 
233 } elsif ($debuglevel =~ 1) {
234         $lastnlines=100; 
235 }
236 if ($debuglevel > 1) { 
237         $var15 = qq{
238         Enter any extra options you want to pass to WINE. Strongly recommended you
239         include -managed:
240         };
241         print do_var($var15);
242         $extraops=<STDIN>;
243         chomp $extraops;
244 } elsif ($debuglevel =~ 1) {
245         $extraops="-managed";
246 }
247 print "Enter your distribution name (Example: Redhat 5.0):\n";
248 $dist=<STDIN>;
249 chomp $dist;
250 if ($debuglevel > 1) {
251         if ($debuglevel =~ 2) {
252                 $var16 = qq{
253                 When you ran ./configure to build wine, were there any special options
254                 you used to do so (Example: --enable-dll)? If you didn't use any special
255                 options or didn't compile WINE on your own, just hit enter:
256                 };
257                 print do_var($var16);
258         } elsif ($debuglevel =~ 3) {
259                 $var17 = qq{
260                 Enter any special options you used when running ./configure for WINE
261                 (Default is none, use if you didn't compile wine yourself):
262                 };
263                 print do_var($var17);
264         }
265         $configopts=<STDIN>;
266         chomp $configopts;
267         if ($configopts=~/\s*/) { 
268         $configopts="None"; 
269         } 
270 } elsif ($debuglevel =~ 1) {
271         $configopts="None"; 
272 }
273 if ($debuglevel > 1) {
274         if ($debuglevel =~ 2) {
275                 $var18 = qq{
276                 Is your wine version CVS or from a .tar.gz file? As in... did you download it
277                 off a website/ftpsite or did you/have you run cvs on it to update it?
278                 For CVS: YYMMDD, where YY is the year (99), MM is the month (01), and DD
279                 is the day (14), that you last updated it (Example: 990114). 
280                 For tar.gz: Just hit enter and I'll figure out the version for you:
281                 };
282                 print do_var($var18);
283         } elsif ($debuglevel =~ 3) {
284                 $var19 = qq{
285                 Is your wine from CVS? Enter the last CVS update date for it here, in
286                 YYMMDD form (If it's from a tarball, just hit enter):
287                 };
288                 print do_var($var19);
289         }
290         $winever=<STDIN>;
291         chomp $winever;
292         $winever=~s/ //g;
293         if ($winever=~/[0-9]+/) {  
294                 $winever .= " CVS";
295         }
296         else {
297                 $winever = `$wineloc -v 2>&1`;
298                 chomp $winever;
299         } 
300 } elsif ($debuglevel =~ 1) {
301         $winever=`$wineloc -v 2>&1`;
302         chomp $winever;
303 }
304 $gccver=`gcc -v 2>&1`;
305 ($leftover,$gccver) = split /\n/,$gccver;
306 chomp $gccver;
307 $cpu=`uname -m`;
308 chomp $cpu;
309 $kernelver=`uname -r`;
310 chomp $kernelver;
311 $ostype=`uname -s`;
312 chomp $ostype;
313 $wineneeds=`ldd $wineloc`;
314 if ($debuglevel < 3) {
315         $var20 = qq{
316         OK, now I'm going to run WINE. I will close it for you once the wine
317         debugger comes up. NOTE: You won't see ANY debug messages. Don't
318         worry, they are being output to a file. Since there are so many, it's
319         not a good idea to have them all output to a terminal (Speed slowdown 
320         mainly).
321         WINE will still run much slower than normal, because there will be so
322         many debug messages being output to file. 
323         };
324         print do_var($var20);
325 } elsif ($debuglevel =~ 3) {
326         $var21 = qq{
327         OK, now it's time to run WINE. I will close down WINE for you after
328         the debugger is finished doing its thing.
329         };
330         print do_var($var21);
331 }
332 print "Hit enter to start wine!\n";
333 $blank=<STDIN>;
334 $dir=$program;
335 $dir=~m#(.*)/#;
336 $dir=$1;
337 chdir($dir);
338 system("echo quit|$wineloc -debugmsg $debugopts $extraops \"$program\" >& $dbgoutfile");
339 $lastlines=`tail -n $lastnlines $dbgoutfile`;
340 system("gzip $dbgoutfile");
341 open(OUTFILE,">$outfile");
342 print OUTFILE <<EOM;
343 Auto-generated debug report by Wine Quick Debug Report Maker Thingy:
344 WINE Version:                $winever
345 Windows Version:             $winver
346 Distribution:                $dist
347 Kernel Version:              $kernelver
348 OS Type:                     $ostype
349 CPU:                         $cpu
350 GCC Version:                 $gccver
351 Program:                     $progname
352 Program Type:                $progbits
353 Debug Options:               -debugmsg $debugopts
354 Other Extra Commands Passed: $extraops
355 Extra ./configure Commands:  $configopts
356 Wine Dependencies: 
357 $wineneeds
358 Last $lastnlines lines of debug output follows:
359 $lastlines
360 I have a copy of the full debug report, if it is needed.
361 Thank you!
362 EOM
363 $var22 = qq{
364 Great! We're finished making the debug report. Do whatever with it. The
365 filename for it is:
366 $outfile
367 The filename for the compressed full debug is:
368 $dbgoutfile.gz
369 Note that it is $dbgoutfile.gz, since I compressed it with gzip for you.
370 C Ya!
371 Adam the Jazz Guy
372 };
373 print do_var($var22);
374
375