ReactOS 0.4.15-dev-7928-g68a8619
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 <rtlfuncs.h>
#include <cmfuncs.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)
 
ULONG NTAPI vDbgPrintExWithPrefix (IN LPCSTR Prefix, IN ULONG ComponentId, IN ULONG Level, IN LPCSTR Format, IN va_list ap)
 
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,...)
 
const charwine_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 charget_temp_buffer (size_t size)
 
static void release_temp_buffer (char *buffer, size_t size)
 
static const chardefault_dbgstr_an (const char *str, int n)
 
static const chardefault_dbgstr_wn (const WCHAR *str, int n)
 
static int default_dbg_vprintf (const char *format, va_list args)
 
const charwine_dbgstr_an (const char *s, int n)
 
const charwine_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 53 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 83 of file debug.c.

84{
85 if (nb_debug_options == -1) debug_init();
86
88 {
90 sizeof(debug_options[0]), cmp_name );
91 if (opt) return opt->flags;
92 }
93 /* no option for this channel */
94 if (channel->flags & (1 << __WINE_DBCL_INIT)) channel->flags = default_flags;
95 return default_flags;
96}
@ __WINE_DBCL_INIT
Definition: debug.h:57
static unsigned char default_flags
Definition: debug.c:55
static int nb_debug_options
Definition: debug.c:56
static void debug_init(void)
Definition: debug.c:220
static struct __wine_debug_channel debug_options[MAX_DEBUG_OPTIONS]
Definition: debug.c:57
static int __cdecl cmp_name(const void *p1, const void *p2)
Definition: debug.c:75
unsigned char flags
Definition: debug.h:62
char name[15]
Definition: debug.h:63
#define bsearch

Referenced by ros_dbg_log(), and wine_dbg_log().

◆ __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 99 of file debug.c.

101{
102 if (nb_debug_options == -1) debug_init();
103
105 {
107 sizeof(debug_options[0]), cmp_name );
108 if (opt)
109 {
110 opt->flags = (opt->flags & ~clear) | set;
111 return 1;
112 }
113 }
114 return 0;
115}
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 551 of file debug.c.

553{
554 if (old_funcs) memcpy( old_funcs, &funcs, min(sizeof(funcs),size) );
555 if (new_funcs) memcpy( &funcs, new_funcs, min(sizeof(funcs),size) );
556}
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:59

◆ add_option()

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

Definition at line 118 of file debug.c.

119{
120 int min = 0, max = nb_debug_options - 1, pos, res;
121
122 if (!name[0]) /* "all" option */
123 {
124 default_flags = (default_flags & ~clear) | set;
125 return;
126 }
127 if (strlen(name) >= sizeof(debug_options[0].name)) return;
128
129 while (min <= max)
130 {
131 pos = (min + max) / 2;
133 if (!res)
134 {
135 debug_options[pos].flags = (debug_options[pos].flags & ~clear) | set;
136 return;
137 }
138 if (res < 0) max = pos - 1;
139 else min = pos + 1;
140 }
141 if (nb_debug_options >= MAX_DEBUG_OPTIONS) return;
142
143 pos = min;
145 (nb_debug_options - pos) * sizeof(debug_options[0]) );
147 debug_options[pos].flags = (default_flags & ~clear) | set;
149}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
GLuint res
Definition: glext.h:9613
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define MAX_DEBUG_OPTIONS
Definition: debug.c:53
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 75 of file debug.c.

76{
77 const char *name = p1;
78 const struct __wine_debug_channel *chan = p2;
79 return strcmp( name, chan->name );
80}

Referenced by __wine_dbg_get_channel_flags(), and __wine_dbg_set_channel_flags().

◆ debug_init()

static void debug_init ( void  )
static

Definition at line 220 of file debug.c.

