|
0
|
1 //========================================================================== |
|
|
2 // |
|
2
|
3 // null.cxx |
|
0
|
4 // |
|
2
|
5 // Null trace and assert functions |
|
0
|
6 // |
|
|
7 //========================================================================== |
|
|
8 //####COPYRIGHTBEGIN#### |
|
|
9 // |
|
|
10 // ------------------------------------------- |
|
|
11 // The contents of this file are subject to the Cygnus eCos Public License |
|
|
12 // Version 1.0 (the "License"); you may not use this file except in |
|
|
13 // compliance with the License. You may obtain a copy of the License at |
|
|
14 // http://sourceware.cygnus.com/ecos |
|
|
15 // |
|
|
16 // Software distributed under the License is distributed on an "AS IS" |
|
|
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
|
18 // License for the specific language governing rights and limitations under |
|
|
19 // the License. |
|
|
20 // |
|
|
21 // The Original Code is eCos - Embedded Cygnus Operating System, released |
|
|
22 // September 30, 1998. |
|
|
23 // |
|
|
24 // The Initial Developer of the Original Code is Cygnus. Portions created |
|
2
|
25 // by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved. |
|
0
|
26 // ------------------------------------------- |
|
|
27 // |
|
|
28 //####COPYRIGHTEND#### |
|
|
29 //========================================================================== |
|
|
30 //#####DESCRIPTIONBEGIN#### |
|
|
31 // |
|
2
|
32 // Author(s): nickg |
|
|
33 // Contributors: nickg |
|
|
34 // Date: 1997-09-15 |
|
|
35 // Purpose: Trace and assert functions |
|
|
36 // Description: The functions in this file are null implementations of the |
|
0
|
37 // standard trace and assert functions. These can be used to |
|
|
38 // eliminate all trace and assert messages without recompiling. |
|
|
39 // |
|
|
40 //####DESCRIPTIONEND#### |
|
|
41 // |
|
|
42 //========================================================================== |
|
|
43 |
|
|
44 #include <pkgconf/infra.h> |
|
|
45 |
|
|
46 #ifndef CYGDBG_USE_ASSERTS |
|
|
47 // then you get an empty function regardless, so that other code can link: |
|
|
48 // (for example libc assert() calls this whether or not eCos code has |
|
|
49 // asserts enabled - of course if it does, assert() maps to the chosen |
|
|
50 // implementation; if not, it's the same inner function to breakpoint.) |
|
|
51 |
|
|
52 #include <cyg/infra/cyg_type.h> // base types |
|
|
53 #include <cyg/infra/cyg_trac.h> // tracing macros |
|
|
54 #include <cyg/infra/cyg_ass.h> // assertion macros |
|
|
55 |
|
|
56 externC void |
|
2
|
57 cyg_assert_fail( const char *psz_func, const char *psz_file, |
|
|
58 cyg_uint32 linenum, const char *psz_msg ) |
|
0
|
59 { |
|
|
60 for(;;); |
|
|
61 }; |
|
|
62 #endif // not CYGDBG_USE_ASSERTS |
|
|
63 |
|
|
64 #ifdef CYGDBG_INFRA_DEBUG_TRACE_ASSERT_NULL |
|
|
65 |
|
|
66 #include <cyg/infra/cyg_type.h> // base types |
|
|
67 #include <cyg/infra/cyg_trac.h> // tracing macros |
|
|
68 #include <cyg/infra/cyg_ass.h> // assertion macros |
|
|
69 |
|
|
70 // ------------------------------------------------------------------------- |
|
|
71 // Trace functions: |
|
|
72 |
|
|
73 #ifdef CYGDBG_USE_TRACING |
|
|
74 |
|
|
75 externC void |
|
|
76 cyg_tracenomsg( char *psz_func, char *psz_file, cyg_uint32 linenum ) |
|
|
77 {} |
|
|
78 |
|
|
79 // provide every other one of these as a space/caller bloat compromise. |
|
|
80 |
|
|
81 externC void |
|
|
82 cyg_tracemsg( cyg_uint32 what, |
|
|
83 char *psz_func, char *psz_file, cyg_uint32 linenum, |
|
|
84 char *psz_msg ) |
|
|
85 {} |
|
|
86 |
|
|
87 externC void |
|
|
88 cyg_tracemsg2( cyg_uint32 what, |
|
|
89 char *psz_func, char *psz_file, cyg_uint32 linenum, |
|
|
90 char *psz_msg, |
|
|
91 CYG_ADDRWORD arg0, CYG_ADDRWORD arg1 ) |
|
|
92 {} |
|
|
93 externC void |
|
|
94 cyg_tracemsg4( cyg_uint32 what, |
|
|
95 char *psz_func, char *psz_file, cyg_uint32 linenum, |
|
|
96 char *psz_msg, |
|
|
97 CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
|
|
98 CYG_ADDRWORD arg2, CYG_ADDRWORD arg3 ) |
|
|
99 {} |
|
|
100 externC void |
|
|
101 cyg_tracemsg6( cyg_uint32 what, |
|
|
102 char *psz_func, char *psz_file, cyg_uint32 linenum, |
|
|
103 char *psz_msg, |
|
|
104 CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
|
|
105 CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, |
|
|
106 CYG_ADDRWORD arg4, CYG_ADDRWORD arg5 ) |
|
|
107 {} |
|
|
108 externC void |
|
|
109 cyg_tracemsg8( cyg_uint32 what, |
|
|
110 char *psz_func, char *psz_file, cyg_uint32 linenum, |
|
|
111 char *psz_msg, |
|
|
112 CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
|
|
113 CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, |
|
|
114 CYG_ADDRWORD arg4, CYG_ADDRWORD arg5, |
|
|
115 CYG_ADDRWORD arg6, CYG_ADDRWORD arg7 ) |
|
|
116 {} |
|
|
117 |
|
|
118 #endif // CYGDBG_USE_TRACING |
|
|
119 |
|
|
120 // ------------------------------------------------------------------------- |
|
|
121 // Assert functions: |
|
|
122 |
|
|
123 #ifdef CYGDBG_USE_ASSERTS |
|
|
124 |
|
|
125 externC void |
|
2
|
126 cyg_assert_fail( const char *psz_func, const char *psz_file, |
|
|
127 cyg_uint32 linenum, const char *psz_msg ) |
|
0
|
128 { |
|
|
129 for(;;); |
|
|
130 }; |
|
|
131 |
|
|
132 extern "C" |
|
|
133 { |
|
|
134 extern unsigned long CYG_LABEL_NAME(stext); |
|
|
135 extern unsigned long CYG_LABEL_NAME(etext); |
|
|
136 |
|
|
137 unsigned long stext_addr = (unsigned long)&CYG_LABEL_NAME(stext); |
|
|
138 unsigned long etext_addr = (unsigned long)&CYG_LABEL_NAME(etext); |
|
|
139 }; |
|
|
140 |
|
|
141 externC cyg_bool cyg_check_data_ptr(void *ptr) |
|
|
142 { |
|
|
143 unsigned long p = (unsigned long)ptr; |
|
|
144 |
|
|
145 if( p == 0 ) return false; |
|
|
146 |
|
|
147 if( p > stext_addr && p < etext_addr ) return false; |
|
|
148 |
|
|
149 return true; |
|
|
150 } |
|
|
151 |
|
|
152 externC cyg_bool cyg_check_func_ptr(void (*ptr)(void)) |
|
|
153 { |
|
|
154 unsigned long p = (unsigned long)ptr; |
|
|
155 |
|
|
156 if( p == 0 ) return false; |
|
|
157 |
|
|
158 if( p < stext_addr && p > etext_addr ) return false; |
|
|
159 |
|
|
160 return true; |
|
|
161 } |
|
|
162 |
|
|
163 #endif // CYGDBG_USE_ASSERTS |
|
|
164 |
|
|
165 #endif // CYGDBG_INFRA_DEBUG_TRACE_ASSERT_NULL |
|
|
166 |
|
|
167 // ------------------------------------------------------------------------- |
|
|
168 // EOF null.cxx |