ReactOS 0.4.17-dev-966-gf06eace
debug.c File Reference
#include "wine/config.h"
#include "wine/port.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <excpt.h>
#include "wine/debug.h"
#include "wine/library.h"
#include "winternl.h"
Include dependency graph for debug.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define MAX_DEBUG_OPTIONS   256
 

Functions

 WINE_DECLARE_DEBUG_CHANNEL (pid)
 
 WINE_DECLARE_DEBUG_CHANNEL (tid)
 
static void debug_init (void)
 
static int winefmt_default_dbg_vlog (enum __wine_debug_class cls, struct __wine_debug_channel *channel, const char *file, const char *func, const int line, const char *format, va_list args)
 
static int rosfmt_default_dbg_vlog (enum __wine_debug_class cls, struct __wine_debug_channel *channel, const char *file, const char *func, const int line, const char *format, va_list args)
 
static int extfmt_default_dbg_vlog (enum __wine_debug_class cls, struct __wine_debug_channel *channel, const char *file, const char *func, const int line, const char *format, va_list args)
 
static int __cdecl cmp_name (const void *p1, const void *p2)
 
unsigned char __wine_dbg_get_channel_flags (struct __wine_debug_channel *channel)
 
int __wine_dbg_set_channel_flags (struct __wine_debug_channel *channel, unsigned char set, unsigned char clear)
 
static void add_option (const char *name, unsigned char set, unsigned char clear)
 
static void parse_options (const char *str)
 
int wine_dbg_printf (const char *format,...)
 
int __wine_dbg_output (const char *str)
 
const char * wine_dbg_sprintf (const char *format,...)
 
int wine_dbg_log (enum __wine_debug_class cls, struct __wine_debug_channel *channel, const char *func, const char *format,...)
 
int ros_dbg_log (enum __wine_debug_class cls, struct __wine_debug_channel *channel, const char *file, const char *func, const int line, const char *format,...)
 
static char * get_temp_buffer (size_t size)
 
static void release_temp_buffer (char *buffer, size_t size)
 
static const char * default_dbgstr_an (const char *str, int n)
 
static const char * default_dbgstr_wn (const WCHAR *str, int n)
 
static int default_dbg_vprintf (const char *format, va_list args)
 
const char * wine_dbgstr_an (const char *s, int n)
 
const char * wine_dbgstr_wn (const WCHAR *s, int n)
 
void __wine_dbg_set_functions (const struct __wine_debug_functions *new_funcs, struct __wine_debug_functions *old_funcs, size_t size)
 

Variables

static const char *const debug_classes [] = { "fixme", "err", "warn", "trace" }
 
static unsigned char default_flags = (1 << __WINE_DBCL_ERR) | (1 << __WINE_DBCL_FIXME)
 
static int nb_debug_options = -1
 
static struct __wine_debug_channel debug_options [MAX_DEBUG_OPTIONS]
 
static struct __wine_debug_functions funcs
 

Macro Definition Documentation

◆ MAX_DEBUG_OPTIONS

#define MAX_DEBUG_OPTIONS   256

Definition at line 42 of file debug.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 31 of file debug.c.

Function Documentation

◆ __wine_dbg_get_channel_flags()

unsigned char __wine_dbg_get_channel_flags ( struct __wine_debug_channel *  channel)

Definition at line 72 of file debug.c.

73{
74 if (nb_debug_options == -1) debug_init();
75
77 {
79 sizeof(debug_options[0]), cmp_name );
80 if (opt) return opt->flags;
81 }
82 /* no option for this channel */
83 if (channel->flags & (1 << __WINE_DBCL_INIT)) channel->flags = default_flags;
84 return default_flags;
85}
@ __WINE_DBCL_INIT
Definition: debug.h:59
static unsigned char default_flags
Definition: debug.c:44
static int nb_debug_options
Definition: debug.c:45
static void debug_init(void)
Definition: debug.c:209
static struct __wine_debug_channel debug_options[MAX_DEBUG_OPTIONS]
Definition: debug.c:46
static int __cdecl cmp_name(const void *p1, const void *p2)
Definition: debug.c:64
unsigned char flags
Definition: debug.h:64
#define bsearch

◆ __wine_dbg_output()

int __wine_dbg_output ( const char *  str)

Definition at line 273 of file debug.c.

274{
275 return wine_dbg_printf( "%s", str );
276}
const WCHAR * str
int wine_dbg_printf(const char *format,...)
Definition: debug.c:262