221{
222 char *wine_debug;
224 /* GetEnvironmentVariableA will change LastError! */
225 DWORD LastError = GetLastError();
226
227 if (nb_debug_options != -1) return; /* already initialized */
229
230 dwLength = GetEnvironmentVariableA("DEBUGCHANNEL", NULL, 0);
231 if (dwLength)
232 {
233 wine_debug = malloc(dwLength);
234 if (wine_debug)
235 {
236 if (GetEnvironmentVariableA("DEBUGCHANNEL", wine_debug, dwLength) < dwLength)
237 parse_options(wine_debug);
238 free(wine_debug);
239 }
240 }
241
242 dwLength = GetEnvironmentVariableA("DEBUGFORMAT", NULL, 0);
243 if (dwLength)
244 {
245 wine_debug = malloc(dwLength);
246 if (wine_debug)
247 {
248 if (GetEnvironmentVariableA("DEBUGFORMAT", wine_debug, dwLength) < dwLength)
249 {
250 if (strcmp(wine_debug, "wine") == 0)
251 {
253 }
254 else
255 if (strcmp(wine_debug, "extended") == 0 ||
256 strcmp(wine_debug, "ext") == 0)
257 {
259 }
260 else
261 {
263 }
264 }
265 free(wine_debug);
266 }
267 }
268
269 SetLastError(LastError);
270}
#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:152
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:514
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:477
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:493
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 469 of file debug.c.

470{
471 return vDbgPrintExWithPrefix("", -1, 0, format, args);
472}
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
ULONG NTAPI vDbgPrintExWithPrefix(IN LPCSTR Prefix, IN ULONG ComponentId, IN ULONG Level, IN LPCSTR Format, IN va_list ap)
Definition: match.c:390

◆ default_dbgstr_an()

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

Definition at line 357 of file debug.c.

358{
359 static const char hex[16] = "0123456789abcdef";
360 char *dst, *res;
361 size_t size;
362
363 if (!((ULONG_PTR)str >> 16))
364 {
365 if (!str) return "(null)";
366 res = funcs.get_temp_buffer( 6 );
367 sprintf( res, "#%04x", LOWORD(str) );
368 return res;
369 }
370 if (n == -1) n = strlen(str);
371 if (n < 0) n = 0;
372 size = 10 + min( 300, n * 4 );
373 dst = res = funcs.get_temp_buffer( size );
374 *dst++ = '"';
375 while (n-- > 0 && dst <= res + size - 9)
376 {
377 unsigned char c = *str++;
378 switch (c)
379 {
380 case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
381 case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
382 case '\t': *dst++ = '\\'; *dst++ = 't'; break;
383 case '"': *dst++ = '\\'; *dst++ = '"'; break;
384 case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
385 default:
386 if (c >= ' ' && c <= 126)
387 *dst++ = c;
388 else
389 {
390 *dst++ = '\\';
391 *dst++ = 'x';
392 *dst++ = hex[(c >> 4) & 0x0f];
393 *dst++ = hex[c & 0x0f];
394 }
395 }
396 }
397 *dst++ = '"';
398 if (n > 0)
399 {
400 *dst++ = '.';
401 *dst++ = '.';
402 *dst++ = '.';
403 }
404 *dst++ = 0;
405 funcs.release_temp_buffer( res, dst - res );
406 return res;
407}
GLdouble n
Definition: glext.h:7729
const GLubyte * c
Definition: glext.h:8905
GLenum GLenum dst
Definition: glext.h:6340
int hex(char ch)
#define c
Definition: ke_i.h:80
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define LOWORD(l)
Definition: pedump.c:82
const WCHAR * str
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 411 of file debug.c.

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

◆ 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 514 of file debug.c.

