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