Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
7df90027
Commit
7df90027
authored
Feb 24, 2005
by
Dimitrie O. Paun
Committed by
Alexandre Julliard
Feb 24, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add info on building dynamic strings for logging.
Reorder some points for a more logical organization.
parent
af812605
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
5 deletions
+34
-5
debugging.sgml
documentation/debugging.sgml
+34
-5
No files found.
documentation/debugging.sgml
View file @
7df90027
...
@@ -429,6 +429,14 @@ TRACE("(%d, %p, ...)\n", par1, par2, ...);
...
@@ -429,6 +429,14 @@ TRACE("(%d, %p, ...)\n", par1, par2, ...);
</listitem>
</listitem>
<listitem>
<listitem>
<para>
<para>
if you want to name a parameter, use <literal>=</literal> :
<programlisting>
TRACE("(fd=%d, file=%s): stub\n", fd, name);
</programlisting>
</para>
</listitem>
<listitem>
<para>
for stubs, you should output a <literal>FIXME</literal>
for stubs, you should output a <literal>FIXME</literal>
message. I suggest this style:
message. I suggest this style:
<programlisting>
<programlisting>
...
@@ -440,16 +448,37 @@ FIXME("(%x, %d, ...): stub\n", par1, par2, ...);
...
@@ -440,16 +448,37 @@ FIXME("(%x, %d, ...): stub\n", par1, par2, ...);
<para>
<para>
try to output one line per message. That is, the format
try to output one line per message. That is, the format
string should contain only one <literal>\n</literal> and it
string should contain only one <literal>\n</literal> and it
should always appear at the end of the string. (there are
should always appear at the end of the string.
many reasons for this requirement, one of them is that
each debug macro adds things to the beginning of the line)
</para>
</para>
</listitem>
</listitem>
<listitem>
<listitem>
<para>
<para>
if you want to name a parameter, use <literal>=</literal> :
if the output string needs to be dynamically constructed,
render it in memory before outputting it:
<programlisting>
<programlisting>
FIXME("(fd=%d, file=%s): stub\n", fd, name);
char buffer[128] = "";
if (flags & FLAG_A) strcat(buffer, "FLAG_A ");
if (flags & FLAG_B) strcat(buffer, "FLAG_B ");
if (flags & FLAG_C) strcat(buffer, "FLAG_C ");
TRACE("flags = %s\n", buffer);
</programlisting>
Most of the time however, it is better to create a helper
function that renders to a temporary buffer:
<programlisting>
static const char *dbgstr_flags(int flags)
{
char buffer[128] = "";
if (flags & FLAG_A) strcat(buffer, "FLAG_A ");
if (flags & FLAG_B) strcat(buffer, "FLAG_B ");
if (flags & FLAG_C) strcat(buffer, "FLAG_C ");
return wine_dbg_sprintf("flags = %s\n\n", buffer);
}
...
TRACE("flags = %s\n", dbgstr_flags(flags));
</programlisting>
</programlisting>
</para>
</para>
</listitem>
</listitem>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment