Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(564)

Side by Side Diff: debug.h

Issue 6893111: Enhancements to ktop (Closed) Base URL: ssh://gitrw.chromium.org:9222/ktop.git@master
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « collector.c ('k') | debug.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /****************************************************************************
2 | (C) Copyright 2008 Novell, Inc. All Rights Reserved.
3 |
4 | GPLv2: This program is free software; you can redistribute it
5 | and/or modify it under the terms of version 2 of the GNU General
6 | Public License as published by the Free Software Foundation.
7 |
8 | This program is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 +-------------------------------------------------------------------------*/
13
14 #ifndef _DEBUG_H_
15 #define _DEBUG_H_
16
17 #ifndef _STYLE_H_
18 #include <style.h>
19 #endif
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 int debugon (void);
26 int debugoff (void);
27 int fdebugon (void);
28 int fdebugoff(void);
29 int debugenv (void);
30
31 void debugstderr(void);
32 void debugstdout(void);
33
34 bool debug_is_on (void);
35 bool debug_is_off (void);
36
37 bool prf (const char *);
38 bool pr (const char *fn, unsigned line, const char *);
39 bool prd (const char *fn, unsigned line, const char *, s64);
40 bool prp (const char *fn, unsigned line, const char *, void *);
41 bool prs (const char *fn, unsigned line, const char *, const char *);
42 bool pru (const char *fn, unsigned line, const char *, u64);
43 bool prx (const char *fn, unsigned line, const char *, u64);
44 bool prg (const char *fn, unsigned line, const char *, double x);
45 bool prid (const char *fn, unsigned line, const char *, guid_t x);
46 bool prmem (const char *, const void *, unsigned int);
47 bool prbytes (const char *, const void *, unsigned int);
48 bool print (const char *fn, unsigned line, const char *format, ...);
49
50 #define FN_ARG __FUNCTION__, __LINE__
51 #define FN prf(__FUNCTION__)
52 #define HERE pr(FN_ARG, NULL)
53 #define PR(_s_) pr(FN_ARG, # _s_)
54 #define PRd(_x_) prd(FN_ARG, # _x_, _x_)
55 #define PRp(_x_) prp(FN_ARG, # _x_, _x_)
56 #define PRs(_x_) prs(FN_ARG, # _x_, _x_)
57 #define PRu(_x_) pru(FN_ARG, # _x_, _x_)
58 #define PRx(_x_) prx(FN_ARG, # _x_, _x_)
59 #define PRg(_x_) prg(FN_ARG, # _x_, _x_)
60 #define PRid(_x_) prid(FN_ARG, # _x_, _x_)
61
62 typedef struct counter_s counter_s;
63 struct counter_s {
64 counter_s *next;
65 const char *where;
66 const char *fn;
67 u64 count;
68 };
69 void count (counter_s *coutner);
70 void report (void);
71 #define CNT { \
72 static counter_s counter = { NULL, WHERE, __FUNCTION__, 0 }; \
73 count( &counter); \
74 }
75
76 #ifndef assert
77 extern int assertError(const char *what);
78 #define assert(_e_) ((void)((_e_) || assertError(WHERE " (" # _e_ ")")))
79 #endif
80
81 #ifdef __cplusplus
82 }
83 #endif
84
85 #endif
OLDNEW
« no previous file with comments | « collector.c ('k') | debug.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698