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