Subversion Repositories HelenOS-historic

Rev

Rev 1702 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1702 Rev 1780
Line 36... Line 36...
36
#define __DEBUG_H__
36
#define __DEBUG_H__
37
 
37
 
38
#include <panic.h>
38
#include <panic.h>
39
#include <arch/debug.h>
39
#include <arch/debug.h>
40
 
40
 
41
#define CALLER       ((__address)__builtin_return_address(0))
41
#define CALLER       ((uintptr_t)__builtin_return_address(0))
42
 
42
 
43
#ifndef HERE
43
#ifndef HERE
44
/** Current Instruction Pointer address */
44
/** Current Instruction Pointer address */
45
#  define HERE ((__address *)0)
45
#  define HERE ((uintptr_t *)0)
46
#endif
46
#endif
47
 
47
 
48
/** Debugging ASSERT macro
48
/** Debugging ASSERT macro
49
 *
49
 *
50
 * If CONFIG_DEBUG is set, the ASSERT() macro
50
 * If CONFIG_DEBUG is set, the ASSERT() macro
Line 53... Line 53...
53
 *
53
 *
54
 * @param expr Expression which is expected to be true.
54
 * @param expr Expression which is expected to be true.
55
 *
55
 *
56
 */
56
 */
57
#ifdef CONFIG_DEBUG
57
#ifdef CONFIG_DEBUG
58
#   define ASSERT(expr) if (!(expr)) { panic("assertion failed (%s), caller=%.*p\n", #expr, sizeof(__address) * 2, CALLER); }
58
#   define ASSERT(expr) if (!(expr)) { panic("assertion failed (%s), caller=%.*p\n", #expr, sizeof(uintptr_t) * 2, CALLER); }
59
#else
59
#else
60
#   define ASSERT(expr)
60
#   define ASSERT(expr)
61
#endif
61
#endif
62
 
62
 
63
#define STRING(arg) STRING_ARG(arg)
63
#define STRING(arg) STRING_ARG(arg)