Referenced by tiff_error_handler(), tiff_warning_handler(), and vkd3d_log_callback().

◆ __wine_dbg_set_channel_flags()

int __wine_dbg_set_channel_flags ( struct __wine_debug_channel *  channel,
unsigned char  set,
unsigned char  clear 
)

Definition at line 88 of file debug.c.

90{
91 if (nb_debug_options == -1) debug_init();
92
94 {
96 sizeof(debug_options[0]), cmp_name );
97 if (opt)
98 {
99 opt->flags = (opt->flags & ~clear) | set;
100 return 1;
101 }
102 }
103 return 0;
104}
Definition: _set.h:50

◆ __wine_dbg_set_functions()

void __wine_dbg_set_functions ( const struct __wine_debug_functions *  new_funcs,
struct __wine_debug_functions *  old_funcs,
size_t  size 
)

Definition at line 552 of file debug.c.

554{
555 if (old_funcs) memcpy( old_funcs, &funcs, min(sizeof(funcs),size) );
556 if (new_funcs) memcpy( &funcs, new_funcs, min(sizeof(funcs),size) );
557}
GLsizeiptr size
Definition: glext.h:5919
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define min(a, b)
Definition: monoChain.cc:55
static struct __wine_debug_functions funcs
Definition: debug.c:48

Referenced by CmdTrace().

◆ add_option()

static void add_option ( const char *  name,
unsigned char  set,
unsigned char  clear 
)
static

Definition at line 107 of file debug.c.

108{
109 int min = 0, max = nb_debug_options - 1, pos, res;
110
111 if (!name[0]) /* "all" option */
112 {
113 default_flags = (default_flags & ~clear) | set;
114 return;
115 }
116 if (strlen(name) >= sizeof(debug_options[0].name)) return;
117
118 while (min <= max)
119 {
120 pos = (min + max) / 2;
122 if (!res)
123 {
124 debug_options[pos].flags = (debug_options[pos].flags & ~clear) | set;
125 return;
126 }
127 if (res < 0) max = pos - 1;
128 else min = pos + 1;
129 }
130 if (nb_debug_options >= MAX_DEBUG_OPTIONS) return;
131
132 pos = min;
134 (nb_debug_options - pos) * sizeof(debug_options[0]) );
136 debug_options[pos].flags = (default_flags & ~clear) | set;
138}
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
GLuint res
Definition: glext.h:9613
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
strcpy
Definition: string.h:131
#define MAX_DEBUG_OPTIONS
Definition: debug.c:42
Definition: name.c:39
#define max(a, b)
Definition: svc.c:63

Referenced by parse_options().

◆ cmp_name()

static int __cdecl cmp_name ( const void *  p1,
const void *  p2 
)
static

Definition at line 64 of file debug.c.

65{
66 const char *name = p1;
67 const struct __wine_debug_channel *chan = p2;
68 return strcmp( name, chan->name );
69}
char name[15]
Definition: debug.h:65

Referenced by __wine_dbg_get_channel_flags(), and __wine_dbg_set_channel_flags().

◆ debug_init()

static void debug_init ( void  )
static

Definition at line 209 of file debug.c.

210{
211 char *wine_debug;
213 /* GetEnvironmentVariableA will change LastError! */
214 DWORD LastError = GetLastError();
215
216 if (nb_debug_options != -1) return; /* already initialized */
218
219 dwLength = GetEnvironmentVariableA("DEBUGCHANNEL", NULL, 0);
220 if (dwLength)
221 {
222 wine_debug = malloc(dwLength);
223 if (wine_debug)
224 {
225 if (GetEnvironmentVariableA("DEBUGCHANNEL", wine_debug, dwLength) < dwLength)
226 parse_options(wine_debug);
227 free(wine_debug);
228 }
229 }
230
231 dwLength = GetEnvironmentVariableA("DEBUGFORMAT", NULL, 0);
232 if (dwLength)
233 {
234 wine_debug = malloc(dwLength);
235 if (wine_debug)
236 {
237 if (GetEnvironmentVariableA("DEBUGFORMAT", wine_debug, dwLength) < dwLength)
238 {
239 if (strcmp(wine_debug, "wine") == 0)
240 {
242 }
243 else
244 if (strcmp(wine_debug, "extended") == 0 ||
245 strcmp(wine_debug, "ext") == 0)
246 {
248 }
249 else
250 {
252 }
253 }
254 free(wine_debug);
255 }
256 }
257
258 SetLastError(LastError);
259}
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define SetLastError(x)
Definition: compat.h:752
#define GetEnvironmentVariableA(x, y, z)
Definition: compat.h:754
static DWORD DWORD * dwLength
Definition: fusion.c:86
unsigned long DWORD
Definition: ntddk_ex.h:95
static void parse_options(const char *str)
Definition: debug.c:141
static int extfmt_default_dbg_vlog(enum __wine_debug_class cls, struct __wine_debug_channel *channel, const char *file, const char *func, const int line, const char *format, va_list args)
Definition: debug.c:513
static int winefmt_default_dbg_vlog(enum __wine_debug_class cls, struct __wine_debug_channel *channel, const char *file, const char *func, const int line, const char *format, va_list args)
Definition: debug.c:471
static int rosfmt_default_dbg_vlog(enum __wine_debug_class cls, struct __wine_debug_channel *channel, const char *file, const char *func, const int line, const char *format, va_list args)
Definition: debug.c:490
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by __wine_dbg_get_channel_flags(), and __wine_dbg_set_channel_flags().

