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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « collector.c ('k') | debug.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: debug.h
diff --git a/debug.h b/debug.h
new file mode 100644
index 0000000000000000000000000000000000000000..5d11ec39200b9e3bac58a6fb86115b6b00316df5
--- /dev/null
+++ b/debug.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+ | (C) Copyright 2008 Novell, Inc. All Rights Reserved.
+ |
+ | GPLv2: This program is free software; you can redistribute it
+ | and/or modify it under the terms of version 2 of the GNU General
+ | Public License as published by the Free Software Foundation.
+ |
+ | This program is distributed in the hope that it will be useful,
+ | but WITHOUT ANY WARRANTY; without even the implied warranty of
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ | GNU General Public License for more details.
+ +-------------------------------------------------------------------------*/
+
+#ifndef _DEBUG_H_
+#define _DEBUG_H_
+
+#ifndef _STYLE_H_
+#include <style.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int debugon (void);
+int debugoff (void);
+int fdebugon (void);
+int fdebugoff(void);
+int debugenv (void);
+
+void debugstderr(void);
+void debugstdout(void);
+
+bool debug_is_on (void);
+bool debug_is_off (void);
+
+bool prf (const char *);
+bool pr (const char *fn, unsigned line, const char *);
+bool prd (const char *fn, unsigned line, const char *, s64);
+bool prp (const char *fn, unsigned line, const char *, void *);
+bool prs (const char *fn, unsigned line, const char *, const char *);
+bool pru (const char *fn, unsigned line, const char *, u64);
+bool prx (const char *fn, unsigned line, const char *, u64);
+bool prg (const char *fn, unsigned line, const char *, double x);
+bool prid (const char *fn, unsigned line, const char *, guid_t x);
+bool prmem (const char *, const void *, unsigned int);
+bool prbytes (const char *, const void *, unsigned int);
+bool print (const char *fn, unsigned line, const char *format, ...);
+
+#define FN_ARG __FUNCTION__, __LINE__
+#define FN prf(__FUNCTION__)
+#define HERE pr(FN_ARG, NULL)
+#define PR(_s_) pr(FN_ARG, # _s_)
+#define PRd(_x_) prd(FN_ARG, # _x_, _x_)
+#define PRp(_x_) prp(FN_ARG, # _x_, _x_)
+#define PRs(_x_) prs(FN_ARG, # _x_, _x_)
+#define PRu(_x_) pru(FN_ARG, # _x_, _x_)
+#define PRx(_x_) prx(FN_ARG, # _x_, _x_)
+#define PRg(_x_) prg(FN_ARG, # _x_, _x_)
+#define PRid(_x_) prid(FN_ARG, # _x_, _x_)
+
+typedef struct counter_s counter_s;
+struct counter_s {
+ counter_s *next;
+ const char *where;
+ const char *fn;
+ u64 count;
+};
+void count (counter_s *coutner);
+void report (void);
+#define CNT { \
+ static counter_s counter = { NULL, WHERE, __FUNCTION__, 0 }; \
+ count( &counter); \
+}
+
+#ifndef assert
+extern int assertError(const char *what);
+#define assert(_e_) ((void)((_e_) || assertError(WHERE " (" # _e_ ")")))
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
« 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