blob: 2e3df36ba1fcb59deca0aa02e8e482c4248fa948 [file] [log] [blame]
Adam the Jazz Guyc1761621999-01-26 17:22:15 +00001#!/usr/bin/perl
2##Wine Quick Debug Report Maker Thingy (WQDRMK)
Ivan Leo Murray-Smith709cc312003-11-26 05:05:17 +00003## Copyright (c) 1998-1999 Adam Sacarny jazz@cscweb.net ICQ: 19617831
Adam the Jazz Guyc1761621999-01-26 17:22:15 +00004##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.
Gerald Pfeifer9217b662000-03-15 19:04:25 +00006##
7## Improvements by Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
8## (c) 2000
9##
Ivan Leo Murray-Smith62437ad2004-03-27 20:42:34 +000010## A few improovements and updates here and there
Ivan Leo Puoti3e42f692004-05-27 02:25:13 +000011## Copyright 2003-2004 Ivan Leo Puoti
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +000012##
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000013## This library is free software; you can redistribute it and/or
14## modify it under the terms of the GNU Lesser General Public
15## License as published by the Free Software Foundation; either
16## version 2.1 of the License, or (at your option) any later version.
17##
18## This library is distributed in the hope that it will be useful,
19## but WITHOUT ANY WARRANTY; without even the implied warranty of
20## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21## Lesser General Public License for more details.
22##
23## You should have received a copy of the GNU Lesser General Public
24## License along with this library; if not, write to the Free Software
25## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Gerald Pfeifer9217b662000-03-15 19:04:25 +000026##
Alexandre Julliard7cae5582002-06-01 02:55:48 +000027##Changelog:
Adam Sacarny9f1d5a71999-09-10 13:53:20 +000028##August 29, 1999 - Work around for debugger exit (or lack thereof)
29## - Should now put debugging output in correct place
Francois Gouget75721482003-01-05 01:08:56 +000030##April 19, 1999 - Much nicer way to select Wine's location
Adam Sacarnyc85f0991999-04-25 09:20:40 +000031## - Option to disable creation of a debugging output
32## - Now places debugging output where it was started
Adam Sacarny833e47d1999-04-06 06:59:49 +000033##April 4, 1999 - Sanity check for file locations/wine strippedness
34## - Various code cleanups/fixes
Adam Sacarny733c1241999-03-22 12:39:49 +000035##March 21, 1999 - Bash 2.0 STDERR workaround (Thanks Ryan Cumming!)
36##March 1, 1999 - Check for stripped build
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +000037##February 3, 1999 - Fix to chdir to the program's directory
38##February 1, 1999 - Cleaned up code
Adam the Jazz Guy5a8cd241999-01-28 09:55:51 +000039##January 26, 1999 - Fixed various bugs...
40## - Made newbie mode easier
41##January 25, 1999 - Initial Release
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +000042sub do_var {
43 $var=$_[0];
44 $var =~ s/\t//g;
45 return $var;
46}
Alexandre Julliard7cae5582002-06-01 02:55:48 +000047open STDERR, ">&SAVEERR"; open STDERR, ">&STDOUT";
Adam the Jazz Guy5a8cd241999-01-28 09:55:51 +000048$ENV{'SHELL'}="/bin/bash";
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +000049$var0 = qq{
Francois Gouget75721482003-01-05 01:08:56 +000050 What is your level of Wine expertise? 1-newbie 2-intermediate 3-advanced
Alexandre Julliard7cae5582002-06-01 02:55:48 +000051
Francois Gouget75721482003-01-05 01:08:56 +000052 1 - Makes a debug report as defined in the Wine documentation. Best
Ivan Leo Murray-Smith62437ad2004-03-27 20:42:34 +000053 for new Wine users. If you're not sure what WINEDEBUG is, then
Gerald Pfeifer9217b662000-03-15 19:04:25 +000054 use this mode.
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +000055 2 - Makes a debug report that is more customizable (Example: you can
Ivan Leo Murray-Smith62437ad2004-03-27 20:42:34 +000056 choose what WINEDEBUG to use). You are asked more questions in
Gerald Pfeifer9217b662000-03-15 19:04:25 +000057 this mode. May intimidate newbies.
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +000058 3 - Just like 2, but not corner cutting. Assumes you know what you're
Gerald Pfeifer9217b662000-03-15 19:04:25 +000059 doing so it leaves out the long descriptions.
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +000060};
Gerald Pfeifer9217b662000-03-15 19:04:25 +000061print do_var($var0)."\n";
Gerald Pfeifer92d76bd2000-03-17 15:07:52 +000062until ($debuglevel >= 1 and $debuglevel <= 3) {
Francois Gouget75721482003-01-05 01:08:56 +000063 print "Enter your level of Wine expertise (1-3): ";
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +000064 $debuglevel=<STDIN>;
65 chomp $debuglevel;
Alexandre Julliard7cae5582002-06-01 02:55:48 +000066}
Gerald Pfeifer9217b662000-03-15 19:04:25 +000067
Adam the Jazz Guyc1761621999-01-26 17:22:15 +000068if ($debuglevel < 3) {
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +000069 $var1 = qq{
Francois Gouget75721482003-01-05 01:08:56 +000070 This program will make a debug report for Wine developers. It generates
Gerald Pfeiferf4c902c2000-03-24 19:48:05 +000071 two files. The first one has everything asked for by the bugreports guide;
72 the second has *all* of the debug output, which can go to thousands of
73 lines.
Andriy Palamarchuk1827e7d12002-05-08 23:14:19 +000074 To (hopefully) get the bug fixed, report it to the project
Dimitrie O. Paunc0232542003-11-26 03:55:01 +000075 bug tracking system at http://bugs.winehq.org.
Andriy Palamarchuk1827e7d12002-05-08 23:14:19 +000076 Attach the first file to the bug description.
77 Also include detailed description of the problem. The developers
Gerald Pfeiferf4c902c2000-03-24 19:48:05 +000078 might ask you for "the last X lines from the report". If so, just
79 provide the output of the following command:
80 gzip -d (output file) | tail -n (X) > outfile
81 If you do not want to create one of the files, just specify "no file".
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +000082 };
83 print do_var($var1);
84} elsif ($debuglevel =~ 3) {
85 $var2 = qq{
86 This program will output to two files:
87 1. Formatted debug report you might want to post to the newsgroup
88 2. File with ALL the debug output (It will later be compressed with
89 gzip, so leave off the trailing .gz)
Adam Sacarnyc85f0991999-04-25 09:20:40 +000090 If you do not want to create one of the files, just type in "no file"
91 and I'll skip it.
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +000092 };
93 print do_var($var2);
Adam the Jazz Guyc1761621999-01-26 17:22:15 +000094}
Gerald Pfeiferf4c902c2000-03-24 19:48:05 +000095
96print "\nFilename for the formatted debug report: ";
Adam the Jazz Guyc1761621999-01-26 17:22:15 +000097$outfile=<STDIN>;
98chomp $outfile;
Adam Sacarny833e47d1999-04-06 06:59:49 +000099$var23 = qq{
100I don't think you typed in the right filename. Let's try again.
101};
102while ($outfile =~ /^(\s)*$/) {
103 print do_var($var23);
104 $outfile=<STDIN>;
105 chomp $outfile;
106}
Gerald Pfeiferf4c902c2000-03-24 19:48:05 +0000107
108print "Filename for full debug output: ";
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000109$dbgoutfile=<STDIN>;
110chomp $dbgoutfile;
Adam Sacarny833e47d1999-04-06 06:59:49 +0000111while ($dbgoutfile =~ /^(\s)*$/) {
112 print do_var($var23);
113 $dbgoutfile=<STDIN>;
114 chomp $dbgoutfile;
115}
Gerald Pfeiferf4c902c2000-03-24 19:48:05 +0000116
Adam Sacarny9f1d5a71999-09-10 13:53:20 +0000117$var31 = qq{
118Since you will only be creating the formatted report, I will need a
119temporary place to put the full output.
120You may not enter "no file" for this.
121Enter the filename for the temporary file:
122};
123if ($outfile ne "no file" and $dbgoutfile eq "no file") {
124 print do_var($var31);
125 $tmpoutfile=<STDIN>;
126 chomp $tmpoutfile;
127 while (($tmpoutfile =~ /^(\s)*$/) or ($tmpoutfile eq "no file")) {
128 print do_var($var23);
129 $tmpoutfile=<STDIN>;
130 chomp $tmpoutfile;
131 }
132}
Gerald Pfeifer9217b662000-03-15 19:04:25 +0000133
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000134$whereis=`whereis wine`;
135chomp $whereis;
Gerald Pfeifer92d76bd2000-03-17 15:07:52 +0000136print "\nWhere is your copy of Wine located?\n\n";
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000137$whereis =~ s/^wine\: //;
138@locations = split(/\s/,$whereis);
Gerald Pfeifer92d76bd2000-03-17 15:07:52 +0000139print "1 - Unlisted (I'll prompt you for a new location\n";
140print "2 - Unsure (I'll use #3, that's probably it)\n";
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000141$i=2;
142foreach $location (@locations) {
143 $i++;
Gerald Pfeifer92d76bd2000-03-17 15:07:52 +0000144 print "$i - $location\n";
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000145}
Gerald Pfeifer92d76bd2000-03-17 15:07:52 +0000146print "\n";
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000147sub select_wineloc {
Gerald Pfeifer92d76bd2000-03-17 15:07:52 +0000148 do
149 {
Gerald Pfeiferf4c902c2000-03-24 19:48:05 +0000150 print "Enter the number that corresponds to Wine's location: ";
151 $wineloc=<STDIN>;
152 chomp $wineloc;
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000153 }
Gerald Pfeiferf4c902c2000-03-24 19:48:05 +0000154 while ( ! ( $wineloc >=1 and $wineloc <= 2+@locations ) );
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000155 if ($wineloc == 1) {
156 $var25 = qq{
157 Enter the full path to wine (Example: /usr/bin/wine):
158 };
159 $var26 = qq{
160 Please enter the full path to wine. A full path is the
161 directories leading up to a program's location, and then the
162 program. For example, if you had the program "wine" in the
163 directory "/usr/bin", you would type in "/usr/bin/wine". Now
164 try:
165 };
166 print do_var($var25) if $debuglevel == 3;
167 print do_var($var26) if $debuglevel < 3;
168 $wineloc=<STDIN>;
169 chomp $wineloc;
170 while ($wineloc =~ /^(\s)*$/) {
171 print do_var($var23);
172 $wineloc=<STDIN>;
173 chomp $wineloc;
174 }
175 }
176 elsif ($wineloc == 2) {
177 $wineloc=$locations[0];
178 }
179 else {
180 $wineloc=$locations[$wineloc-3];
181 }
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000182}
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000183&select_wineloc;
Adam Sacarny733c1241999-03-22 12:39:49 +0000184print "Checking if $wineloc is stripped...\n";
185$ifstrip = `nm $wineloc 2>&1`;
Adam Sacarny833e47d1999-04-06 06:59:49 +0000186while ($ifstrip =~ /no symbols/) {
187 $var24 = qq{
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000188 Your wine is stripped! Stripped versions make useless debug reports
Adam Sacarny833e47d1999-04-06 06:59:49 +0000189 If you have another location of wine that may be used, enter it now.
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000190 Otherwise, hit control-c and download an unstripped (Debug) version, then re-run
191 this script.
Adam Sacarny833e47d1999-04-06 06:59:49 +0000192 };
193 print do_var($var24);
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000194 &select_wineloc;
195 $ifstrip = `nm $wineloc 2>&1`;
196}
197while ($ifstrip =~ /not recognized/) {
198 $var26 = qq{
Francois Gouget75721482003-01-05 01:08:56 +0000199 Looks like you gave me something that isn't a Wine binary (It could be a
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000200 text file). Try again.
201 };
202 print do_var($var26);
203 &select_wineloc;
204 print "Checking if $wineloc is stripped...\n";
Adam Sacarny833e47d1999-04-06 06:59:49 +0000205 $ifstrip = `nm $wineloc 2>&1`;
Adam Sacarny733c1241999-03-22 12:39:49 +0000206}
Gerald Pfeiferf4c902c2000-03-24 19:48:05 +0000207
Francois Gouget75721482003-01-05 01:08:56 +0000208print "\nWhat version of Windows are you using with Wine?\n\n".
Gerald Pfeiferf4c902c2000-03-24 19:48:05 +0000209 "0 - None\n".
210 "1 - Windows 3.x\n".
211 "2 - Windows 95\n".
212 "3 - Windows 98\n".
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000213 "4 - Windows ME\n".
214 "5 - Windows NT 3.5x\n".
215 "6 - Windows NT4.x\n".
216 "7 - Windows 2000\n".
217 "8 - Windows XP\n".
218 "9 - Windows Server 2003\n".
219 "10 - Other\n\n";
Gerald Pfeiferf4c902c2000-03-24 19:48:05 +0000220do
221 {
Francois Gouget75721482003-01-05 01:08:56 +0000222 print "Enter the number that corresponds to your Windows version: ";
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000223 $winver=<STDIN>;
224 chomp $winver;
Gerald Pfeiferf4c902c2000-03-24 19:48:05 +0000225 }
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000226until ($winver >= 0 and $winver <= 10);
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000227if ($winver =~ 0) {
228 $winver="None Installed";
229} elsif ($winver =~ 1) {
230 $winver="Windows 3.x";
231} elsif ($winver =~ 2) {
232 $winver="Windows 95";
233} elsif ($winver =~ 3) {
234 $winver="Windows 98";
235} elsif ($winver =~ 4) {
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000236 $winver="Windows ME";
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000237} elsif ($winver =~ 5) {
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000238 $winver="Windows NT 3.5x";
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000239} elsif ($winver =~ 6) {
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000240 $winver="Windows NT 4.x";
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000241} elsif ($winver =~ 7) {
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000242 $winver="Windows 2000";
Andreas Mohr3e7628e2003-01-02 17:53:26 +0000243} elsif ($winver =~ 8) {
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000244 $winver="Windows XP";
245} elsif ($winver =~ 9) {
246 $winver="Windows Server 2003";
247} elsif ($winver =~ 10) {
Gerald Pfeiferf4c902c2000-03-24 19:48:05 +0000248 print "What version of Windows are you using? ";
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000249 $winver=<STDIN>;
250 chomp $winver;
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000251}
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000252if ($debuglevel < 3) {
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000253 $var7 = qq{
254 Enter the full path to the program you want to run. Remember what you
255 were told before - a full path is the directories leading up to the
256 program and then the program's name, like /dos/windows/sol.exe, not
257 sol.exe:
258 };
259 print do_var($var7);
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000260}
261if ($debuglevel =~ 3) {
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000262 $var8 = qq{
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000263 Enter the full path to the program you want to run (Example:
264 /dos/windows/sol.exe, NOT sol.exe):
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000265 };
266 print do_var($var8);
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000267}
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000268$program=<STDIN>;
269chomp $program;
Adam Sacarny833e47d1999-04-06 06:59:49 +0000270while ($program =~ /^(\s)*$/) {
271 print do_var($var23);
272 $program=<STDIN>;
273 chomp $program;
274}
275$program =~ s/\"//g;
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000276$var9 = qq{
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000277Enter the name, version, and manufacturer of the program (Example:
278Netscape Navigator 4.5):
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000279};
280print do_var($var9);
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000281$progname=<STDIN>;
282chomp $progname;
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000283$var10 = qq{
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000284Enter 1 if your program is 16 bit (Windows 3.x), 2 if your program is 32
285bit (Windows 95, NT3.x and up), or 3 if you are unsure:
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000286};
287print do_var($var10);
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000288$progbits=<STDIN>;
289chomp $progbits;
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000290until ($progbits == 1 or $progbits == 2 or $progbits == 3) {
291 print "You must enter 1, 2 or 3!\n";
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000292 $progbits=<STDIN>;
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000293 chomp $progbits
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000294}
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000295if ($progbits =~ 1) {
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000296 $progbits=Win16
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000297} elsif ($progbits =~ 2) {
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000298 $progbits=Win32
299} else {
300 $progbits = "Unsure"
301}
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000302if ($debuglevel > 1) {
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000303 if ($debuglevel =~ 2) {
304 $var11 = qq{
305 Enter any extra debug options. Default is +relay - If you don't
306 know what options to use, just hit enter, and I'll use those (Example, the
Ivan Leo Murray-Smith62437ad2004-03-27 20:42:34 +0000307 developer tells you to re-run with WINEDEBUG=+dosfs,+module you would type
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000308 in +dosfs,+module). Hit enter if you're not sure what to do:
309 };
310 print do_var($var11);
311 } elsif ($debuglevel =~ 3) {
312 $var12 = qq{
313 Enter any debug options you would like to use. Just enter parts after
Ivan Leo Murray-Smith62437ad2004-03-27 20:42:34 +0000314 WINEDEBUG. Default is +relay:
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000315 };
316 print do_var($var12);
317 }
318 $debugopts=<STDIN>;
319 chomp $debugopts;
Ivan Leo Murray-Smith709cc312003-11-26 05:05:17 +0000320 if ($debugopts =~ /--debugmsg /) {
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000321 ($crap, $debugopts) = split / /,$debugopts;
Ivan Leo Murray-Smith6a1ce962004-03-31 00:55:25 +0000322 if ($debugopts =~ /WINEDEBUG= /) {
Ivan Leo Murray-Smith62437ad2004-03-27 20:42:34 +0000323 ($crap, $debugopts) = split / /,$debugopts;
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000324 }
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000325 if ($debugopts =~ /^\s*$/) {
326 $debugopts="+relay";
327 }
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000328} elsif ($debuglevel =~ 1) {
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000329 $debugopts = "+relay";
330}
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000331if ($debuglevel > 1) {
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000332 if ($debuglevel =~ 2) {
333 $var13 = qq{
334 How many trailing lines of debugging info do you want to include in the report
335 you're going to submit (First file)? If a developer asks you to include
Andreas Mohr3e7628e2003-01-02 17:53:26 +0000336 the last 15000 lines, enter 15000 here. Default is 3000, which is reached by
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000337 pressing enter. (If you're not sure, just hit enter):
338 };
339 print do_var($var13);
340 } elsif ($debuglevel =~ 3) {
341 $var14 = qq{
342 Enter how many lines of trailing debugging output you want in your nice
Andreas Mohr3e7628e2003-01-02 17:53:26 +0000343 formatted report. Default is 3000:
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000344 };
345 print do_var($var14);
346 }
347 $lastnlines=<STDIN>;
348 chomp $lastnlines;
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000349 if ($lastnlines =~ /^\s*$/) {
Andreas Mohr3e7628e2003-01-02 17:53:26 +0000350 $lastnlines=3000;
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000351 }
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000352} elsif ($debuglevel =~ 1) {
Andreas Mohr3e7628e2003-01-02 17:53:26 +0000353 $lastnlines=3000;
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000354}
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000355if ($debuglevel > 1) {
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000356 $var15 = qq{
Francois Gouget75721482003-01-05 01:08:56 +0000357 Enter any extra options you want to pass to Wine.
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000358 };
359 print do_var($var15);
360 $extraops=<STDIN>;
361 chomp $extraops;
362} elsif ($debuglevel =~ 1) {
Tony Lambregts04274792002-05-30 20:08:26 +0000363 $extraops=" ";
Adam the Jazz Guy5a8cd241999-01-28 09:55:51 +0000364}
Gerald Pfeiferf4c902c2000-03-24 19:48:05 +0000365
Ivan Leo Murray-Smith62437ad2004-03-27 20:42:34 +0000366print "\nEnter the name of your distribution (Example: RedHat 9.0): ";
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000367$dist=<STDIN>;
368chomp $dist;
Gerald Pfeiferf4c902c2000-03-24 19:48:05 +0000369
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000370if ($debuglevel > 1) {
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000371 if ($debuglevel =~ 2) {
372 $var16 = qq{
373 When you ran ./configure to build wine, were there any special options
374 you used to do so (Example: --enable-dll)? If you didn't use any special
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000375 options or didn't compile Wine yourself, just hit enter:
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000376 };
377 print do_var($var16);
378 } elsif ($debuglevel =~ 3) {
379 $var17 = qq{
Francois Gouget75721482003-01-05 01:08:56 +0000380 Enter any special options you used when running ./configure for Wine
381 (Default is none, use if you didn't compile Wine yourself):
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000382 };
383 print do_var($var17);
384 }
385 $configopts=<STDIN>;
386 chomp $configopts;
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000387 if ($configopts =~ /^\s*$/) {
388 $configopts="None";
389 }
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000390} elsif ($debuglevel =~ 1) {
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000391 $configopts="None";
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000392}
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000393if ($debuglevel > 1) {
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000394 if ($debuglevel =~ 2) {
395 $var18 = qq{
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000396 Is your Wine version CVS or from a .tar.gz or RPM file? As in... did you download it
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000397 off a website/ftpsite or did you/have you run cvs on it to update it?
Ivan Leo Murray-Smith62437ad2004-03-27 20:42:34 +0000398 For CVS: YYYYMMDD, where YYYY is the year (2004), MM is the month (03), and DD
399 is the day (09), that you last updated it (Example: 20040309).
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000400 For tar.gz and RPM: Just hit enter and I'll figure out the version for you:
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000401 };
402 print do_var($var18);
403 } elsif ($debuglevel =~ 3) {
404 $var19 = qq{
Francois Gouget75721482003-01-05 01:08:56 +0000405 Is your Wine from CVS? Enter the last CVS update date for it here, in
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000406 YYYYMMDD form (If it's from a tarball or RPM, just hit enter):
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000407 };
408 print do_var($var19);
409 }
410 $winever=<STDIN>;
411 chomp $winever;
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000412 if ($winever =~ /[0-9]+/) {
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000413 $winever .= " CVS";
414 }
415 else {
416 $winever = `$wineloc -v 2>&1`;
417 chomp $winever;
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000418 }
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000419} elsif ($debuglevel =~ 1) {
420 $winever=`$wineloc -v 2>&1`;
421 chomp $winever;
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000422}
423$gccver=`gcc -v 2>&1`;
424($leftover,$gccver) = split /\n/,$gccver;
425chomp $gccver;
426$cpu=`uname -m`;
427chomp $cpu;
428$kernelver=`uname -r`;
429chomp $kernelver;
430$ostype=`uname -s`;
431chomp $ostype;
432$wineneeds=`ldd $wineloc`;
433if ($debuglevel < 3) {
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000434 $var20 = qq{
Francois Gouget75721482003-01-05 01:08:56 +0000435 OK, now I'm going to run Wine. I will close it for you once the Wine
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000436 debugger comes up. NOTE: You won't see ANY debug messages. Don't
437 worry, they are being output to a file. Since there are so many, it's
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000438 not a good idea to have them all output to a terminal (Speed slowdown
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000439 mainly).
Francois Gouget75721482003-01-05 01:08:56 +0000440 Wine will still run much slower than normal, because there will be so
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000441 many debug messages being output to file.
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000442 };
443 print do_var($var20);
444} elsif ($debuglevel =~ 3) {
445 $var21 = qq{
Francois Gouget75721482003-01-05 01:08:56 +0000446 OK, now it's time to run Wine. I will close down Wine for you after
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000447 the debugger is finished doing its thing.
448 };
449 print do_var($var21);
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000450}
Adam Sacarny733c1241999-03-22 12:39:49 +0000451$bashver=qw("/bin/bash -version");
452if ($bashver =~ /2\./) { $outflags = "2>" }
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000453else { $outflags = ">\&" }
Francois Gouget75721482003-01-05 01:08:56 +0000454print "Hit enter to start Wine!\n";
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000455$blank=<STDIN>;
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000456$dir=$program;
457$dir=~m#(.*)/#;
458$dir=$1;
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000459use Cwd;
460$nowdir=getcwd;
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000461chdir($dir);
Adam Sacarny9f1d5a71999-09-10 13:53:20 +0000462if (!($outfile =~ /\//) and $outfile ne "no file") {
463 $outfile = "$nowdir/$outfile";
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000464}
Adam Sacarny9f1d5a71999-09-10 13:53:20 +0000465if (!($dbgoutfile =~ /\//) and $dbgoutfile ne "no file") {
466 $dbgoutfile = "$nowdir/$dbgoutfile";
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000467}
Adam Sacarny9f1d5a71999-09-10 13:53:20 +0000468if (!($tmpoutfile =~ /\//)) {
469 $tmpoutfile = "$nowdir/$tmpoutfile";
470}
471$SIG{CHLD}=$SIG{CLD}=sub { wait };
472if ($dbgoutfile ne "no file") {
473 unlink("$dbgoutfile");
474 if ($pid=fork()) {
475 }
476 elsif (defined $pid) {
477 close(0);close(1);close(2);
Ivan Leo Murray-Smith62437ad2004-03-27 20:42:34 +0000478 exec "echo quit | WINEDEBUG=$debugopts $wineloc $extraops \"$program\" > $dbgoutfile 2>&1";
Adam Sacarny9f1d5a71999-09-10 13:53:20 +0000479 }
480 else {
481 die "couldn't fork";
482 }
483 while (kill(0, $pid)) {
484 sleep(5);
485 $last = `tail -n 5 $dbgoutfile | grep Wine-dbg`;
486 if ($last =~ /Wine-dbg/) {
487 kill "TERM", $pid;
488 break;
489 }
490 }
491 if ($outfile ne "no file") {
492 $lastlines=`tail -n $lastnlines $dbgoutfile`;
493 system("gzip $dbgoutfile");
494 &generate_outfile;
495 }
496 else {
497 system("gzip $dbgoutfile");
498 }
499}
500elsif ($outfile ne "no file" and $dbgoutfile eq "no file") {
501 if ($pid=fork()) {
502 }
503 elsif (defined $pid) {
504 close(0);close(1);close(2);
Ivan Leo Murray-Smith62437ad2004-03-27 20:42:34 +0000505 exec "echo quit | WINEDEBUG=$debugopts $wineloc $extraops \"$program\" 2>&1| tee $tmpoutfile | tail -n $lastnlines > $outfile";
Adam Sacarny9f1d5a71999-09-10 13:53:20 +0000506 }
507 else {
508 die "couldn't fork";
509 }
510 print "$outfile $tmpoutfile";
511 while (kill(0, $pid)) {
512 sleep(5);
513 $last = `tail -n 5 $tmpoutfile | grep Wine-dbg`;
514 if ($last =~ /Wine-dbg/) {
515 kill "TERM", $pid;
516 break;
517 }
518 }
519 unlink($tmpoutfile);
520 open(OUTFILE, "$outfile");
521 while (<OUTFILE>) {
522 $lastlines .= $_;
523 }
524 close(OUTFILE);
525 unlink($outfile);
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000526 &generate_outfile;
527}
528else {
529 $var27 = qq{
530 I guess you don't want me to make any debugging output. I'll send
531 it to your terminal. This will be a *lot* of output -- hit enter to
532 continue, control-c to quit.
533 Repeat: this will be a lot of output!
534 };
535 print do_var($var27);
536 $blah=<STDIN>;
Ivan Leo Murray-Smith62437ad2004-03-27 20:42:34 +0000537 system("$wineloc WINEDEBUG=$debugopts $extraops \"$program\"");
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000538}
539sub generate_outfile {
Adam Sacarny9f1d5a71999-09-10 13:53:20 +0000540open(OUTFILE,">$outfile");
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000541print OUTFILE <<EOM;
Ivan Leo Murray-Smith62437ad2004-03-27 20:42:34 +0000542Auto-generated debug report by Wine Quick Debug Report Maker Tool:
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000543WINE Version: $winever
544Windows Version: $winver
545Distribution: $dist
546Kernel Version: $kernelver
547OS Type: $ostype
548CPU: $cpu
549GCC Version: $gccver
550Program: $progname
551Program Type: $progbits
Ivan Leo Murray-Smith62437ad2004-03-27 20:42:34 +0000552Debug Options: WINEDEBUG=$debugopts
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000553Other Extra Commands Passed: $extraops
554Extra ./configure Commands: $configopts
Alexandre Julliard7cae5582002-06-01 02:55:48 +0000555Wine Dependencies:
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000556$wineneeds
557Last $lastnlines lines of debug output follows:
558$lastlines
559I have a copy of the full debug report, if it is needed.
560Thank you!
561EOM
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000562}
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000563$var22 = qq{
Dimitrie O. Paunc0232542003-11-26 03:55:01 +0000564Great! We're finished making the debug report. Please go to http://bugs.winehq.org
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000565and enter it as a new bug. Check that nobody has already reported the same bug!
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000566};
567$var28 = qq{
568The filename for the formatted report is:
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000569$outfile
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000570};
571$var29 = qq{
Adam the Jazz Guyc1761621999-01-26 17:22:15 +0000572The filename for the compressed full debug is:
573$dbgoutfile.gz
574Note that it is $dbgoutfile.gz, since I compressed it with gzip for you.
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000575};
576$var30 = qq{
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000577If you have any problems with this bug reporting tool,
Dimitrie O. Paunc0232542003-11-26 03:55:01 +0000578please submit a bug report to Wine bugtracking system at http://bugs.winehq.org
Ivan Leo Murray-Smitha7bdb742003-11-25 01:47:22 +0000579or tell the Wine newsgroup (comp.emulators.ms-windows.wine).
Adam the Jazz Guyb5e02711999-02-09 14:07:49 +0000580};
581print do_var($var22);
Adam Sacarnyc85f0991999-04-25 09:20:40 +0000582print do_var($var28) if $outfile ne "no file";
583print do_var($var29) if $dbgoutfile ne "no file";
584print do_var($var30);