◆ default_dbg_vprintf()

static int default_dbg_vprintf ( const char *  format,
va_list  args 
)
static

Definition at line 463 of file debug.c.

464{
465 return vDbgPrintExWithPrefix("", -1, 0, format, args);
466}
ULONG NTAPI vDbgPrintExWithPrefix(IN PCCH Prefix, IN ULONG ComponentId, IN ULONG Level, IN PCCH Format, IN va_list ap)
Definition: debug.c:167
Definition: match.c:390

◆ default_dbgstr_an()

static const char * default_dbgstr_an ( const char *  str,
int  n 
)
static

Definition at line 351 of file debug.c.

352{
353 static const char hex[16] = "0123456789abcdef";
354 char *dst, *res;
355 size_t size;
356
357 if (!((ULONG_PTR)str >> 16))
358 {
359 if (!str) return "(null)";
360 res = funcs.get_temp_buffer( 6 );
361 sprintf( res, "#%04x", LOWORD(str) );
362 return res;
363 }
364 if (n == -1) n = (int)strlen(str);
365 if (n < 0) n = 0;
366 size = 10 + min( 300, n * 4 );
367 dst = res = funcs.get_temp_buffer( size );
368 *dst++ = '"';
369 while (n-- > 0 && dst <= res + size - 9)
370 {
371 unsigned char c = *str++;
372 switch (c)
373 {
374 case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
375 case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
376 case '\t': *dst++ = '\\'; *dst++ = 't'; break;
377 case '"': *dst++ = '\\'; *dst++ = '"'; break;
378 case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
379 default:
380 if (c >= ' ' && c <= 126)
381 *dst++ = c;
382 else
383 {
384 *dst++ = '\\';
385 *dst++ = 'x';
386 *dst++ = hex[(c >> 4) & 0x0f];
387 *dst++ = hex[c & 0x0f];
388 }
389 }
390 }
391 *dst++ = '"';
392 if (n > 0)
393 {
394 *dst++ = '.';
395 *dst++ = '.';
396 *dst++ = '.';
397 }
398 *dst++ = 0;
399 funcs.release_temp_buffer( res, dst - res );
400 return res;
401}
ios_base &_STLP_CALL hex(ios_base &__s)
Definition: _ios_base.h:324
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLdouble n
Definition: glext.h:7729
const GLubyte * c
Definition: glext.h:8905
GLenum GLenum dst
Definition: glext.h:6340
#define c
Definition: ke_i.h:80
#define sprintf
Definition: sprintf.c:45
#define LOWORD(l)
Definition: pedump.c:82
uint32_t ULONG_PTR
Definition: typedefs.h:65

◆ default_dbgstr_wn()

static const char * default_dbgstr_wn ( const WCHAR *  str,
int  n 
)
static

Definition at line 405 of file debug.c.

