1 |
"Mark Knecht" <markknecht@×××××.com> posted |
2 |
5bdc1c8b0803071105v2c295a53we799b81f48fc0b9b@××××××××××.com, excerpted |
3 |
below, on Fri, 07 Mar 2008 11:05:42 -0800: |
4 |
|
5 |
>> Thanks Duncan. Can you suggest what I minimally need to change to get |
6 |
>> good backtrace data out of Wine. I've added ccache, run the command |
7 |
>> ccache -M 2G and rebuilt Wine at this point. Just figured I could do |
8 |
>> that in the background while I Waited for someone more experience like |
9 |
>> you to come along and tell me the right way to do it. |
10 |
|
11 |
> Sorry. Also added |
12 |
> |
13 |
> FEATURES="parallel-fetch distclean ccache confcache splitdebug" |
14 |
> |
15 |
> to make.conf |
16 |
|
17 |
I didn't answer this one because I don't know a lot about wine. I don't |
18 |
use it myself as I don't use closed source and that's sort of the point |
19 |
with wine. Thus, I figured someone else who really knew what they were |
20 |
talking about with wine would answer. |
21 |
|
22 |
Never-the-less, in general, you can add -g to your CFLAGS (CXXFLAGS if |
23 |
wine is C++ based, I don't know). Note that the standard -O2 takes |
24 |
optimization shortcuts that confuse debuggers to some extent, so you |
25 |
/may/ wish to use plain -O (which is the same as -O1), unless of course |
26 |
you are trying to debug something that happens at -O2 but not at -O. -g, |
27 |
as with -O, defaults to a level, in this case -g2. If you want even more |
28 |
debugging output, try -g3, but I'd suggest sticking with -g unless you or |
29 |
the wine devs are tracking something special that needs the additional |
30 |
data. There are "a slew" of additional debug switches you can add (see |
31 |
the gcc manpage debugging options section for details), but most of them |
32 |
are really for debugging what gcc is doing more than for debugging a |
33 |
program compiled with gcc. |
34 |
|
35 |
There's a big caveat here, however. AFAIK wine is 32-bit only. (??) If |
36 |
so, that means it and/or some of its libraries are likely to be binary- |
37 |
only 32-bit compatibility packages, if you are using a standard multilib |
38 |
profile. All these compiling options obviously aren't going to do a lot |
39 |
of good on binary-only stuff. You can of course go the 32-bit chroot |
40 |
route and thereby compile everything from source, but that's going to be |
41 |
an awful lot of work just to debug something if you aren't extremely |
42 |
motivated. OTOH, it DOES give you the opportunity to build the entire 32- |
43 |
bit side with -g if you want, without interfering with your 64-bit main |
44 |
system. This would be a blocker for many, but I'm not /sure/ wine is 32- |
45 |
bit only. |
46 |
|
47 |
If you DO go 32-bit compiling, there's an additional factor with 32-bit |
48 |
CFLAGS. Namely, while -fomit-frame-pointer is a very common bit of |
49 |
optimization that doesn't interfere with 64-bit debugging, it DOES |
50 |
interfere with 32-bit debugging. You'll specifically NOT want to include |
51 |
it for 32-bit debugging builds. (With gcc-4.1 and later at least, -O |
52 |
automatically turns it on if it does NOT interfere with debugging, thus |
53 |
on amd64 64-bit, but NOT on 32-bit x86. Thus, you don't have to worry |
54 |
about -O interference in that regard, just the specific -fomit-frame- |
55 |
pointer. However, -fomit-frame-pointer is a very common flag so it's |
56 |
worth the entire paragraph of coverage.) |
57 |
|
58 |
The FEATURES=splitdebug thing helps by splitting the debug info from the |
59 |
application itself. This way the system doesn't have to load the debug |
60 |
info unless you are actually debugging. |
61 |
|
62 |
Note that you may wish or need additional packages merged with debug info |
63 |
as well. These will include the shared object (*.so*) libraries loaded |
64 |
by the wine binary. You can get an idea of which libraries are used with |
65 |
ldd. "ldd /path/to/wine" or to have it grab the path automatically, "ldd |
66 |
$(which wine)" . That'll give you a list of the libs. You can then use |
67 |
"equery b <library>" (b=belongs) to find the package the library file |
68 |
belongs to. Chances are you'll not need to trace into all such libraries |
69 |
-- in particular you can probably ignore glibc libs and just assume they |
70 |
are "correct", but the closer related something is to the application and |
71 |
functionality being debugged, the more likely having it built with |
72 |
debugging info will help. |
73 |
|
74 |
As for a runtime debugger to make use of all the info -g produces, gdb is |
75 |
the usual tool there. Thus, you probably want it merged. Using it... I |
76 |
honestly don't know what I'm doing, but I can follow instructions if a |
77 |
developer tells me what they want. =8^) I'd assume there's a way to tell |
78 |
gdb where the split-debug info is, but I don't know it... |
79 |
|
80 |
That's about it for the general stuff I can help with. If as I believe, |
81 |
wine is 32-bit, it's possible there's not a lot you can do with it unless |
82 |
you choose to do the 32-bit chroot thing. It's possibly still worth |
83 |
running gdb on, however, depending on what you are debugging. |
84 |
|
85 |
At a different level, there's strace. You can strace any app, 32-bit, 64- |
86 |
bit, closed source, open source, doesn't matter, because strace doesn't |
87 |
actually go into the app to debug, but rather, inserts itself at the |
88 |
system-call interface, tracing any kernel calls the program makes. Thus, |
89 |
it's useful for debugging file access type problems or simply finding out |
90 |
where a program is looking for things. As is common with this type of |
91 |
program, the volume of output will initially be extremely high. (You'd be |
92 |
surprised how many places the system looks for a library, for instance, |
93 |
and how many libraries are loaded -- that can easily be thousands of |
94 |
lines of output right there, the same for fonts and icons, etc, so if |
95 |
that's not what you are looking at, it's easily ten-thousand lines of |
96 |
"noise" right there!) However, there are ways to exclude whole |
97 |
categories of output, and one can then use grep -v to exclude even more |
98 |
(like all references to /icons and /fonts). When I run it, I'll normally |
99 |
run it several times, deciding each time that there's more "noise" I can |
100 |
exclude, until I get it down to something manageable. Even then, |
101 |
redirecting the output to a file and using grep on it can be more |
102 |
effective than trying to read the output directly in a terminal window. |
103 |
strace isn't really debugging in the traditional debugger sense, but it |
104 |
can sure be useful if for instance one's trying to figure out just where |
105 |
an app is picking up its config so one can edit it! |
106 |
|
107 |
-- |
108 |
Duncan - List replies preferred. No HTML msgs. |
109 |
"Every nonfree program has a lord, a master -- |
110 |
and if you use the program, he is your master." Richard Stallman |
111 |
|
112 |
-- |
113 |
gentoo-amd64@l.g.o mailing list |