File: rtl_debug.h

package info (click to toggle)
rtlinux 3.1pre3-3
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 4,896 kB
  • ctags: 4,228
  • sloc: ansic: 26,204; sh: 2,069; makefile: 1,414; perl: 855; tcl: 489; asm: 380; cpp: 42
file content (51 lines) | stat: -rw-r--r-- 1,292 bytes parent folder | download | duplicates (2)
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
/*
 * RTLinux debug routines
 *
 * Written by Michael Barabanov
 * Copyright (C) Finite State Machine Labs Inc., 1998-1999
 * Released under the terms of the GPL Version 2
 *
 * Idea for debugpr from include/linux/sunrpc/debug.h
 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
 *
 */

#ifndef __RTL_DEBUG__
#define __RTL_DEBUG__


#define do_first(x) if (({static int __count=(x); __count-- > 0;}))

#define do_every(x) if (({static unsigned __count=x; !(__count++ % x); }))

#ifdef __KERNEL__

#ifdef RTL_DEBUG_PRINT
#define debugpr(format, args...)	rtl_printf(format, ## args)
#else
#define debugpr(format, args...)	do { ; } while (0)
#endif

#ifdef __i386__
#define BREAKPOINT() asm("   int $3");
#elif defined(__powerpc__)
#define BREAKPOINT() asm(".long 0x7d821008");
#elif defined(__alpha__)
#define BREAKPOINT() asm("	bpt");
#else
#define BREAKPOINT() do { ; } while (0)
#endif

/* This will generate a breakpoint exception.  It can be used at the
   beginning of a program to sync up with a debugger and can be used
   otherwise as a quick means to stop program execution and "break" into
   the debugger. */

extern int rtl_debug_initialized;
#define breakpoint() do { if (rtl_debug_initialized) BREAKPOINT(); } while (0)

#endif /* __KERNEL__ */


#endif /* __RTL_DEBUG__ */