406{
407 char *dst, *res;
408 size_t size;
409
410 if (!((ULONG_PTR)str >> 16))
411 {
412 if (!str) return "(null)";
413 res = funcs.get_temp_buffer( 6 );
414 sprintf( res, "#%04x", LOWORD(str) );
415 return res;
416 }
417 if (n == -1)
418 {
419 const WCHAR *end = str;
420 while (*end) end++;
421 n = end - str;
422 }
423 if (n < 0) n = 0;
424 size = 12 + min( 300, n * 5 );
425 dst = res = funcs.get_temp_buffer( size );
426 *dst++ = 'L';
427 *dst++ = '"';
428 while (n-- > 0 && dst <= res + size - 10)
429 {
430 WCHAR c = *str++;
431 switch (c)
432 {
433 case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
434 case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
435 case '\t': *dst++ = '\\'; *dst++ = 't'; break;
436 case '"': *dst++ = '\\'; *dst++ = '"'; break;
437 case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
438 default:
439 if (c >= ' ' && c <= 126)
440 *dst++ = c;
441 else
442 {
443 *dst++ = '\\';
444 sprintf(dst,"%04x",c);
445 dst+=4;
446 }
447 }
448 }
449 *dst++ = '"';
450 if (n > 0)
451 {
452 *dst++ = '.';
453 *dst++ = '.';
454 *dst++ = '.';
455 }
456 *dst++ = 0;
457 funcs.release_temp_buffer( res, dst - res );
458 return res;
459}
GLuint GLuint end
Definition: gl.h:1545
short WCHAR
Definition: pedump.c:58

◆ extfmt_default_dbg_vlog()

static int extfmt_default_dbg_vlog ( enum __wine_debug_class  cls,
struct __wine_debug_channel *  channel,
const char *  file,
const char *  func,
const int  line,
const char *  format,
va_list  args 
)
static

Definition at line 513 of file debug.c.

