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