diff options
author | hunt <hunt> | 2008-02-27 19:45:45 +0000 |
---|---|---|
committer | hunt <hunt> | 2008-02-27 19:45:45 +0000 |
commit | 9a5de18784b77de82e5121861fac892c2d4d2630 (patch) | |
tree | 54d0a3fb138a31627788606953bb1cb37897caf8 /runtime/debug.h | |
parent | a2dc47ddef0dbed1b0dc912c876f5f57f97c1ede (diff) | |
download | systemtap-steved-9a5de18784b77de82e5121861fac892c2d4d2630.tar.gz systemtap-steved-9a5de18784b77de82e5121861fac892c2d4d2630.tar.xz systemtap-steved-9a5de18784b77de82e5121861fac892c2d4d2630.zip |
2008-02-27 Martin Hunt <hunt@redhat.com>
* sym.h (_stp_module): Add text_size, lock, and unwind data
pointer.
* sym.c (_stp_find_module_by_addr): New function.
(_stp_kallsyms_lookup): Call _stp_find_module_by_addr().
(_stp_get_unwind_info): New.
* runtime.h: Move debug macros to debug.h. Include it.
* debug.h: New file.
* map.c: Update debug calls.
* map-gen.c: Update debug calls.
* pmap-gen.c: Update debug calls.
* mempool.c: New file.
* symbols.c: Use rwlocks. Use new dbug macros. Handle
unwind info if present.
* transport.c: Include mempool.c. Update dbug and kbug calls
to new macros.
* transport_msgs.h (_stp_command_name): Add
struct containing message names for debugging.
* control.c, procfs.c: Use new dbug macros. Use
new mempool functions.
Diffstat (limited to 'runtime/debug.h')
-rw-r--r-- | runtime/debug.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/runtime/debug.h b/runtime/debug.h new file mode 100644 index 00000000..8f877ede --- /dev/null +++ b/runtime/debug.h @@ -0,0 +1,66 @@ +/* Systemtap Debug Macros + * Copyright (C) 2008 Red Hat Inc. + * + * This file is part of systemtap, and is free software. You can + * redistribute it and/or modify it under the terms of the GNU General + * Public License (GPL); either version 2, or (at your option) any + * later version. + */ + +#ifndef _STP_DEBUG_H_ +#define _STP_DEBUG_H_ + +/* These are always on. + * _dbug() writes to systemtap stderr. + * errk() writes to the system log. + */ +#define _dbug(args...) _stp_dbug(__FUNCTION__, __LINE__, args) + +#define errk(args...) do { \ + printk("Systemtap Error at %s:%d ",__FUNCTION__, __LINE__); \ + printk(args); \ + } while (0) + +#ifdef DEBUG_TRANSPORT +#undef DEBUG_TRANSPORT +#define DEBUG_TRANSPORT 1 +#else +#define DEBUG_TRANSPORT 0 +#endif + +#ifdef DEBUG_UNWIND +#undef DEBUG_UNWIND +#define DEBUG_UNWIND 2 +#else +#define DEBUG_UNWIND 0 +#endif + +#ifdef DEBUG_SYMBOLS +#undef DEBUG_SYMBOLS +#define DEBUG_SYMBOLS 4 +#else +#define DEBUG_SYMBOLS 0 +#endif + +#define DEBUG_TYPE (DEBUG_TRANSPORT|DEBUG_UNWIND|DEBUG_SYMBOLS) + +#if DEBUG_TYPE > 0 + +#define dbug(type, args...) do { \ + if ((type) & DEBUG_TYPE) \ + _stp_dbug(__FUNCTION__, __LINE__, args); \ + } while (0) + +#define kbug(type, args...) do { \ + if ((type) & DEBUG_TYPE) { \ + printk("%s:%d ",__FUNCTION__, __LINE__); \ + printk(args); \ + } \ + } while (0) + +#else +#define dbug(type, args...) ; +#define kbug(type, args...) ; +#endif /* DEBUG_TYPE > 0 */ + +#endif /* _STP_DEBUG_H_ */ |