515{
516 char prefix[256];
517 static const int max_len = sizeof(prefix);
518 int len = 0;
519
520 if (TRACE_ON(pid) || TRACE_ON(tid))
521 {
522 len += _snprintf(prefix + len, max_len - len, "[%04x:%04x]:",
525 }
526
527 if (cls < sizeof(debug_classes)/sizeof(debug_classes[0]))
528 len += _snprintf(prefix + len, max_len - len, "%s:", debug_classes[cls]);
529
530 if (file && line)
531 len += _snprintf(prefix + len, max_len - len, "(%s:%d):", file, line);
532
533 if (len < max_len)
534 len += _snprintf(prefix + len, max_len - len, "%s:%s ", channel->name, func);
535
536 prefix[max_len - 1] = 0;
537 return vDbgPrintExWithPrefix(prefix, -1, 0, format, args);
538}
#define HandleToULong(h)
Definition: basetsd.h:89
#define TRACE_ON(x)
Definition: compat.h:75
static int __cdecl _snprintf(char *buffer, size_t size, const char *format,...) __WINE_CRT_PRINTF_ATTR(3
Definition: stdio.h:507
GLenum func
Definition: glext.h:6028
GLenum GLsizei len
Definition: glext.h:6722
static TfClientId tid
#define NtCurrentTeb
static const char *const debug_classes[]
Definition: debug.c:40
HANDLE UniqueThread
Definition: compat.h:826
HANDLE UniqueProcess
Definition: compat.h:825
Definition: fci.c:123
Definition: parser.c:49
Character const *const prefix
Definition: tempnam.cpp:195
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1151

Referenced by debug_init().

◆ get_temp_buffer()

static char * get_temp_buffer ( size_t  size)
static

Definition at line 330 of file debug.c.

331{
332 static char *list[32];
333 static long pos = 0;
334 char *ret;
335 long idx;
336
337 idx = interlocked_xchg_add( &pos, 1 ) % (sizeof(list)/sizeof(list[0]));
338 if ((ret = realloc( list[idx], size ))) list[idx] = ret;
339 return ret;
340}
Definition: list.h:39
#define realloc
Definition: debug_ros.c:6
unsigned int idx
Definition: utils.c:40
return ret
Definition: mutex.c:147
#define list
Definition: rosglue.h:35
#define interlocked_xchg_add
Definition: port.h:348

◆ parse_options()

static void parse_options ( const char *  str)
static

Definition at line 141 of file debug.c.

142{
143 char *opt, *next, *options;
144 unsigned int i;
145
146 if (!(options = _strdup(str))) return;
147 for (opt = options; opt; opt = next)
148 {
149 const char *p;
150 unsigned char set = 0, clear = 0;
151
152 if ((next = strchr( opt, ',' ))) *next++ = 0;
153
154 p = opt + strcspn( opt, "+-" );
155 if (!p[0]) p = opt; /* assume it's a debug channel name */
156
157 if (p > opt)
158 {
159 for (i = 0; i < sizeof(debug_classes)/sizeof(debug_classes[0]); i++)
160 {
161 size_t len = strlen(debug_classes[i]);
162 if (len != (p - opt)) continue;
163 if (!memcmp( opt, debug_classes[i], len )) /* found it */
164 {
165 if (*p == '+') set |= 1 << i;
166 else clear |= 1 << i;
167 break;
168 }
169 }
170 if (i == sizeof(debug_classes)/sizeof(debug_classes[0])) /* bad class name, skip it */
171 continue;
172 }
173 else
174 {
175 if (*p == '-') clear = ~0;
176 else set = ~0;
177 }
178 if (*p == '+' || *p == '-') p++;
179 if (!p[0]) continue;
180
181 if (!strcmp( p, "all" ))
182 default_flags = (default_flags & ~clear) | set;
183 else
184 add_option( p, set, clear );
185 }
186 free( options );
187}
#define _strdup
Definition: debug_ros.c:7
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
_ACRTIMP char *__cdecl strchr(const char *, int)
Definition: string.c:3291
_ACRTIMP size_t __cdecl strcspn(const char *, const char *)
Definition: string.c:3498
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static unsigned __int64 next
Definition: rand_nt.c:6
static void add_option(const char *name, unsigned char set, unsigned char clear)
Definition: debug.c:107

Referenced by debug_init().

◆ release_temp_buffer()

static void release_temp_buffer ( char *  buffer,
size_t  size 
)
static

Definition at line 344 of file debug.c.

345{
346 /* don't bother doing anything */
347}

◆ ros_dbg_log()

int ros_dbg_log ( enum __wine_debug_class  cls,
struct __wine_debug_channel *  channel,
const char *  file,
const char *  func,
const int  line,
const char *  format,
  ... 
)

Definition at line 313 of file debug.c.

315{
316 int ret;
318
319 if (!(__wine_dbg_get_channel_flags( channel ) & (1 << cls))) return -1;
320
322 ret = funcs.dbg_vlog( cls, channel, file, func, line, format, valist );
323 va_end(valist);
324 return ret;
325}
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
static va_list valist
Definition: printf.c:46
#define __wine_dbg_get_channel_flags(channel)
Definition: wine_debug.c:172

◆ rosfmt_default_dbg_vlog()

static int rosfmt_default_dbg_vlog ( enum __wine_debug_class  cls,
struct __wine_debug_channel *  channel,
const char *  file,
const char *  func,
const int  line,
const char *  format,
va_list  args 
)
static

Definition at line 490 of file debug.c.

492{
493 char prefix[256];
494 static const int max_len = sizeof(prefix);
495 int len = 0;
496
497 if (TRACE_ON(tid))
499
500 if (cls < sizeof(debug_classes)/sizeof(debug_classes[0]))
501 len += _snprintf(prefix + len, max_len - len, "%s:", debug_classes[cls]);
502
503 if (file && line)
504 len += _snprintf(prefix + len, max_len - len, "(%s:%d) ", file, line);
505 else
506 len += _snprintf(prefix + len, max_len - len, "%s:%s: ", channel->name, func);
507
508 prefix[max_len - 1] = 0;
509 return vDbgPrintExWithPrefix(prefix, -1, 0, format, args);
510}

Referenced by debug_init().

◆ wine_dbg_log()

int wine_dbg_log ( enum __wine_debug_class  cls,
struct __wine_debug_channel *  channel,
const char *  func,
const char *  format,
  ... 
)

Definition at line 297 of file debug.c.

299{
300 int ret;
302
303 if (!(__wine_dbg_get_channel_flags( channel ) & (1 << cls))) return -1;
304
306 ret = funcs.dbg_vlog( cls, channel, NULL, func, 0, format, valist );
307 va_end(valist);
308 return ret;
309}

◆ wine_dbg_printf()

int wine_dbg_printf ( const char *  format,
  ... 
)

Definition at line 262 of file debug.c.

263{
264 int ret;
266
268 ret = funcs.dbg_vprintf( format, valist );
269 va_end(valist);
270 return ret;
271}

Referenced by __wine_dbg_output(), and winefmt_default_dbg_vlog().

◆ wine_dbg_sprintf()

const char * wine_dbg_sprintf ( const char *  format,
  ... 
)

Definition at line 279 of file debug.c.

280{
281 static const int max_size = 200;
282 char *ret;
283 int len;
285
287 ret = funcs.get_temp_buffer( max_size );
289 if (len == -1 || len >= max_size) ret[max_size-1] = 0;
290 else funcs.release_temp_buffer( ret, len + 1 );
291 va_end(valist);
292 return ret;
293}
#define vsnprintf
Definition: acwin.h:108
static INT max_size
Definition: history.c:51

◆ wine_dbgstr_an()

const char * wine_dbgstr_an ( const char *  s,
int  n 
)

Definition at line 542 of file debug.c.

543{
544 return funcs.dbgstr_an(s, n);
545}
GLdouble s
Definition: gl.h:2039

Referenced by debugstr_a(), debugstr_an(), and wine_dbgstr_a().

◆ wine_dbgstr_wn()

const char * wine_dbgstr_wn ( const WCHAR *  s,
int  n 
)

Definition at line 547 of file debug.c.

548{
549 return funcs.dbgstr_wn(s, n);
550}

◆ WINE_DECLARE_DEBUG_CHANNEL() [1/2]

WINE_DECLARE_DEBUG_CHANNEL ( pid  )

◆ WINE_DECLARE_DEBUG_CHANNEL() [2/2]

WINE_DECLARE_DEBUG_CHANNEL ( tid  )

◆ winefmt_default_dbg_vlog()

static int winefmt_default_dbg_vlog ( enum __wine_debug_class  cls,
struct __wine_debug_channel *  channel,
const char *  file,
const char *  func,
const int  line,
const char *  format,
va_list  args 
)
static

Definition at line 471 of file debug.c.

473{
474 char prefix[256];
475 static const int max_len = sizeof(prefix);
476 int len = 0;
477
478 if (TRACE_ON(pid))
481
482 if (cls < sizeof(debug_classes)/sizeof(debug_classes[0]))
483 len += _snprintf(prefix + len, max_len - len, "%s:%s:%s ", debug_classes[cls], channel->name, func);
484
485 prefix[max_len - 1] = 0;
486 return vDbgPrintExWithPrefix(prefix, -1, 0, format, args);
487}

Referenced by debug_init().

Variable Documentation

◆ debug_classes

const char* const debug_classes[] = { "fixme", "err", "warn", "trace" }
static

◆ debug_options

◆ default_flags

◆ funcs

static struct __wine_debug_functions funcs
static
Initial value:
=
{
}
static LPSTR get_temp_buffer(void)
Definition: dplayx.c:114
static void release_temp_buffer(char *buffer, size_t size)
Definition: debug.c:344
static const char * default_dbgstr_an(const char *str, int n)
Definition: debug.c:351
static int default_dbg_vprintf(const char *format, va_list args)
Definition: debug.c:463
static const char * default_dbgstr_wn(const WCHAR *str, int n)
Definition: debug.c:405

Definition at line 48 of file debug.c.

Referenced by __wine_dbg_set_functions(), add_func_info(), build_format_strings(), cff_size_done(), cff_size_init(), cff_size_request(), cff_slot_init(), cid_size_done(), cid_size_init(), cid_size_request(), cid_slot_init(), create_enumvariant(), create_nodemap(), CreateProxyFromTypeInfo(), CreateStubFromTypeInfo(), debug_init(), default_dbgstr_an(), default_dbgstr_wn(), DispatchEx_GetNextDispID(), get_func_from_memid(), get_iface_info(), get_proc_address64(), ITypeInfoImpl_GetInternalDispatchFuncDesc(), lookup_global_funcs(), mesh_get_parse_func(), NP_GetEntryPoints(), num_handlers(), psh_globals_funcs_init(), report(), ros_dbg_log(), T1_GlyphSlot_Init(), t1_hints_funcs_init(), T1_Size_Done(), T1_Size_Init(), T1_Size_Request(), t2_hints_funcs_init(), tess_callback_begin(), tess_callback_end(), tess_callback_vertex(), test_LoadFunctionPointers(), test_provider_funcs(), test_utils(), testCertTrust(), testInitialize(), testObjTrust(), wglUseFontBitmaps_common(), wglUseFontOutlines_common(), wine_dbg_log(), wine_dbg_printf(), wine_dbg_sprintf(), wine_dbgstr_an(), wine_dbgstr_wn(), and write_iface_fs().

◆ nb_debug_options

int nb_debug_options = -1
static