File: debugtools.h

package info (click to toggle)
wine 0.0.980315-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 10,136 kB
  • ctags: 26,112
  • sloc: ansic: 156,310; makefile: 1,160; yacc: 807; perl: 655; lex: 555; sh: 304
file content (51 lines) | stat: -rw-r--r-- 1,459 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

#ifndef __WINE_DEBUGTOOLS_H
#define __WINE_DEBUGTOOLS_H

#include <stdio.h>

#define DEBUG_RUNTIME
#define stddeb  stdout
#define stdnimp stdout

#define DEBUG_CLASS_COUNT 4

extern short debug_msg_enabled[][DEBUG_CLASS_COUNT];

#define dbg_str(name) debug_str_##name
#define dbg_buf(name) debug_buf_##name

#define dbg_decl_str(name, size) \
  char dbg_str(name)[size], *dbg_buf(name)=dbg_str(name)

#define dbg_reset_str(name) \
  dbg_buf(name)=dbg_str(name)

#define dsprintf(name, format, args...) \
  dbg_buf(name)+=sprintf(dbg_buf(name), format, ## args)

#define dbg_ch_index(ch) (dbch_##ch)
#define dbg_cl_index(cl) (dbcl_##cl)

#define DEBUGGING(cl, ch) \
  (dbg_ch_index(ch) >=0 && dbg_cl_index(cl) >= 0 && \
   debug_msg_enabled[dbg_ch_index(ch)][dbg_cl_index(cl)])

#define DPRINTF(format, args...) \
  fprintf(stddeb, format, ## args)

#define DPRINTF_(cl, ch, format, args...) \
  if(!DEBUGGING(cl, ch)) ; \
  else DPRINTF(# cl ":" # ch ":%s " format, __FUNCTION__ , ## args)

#define TRACE(ch, fmt, args...) DPRINTF_(trace, ch, fmt, ## args)
#define WARN(ch, fmt, args...)  DPRINTF_(warn,  ch, fmt, ## args)
#define FIXME(ch, fmt, args...) DPRINTF_(fixme, ch, fmt, ## args)
#define ERR(ch, fmt, args...)   DPRINTF_(err, ch, fmt, ## args)

#define FIXME_ON(ch)  DEBUGGING(fixme, ch)
#define ERR_ON(ch)    DEBUGGING(err, ch)
#define WARN_ON(ch)   DEBUGGING(warn, ch)
#define TRACE_ON(ch)  DEBUGGING(trace, ch)

#endif  /* __WINE_DEBUGTOOLS_H */