Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / libcfs / libcfs / darwin / darwin-debug.c
1 # define DEBUG_SUBSYSTEM S_LNET
2
3 #include <libcfs/kp30.h>
4 #include <libcfs/libcfs.h>
5 #include "tracefile.h"
6
7 void libcfs_debug_dumpstack(cfs_task_t *tsk)
8
9         return;
10 }
11
12 void libcfs_run_lbug_upcall(char *file, const char *fn, const int line)
13 {
14 }
15
16 void lbug_with_loc(char *file, const char *func, const int line)
17 {
18         libcfs_catastrophe = 1;
19         CEMERG("LBUG: pid: %u thread: %#x\n",
20                (unsigned)cfs_curproc_pid(), (unsigned)current_thread());
21         libcfs_debug_dumplog();
22         libcfs_run_lbug_upcall(file, func, line);
23         while (1)
24                 cfs_schedule();
25
26         /* panic("lbug_with_loc(%s, %s, %d)", file, func, line) */
27 }
28
29 #if ENTRY_NESTING_SUPPORT
30
31 static inline struct cfs_debug_data *__current_cdd(void)
32 {
33         struct cfs_debug_data *cdd;
34
35         cdd = (struct cfs_debug_data *)current_uthread()->uu_nlminfo;
36         if (cdd != NULL &&
37             cdd->magic1 == CDD_MAGIC1 && cdd->magic2 == CDD_MAGIC2 &&
38             cdd->nesting_level < 1000)
39                 return cdd;
40         else
41                 return NULL;
42 }
43
44 static inline void __current_cdd_set(struct cfs_debug_data *cdd)
45 {
46         current_uthread()->uu_nlminfo = (void *)cdd;
47 }
48
49 void __entry_nesting(struct cfs_debug_data *child)
50 {
51         struct cfs_debug_data *parent;
52
53         parent = __current_cdd();
54         if (parent != NULL) {
55                 child->parent        = parent;
56                 child->nesting_level = parent->nesting_level + 1;
57         }
58         __current_cdd_set(child);
59 }
60
61 void __exit_nesting(struct cfs_debug_data *child)
62 {
63         __current_cdd_set(child->parent);
64 }
65
66 unsigned int __current_nesting_level(void)
67 {
68         struct cfs_debug_data *cdd;
69
70         cdd = __current_cdd();
71         if (cdd != NULL)
72                 return cdd->nesting_level;
73         else
74                 return 0;
75 }
76 /* ENTRY_NESTING_SUPPORT */
77 #endif