516{
517 int ret = 0;
518
519 if (TRACE_ON(pid) || TRACE_ON(tid))
520 {
521 ret += wine_dbg_printf( "[%04x:%04x]:",
524 }
525
526 if (cls < sizeof(debug_classes)/sizeof(debug_classes[0]))
527 ret += wine_dbg_printf( "%s:", debug_classes[cls] );
528
529 if (file && line)
530 ret += wine_dbg_printf( "(%s:%d):", file, line );
531
532 ret += wine_dbg_printf( "%s:%s ", channel->name, func );
533
534 if (format)
535 ret += funcs.dbg_vprintf( format, args );
536 return ret;
537}
#define HandleToULong(h)
Definition: basetsd.h:95
#define TRACE_ON(x)
Definition: compat.h:75
GLenum func
Definition: glext.h:6028
#define NtCurrentTeb
static TfClientId tid
static const char *const debug_classes[]
Definition: debug.c:51
int wine_dbg_printf(const char *format,...)
Definition: debug.c:273
HANDLE UniqueThread
Definition: compat.h:826
HANDLE UniqueProcess
Definition: compat.h:825
Definition: fci.c:127
Definition: parser.c:49
int ret
_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 336 of file debug.c.

337{
338 static char *list[32];
339 static long pos = 0;
340 char *ret;
341 long idx;
342
343 idx = interlocked_xchg_add( &pos, 1 ) % (sizeof(list)/sizeof(list[0]));
344 if ((ret = realloc( list[idx], size ))) list[idx] = ret;
345 return ret;
346}
Definition: list.h:37
#define realloc
Definition: debug_ros.c:6
unsigned int idx
Definition: utils.c:41
#define list
Definition: rosglue.h:35
#define interlocked_xchg_add
Definition: port.h:347

◆ parse_options()

static void parse_options ( const char str)
static

Definition at line 152 of file debug.c.

153{
154 char *opt, *next, *options;
155 unsigned int i;
156
157 if (!(options = _strdup(str))) return;
158 for (opt = options; opt; opt = next)
159 {
160 const char *p;
161 unsigned char set = 0, clear = 0;
162
163 if ((next = strchr( opt, ',' ))) *next++ = 0;
164
165 p = opt + strcspn( opt, "+-" );
166 if (!p[0]) p = opt; /* assume it's a debug channel name */
167
168 if (p > opt)
169 {
170 for (i = 0; i < sizeof(debug_classes)/sizeof(debug_classes[0]); i++)
171 {
172 int len = strlen(debug_classes[i]);
173 if (len != (p - opt)) continue;
174 if (!memcmp( opt, debug_classes[i], len )) /* found it */
175 {
176 if (*p == '+') set |= 1 << i;
177 else clear |= 1 << i;
178 break;
179 }
180 }
181 if (i == sizeof(debug_classes)/sizeof(debug_classes[0])) /* bad class name, skip it */
182 continue;
183 }
184 else
185 {
186 if (*p == '-') clear = ~0;
187 else set = ~0;
188 }
189 if (*p == '+' || *p == '-') p++;
190 if (!p[0]) continue;
191
192 if (!strcmp( p, "all" ))
193 default_flags = (default_flags & ~clear) | set;
194 else
195 add_option( p, set, clear );
196 }
197 free( options );
198}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define _strdup
Definition: debug_ros.c:7
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
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
_Check_return_ _CRTIMP size_t __cdecl strcspn(_In_z_ const char *_Str, _In_z_ const char *_Control)
static void add_option(const char *name, unsigned char set, unsigned char clear)
Definition: debug.c:118

Referenced by debug_init().

◆ release_temp_buffer()

static void release_temp_buffer ( char buffer,
size_t  size 
)
static

Definition at line 350 of file debug.c.

351{
352 /* don't bother doing anything */
353}

◆ 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 319 of file debug.c.

321{
322 int ret;
324
325 if (!(__wine_dbg_get_channel_flags( channel ) & (1 << cls))) return -1;
326
328 ret = funcs.dbg_vlog( cls, channel, file, func, line, format, valist );
329 va_end(valist);
330 return ret;
331}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
static __ms_va_list valist
Definition: printf.c:66
unsigned char __wine_dbg_get_channel_flags(struct __wine_debug_channel *channel)
Definition: debug.c:83

◆ 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 493 of file debug.c.

495{
496 int ret = 0;
497
498 if (TRACE_ON(tid))
500
501 if (cls < sizeof(debug_classes)/sizeof(debug_classes[0]))
502 ret += wine_dbg_printf( "%s:", debug_classes[cls] );
503
504 if (file && line)
505 ret += wine_dbg_printf( "(%s:%d) ", file, line );
506 else
507 ret += wine_dbg_printf( "%s:%s: ", channel->name, func );
508
509 if (format)
510 ret += funcs.dbg_vprintf( format, args );
511 return ret;
512}

Referenced by debug_init().

◆ vDbgPrintExWithPrefix()

ULONG NTAPI vDbgPrintExWithPrefix ( IN LPCSTR  Prefix,
IN ULONG  ComponentId,
IN ULONG  Level,
IN LPCSTR  Format,
IN va_list  ap 
)

◆ 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 303 of file debug.c.

305{
306 int ret;
308
309 if (!(__wine_dbg_get_channel_flags( channel ) & (1 << cls))) return -1;
310
312 ret = funcs.dbg_vlog( cls, channel, NULL, func, 0, format, valist );
313 va_end(valist);
314 return ret;
315}

◆ wine_dbg_printf()

int wine_dbg_printf ( const char format,
  ... 
)

Definition at line 273 of file debug.c.

274{
275 int ret;
277
279 ret = funcs.dbg_vprintf( format, valist );
280 va_end(valist);
281 return ret;
282}

Referenced by extfmt_default_dbg_vlog(), rosfmt_default_dbg_vlog(), and winefmt_default_dbg_vlog().

◆ wine_dbg_sprintf()

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

Definition at line 285 of file debug.c.

286{
287 static const int max_size = 200;
288 char *ret;
289 int len;
291
293 ret = funcs.get_temp_buffer( max_size );
295 if (len == -1 || len >= max_size) ret[max_size-1] = 0;
296 else funcs.release_temp_buffer( ret, len + 1 );
297 va_end(valist);
298 return ret;
299}
static INT max_size
Definition: history.c:51
#define vsnprintf
Definition: tif_win32.c:406

Referenced by wine_dbgstr_longlong().

◆ wine_dbgstr_an()

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

Definition at line 541 of file debug.c.

542{
543 return funcs.dbgstr_an(s, n);
544}
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 546 of file debug.c.

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

Referenced by debugstr_w(), debugstr_wn(), and wine_dbgstr_w().

◆ 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 477 of file debug.c.

479{
480 int ret = 0;
481
482 if (TRACE_ON(pid))
485
486 if (cls < sizeof(debug_classes)/sizeof(debug_classes[0]))
487 ret += wine_dbg_printf( "%s:%s:%s ", debug_classes[cls], channel->name, func );
488 if (format)
489 ret += funcs.dbg_vprintf( format, args );
490 return ret;
491}

Referenced by debug_init().

Variable Documentation

◆ debug_classes

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

◆ debug_options

◆ default_flags

unsigned char default_flags = (1 << __WINE_DBCL_ERR) | (1 << __WINE_DBCL_FIXME)
static

Definition at line 55 of file debug.c.

Referenced by __wine_dbg_get_channel_flags(), add_option(), and parse_options().

◆ funcs

static struct __wine_debug_functions funcs
static
Initial value:
=
{
}
static LPSTR get_temp_buffer(void)
Definition: dplayx.c:88
static void release_temp_buffer(char *buffer, size_t size)
Definition: debug.c:350
static const char * default_dbgstr_an(const char *str, int n)
Definition: debug.c:357
static int default_dbg_vprintf(const char *format, va_list args)
Definition: debug.c:469
static const char * default_dbgstr_wn(const WCHAR *str, int n)
Definition: debug.c:411

Definition at line 59 of file debug.c.

Referenced by __wine_dbg_set_functions(), add_func_info(), add_function_decl(), 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(), CreateProxyFromTypeInfo(), CreateStubFromTypeInfo(), debug_init(), default_dbgstr_an(), default_dbgstr_wn(), DispatchEx_GetNextDispID(), extfmt_default_dbg_vlog(), get_iface_info(), ITypeInfoImpl_GetInternalDispatchFuncDesc(), NP_GetEntryPoints(), num_handlers(), psh_globals_funcs_init(), report(), ros_dbg_log(), rosfmt_default_dbg_vlog(), 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_FakeDLL(), 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(), winefmt_default_dbg_vlog(), and write_iface_fs().

◆ nb_debug_options

int nb_debug_options = -1
static