source: SVN/cambria/redboot/packages/infra/current/src/null.cxx @ 1

Last change on this file since 1 was 1, checked in by Tim Harvey, 2 years ago

restored latest version of files from server backup

Signed-off-by: Tim Harvey <tharvey@…>

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