1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// null.cxx
|
4 |
|
|
//
|
5 |
|
|
// Null trace and assert functions
|
6 |
|
|
//
|
7 |
|
|
//==========================================================================
|
8 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
// -------------------------------------------
|
10 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
12 |
|
|
//
|
13 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
// the terms of the GNU General Public License as published by the Free
|
15 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
16 |
|
|
// version.
|
17 |
|
|
//
|
18 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
// for more details.
|
22 |
|
|
//
|
23 |
|
|
// You should have received a copy of the GNU General Public License
|
24 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
//
|
27 |
|
|
// As a special exception, if other files instantiate templates or use
|
28 |
|
|
// macros or inline functions from this file, or you compile this file
|
29 |
|
|
// and link it with other works to produce a work based on this file,
|
30 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
// the GNU General Public License. However the source code for this file
|
32 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
// General Public License v2.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based
|
36 |
|
|
// on this file might be covered by the GNU General Public License.
|
37 |
|
|
// -------------------------------------------
|
38 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
//==========================================================================
|
40 |
|
|
//#####DESCRIPTIONBEGIN####
|
41 |
|
|
//
|
42 |
|
|
// Author(s): nickg
|
43 |
|
|
// Contributors: nickg
|
44 |
|
|
// Date: 1997-09-15
|
45 |
|
|
// Purpose: Trace and assert functions
|
46 |
|
|
// Description: The functions in this file are null implementations of the
|
47 |
|
|
// standard trace and assert functions. These can be used to
|
48 |
|
|
// eliminate all trace and assert messages without recompiling.
|
49 |
|
|
//
|
50 |
|
|
//####DESCRIPTIONEND####
|
51 |
|
|
//
|
52 |
|
|
//==========================================================================
|
53 |
|
|
|
54 |
|
|
#include <pkgconf/infra.h>
|
55 |
|
|
|
56 |
|
|
#ifndef CYGDBG_USE_ASSERTS
|
57 |
|
|
// then you get an empty function regardless, so that other code can link:
|
58 |
|
|
// (for example libc assert() calls this whether or not eCos code has
|
59 |
|
|
// asserts enabled - of course if it does, assert() maps to the chosen
|
60 |
|
|
// implementation; if not, it's the same inner function to breakpoint.)
|
61 |
|
|
|
62 |
|
|
#include <cyg/infra/cyg_type.h> // base types
|
63 |
|
|
#include <cyg/infra/cyg_trac.h> // tracing macros
|
64 |
|
|
#include <cyg/infra/cyg_ass.h> // assertion macros
|
65 |
|
|
|
66 |
|
|
externC void
|
67 |
|
|
cyg_assert_fail( const char *psz_func, const char *psz_file,
|
68 |
|
|
cyg_uint32 linenum, const char *psz_msg ) __THROW
|
69 |
|
|
{
|
70 |
|
|
for(;;);
|
71 |
|
|
};
|
72 |
|
|
#endif // not CYGDBG_USE_ASSERTS
|
73 |
|
|
|
74 |
|
|
#ifdef CYGDBG_INFRA_DEBUG_TRACE_ASSERT_NULL
|
75 |
|
|
|
76 |
|
|
#include <cyg/infra/cyg_type.h> // base types
|
77 |
|
|
#include <cyg/infra/cyg_trac.h> // tracing macros
|
78 |
|
|
#include <cyg/infra/cyg_ass.h> // assertion macros
|
79 |
|
|
|
80 |
|
|
// -------------------------------------------------------------------------
|
81 |
|
|
// Trace functions:
|
82 |
|
|
|
83 |
|
|
#ifdef CYGDBG_USE_TRACING
|
84 |
|
|
|
85 |
|
|
externC void
|
86 |
|
|
cyg_tracenomsg( const char *psz_func, const char *psz_file, cyg_uint32 linenum )
|
87 |
|
|
{}
|
88 |
|
|
|
89 |
|
|
// provide every other one of these as a space/caller bloat compromise.
|
90 |
|
|
|
91 |
|
|
externC void
|
92 |
|
|
cyg_tracemsg( cyg_uint32 what,
|
93 |
|
|
const char *psz_func, const char *psz_file, cyg_uint32 linenum,
|
94 |
|
|
const char *psz_msg )
|
95 |
|
|
{}
|
96 |
|
|
|
97 |
|
|
externC void
|
98 |
|
|
cyg_tracemsg2( cyg_uint32 what,
|
99 |
|
|
const char *psz_func, const char *psz_file, cyg_uint32 linenum,
|
100 |
|
|
const char *psz_msg,
|
101 |
|
|
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1 )
|
102 |
|
|
{}
|
103 |
|
|
externC void
|
104 |
|
|
cyg_tracemsg4( cyg_uint32 what,
|
105 |
|
|
const char *psz_func, const char *psz_file, cyg_uint32 linenum,
|
106 |
|
|
const char *psz_msg,
|
107 |
|
|
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1,
|
108 |
|
|
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3 )
|
109 |
|
|
{}
|
110 |
|
|
externC void
|
111 |
|
|
cyg_tracemsg6( cyg_uint32 what,
|
112 |
|
|
const char *psz_func, const char *psz_file, cyg_uint32 linenum,
|
113 |
|
|
const 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 |
|
|
{}
|
118 |
|
|
externC void
|
119 |
|
|
cyg_tracemsg8( cyg_uint32 what,
|
120 |
|
|
const char *psz_func, const char *psz_file, cyg_uint32 linenum,
|
121 |
|
|
const char *psz_msg,
|
122 |
|
|
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1,
|
123 |
|
|
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3,
|
124 |
|
|
CYG_ADDRWORD arg4, CYG_ADDRWORD arg5,
|
125 |
|
|
CYG_ADDRWORD arg6, CYG_ADDRWORD arg7 )
|
126 |
|
|
{}
|
127 |
|
|
|
128 |
|
|
// -------------------------------------------------------------------------
|
129 |
|
|
|
130 |
|
|
externC void
|
131 |
|
|
cyg_trace_dump(void)
|
132 |
|
|
{}
|
133 |
|
|
|
134 |
|
|
#endif // CYGDBG_USE_TRACING
|
135 |
|
|
|
136 |
|
|
// -------------------------------------------------------------------------
|
137 |
|
|
// Assert functions:
|
138 |
|
|
|
139 |
|
|
#ifdef CYGDBG_USE_ASSERTS
|
140 |
|
|
|
141 |
|
|
externC void
|
142 |
|
|
cyg_assert_fail( const char *psz_func, const char *psz_file,
|
143 |
|
|
cyg_uint32 linenum, const char *psz_msg ) __THROW
|
144 |
|
|
{
|
145 |
|
|
for(;;);
|
146 |
|
|
};
|
147 |
|
|
|
148 |
|
|
extern "C"
|
149 |
|
|
{
|
150 |
|
|
extern unsigned long _stext;
|
151 |
|
|
extern unsigned long _etext;
|
152 |
|
|
|
153 |
|
|
unsigned long stext_addr = (unsigned long)&_stext;
|
154 |
|
|
unsigned long etext_addr = (unsigned long)&_etext;
|
155 |
|
|
};
|
156 |
|
|
|
157 |
|
|
externC cyg_bool cyg_check_data_ptr(const void *ptr)
|
158 |
|
|
{
|
159 |
|
|
unsigned long p = (unsigned long)ptr;
|
160 |
|
|
|
161 |
|
|
if( p == 0 ) return false;
|
162 |
|
|
|
163 |
|
|
if( p > stext_addr && p < etext_addr ) return false;
|
164 |
|
|
|
165 |
|
|
return true;
|
166 |
|
|
}
|
167 |
|
|
|
168 |
|
|
externC cyg_bool cyg_check_func_ptr(void (*ptr)(void))
|
169 |
|
|
{
|
170 |
|
|
unsigned long p = (unsigned long)ptr;
|
171 |
|
|
|
172 |
|
|
if( p == 0 ) return false;
|
173 |
|
|
|
174 |
|
|
if( p < stext_addr && p > etext_addr ) return false;
|
175 |
|
|
|
176 |
|
|
return true;
|
177 |
|
|
}
|
178 |
|
|
|
179 |
|
|
#endif // CYGDBG_USE_ASSERTS
|
180 |
|
|
|
181 |
|
|
#endif // CYGDBG_INFRA_DEBUG_TRACE_ASSERT_NULL
|
182 |
|
|
|
183 |
|
|
// -------------------------------------------------------------------------
|
184 |
|
|
// EOF null.cxx
|