2000-08-08 03:24:00 +02:00
|
|
|
<chapter id="debugging">
|
2000-12-13 22:52:37 +01:00
|
|
|
<title>Debug Logging</title>
|
2000-08-08 03:24:00 +02:00
|
|
|
|
|
|
|
<para>
|
2000-12-13 22:52:37 +01:00
|
|
|
Written by &name-dimitrie-paun; <email>&email-dimitrie-paun;</email>, 28 Mar 1998
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
(Extracted from <filename>wine/documentation/debug-msgs</filename>)
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<note>
|
2002-07-03 03:20:46 +02:00
|
|
|
<para>
|
|
|
|
It is possible to turn on and of debugging output from
|
2003-06-18 05:30:39 +02:00
|
|
|
within the debugger using the set command. Please see the
|
2002-07-03 03:20:46 +02:00
|
|
|
WineDbg Command Reference section for how to do this.
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
|
|
|
</note>
|
|
|
|
|
|
|
|
<important>
|
|
|
|
<para>
|
|
|
|
At the end of the document, there is a "Style Guide" for
|
|
|
|
debugging messages. Please read it.
|
|
|
|
</para>
|
|
|
|
</important>
|
|
|
|
|
2000-12-13 22:52:37 +01:00
|
|
|
<sect1 id="dbg-classes">
|
2000-08-08 03:24:00 +02:00
|
|
|
<title>Debugging classes</title>
|
|
|
|
|
|
|
|
<para>
|
2002-08-14 22:59:33 +02:00
|
|
|
There are 4 types (or classes) of messages:
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><literal>FIXME</literal></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2002-08-14 22:59:33 +02:00
|
|
|
Messages in this class are meant to signal unimplemented
|
|
|
|
features, known bugs, etc. They serve as a constant and
|
|
|
|
active reminder of what needs to be done.
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
2003-07-22 00:42:50 +02:00
|
|
|
<para>
|
|
|
|
Examples: stubs, semi-implemented features, etc.
|
|
|
|
</para>
|
2000-08-08 03:24:00 +02:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><literal>ERR</literal></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Messages in this class relate to serious errors in
|
2002-08-14 22:59:33 +02:00
|
|
|
Wine. This sort of messages signal an inconsistent
|
|
|
|
internal state, or more general, a condition which
|
|
|
|
should never happen by design.
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Examples: unexpected change in internal state, etc.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><literal>WARN</literal></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
These are warning messages. You should report a
|
|
|
|
warning when something unwanted happen but the
|
|
|
|
function behaves properly. That is, output a warning
|
|
|
|
when you encounter something unexpected (ex: could not
|
|
|
|
open a file) but the function deals correctly with the
|
|
|
|
situation (that is, according to the docs). If you do
|
2002-07-03 03:20:46 +02:00
|
|
|
not deal correctly with it, output a fixme.
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
|
|
|
<para>
|
2002-08-14 22:59:33 +02:00
|
|
|
Examples: fail to access a resource required by the app.
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><literal>TRACE</literal></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
These are detailed debugging messages that are mainly
|
2002-08-14 22:59:33 +02:00
|
|
|
useful to debug a component. These are usually turned
|
2000-08-08 03:24:00 +02:00
|
|
|
off.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Examples: everything else that does not fall in one of
|
|
|
|
the above mentioned categories and the user does not
|
|
|
|
need to know about it.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
2000-12-13 22:52:37 +01:00
|
|
|
</sect1>
|
2000-08-08 03:24:00 +02:00
|
|
|
|
2000-12-13 22:52:37 +01:00
|
|
|
<sect1 id="dbg-channels">
|
2000-08-08 03:24:00 +02:00
|
|
|
<title>Debugging channels</title>
|
|
|
|
|
|
|
|
<para>
|
2002-08-14 22:59:33 +02:00
|
|
|
To better manage the large volume of debugging messages that
|
|
|
|
Wine can generate, we divide them also on a component basis.
|
2000-08-08 03:24:00 +02:00
|
|
|
Each component is assigned a debugging channel. The
|
|
|
|
identifier of the channel must be a valid C identifier but
|
|
|
|
note that it may also be a reserved word like
|
|
|
|
<type>int</type> or <type>static</type>.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Examples of debugging channels:
|
|
|
|
<simplelist type="inline">
|
|
|
|
<member><literal>reg</literal></member>
|
|
|
|
<member><literal>updown</literal></member>
|
|
|
|
<member><literal>string</literal></member>
|
|
|
|
</simplelist>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
We will refer to a generic channel as <literal>xxx</literal>.
|
|
|
|
</para>
|
2000-12-13 22:52:37 +01:00
|
|
|
</sect1>
|
2000-08-08 03:24:00 +02:00
|
|
|
|
2000-12-13 22:52:37 +01:00
|
|
|
<sect1 id="dbg-using">
|
2000-08-08 03:24:00 +02:00
|
|
|
<title>How to use it</title>
|
|
|
|
|
|
|
|
<para>
|
2002-08-14 22:59:33 +02:00
|
|
|
Typically, a file contains code pertaining to only one component,
|
|
|
|
and as such, there is only one channel to output to. To simplify
|
|
|
|
usage, you can declare that channel at the beginning of the file,
|
|
|
|
and simply write FIXMEs, ERRs, etc. as such:
|
|
|
|
|
2000-08-08 03:24:00 +02:00
|
|
|
<programlisting>
|
2002-08-14 22:59:33 +02:00
|
|
|
#include "wine/debug.h"
|
2000-08-08 03:24:00 +02:00
|
|
|
|
2002-08-14 22:59:33 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(xxx);
|
|
|
|
...
|
2000-08-08 03:24:00 +02:00
|
|
|
|
2002-08-14 22:59:33 +02:00
|
|
|
FIXME("some unimplemented feature", ...);
|
|
|
|
...
|
|
|
|
if (zero != 0)
|
|
|
|
ERR("This should never be non-null: %d", zero);
|
|
|
|
...
|
2000-08-08 03:24:00 +02:00
|
|
|
</programlisting>
|
2002-08-14 22:59:33 +02:00
|
|
|
</para>
|
|
|
|
<para>
|
2003-06-04 22:29:05 +02:00
|
|
|
In rare situations there is a need to output to more than one
|
2002-08-14 22:59:33 +02:00
|
|
|
debug channel per file. In such cases, you need to declare
|
|
|
|
all the additional channels at the top of the file, and
|
|
|
|
use the _-version of the debugging macros:
|
2000-08-08 03:24:00 +02:00
|
|
|
<programlisting>
|
2002-08-14 22:59:33 +02:00
|
|
|
#include "wine/debug.h"
|
2000-08-08 03:24:00 +02:00
|
|
|
|
2002-08-14 22:59:33 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(xxx);
|
|
|
|
WINE_DECLARE_DEBUG_CHANNEL(yyy);
|
|
|
|
WINE_DECLARE_DEBUG_CHANNEL(zzz);
|
2000-08-08 03:24:00 +02:00
|
|
|
...
|
|
|
|
|
2002-08-14 22:59:33 +02:00
|
|
|
FIXME("this one goes to xxx channel");
|
|
|
|
...
|
|
|
|
FIXME_(yyy)("Some other msg for the yyy channel");
|
|
|
|
...
|
|
|
|
WARN_(zzz)("And yet another msg on another channel!");
|
|
|
|
...
|
2000-08-08 03:24:00 +02:00
|
|
|
</programlisting>
|
2002-08-14 22:59:33 +02:00
|
|
|
</para>
|
|
|
|
|
2000-08-08 03:24:00 +02:00
|
|
|
<para>
|
2002-08-14 22:59:33 +02:00
|
|
|
If you need to declare a new debugging channel, simply use it in
|
|
|
|
your code. It will be picked up automatically by the build process.
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
|
|
|
|
2000-12-13 22:52:37 +01:00
|
|
|
</sect1>
|
2000-08-08 03:24:00 +02:00
|
|
|
|
2000-12-13 22:52:37 +01:00
|
|
|
<sect1 id="dbg-checking">
|
2000-08-08 03:24:00 +02:00
|
|
|
<title>Are we debugging?</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
To test whether the debugging output of class
|
|
|
|
<literal>yyy</literal> on channel <literal>xxx</literal> is
|
|
|
|
enabled, use:
|
|
|
|
</para>
|
|
|
|
<screen>
|
|
|
|
TRACE_ON to test if TRACE is enabled
|
|
|
|
WARN_ON to test if WARN is enabled
|
|
|
|
FIXME_ON to test if FIXME is enabled
|
|
|
|
ERR_ON to test if ERR is enabled
|
|
|
|
</screen>
|
|
|
|
<para>
|
|
|
|
Examples:
|
|
|
|
</para>
|
|
|
|
<programlisting>
|
|
|
|
if(TRACE_ON(atom)){
|
|
|
|
...blah...
|
|
|
|
}
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
<note>
|
|
|
|
<para>
|
|
|
|
You should normally need to test only if
|
|
|
|
<literal>TRACE_ON</literal>. At present, none of the other
|
|
|
|
3 tests (except for <literal>ERR_ON</literal> which is
|
|
|
|
used only once!) are used in Wine.
|
|
|
|
</para>
|
|
|
|
</note>
|
2000-12-13 22:52:37 +01:00
|
|
|
</sect1>
|
2000-08-08 03:24:00 +02:00
|
|
|
|
2000-12-13 22:52:37 +01:00
|
|
|
<sect1 id="dbg-resource-ids">
|
2000-08-08 03:24:00 +02:00
|
|
|
<title>Resource identifiers</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Resource identifiers can be either strings or numbers. To
|
|
|
|
make life a bit easier for outputting these beasts (and to
|
|
|
|
help you avoid the need to build the message in memory), I
|
|
|
|
introduced a new function called <function>debugres</function>.
|
|
|
|
</para>
|
|
|
|
<para>
|
2002-08-14 22:59:33 +02:00
|
|
|
The function is defined in <filename>wine/debug.h</filename>
|
2000-08-08 03:24:00 +02:00
|
|
|
and has the following prototype:
|
|
|
|
</para>
|
|
|
|
<programlisting>
|
|
|
|
LPSTR debugres(const void *id);
|
|
|
|
</programlisting>
|
|
|
|
<para>
|
|
|
|
It takes a pointer to the resource id and returns a nicely
|
2002-08-14 22:59:33 +02:00
|
|
|
formatted string of the identifier (which can be a string or
|
|
|
|
a number, depending on the value of the high word).
|
|
|
|
Numbers are formatted as such:
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
|
|
|
<programlisting>
|
|
|
|
#xxxx
|
|
|
|
</programlisting>
|
|
|
|
<para>
|
2002-08-14 22:59:33 +02:00
|
|
|
while strings as:
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
|
|
|
<programlisting>
|
2002-08-14 22:59:33 +02:00
|
|
|
'some-string'
|
2000-08-08 03:24:00 +02:00
|
|
|
</programlisting>
|
|
|
|
<para>
|
2002-08-14 22:59:33 +02:00
|
|
|
Simply use it in your code like this:
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
|
|
|
<programlisting>
|
2002-08-14 22:59:33 +02:00
|
|
|
#include "wine/debug.h"
|
2000-08-08 03:24:00 +02:00
|
|
|
|
|
|
|
...
|
|
|
|
|
2002-08-14 22:59:33 +02:00
|
|
|
TRACE("resource is %s", debugres(myresource));
|
2000-08-08 03:24:00 +02:00
|
|
|
</programlisting>
|
2000-12-13 22:52:37 +01:00
|
|
|
</sect1>
|
2000-08-08 03:24:00 +02:00
|
|
|
|
2000-12-13 22:52:37 +01:00
|
|
|
<sect1 id="dbg-param">
|
2000-08-08 03:24:00 +02:00
|
|
|
<title>The <parameter>--debugmsg</parameter> command line option</title>
|
|
|
|
|
|
|
|
<para>
|
2002-08-14 22:59:33 +02:00
|
|
|
The <parameter>--debugmsg</parameter> command line
|
|
|
|
option controls the output of the debug messages.
|
|
|
|
It has the following syntax:
|
|
|
|
<parameter>--debugmsg [yyy]#xxx[,[yyy1]#xxx1]*</parameter>
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2002-08-14 22:59:33 +02:00
|
|
|
where
|
2000-08-08 03:24:00 +02:00
|
|
|
<literal>#</literal> is either <literal>+</literal> or
|
|
|
|
<literal>-</literal>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
when the optional class argument (<literal>yyy</literal>)
|
|
|
|
is not present, then the statement will
|
|
|
|
enable(<literal>+</literal>)/disable(<literal>-</literal>)
|
|
|
|
all messages for the given channel (<literal>xxx</literal>)
|
|
|
|
on all classes. For example:
|
|
|
|
</para>
|
|
|
|
<programlisting>
|
|
|
|
--debugmsg +reg,-file
|
|
|
|
</programlisting>
|
|
|
|
<para>
|
|
|
|
enables all messages on the <literal>reg</literal>
|
|
|
|
channel and disables all messages on the
|
2002-08-14 22:59:33 +02:00
|
|
|
<literal>file</literal> channel.
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
when the optional class argument (<literal>yyy</literal>)
|
|
|
|
is present, then the statement will enable
|
|
|
|
(<literal>+</literal>)/disable(<literal>-</literal>)
|
|
|
|
messages for the given channel (<literal>xxx</literal>)
|
|
|
|
only on the given class. For example:
|
|
|
|
</para>
|
|
|
|
<programlisting>
|
|
|
|
--debugmsg trace+reg,warn-file
|
|
|
|
</programlisting>
|
|
|
|
<para>
|
|
|
|
enables trace messages on the <literal>reg</literal>
|
|
|
|
channel and disables warning messages on the
|
|
|
|
<literal>file</literal> channel.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
also, the pseudo-channel all is also supported and it
|
|
|
|
has the intuitive semantics:
|
|
|
|
</para>
|
|
|
|
<screen>
|
|
|
|
--debugmsg +all -- enables all debug messages
|
2002-07-03 03:20:46 +02:00
|
|
|
--debugmsg -all -- disables all debug messages
|
2000-08-08 03:24:00 +02:00
|
|
|
--debugmsg yyy+all -- enables debug messages for class yyy on all
|
|
|
|
channels.
|
|
|
|
--debugmsg yyy-all -- disables debug messages for class yyy on all
|
|
|
|
channels.
|
|
|
|
</screen>
|
|
|
|
<para>
|
|
|
|
So, for example:
|
|
|
|
</para>
|
|
|
|
<screen>
|
|
|
|
--debugmsg warn-all -- disables all warning messages.
|
|
|
|
</screen>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Also, note that at the moment:
|
|
|
|
</para>
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
2003-07-22 00:42:50 +02:00
|
|
|
<para>
|
|
|
|
the <literal>FIXME</literal> and <literal>ERR</literal>
|
|
|
|
classes are enabled by default
|
|
|
|
</para>
|
2000-08-08 03:24:00 +02:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
2003-07-22 00:42:50 +02:00
|
|
|
<para>
|
|
|
|
the <literal>TRACE</literal> and <literal>WARN</literal>
|
|
|
|
classes are disabled by default
|
|
|
|
</para>
|
2000-08-08 03:24:00 +02:00
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
2000-12-13 22:52:37 +01:00
|
|
|
</sect1>
|
2000-08-08 03:24:00 +02:00
|
|
|
|
2000-12-13 22:52:37 +01:00
|
|
|
<sect1 id="dbg-compiling">
|
2000-08-08 03:24:00 +02:00
|
|
|
<title>Compiling Out Debugging Messages</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
To compile out the debugging messages, provide
|
|
|
|
<command>configure</command> with the following options:
|
|
|
|
</para>
|
|
|
|
<screen>
|
|
|
|
--disable-debug -- turns off TRACE, WARN, and FIXME (and DUMP).
|
|
|
|
--disable-trace -- turns off TRACE only.
|
|
|
|
</screen>
|
|
|
|
<para>
|
|
|
|
This will result in an executable that, when stripped, is
|
|
|
|
about 15%-20% smaller. Note, however, that you will not be
|
2002-07-03 03:20:46 +02:00
|
|
|
able to effectively debug Wine without these messages.
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
This feature has not been extensively tested--it may subtly
|
|
|
|
break some things.
|
|
|
|
</para>
|
2000-12-13 22:52:37 +01:00
|
|
|
</sect1>
|
2000-08-08 03:24:00 +02:00
|
|
|
|
2000-12-13 22:52:37 +01:00
|
|
|
<sect1 id="dbg-notes">
|
2000-08-08 03:24:00 +02:00
|
|
|
<title>A Few Notes on Style</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
This new scheme makes certain things more consistent but
|
|
|
|
there is still room for improvement by using a common style
|
|
|
|
of debug messages. Before I continue, let me note that the
|
|
|
|
output format is the following:
|
|
|
|
</para>
|
|
|
|
<screen>
|
2000-12-13 22:52:37 +01:00
|
|
|
yyy:xxx:fff <message>
|
2000-08-08 03:24:00 +02:00
|
|
|
|
2002-07-03 03:20:46 +02:00
|
|
|
where:
|
2000-08-08 03:24:00 +02:00
|
|
|
yyy = the class (fixme, err, warn, trace)
|
|
|
|
xxx = the channel (atom, win, font, etc)
|
|
|
|
fff = the function name
|
|
|
|
</screen>
|
|
|
|
<para>
|
|
|
|
these fields are output automatically. All you have to
|
2000-12-13 22:52:37 +01:00
|
|
|
provide is the <message> part.
|
2000-08-08 03:24:00 +02:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
So here are some ideas:
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
2003-07-22 00:42:50 +02:00
|
|
|
<para>
|
|
|
|
do NOT include the name of the function: it is included automatically
|
|
|
|
</para>
|
2000-08-08 03:24:00 +02:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
if you want to output the parameters of the function, do
|
|
|
|
it as the first thing and include them in parentheses,
|
2002-07-03 03:20:46 +02:00
|
|
|
like this:
|
2000-08-08 03:24:00 +02:00
|
|
|
<programlisting>
|
2002-08-14 22:59:33 +02:00
|
|
|
TRACE("(%d, %p, ...)\n", par1, par2, ...);
|
2000-08-08 03:24:00 +02:00
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
for stubs, you should output a <literal>FIXME</literal>
|
|
|
|
message. I suggest this style:
|
|
|
|
<programlisting>
|
2002-08-14 22:59:33 +02:00
|
|
|
FIXME("(%x, %d, ...): stub\n", par1, par2, ...);
|
2000-08-08 03:24:00 +02:00
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2002-08-14 22:59:33 +02:00
|
|
|
try to output one line per message. That is, the format
|
|
|
|
string should contain only one <literal>\n</literal> and it
|
2000-08-08 03:24:00 +02:00
|
|
|
should always appear at the end of the string. (there are
|
|
|
|
many reasons for this requirement, one of them is that
|
|
|
|
each debug macro adds things to the beginning of the line)
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
if you want to name a value, use <literal>=</literal> and
|
|
|
|
NOT <literal>:</literal>. That is, instead of saying:
|
|
|
|
<programlisting>
|
2002-08-14 22:59:33 +02:00
|
|
|
FIXME("(fd: %d, file: %s): stub\n", fd, name);
|
2000-08-08 03:24:00 +02:00
|
|
|
</programlisting>
|
|
|
|
say:
|
|
|
|
<programlisting>
|
2002-08-14 22:59:33 +02:00
|
|
|
FIXME("(fd=%d, file=%s): stub\n", fd, name);
|
2000-08-08 03:24:00 +02:00
|
|
|
</programlisting>
|
|
|
|
use <literal>:</literal> to separate categories.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
try to avoid the style:
|
|
|
|
<programlisting>
|
2001-05-02 03:10:16 +02:00
|
|
|
FIXME(xxx, "(fd=%d, file=%s)\n", fd, name);
|
2000-08-08 03:24:00 +02:00
|
|
|
</programlisting>
|
2002-08-14 22:59:33 +02:00
|
|
|
instead use:
|
2000-08-08 03:24:00 +02:00
|
|
|
<programlisting>
|
|
|
|
FIXME(xxx, "(fd=%d, file=%s): stub\n", fd, name);
|
|
|
|
</programlisting>
|
|
|
|
The reason is that if you want to <command>grep</command>
|
|
|
|
for things, you would search for <literal>FIXME</literal>
|
|
|
|
but in the first case there is no additional information
|
|
|
|
available, where in the second one, there is (e.g. the word
|
|
|
|
stub)
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
if you output a string s that might contain control
|
|
|
|
characters, or if <parameter>s</parameter> may be
|
|
|
|
<literal>NULL</literal>, use
|
|
|
|
<function>debugstr_a</function> (for ASCII strings, or
|
|
|
|
<function>debugstr_w</function> for Unicode strings) to
|
|
|
|
convert <parameter>s</parameter> to a C string, like this:
|
|
|
|
<programlisting>
|
|
|
|
HANDLE32 WINAPI YourFunc(LPCSTR s)
|
|
|
|
{
|
2002-08-14 22:59:33 +02:00
|
|
|
FIXME("(%s): stub\n", debugstr_a(s));
|
2000-08-08 03:24:00 +02:00
|
|
|
}
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
if you want to output a resource identifier, use debugres to
|
|
|
|
convert it to a string first, like this:
|
|
|
|
<programlisting>
|
|
|
|
HANDLE32 WINAPI YourFunc(LPCSTR res)
|
|
|
|
{
|
2002-08-14 22:59:33 +02:00
|
|
|
FIXME("(res=%s): stub\n", debugres(s));
|
2000-08-08 03:24:00 +02:00
|
|
|
}
|
|
|
|
</programlisting>
|
|
|
|
if the resource identifier is a <type>SEGPTR</type>, use
|
|
|
|
<function>PTR_SEG_TO_LIN</function> to get a
|
|
|
|
liner pointer first:
|
|
|
|
<programlisting>
|
|
|
|
HRSRC16 WINAPI FindResource16( HMODULE16 hModule, SEGPTR name, SEGPTR type )
|
|
|
|
{
|
|
|
|
[...]
|
2002-07-03 03:20:46 +02:00
|
|
|
TRACE(resource, "module=%04x name=%s type=%s\n",
|
|
|
|
hModule, debugres(PTR_SEG_TO_LIN(name)),
|
2000-08-08 03:24:00 +02:00
|
|
|
debugres(PTR_SEG_TO_LIN(type)) );
|
|
|
|
[...]
|
|
|
|
}
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
for messages intended for the user (specifically those that
|
2002-07-24 05:00:02 +02:00
|
|
|
report errors in the wine config file), use the
|
2000-08-08 03:24:00 +02:00
|
|
|
<literal>MSG</literal> macro. Use it like a
|
|
|
|
<function>printf</function>:
|
|
|
|
<programlisting>
|
2002-07-03 03:20:46 +02:00
|
|
|
MSG( "Definition of drive %d is incorrect!\n", drive );
|
2000-08-08 03:24:00 +02:00
|
|
|
</programlisting>
|
|
|
|
However, note that there are <emphasis>very</emphasis> few
|
|
|
|
valid uses of this macro. Most messages are debugging
|
|
|
|
messages, so chances are you will not need to use this
|
|
|
|
macro. Grep the source to get an idea where it is
|
|
|
|
appropriate to use it.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
For structure dumps, use the <function>DUMP</function>
|
|
|
|
macro. Use it like a <function>printf</function>, just like
|
|
|
|
the <literal>MSG</literal> macro. Similarly, there are only
|
|
|
|
a few valid uses of this macro. Grep the source to see when
|
|
|
|
to use it.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
2000-12-13 22:52:37 +01:00
|
|
|
</sect1>
|
2000-08-08 03:24:00 +02:00
|
|
|
|
|
|
|
</chapter>
|
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
2003-04-19 04:50:57 +02:00
|
|
|
sgml-parent-document:("wine-devel.sgml" "set" "book" "part" "chapter" "")
|
2000-08-08 03:24:00 +02:00
|
|
|
End:
|
|
|
|
-->
|