OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [infra/] [current/] [include/] [cyg_trac.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_INFRA_CYG_TRAC_H
2
#define CYGONCE_INFRA_CYG_TRAC_H
3
 
4
//==========================================================================
5
//
6
//      cyg_trac.h
7
//
8
//      Macros and prototypes for the tracing system
9
//
10
//==========================================================================
11
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
12
// -------------------------------------------                              
13
// This file is part of eCos, the Embedded Configurable Operating System.   
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under    
17
// the terms of the GNU General Public License as published by the Free     
18
// Software Foundation; either version 2 or (at your option) any later      
19
// version.                                                                 
20
//
21
// eCos is distributed in the hope that it will be useful, but WITHOUT      
22
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
24
// for more details.                                                        
25
//
26
// You should have received a copy of the GNU General Public License        
27
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
28
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
29
//
30
// As a special exception, if other files instantiate templates or use      
31
// macros or inline functions from this file, or you compile this file      
32
// and link it with other works to produce a work based on this file,       
33
// this file does not by itself cause the resulting work to be covered by   
34
// the GNU General Public License. However the source code for this file    
35
// must still be made available in accordance with section (3) of the GNU   
36
// General Public License v2.                                               
37
//
38
// This exception does not invalidate any other reasons why a work based    
39
// on this file might be covered by the GNU General Public License.         
40
// -------------------------------------------                              
41
// ####ECOSGPLCOPYRIGHTEND####                                              
42
//==========================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):   nickg from an original by hmt
46
// Contributors:        nickg
47
// Date:        1998-04-23
48
// Purpose:     Use traces to log procedure entry, and "print" stuff
49
// Description: Runtime logging messages that compile to nothing in
50
//              release versions of the code, to allow
51
//              as-you-go tracing of alternate builds.
52
// Usage:       #include <cyg/infra/cyg_trac.h>
53
//              ...
54
//              CYG_TRACE2( PIPE_TRACE, "pipe %x, data %d", ppipe, oword );
55
//
56
//      which can result, for example, in a message of the form:
57
//      "TRACE: pipemgr.cxx:1340, write_pipe(): pipe 0x8004c, data 17"
58
//
59
//####DESCRIPTIONEND####
60
//
61
 
62
/****************************************************************************
63
 
64
Explicit tracing
65
================
66
 
67
CYG_TRACE0( bool, msg );
68
CYG_TRACE1( bool, msg, arg1 );
69
CYG_TRACE2( bool, msg, arg1, arg2 );
70
....
71
CYG_TRACE8( bool, msg, .... [with 8 args] );
72
 
73
In general, the bool controls whether or not the tracing occurs for a
74
particular invocation of the macro.  The msg is a printf-style string,
75
though exactly which formats are supported depends on the underlying
76
implementation.  Typically, at least %d, %x, %08x, %c and %s will be
77
supported.  Of course a most compact implementation might print
78
 
79
  TRACE:z1dbuff.c[92]get_nextdata(): data pointer %x offset %d: 42BD8 1C
80
 
81
or some such, leaving you to work it out for yourself.
82
 
83
It is expected that the boolean would rarely actually be a complex
84
expression; it is more likely that it would either be "1", tracing being
85
controlled for the whole compilation unit or subsystem by means of the
86
CYGDBG_USE_TRACING symbol, or a local symbol for tracing over the whole
87
file, defined to 0 or to 1.  For runtime control of tracing in a debugging
88
session, it is typical to use symbols defined to expressions such as:
89
 
90
    static int xxx_trace = 0;
91
    #define TL1 (0 < xxx_trace)
92
    #define TL2 (1 < xxx_trace)
93
 
94
so you set xxx_trace to 1 to enable those messages conditioned by TL1
95
(trace level 1) and so on.
96
 
97
    CYG_TRACE1( TL1, "Major argument is %d", zz );
98
    CYG_TRACE4( TL2, "...minor details %d %d %d %d", m1, m2, m3 ,m4 );
99
 
100
To assist with the case where the same symbol or expression is used
101
throughout a compilation unit, the programmer can define the symbol
102
CYG_TRACE_USER_BOOL as they choose and then use convenience macros with the
103
suffix 'B' in the obvious manner:
104
 
105
    #define CYG_TRACE_USER_BOOL (xxx_trace > 0)
106
    CYG_TRACE2B( "Counters are %d, %d", countlo, counthi );
107
 
108
For the case where you just want to print a load of numbers in hex, or
109
decimal, convenience suffices X, D and Y are provided.  X uses %08x, D %d
110
and Y an unadorned %x for each argument.
111
 
112
    CYG_TRACE3D( TL2, m1, m2, d );
113
 
114
If you want to do something similar but with a little more comment, the
115
names (strictly spellings) of the variables you are printing can be used by
116
appending a V to the X, D or Y.
117
 
118
    CYG_TRACE3DV( TL2, m1, m2, d );
119
 
120
might output:
121
 
122
  TRACE:z1dbuff.c[92]get_nextdata(): m1=23 m2=-4 d=55
123
 
124
These conveniences can be combined, and they apply equally to tracing with
125
up to 8 variables; the B for Bool goes last:
126
 
127
     CYG_TRACE4DVB( i, i*i, i*i*i, i*i*i*i );
128
 
129
might output:
130
 
131
  TRACE:table.c[12]main(): i=3 i*i=9 i*i*i=27 i*i*i*i=81
132
 
133
 
134
Function Tracing
135
================
136
 
137
There are also facities for easily reporting function entry and exit,
138
printing the function arguments, and detecting returns without logging (or
139
without a value!).
140
 
141
The basic facility is
142
 
143
        CYG_REPORT_FUNCTION();
144
 
145
In C, place this between the local variable declarations and the first
146
statement or errors will ensue.  C++ is more flexible; place the macro as
147
the first line of all functions you wish to trace.  The following
148
variations are also provided:
149
 
150
  CYG_REPORT_FUNCTYPE( exitmsg )  provide a printf string for the type
151
                                  of the returned value
152
  CYG_REPORT_FUNCNAME( name )     supply a function name explicitly, for
153
                                  if __FUNCTION__ is not supported
154
  CYG_REPORT_FUNCNAMETYPE( name, exitmsg ) both of the above extensions
155
 
156
These are unconditional; the assumption is that if function reporting is
157
used at all it will be used for all functions within a compilation unit.
158
However, it is useful to be able to control function reporting at finer
159
grain without editing the source files concerned, at compile time or at
160
runtime.  To support this, conditioned versions (with suffix 'C') are
161
provided for the above four macros, which only procduce trace output if the
162
macro CYG_REPORT_USER_BOOL evaluates true.
163
 
164
  CYG_REPORT_FUNCTIONC()
165
  CYG_REPORT_FUNCNAMEC( name )
166
  CYG_REPORT_FUNCTYPEC( exitmsg )
167
  CYG_REPORT_FUNCNAMETYPEC( name, exitmsg )
168
 
169
You can define CYG_REPORT_USER_BOOL to anything you like before invoking
170
these macros; using a simple -DCYG_REPORT_USER_BOOL=0 or ...=1 on the
171
compiler command line would do the trick, but there is more flexibility to
172
be gained by something like:
173
 
174
  #define CYG_REPORT_USER_BOOL (reporting_bool_FOO)
175
  #ifdef TRACE_FOO
176
  int reporting_bool_FOO = 1;
177
  #else
178
  int reporting_bool_FOO = 0;
179
  #endif
180
 
181
where FOO relates to the module name.  Thus an external symbol sets the
182
default, but it can be overridden in a debugging session by setting the
183
variable reporting_bool_FOO.
184
 
185
Note that the condition applied to the initial CYG_REPORT_FUNC...() macro
186
controls all function-related reporting (not tracing) from that function;
187
the underlying mechanisms still operate even if no output is created.  Thus
188
no conditioned variants of CYG_REPORT_FUNCARG[s] nor of CYG_REPORT_RETURN
189
are needed.
190
 
191
Examples:
192
    int myfunction()
193
    {
194
        CYG_REPORT_FUNCTYPE( "recode is %d" );
195
 
196
A function return is traced using
197
 
198
    CYG_REPORT_RETURN()         a void return
199
    CYG_REPORT_RETVAL( value )  returning a value
200
 
201
With the CYG_REPORT_FUNCTYPE example, the latter might produce a message
202
like:
203
 
204
  TRACE:myprog.c[40]fact(): enter
205
  TRACE:myprog.c[53]fact(): retcode is 24
206
 
207
It is also useful to trace the values of the arguments to a function:
208
        CYG_REPORT_FUNCARGVOID          confirms that the function is void
209
        CYG_REPORT_FUNCARG1( format, arg )              printf-style
210
                to
211
        CYG_REPORT_FUNCARG8( format, arg1...arg8 )      printf-style
212
 
213
The CYG_REPORT_FUNCARG[1-8] macros are also offered with the convenience
214
extensions: D, X, or Y, and V like the explicit tracing macros.  For
215
example:
216
 
217
    int fact( int number )
218
    {
219
        CYG_REPORT_FUNCTYPE( "recode is %d" );
220
        CYG_REPORT_FUNCARG1DV( number );
221
        int result = number;
222
        while ( --number > 1 )  result *= number
223
        CYG_REPORT_RETVAL( result );
224
        return result;
225
    }
226
 
227
might produce:
228
 
229
  TRACE:myprog.c[40]fact(): enter
230
  TRACE:myprog.c[40]fact(): number=4
231
  TRACE:myprog.c[53]fact(): retcode is 24
232
 
233
If no exit message is provided, a default of %08x is used.
234
 
235
 
236
General Configury
237
=================
238
 
239
If CYGDBG_INFRA_DEBUG_FUNCTION_PSEUDOMACRO is *not* defined, it is assumed
240
that __PRETTY_FUNCTION__ or equivalents do not exist, so no function name
241
tracing is possible; only file and line number.
242
 
243
If CYGDBG_INFRA_DEBUG_TRACE_MESSAGE is *not* defined, the message and
244
arguments to all tracing macros are not used; only "execution was here"
245
type information, by file, function and line number, is available.  This
246
can greatly reduce the size of an image with tracing disabled, which may be
247
crucial in debugging on actual shipped hardware with limited memory.
248
 
249
If configured for buffered tracing then CYG_TRACE_PRINT() can be used to
250
output the contents of the trace buffer on demand.
251
 
252
CYG_TRACE_DUMP() outputs a form of "core dump" containing info on the
253
scheduler and threads at the time. This information will be invalid if
254
the kernel is not running.
255
 
256
C/C++: in C++ the function reporting is implemented using a class object
257
with a destructor; this allows reporting of a return which has not been
258
explicitly reported, and detection of accidental multiple return reports.
259
This helps you write the function reporting correctly.  In C it is not
260
possible to be so sophisticated, so the implementation is not so helpful in
261
detecting errors in the use of the tracing system.
262
 
263
Note that for all of the above variations, the internal API to the
264
functions which are called in consequence of tracing remains the same, so
265
these variations can be mixed in the same executable, by configuring the
266
tracing macros differently in different compilation units or subsystems.
267
 
268
 
269
Summary
270
=======
271
 
272
Explicit tracing
273
----------------
274
 
275
CYG_TRACE0( bool, msg )                         if bool, print msg
276
CYG_TRACE1( bool, msg, arg )                    if bool, printf-style
277
        to
278
CYG_TRACE8( bool, msg, arg1...arg8 )            if bool, printf-style
279
 
280
CYG_TRACE0B( msg, args... ) to CYG_TRACE8B()    use CYG_TRACE_USER_BOOL
281
 
282
CYG_TRACE1X( bool, args... ) to CYG_TRACE8X()   print args using %08x
283
CYG_TRACE1Y( bool, args... ) to CYG_TRACE8Y()   print args using %x
284
CYG_TRACE1D( bool, args... ) to CYG_TRACE8D()   print args using %d
285
 
286
CYG_TRACE1XV( bool, args... ) to CYG_TRACE8XV() print args using "arg=%08x"
287
CYG_TRACE1YV( bool, args... ) to CYG_TRACE8YV() print args using "arg=%x"
288
CYG_TRACE1DV( bool, args... ) to CYG_TRACE8DV() print args using "arg=%d"
289
 
290
CYG_TRACE1XB( args... ) to CYG_TRACE8XB()       print using %08x, no bool
291
CYG_TRACE1YB( args... ) to CYG_TRACE8YB()       print using %x, no bool
292
CYG_TRACE1DB( args... ) to CYG_TRACE8DB()       print using %d, no bool
293
 
294
CYG_TRACE1XVB( args... ) to CYG_TRACE8XVB()     use "arg=%08x", no bool
295
CYG_TRACE1YVB( args... ) to CYG_TRACE8YVB()     use "arg=%x", no bool
296
CYG_TRACE1DVB( args... ) to CYG_TRACE8DVB()     use "arg=%d", no bool
297
 
298
Function tracing
299
----------------
300
 
301
CYG_REPORT_FUNCTION()                           default function entry
302
CYG_REPORT_FUNCNAME( name )                     name the function
303
CYG_REPORT_FUNCTYPE( exitmsg )                  printf for retval
304
CYG_REPORT_FUNCNAMETYPE( name, exitmsg )        both
305
 
306
CYG_REPORT_FUNCTIONC()                          as above, but conditional
307
CYG_REPORT_FUNCNAMEC( name )                    on CYG_REPORT_USER_BOOL
308
CYG_REPORT_FUNCTYPEC( exitmsg )                 however it is defined
309
CYG_REPORT_FUNCNAMETYPEC( name, exitmsg )       ...
310
 
311
CYG_REPORT_RETURN()                             void function exit
312
CYG_REPORT_RETVAL( value )                      returning value
313
 
314
CYG_REPORT_FUNCARGVOID()                        void function entry
315
CYG_REPORT_FUNCARG1( format, arg )              printf-style
316
        to
317
CYG_REPORT_FUNCARG8( format, arg1...arg8 )      printf-style
318
 
319
CYG_REPORT_FUNCARG1X( arg )
320
        to
321
CYG_REPORT_FUNCARG8X( arg1...arg8 )             use %08x
322
CYG_REPORT_FUNCARG1Y...                         use %x
323
CYG_REPORT_FUNCARG1D...                         use %d
324
 
325
CYG_REPORT_FUNCARG1XV...                        use "arg=%08x"
326
CYG_REPORT_FUNCARG1YV...                        use "arg=%x"
327
CYG_REPORT_FUNCARG1DV...                        use "arg=%d"
328
 
329
Other
330
-----
331
 
332
CYG_TRACE_DUMP()                                dumps kernel state
333
CYG_TRACE_PRINT()                               prints buffered tracing
334
 
335
 
336
---------------------------------------------------------------------------
337
 
338
Internal Documentation
339
======================
340
 
341
The required functions which are used by the tracing macros are
342
 
343
    externC void
344
    cyg_tracenomsg( const char *psz_func, const char *psz_file,
345
                    cyg_uint32 linenum );
346
 
347
    externC void
348
    cyg_tracemsg( cyg_uint32 what, const char *psz_func, const char *psz_file,
349
                  cyg_uint32 linenum, const char *psz_msg );
350
 
351
    externC void
352
    cyg_tracemsg2( cyg_uint32 what,
353
                   const char *psz_func, const char *psz_file,
354
                   cyg_uint32 linenum, const char *psz_msg,
355
                   CYG_ADDRWORD arg0,  CYG_ADDRWORD arg1 );
356
    // extended in the obvious way for 4,6,8 arguments
357
 
358
These functions should expect psz_func and psz_file to possibly be NULL in
359
case those facilities are not available in the compilation environment, and
360
do something safe in such cases.  A NULL message should really be dealt
361
with safely also, just logging "execution here" info like cyg_tracenomsg().
362
 
363
Discussion of possible underlying implementations
364
-------------------------------------------------
365
 
366
It is intended that the functions that get called can simply print the info
367
they are given in as fancy a format as you like, or they could do the
368
printf-type formatting and log the resulting text in a buffer.  They get
369
told the type of event (function-entry, function-arguments, function-exit
370
or plain tracing info) and so can perform fancy indenting, for example, to
371
make call stack inspection more obvious to humans.  It is also intended
372
that a more compact logging arrangement be possible, for example one which
373
records, in 32-bit words (CYG_ADDRWORDs), the addresses of the file,
374
function and msg strings, the line number and the arguments.  This has the
375
implication that the msg string should not be constructed dynamically but
376
be static ie. a plain quoted C string.  The number of arguments also must
377
be recorded, and if it is chosen to save string arguments in the buffer
378
rather than just their addresses (which could be invalid by the time the
379
logged information is processed) some flagging of which arguments are
380
strings must be provided.  The system could also be extended to deal with
381
floats of whichever size fir in a CYG_ADDRWORD; these would probably
382
require special treatment also.  With these considerations in mind, the
383
maximum number of parameters in a single trace message has been set to 8,
384
so that a byte bitset could be used to indicate which arguments are
385
strings, another for those which are floats, and the count of arguments
386
also fits in a byte as number or a bitset.
387
 
388
 
389
****************************************************************************/
390
 
391
#include <pkgconf/infra.h>
392
 
393
#include <cyg/infra/cyg_ass.h>
394
 
395
// -------------------------------------------------------------------------
396
// CYGDBG_INFRA_DEBUG_FUNCTION_PSEUDOMACRO is dealt with in cyg_ass.h.
397
// -------------------------------------------------------------------------
398
 
399
#ifdef CYGDBG_USE_TRACING
400
 
401
// -------------------------------------------------------------------------
402
// We define macros and appropriate prototypes for the trace/fail
403
// system.  These are:
404
//      CYG_TRACE0..8     - trace if boolean
405
//      CYG_TRACEPROC     - default no comment proc entry
406
//      CYG_TRACEPROCOUT  - default no comment proc exit
407
//      CYG_TRACE_DUMP    - outputs a form of "core dump", including the state
408
//                          of the kernel scheduler, threads, etc.
409
//      CYG_TRACE_PRINT   - Forces manual output of any trace info that has
410
//                          been buffered up.
411
 
412
// these are executed to deal with tracing - breakpoint?
413
 
414
externC void
415
cyg_tracenomsg( const char *psz_func, const char *psz_file, cyg_uint32 linenum );
416
 
417
externC void
418
cyg_trace_dump(void);
419
 
420
#define CYG_TRACE_DUMP() cyg_trace_dump()
421
 
422
#ifdef CYGDBG_INFRA_DEBUG_TRACE_ASSERT_BUFFER
423
 
424
externC void
425
cyg_trace_print(void);
426
 
427
#define CYG_TRACE_PRINT() cyg_trace_print()
428
 
429
#else
430
#define CYG_TRACE_PRINT() CYG_EMPTY_STATEMENT
431
#endif
432
 
433
// provide every other one of these as a space/caller bloat compromise.
434
 
435
# ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
436
 
437
enum cyg_trace_what{
438
    cyg_trace_trace = 0,
439
    cyg_trace_enter,
440
    cyg_trace_args,
441
    cyg_trace_return,
442
//    cyg_trace_,
443
//    cyg_trace_,
444
};
445
 
446
externC void
447
cyg_tracemsg( cyg_uint32 what,
448
              const char *psz_func, const char *psz_file, cyg_uint32 linenum,
449
              const char *psz_msg );
450
 
451
externC void
452
cyg_tracemsg2( cyg_uint32 what,
453
               const char *psz_func, const char *psz_file, cyg_uint32 linenum,
454
               const char *psz_msg,
455
               CYG_ADDRWORD arg0,  CYG_ADDRWORD arg1 );
456
externC void
457
cyg_tracemsg4( cyg_uint32 what,
458
               const char *psz_func, const char *psz_file, cyg_uint32 linenum,
459
               const char *psz_msg,
460
               CYG_ADDRWORD arg0,  CYG_ADDRWORD arg1,
461
               CYG_ADDRWORD arg2,  CYG_ADDRWORD arg3 );
462
externC void
463
cyg_tracemsg6( cyg_uint32 what,
464
               const char *psz_func, const char *psz_file, cyg_uint32 linenum,
465
               const char *psz_msg,
466
               CYG_ADDRWORD arg0,  CYG_ADDRWORD arg1,
467
               CYG_ADDRWORD arg2,  CYG_ADDRWORD arg3,
468
               CYG_ADDRWORD arg4,  CYG_ADDRWORD arg5 );
469
externC void
470
cyg_tracemsg8( cyg_uint32 what,
471
               const char *psz_func, const char *psz_file, cyg_uint32 linenum,
472
               const char *psz_msg,
473
               CYG_ADDRWORD arg0,  CYG_ADDRWORD arg1,
474
               CYG_ADDRWORD arg2,  CYG_ADDRWORD arg3,
475
               CYG_ADDRWORD arg4,  CYG_ADDRWORD arg5,
476
               CYG_ADDRWORD arg6,  CYG_ADDRWORD arg7 );
477
 
478
#endif // CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
479
 
480
// -------------------------------------------------------------------------
481
 
482
# ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
483
 
484
#  define CYG_TRACE_docall0( _msg_ )                                    \
485
    cyg_tracemsg( cyg_trace_trace,                                      \
486
                  __PRETTY_FUNCTION__, __FILE__, __LINE__, _msg_ );
487
 
488
#  define CYG_TRACE_docall2( _msg_, _arg0_, _arg1_ )                    \
489
    cyg_tracemsg2( cyg_trace_trace,                                     \
490
                   __PRETTY_FUNCTION__, __FILE__, __LINE__, _msg_,      \
491
                 (CYG_ADDRWORD)_arg0_, (CYG_ADDRWORD)_arg1_ );
492
 
493
#  define CYG_TRACE_docall4( _msg_, _arg0_, _arg1_ , _arg2_, _arg3_  )  \
494
    cyg_tracemsg4( cyg_trace_trace,                                     \
495
                   __PRETTY_FUNCTION__, __FILE__, __LINE__, _msg_,      \
496
                 (CYG_ADDRWORD)_arg0_, (CYG_ADDRWORD)_arg1_,            \
497
                 (CYG_ADDRWORD)_arg2_, (CYG_ADDRWORD)_arg3_ );
498
 
499
#  define CYG_TRACE_docall6( _msg_, _arg0_, _arg1_ , _arg2_, _arg3_,    \
500
                                    _arg4_, _arg5_                   )  \
501
    cyg_tracemsg6( cyg_trace_trace,                                     \
502
                   __PRETTY_FUNCTION__, __FILE__, __LINE__, _msg_,      \
503
                 (CYG_ADDRWORD)_arg0_, (CYG_ADDRWORD)_arg1_,            \
504
                 (CYG_ADDRWORD)_arg2_, (CYG_ADDRWORD)_arg3_,            \
505
                 (CYG_ADDRWORD)_arg4_, (CYG_ADDRWORD)_arg5_ );
506
 
507
#  define CYG_TRACE_docall8( _msg_, _arg0_, _arg1_ , _arg2_, _arg3_,    \
508
                                    _arg4_,  _arg5_, _arg6_, _arg7_ )   \
509
    cyg_tracemsg8( cyg_trace_trace,                                     \
510
                   __PRETTY_FUNCTION__, __FILE__, __LINE__, _msg_,      \
511
                 (CYG_ADDRWORD)_arg0_, (CYG_ADDRWORD)_arg1_,            \
512
                 (CYG_ADDRWORD)_arg2_, (CYG_ADDRWORD)_arg3_,            \
513
                 (CYG_ADDRWORD)_arg4_, (CYG_ADDRWORD)_arg5_,            \
514
                 (CYG_ADDRWORD)_arg6_, (CYG_ADDRWORD)_arg7_ );
515
 
516
# else // do not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
517
 
518
#  define CYG_TRACE_docall0( _msg_ )                                    \
519
    cyg_tracenomsg( __PRETTY_FUNCTION__, __FILE__, __LINE__ );
520
 
521
#  define CYG_TRACE_docall2( _msg_, _arg0_, _arg1_ )                    \
522
    cyg_tracenomsg( __PRETTY_FUNCTION__, __FILE__, __LINE__ );
523
 
524
#  define CYG_TRACE_docall4( _msg_, _arg0_, _arg1_ , _arg2_, _arg3_  )  \
525
    cyg_tracenomsg( __PRETTY_FUNCTION__, __FILE__, __LINE__ );
526
 
527
#  define CYG_TRACE_docall6( _msg_, _arg0_, _arg1_ , _arg2_, _arg3_,    \
528
                                    _arg4_, _arg5_                   )  \
529
    cyg_tracenomsg( __PRETTY_FUNCTION__, __FILE__, __LINE__ );
530
 
531
#  define CYG_TRACE_docall8( _msg_, _arg0_, _arg1_, _arg2_, _arg3_,     \
532
                                    _arg4_, _arg5_, _arg6_, _arg7_   )  \
533
    cyg_tracenomsg( __PRETTY_FUNCTION__, __FILE__, __LINE__ );
534
 
535
#endif
536
 
537
// -------------------------------------------------------------------------
538
// Conditioned trace; if the condition is false, fail.
539
 
540
#define CYG_TRACE0( _bool_, _msg_ )                             \
541
    CYG_MACRO_START                                             \
542
    if ( ( _bool_ ) )                                           \
543
        CYG_TRACE_docall0( _msg_ );                             \
544
    CYG_MACRO_END
545
 
546
#define CYG_TRACE1( _bool_, _msg_, a )                          \
547
    CYG_MACRO_START                                             \
548
    if ( ( _bool_ ) )                                           \
549
        CYG_TRACE_docall2( _msg_, a, 0 );                       \
550
    CYG_MACRO_END
551
 
552
#define CYG_TRACE2( _bool_, _msg_, a, b )                       \
553
    CYG_MACRO_START                                             \
554
    if ( ( _bool_ ) )                                           \
555
        CYG_TRACE_docall2( _msg_, a, b );                       \
556
    CYG_MACRO_END
557
 
558
#define CYG_TRACE3( _bool_, _msg_, a, b, c )                    \
559
    CYG_MACRO_START                                             \
560
    if ( ( _bool_ ) )                                           \
561
        CYG_TRACE_docall4( _msg_, a, b, c, 0 );                 \
562
    CYG_MACRO_END
563
 
564
#define CYG_TRACE4( _bool_, _msg_, a, b, c, d )                 \
565
    CYG_MACRO_START                                             \
566
    if ( ( _bool_ ) )                                           \
567
        CYG_TRACE_docall4( _msg_, a, b, c, d );                 \
568
    CYG_MACRO_END
569
 
570
#define CYG_TRACE5( _bool_, _msg_, a, b, c, d, e )              \
571
    CYG_MACRO_START                                             \
572
    if ( ( _bool_ ) )                                           \
573
        CYG_TRACE_docall6( _msg_, a, b, c, d, e, 0 );           \
574
    CYG_MACRO_END
575
 
576
#define CYG_TRACE6( _bool_, _msg_, a, b, c, d, e, f )           \
577
    CYG_MACRO_START                                             \
578
    if ( ( _bool_ ) )                                           \
579
        CYG_TRACE_docall6( _msg_, a, b, c, d, e, f );           \
580
    CYG_MACRO_END
581
 
582
#define CYG_TRACE7( _bool_, _msg_, a, b, c, d, e, f, g )        \
583
    CYG_MACRO_START                                             \
584
    if ( ( _bool_ ) )                                           \
585
        CYG_TRACE_docall8( _msg_, a, b, c, d, e, f, g, 0 );     \
586
    CYG_MACRO_END
587
 
588
#define CYG_TRACE8( _bool_, _msg_, a, b, c, d, e, f, g, h )     \
589
    CYG_MACRO_START                                             \
590
    if ( ( _bool_ ) )                                           \
591
        CYG_TRACE_docall8( _msg_, a, b, c, d, e, f, g, h );     \
592
    CYG_MACRO_END
593
 
594
// -------------------------------------------------------------------------
595
// Report function entry and exit.
596
// In C++ the macro CYG_REPORT_FUNCTION should appear as the first line of
597
// any function. It will generate a message whenever the function is entered
598
// and when it is exited.
599
// In C the macro should appear as the first statement after any local variable
600
// definitions. No exit message will be generated unless CYG_REPORT_RETURN is
601
// placed just before each return.
602
// Where a piece of code is to be compiled with both C and C++, the above
603
// rules for C should be followed.
604
 
605
#ifdef CYGDBG_INFRA_DEBUG_FUNCTION_REPORTS
606
 
607
#ifdef __cplusplus
608
 
609
class Cyg_TraceFunction_Report_
610
{
611
public:
612
    int   cond;
613
    const char *func;
614
    const char *file;
615
    cyg_uint32 lnum;
616
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
617
    char *exitmsg;
618
    CYG_ADDRWORD exitvalue;
619
    enum { UNSET = 0, SET, VOID } exitset;
620
#endif
621
 
622
    Cyg_TraceFunction_Report_(
623
        int condition, const char *psz_func, const char *psz_file,
624
        cyg_uint32 linenum)
625
    {
626
        cond = condition;
627
        func = psz_func;
628
        file = psz_file;
629
        lnum = linenum;
630
 
631
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
632
        exitmsg = NULL;
633
        exitset  = UNSET;
634
        if ( cond )
635
            cyg_tracemsg( cyg_trace_enter, func, file, lnum, "enter");
636
#else
637
        if ( cond )
638
            cyg_tracenomsg( func, file, lnum );
639
#endif
640
    };
641
 
642
    Cyg_TraceFunction_Report_(
643
        int condition, const char *psz_func, const char *psz_file,
644
        cyg_uint32 linenum, char *psz_exitmsg )
645
    {
646
        cond = condition;
647
        func = psz_func;
648
        file = psz_file;
649
        lnum = linenum;
650
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
651
        exitmsg = psz_exitmsg;
652
        exitset  = UNSET;
653
        if ( cond )
654
            cyg_tracemsg( cyg_trace_enter, func, file, lnum, "enter");
655
#else
656
        CYG_UNUSED_PARAM( char *, psz_exitmsg );
657
        if ( cond )
658
            cyg_tracenomsg( func, file, lnum );
659
#endif
660
    };
661
 
662
    inline void set_exitvoid( cyg_uint32 linenum )
663
    {
664
        lnum = linenum;
665
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
666
        CYG_ASSERT( NULL == exitmsg, "exitvoid used in typed function" );
667
        CYG_ASSERT( UNSET == exitset, "exitvoid used when arg already set" );
668
        exitset = VOID;
669
#endif
670
    }
671
 
672
    inline void set_exitvalue( cyg_uint32 linenum, CYG_ADDRWORD retcode )
673
    {
674
        lnum = linenum;
675
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
676
        CYG_ASSERT( UNSET == exitset, "exitvalue used when arg already set" );
677
        exitvalue = retcode;
678
        exitset = SET;
679
#else
680
        CYG_UNUSED_PARAM( CYG_ADDRWORD, retcode );
681
#endif
682
    }
683
 
684
    ~Cyg_TraceFunction_Report_()
685
    {
686
        if ( cond ) {
687
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
688
            if ( VOID == exitset )
689
                cyg_tracemsg( cyg_trace_return, func, file, lnum,
690
                              "return void");
691
            else if ( UNSET == exitset )
692
                cyg_tracemsg( cyg_trace_return, func, file, lnum,
693
                              "RETURNING UNSET!");
694
            else if ( NULL == exitmsg )
695
                cyg_tracemsg2( cyg_trace_return, func, file, lnum,
696
                               "return %08x", exitvalue, 0 );
697
            else
698
                cyg_tracemsg2( cyg_trace_return, func, file, lnum,
699
                               exitmsg, exitvalue, 0 );
700
#else
701
            cyg_tracenomsg( func, file, lnum );
702
#endif
703
        }
704
    }
705
};
706
 
707
// These have no CYG_MACRO_START,END around because it is required
708
// that the scope of the object be the whole function body.  Get it?
709
 
710
// These are the unconditional versions:
711
#define CYG_REPORT_FUNCTION()                           \
712
  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \
713
        1, __PRETTY_FUNCTION__,                         \
714
        __FILE__, __LINE__ )
715
 
716
#define CYG_REPORT_FUNCTYPE( _exitmsg_ )                \
717
  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \
718
        1, __PRETTY_FUNCTION__,                         \
719
        __FILE__, __LINE__, _exitmsg_ )
720
 
721
#define CYG_REPORT_FUNCNAME( _name_ )                   \
722
  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \
723
        1, _name_,                                      \
724
        __FILE__, __LINE__ )
725
 
726
#define CYG_REPORT_FUNCNAMETYPE( _name_, _exitmsg_  )   \
727
  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \
728
        1, _name_,                                      \
729
        __FILE__, __LINE__, _exitmsg_ )
730
 
731
// These are conditioned on macro CYG_REPORT_USER_BOOL
732
// (which you better have defined)
733
#define CYG_REPORT_FUNCTIONC()                          \
734
  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \
735
        CYG_REPORT_USER_BOOL, __PRETTY_FUNCTION__,      \
736
        __FILE__, __LINE__ )
737
 
738
#define CYG_REPORT_FUNCTYPEC( _exitmsg_ )               \
739
  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \
740
        CYG_REPORT_USER_BOOL, __PRETTY_FUNCTION__,      \
741
        __FILE__, __LINE__, _exitmsg_ )
742
 
743
#define CYG_REPORT_FUNCNAMEC( _name_ )                  \
744
  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \
745
        CYG_REPORT_USER_BOOL, _name_,                   \
746
        __FILE__, __LINE__ )
747
 
748
#define CYG_REPORT_FUNCNAMETYPEC( _name_, _exitmsg_  )  \
749
  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \
750
        CYG_REPORT_USER_BOOL, _name_,                   \
751
        __FILE__, __LINE__, _exitmsg_ )
752
 
753
 
754
#define CYG_REPORT_RETURN() CYG_MACRO_START             \
755
    cyg_tracefunction_report_.set_exitvoid( __LINE__ ); \
756
CYG_MACRO_END
757
 
758
#define CYG_REPORT_RETVAL( _value_) CYG_MACRO_START     \
759
    cyg_tracefunction_report_.set_exitvalue(            \
760
        __LINE__, (CYG_ADDRWORD)(_value_) );            \
761
CYG_MACRO_END
762
 
763
 
764
#else   // not __cplusplus
765
 
766
 
767
struct Cyg_TraceFunction_Report_
768
{
769
    int   cond;
770
    char *func;
771
    char *file; /* not strictly needed in plain 'C' */
772
    cyg_uint32 lnum; /* nor this */
773
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
774
    char *exitmsg;
775
    CYG_ADDRWORD exitvalue;
776
    int exitset;
777
#endif
778
 
779
};
780
 
781
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
782
 
783
#define CYG_REPORT_FUNCTION_ENTER_INTERNAL() CYG_MACRO_START            \
784
  if ( cyg_tracefunction_report_.cond )                                 \
785
    cyg_tracemsg( cyg_trace_enter,                                      \
786
                  cyg_tracefunction_report_.func,                       \
787
                  cyg_tracefunction_report_.file,                       \
788
                  cyg_tracefunction_report_.lnum,                       \
789
                  "enter" );                                            \
790
CYG_MACRO_END
791
 
792
#define CYG_REPORT_FUNCTION_CONSTRUCT( _c_, _fn_,_fl_,_l_,_xm_,_xv_,_xs_ ) \
793
        { _c_, _fn_, _fl_, _l_, _xm_, _xv_, _xs_ }
794
 
795
#else // do not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
796
 
797
#define CYG_REPORT_FUNCTION_ENTER_INTERNAL() CYG_MACRO_START            \
798
  if ( cyg_tracefunction_report_.cond )                                 \
799
    cyg_tracenomsg( cyg_tracefunction_report_.func,                     \
800
                    cyg_tracefunction_report_.file,                     \
801
                    cyg_tracefunction_report_.lnum );                   \
802
CYG_MACRO_END
803
 
804
#define CYG_REPORT_FUNCTION_CONSTRUCT( _c_, _fn_,_fl_,_l_,_xm_,_xv_,_xs_ ) \
805
        { _c_, _fn_, _fl_, _l_ }
806
 
807
#endif // not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
808
 
809
// These have no CYG_MACRO_START,END around because it is required
810
// that the scope of the object be the whole function body.  Get it?
811
 
812
// These are the unconditional versions:
813
#define CYG_REPORT_FUNCTION()                                           \
814
    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \
815
    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \
816
        1, __PRETTY_FUNCTION__, __FILE__, __LINE__, NULL, 0, 0 );       \
817
    CYG_REPORT_FUNCTION_ENTER_INTERNAL()
818
 
819
#define CYG_REPORT_FUNCTYPE( _exitmsg_ )                                \
820
    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \
821
    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \
822
        1, __PRETTY_FUNCTION__, __FILE__, __LINE__, _exitmsg_, 0, 0 );  \
823
    CYG_REPORT_FUNCTION_ENTER_INTERNAL()
824
 
825
#define CYG_REPORT_FUNCNAME( _name_ )                                   \
826
    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \
827
    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \
828
        1, _name_, __FILE__, __LINE__, NULL, 0, 0 );                    \
829
    CYG_REPORT_FUNCTION_ENTER_INTERNAL()
830
 
831
#define CYG_REPORT_FUNCNAMETYPE( _name_, _exitmsg_  )                   \
832
    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \
833
    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \
834
        1, _name_, __FILE__, __LINE__, _exitmsg_, 0, 0 );               \
835
    CYG_REPORT_FUNCTION_ENTER_INTERNAL()
836
 
837
// These are conditioned on macro CYG_REPORT_USER_BOOL
838
// (which you better have defined)
839
#define CYG_REPORT_FUNCTIONC()                                          \
840
    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \
841
    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \
842
        CYG_REPORT_USER_BOOL,                                           \
843
        __PRETTY_FUNCTION__, __FILE__, __LINE__, NULL, 0, 0 );          \
844
    CYG_REPORT_FUNCTION_ENTER_INTERNAL()
845
 
846
#define CYG_REPORT_FUNCTYPEC( _exitmsg_ )                               \
847
    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \
848
    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \
849
        CYG_REPORT_USER_BOOL,                                           \
850
        __PRETTY_FUNCTION__, __FILE__, __LINE__, _exitmsg_, 0, 0 );     \
851
    CYG_REPORT_FUNCTION_ENTER_INTERNAL()
852
 
853
#define CYG_REPORT_FUNCNAMEC( _name_ )                                  \
854
    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \
855
    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \
856
        CYG_REPORT_USER_BOOL,                                           \
857
        _name_, __FILE__, __LINE__, NULL, 0, 0 );                       \
858
    CYG_REPORT_FUNCTION_ENTER_INTERNAL()
859
 
860
#define CYG_REPORT_FUNCNAMETYPEC( _name_, _exitmsg_  )                  \
861
    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \
862
    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \
863
        CYG_REPORT_USER_BOOL,                                           \
864
        _name_, __FILE__, __LINE__, _exitmsg_, 0, 0 );                  \
865
    CYG_REPORT_FUNCTION_ENTER_INTERNAL()
866
 
867
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
868
 
869
#define CYG_REPORT_RETURN() CYG_MACRO_START                             \
870
    CYG_ASSERT( NULL == cyg_tracefunction_report_.exitmsg,              \
871
                "exitvoid used in typed function" );                    \
872
    CYG_ASSERT( 0 == cyg_tracefunction_report_.exitset,                 \
873
                "exitvoid used when arg already set" );                 \
874
    cyg_tracefunction_report_.lnum = __LINE__;                          \
875
    cyg_tracefunction_report_.exitset = 2;                              \
876
    if ( cyg_tracefunction_report_.cond )                               \
877
      cyg_tracemsg( cyg_trace_return,                                   \
878
                    cyg_tracefunction_report_.func,                     \
879
                    cyg_tracefunction_report_.file,                     \
880
                    cyg_tracefunction_report_.lnum,                     \
881
                    "return void" );                                    \
882
CYG_MACRO_END
883
 
884
#define CYG_REPORT_RETVAL( _value_ ) CYG_MACRO_START                    \
885
    CYG_ASSERT( 0 == cyg_tracefunction_report_.exitset,                 \
886
                "exitvalue used when arg already set" );                \
887
    cyg_tracefunction_report_.lnum = __LINE__;                          \
888
    cyg_tracefunction_report_.exitvalue = (CYG_ADDRWORD)(_value_);      \
889
    cyg_tracefunction_report_.exitset = 1;                              \
890
    if ( cyg_tracefunction_report_.cond )                               \
891
      cyg_tracemsg2( cyg_trace_return,                                  \
892
                     cyg_tracefunction_report_.func,                    \
893
                     cyg_tracefunction_report_.file,                    \
894
                     cyg_tracefunction_report_.lnum,                    \
895
                     cyg_tracefunction_report_.exitmsg ?                \
896
                        cyg_tracefunction_report_.exitmsg :             \
897
                        "return %08x",                                  \
898
                     cyg_tracefunction_report_.exitvalue, 0 );          \
899
CYG_MACRO_END
900
 
901
#else // do not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
902
 
903
#define CYG_REPORT_RETURN() CYG_MACRO_START                             \
904
    cyg_tracefunction_report_.lnum = __LINE__;                          \
905
    if ( cyg_tracefunction_report_.cond )                               \
906
      cyg_tracenomsg( cyg_tracefunction_report_.func,                   \
907
                      cyg_tracefunction_report_.file,                   \
908
                      cyg_tracefunction_report_.lnum );                 \
909
CYG_MACRO_END
910
 
911
#define CYG_REPORT_RETVAL( _value_ ) CYG_MACRO_START                    \
912
    CYG_REPORT_RETURN();                                                \
913
CYG_MACRO_END
914
 
915
#endif // not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
916
 
917
#endif // not __cplusplus
918
 
919
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
920
 
921
#define CYG_REPORT_FUNCARGVOID() CYG_MACRO_START                        \
922
  if ( cyg_tracefunction_report_.cond )                                 \
923
    cyg_tracemsg(  cyg_trace_args,                                      \
924
                   cyg_tracefunction_report_.func,                      \
925
                   cyg_tracefunction_report_.file,                      \
926
                   cyg_tracefunction_report_.lnum,                      \
927
                   "(void)"                                             \
928
                   );                                                   \
929
CYG_MACRO_END
930
 
931
#define CYG_REPORT_FUNCARG1( _format_, a ) CYG_MACRO_START              \
932
  if ( cyg_tracefunction_report_.cond )                                 \
933
    cyg_tracemsg2( cyg_trace_args,                                      \
934
                   cyg_tracefunction_report_.func,                      \
935
                   cyg_tracefunction_report_.file,                      \
936
                   cyg_tracefunction_report_.lnum,                      \
937
                   (_format_),                                          \
938
                   (CYG_ADDRWORD)a      , 0                             \
939
                   );                                                   \
940
CYG_MACRO_END
941
 
942
#define CYG_REPORT_FUNCARG2( _format_, a,b ) CYG_MACRO_START            \
943
  if ( cyg_tracefunction_report_.cond )                                 \
944
    cyg_tracemsg2( cyg_trace_args,                                      \
945
                   cyg_tracefunction_report_.func,                      \
946
                   cyg_tracefunction_report_.file,                      \
947
                   cyg_tracefunction_report_.lnum,                      \
948
                   (_format_),                                          \
949
                   (CYG_ADDRWORD)a, (CYG_ADDRWORD)b                     \
950
                   );                                                   \
951
CYG_MACRO_END
952
 
953
#define CYG_REPORT_FUNCARG3( _format_, a,b,c ) CYG_MACRO_START          \
954
  if ( cyg_tracefunction_report_.cond )                                 \
955
    cyg_tracemsg4( cyg_trace_args,                                      \
956
                   cyg_tracefunction_report_.func,                      \
957
                   cyg_tracefunction_report_.file,                      \
958
                   cyg_tracefunction_report_.lnum,                      \
959
                   (_format_),                                          \
960
                   (CYG_ADDRWORD)a, (CYG_ADDRWORD)b,                    \
961
                   (CYG_ADDRWORD)c      , 0                             \
962
                   );                                                   \
963
CYG_MACRO_END
964
 
965
#define CYG_REPORT_FUNCARG4( _format_, a,b,c,d ) CYG_MACRO_START        \
966
  if ( cyg_tracefunction_report_.cond )                                 \
967
    cyg_tracemsg4( cyg_trace_args,                                      \
968
                   cyg_tracefunction_report_.func,                      \
969
                   cyg_tracefunction_report_.file,                      \
970
                   cyg_tracefunction_report_.lnum,                      \
971
                   (_format_),                                          \
972
                   (CYG_ADDRWORD)a, (CYG_ADDRWORD)b,                    \
973
                   (CYG_ADDRWORD)c, (CYG_ADDRWORD)d                     \
974
                   );                                                   \
975
CYG_MACRO_END
976
 
977
#define CYG_REPORT_FUNCARG5( _format_, a,b,c,d,e ) CYG_MACRO_START      \
978
  if ( cyg_tracefunction_report_.cond )                                 \
979
    cyg_tracemsg6( cyg_trace_args,                                      \
980
                   cyg_tracefunction_report_.func,                      \
981
                   cyg_tracefunction_report_.file,                      \
982
                   cyg_tracefunction_report_.lnum,                      \
983
                   (_format_),                                          \
984
                   (CYG_ADDRWORD)a, (CYG_ADDRWORD)b,                    \
985
                   (CYG_ADDRWORD)c, (CYG_ADDRWORD)d,                    \
986
                   (CYG_ADDRWORD)e      , 0                             \
987
                   );                                                   \
988
CYG_MACRO_END
989
 
990
#define CYG_REPORT_FUNCARG6( _format_, a,b,c,d,e,f ) CYG_MACRO_START    \
991
  if ( cyg_tracefunction_report_.cond )                                 \
992
    cyg_tracemsg6( cyg_trace_args,                                      \
993
                   cyg_tracefunction_report_.func,                      \
994
                   cyg_tracefunction_report_.file,                      \
995
                   cyg_tracefunction_report_.lnum,                      \
996
                   (_format_),                                          \
997
                   (CYG_ADDRWORD)a, (CYG_ADDRWORD)b,                    \
998
                   (CYG_ADDRWORD)c, (CYG_ADDRWORD)d,                    \
999
                   (CYG_ADDRWORD)e, (CYG_ADDRWORD)f                     \
1000
                   );                                                   \
1001
CYG_MACRO_END
1002
 
1003
#define CYG_REPORT_FUNCARG7( _format_, a,b,c,d,e,f,g ) CYG_MACRO_START  \
1004
  if ( cyg_tracefunction_report_.cond )                                 \
1005
    cyg_tracemsg8( cyg_trace_args,                                      \
1006
                   cyg_tracefunction_report_.func,                      \
1007
                   cyg_tracefunction_report_.file,                      \
1008
                   cyg_tracefunction_report_.lnum,                      \
1009
                   (_format_),                                          \
1010
                   (CYG_ADDRWORD)a, (CYG_ADDRWORD)b,                    \
1011
                   (CYG_ADDRWORD)c, (CYG_ADDRWORD)d,                    \
1012
                   (CYG_ADDRWORD)e, (CYG_ADDRWORD)f,                    \
1013
                   (CYG_ADDRWORD)g      , 0                             \
1014
                   );                                                   \
1015
CYG_MACRO_END
1016
 
1017
#define CYG_REPORT_FUNCARG8( _format_, a,b,c,d,e,f,g,h ) CYG_MACRO_START\
1018
  if ( cyg_tracefunction_report_.cond )                                 \
1019
    cyg_tracemsg8( cyg_trace_args,                                      \
1020
                   cyg_tracefunction_report_.func,                      \
1021
                   cyg_tracefunction_report_.file,                      \
1022
                   cyg_tracefunction_report_.lnum,                      \
1023
                   (_format_),                                          \
1024
                   (CYG_ADDRWORD)a, (CYG_ADDRWORD)b,                    \
1025
                   (CYG_ADDRWORD)c, (CYG_ADDRWORD)d,                    \
1026
                   (CYG_ADDRWORD)e, (CYG_ADDRWORD)f,                    \
1027
                   (CYG_ADDRWORD)g, (CYG_ADDRWORD)h                     \
1028
                   );                                                   \
1029
CYG_MACRO_END
1030
 
1031
 
1032
#else // do not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
1033
 
1034
#define CYG_REPORT_FUNCARGVOID() CYG_EMPTY_STATEMENT
1035
#define CYG_REPORT_FUNCARG1( _format_, a ) CYG_EMPTY_STATEMENT
1036
#define CYG_REPORT_FUNCARG2( _format_, a,b ) CYG_EMPTY_STATEMENT
1037
#define CYG_REPORT_FUNCARG3( _format_, a,b,c ) CYG_EMPTY_STATEMENT
1038
#define CYG_REPORT_FUNCARG4( _format_, a,b,c,d ) CYG_EMPTY_STATEMENT
1039
#define CYG_REPORT_FUNCARG5( _format_, a,b,c,d,e ) CYG_EMPTY_STATEMENT
1040
#define CYG_REPORT_FUNCARG6( _format_, a,b,c,d,e,f ) CYG_EMPTY_STATEMENT
1041
#define CYG_REPORT_FUNCARG7( _format_, a,b,c,d,e,f,g ) CYG_EMPTY_STATEMENT
1042
#define CYG_REPORT_FUNCARG8( _format_, a,b,c,d,e,f,g,h ) CYG_EMPTY_STATEMENT
1043
 
1044
#endif  // not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE
1045
 
1046
#else   // no CYGDBG_INFRA_DEBUG_FUNCTION_REPORTS
1047
 
1048
#define CYG_REPORT_FUNCTION()                           CYG_EMPTY_STATEMENT
1049
#define CYG_REPORT_FUNCTYPE( _exitmsg_ )                CYG_EMPTY_STATEMENT
1050
#define CYG_REPORT_FUNCNAME( _name_ )                   CYG_EMPTY_STATEMENT
1051
#define CYG_REPORT_FUNCNAMETYPE( _name_, _exitmsg_  )   CYG_EMPTY_STATEMENT
1052
 
1053
#define CYG_REPORT_FUNCTIONC()                          CYG_EMPTY_STATEMENT
1054
#define CYG_REPORT_FUNCTYPEC( _exitmsg_ )               CYG_EMPTY_STATEMENT
1055
#define CYG_REPORT_FUNCNAMEC( _name_ )                  CYG_EMPTY_STATEMENT
1056
#define CYG_REPORT_FUNCNAMETYPEC( _name_, _exitmsg_  )  CYG_EMPTY_STATEMENT
1057
 
1058
#define CYG_REPORT_FUNCARGVOID() CYG_EMPTY_STATEMENT
1059
#define CYG_REPORT_FUNCARG1( _format_, a ) CYG_EMPTY_STATEMENT
1060
#define CYG_REPORT_FUNCARG2( _format_, a,b ) CYG_EMPTY_STATEMENT
1061
#define CYG_REPORT_FUNCARG3( _format_, a,b,c ) CYG_EMPTY_STATEMENT
1062
#define CYG_REPORT_FUNCARG4( _format_, a,b,c,d ) CYG_EMPTY_STATEMENT
1063
#define CYG_REPORT_FUNCARG5( _format_, a,b,c,d,e ) CYG_EMPTY_STATEMENT
1064
#define CYG_REPORT_FUNCARG6( _format_, a,b,c,d,e,f ) CYG_EMPTY_STATEMENT
1065
#define CYG_REPORT_FUNCARG7( _format_, a,b,c,d,e,f,g ) CYG_EMPTY_STATEMENT
1066
#define CYG_REPORT_FUNCARG8( _format_, a,b,c,d,e,f,g,h ) CYG_EMPTY_STATEMENT
1067
 
1068
#define CYG_REPORT_RETURN()                             CYG_EMPTY_STATEMENT
1069
#define CYG_REPORT_RETVAL( _value_ )                    CYG_EMPTY_STATEMENT
1070
 
1071
#endif  // CYGDBG_INFRA_DEBUG_FUNCTION_REPORTS
1072
 
1073
#else   // ! CYGDBG_USE_TRACING
1074
 
1075
// -------------------------------------------------------------------------
1076
// No traces: we define empty statements for trace macros.
1077
 
1078
#define CYG_TRACE0( _bool_, _msg_  ) CYG_EMPTY_STATEMENT
1079
#define CYG_TRACE1( _bool_, _msg_, a ) CYG_EMPTY_STATEMENT
1080
#define CYG_TRACE2( _bool_, _msg_, a,b ) CYG_EMPTY_STATEMENT
1081
#define CYG_TRACE3( _bool_, _msg_, a,b,c ) CYG_EMPTY_STATEMENT
1082
#define CYG_TRACE4( _bool_, _msg_, a,b,c,d ) CYG_EMPTY_STATEMENT
1083
#define CYG_TRACE5( _bool_, _msg_, a,b,c,d,e ) CYG_EMPTY_STATEMENT
1084
#define CYG_TRACE6( _bool_, _msg_, a,b,c,d,e,f ) CYG_EMPTY_STATEMENT
1085
#define CYG_TRACE7( _bool_, _msg_, a,b,c,d,e,f,g ) CYG_EMPTY_STATEMENT
1086
#define CYG_TRACE8( _bool_, _msg_, a,b,c,d,e,f,g,h ) CYG_EMPTY_STATEMENT
1087
 
1088
#define CYG_REPORT_FUNCTION()                           CYG_EMPTY_STATEMENT
1089
#define CYG_REPORT_FUNCTYPE( _exitmsg_ )                CYG_EMPTY_STATEMENT
1090
#define CYG_REPORT_FUNCNAME( _name_ )                   CYG_EMPTY_STATEMENT
1091
#define CYG_REPORT_FUNCNAMETYPE( _name_, _exitmsg_  )   CYG_EMPTY_STATEMENT
1092
 
1093
#define CYG_REPORT_FUNCTIONC()                          CYG_EMPTY_STATEMENT
1094
#define CYG_REPORT_FUNCTYPEC( _exitmsg_ )               CYG_EMPTY_STATEMENT
1095
#define CYG_REPORT_FUNCNAMEC( _name_ )                  CYG_EMPTY_STATEMENT
1096
#define CYG_REPORT_FUNCNAMETYPEC( _name_, _exitmsg_  )  CYG_EMPTY_STATEMENT
1097
 
1098
#define CYG_REPORT_FUNCARGVOID() CYG_EMPTY_STATEMENT
1099
#define CYG_REPORT_FUNCARG1( _format_, a ) CYG_EMPTY_STATEMENT
1100
#define CYG_REPORT_FUNCARG2( _format_, a,b ) CYG_EMPTY_STATEMENT
1101
#define CYG_REPORT_FUNCARG3( _format_, a,b,c ) CYG_EMPTY_STATEMENT
1102
#define CYG_REPORT_FUNCARG4( _format_, a,b,c,d ) CYG_EMPTY_STATEMENT
1103
#define CYG_REPORT_FUNCARG5( _format_, a,b,c,d,e ) CYG_EMPTY_STATEMENT
1104
#define CYG_REPORT_FUNCARG6( _format_, a,b,c,d,e,f ) CYG_EMPTY_STATEMENT
1105
#define CYG_REPORT_FUNCARG7( _format_, a,b,c,d,e,f,g ) CYG_EMPTY_STATEMENT
1106
#define CYG_REPORT_FUNCARG8( _format_, a,b,c,d,e,f,g,h ) CYG_EMPTY_STATEMENT
1107
 
1108
#define CYG_REPORT_RETURN()                             CYG_EMPTY_STATEMENT
1109
#define CYG_REPORT_RETVAL( _value_ )                    CYG_EMPTY_STATEMENT
1110
 
1111
#define CYG_TRACE_PRINT() CYG_EMPTY_STATEMENT
1112
#define CYG_TRACE_DUMP()  CYG_EMPTY_STATEMENT
1113
 
1114
#endif // ! CYGDBG_USE_TRACING
1115
 
1116
// -------------------------------------------------------------------------
1117
//
1118
// CYG_TRACEn{[XDY]{V}}{B}
1119
//
1120
// Convenience macros: these fall into a few dimensions, with suffix letters:
1121
// First option:
1122
//     X: user need not supply a format string, %08x is used
1123
//     D: ditto but signed decimal, %d
1124
//     Y: ditto but just plain %x
1125
// Second option, only meaningful with one of XDY:
1126
//     V: "<var> = %..." is used, by stringifying the argument
1127
// Third option:
1128
//     B: user need not supply a bool; the symbol CYG_TRACE_USER_BOOL is
1129
//        used (which we do not define, user must do this)
1130
 
1131
#define CYG_TRACE0B( _msg_  ) \
1132
        CYG_TRACE0( CYG_TRACE_USER_BOOL, _msg_  )
1133
#define CYG_TRACE1B( _msg_, a ) \
1134
        CYG_TRACE1( CYG_TRACE_USER_BOOL, _msg_, a )
1135
#define CYG_TRACE2B( _msg_, a,b ) \
1136
        CYG_TRACE2( CYG_TRACE_USER_BOOL, _msg_, a,b )
1137
#define CYG_TRACE3B( _msg_, a,b,c ) \
1138
        CYG_TRACE3( CYG_TRACE_USER_BOOL, _msg_, a,b,c )
1139
#define CYG_TRACE4B( _msg_, a,b,c,d ) \
1140
        CYG_TRACE4( CYG_TRACE_USER_BOOL, _msg_, a,b,c,d )
1141
#define CYG_TRACE5B( _msg_, a,b,c,d,e ) \
1142
        CYG_TRACE5( CYG_TRACE_USER_BOOL, _msg_, a,b,c,d,e )
1143
#define CYG_TRACE6B( _msg_, a,b,c,d,e,f ) \
1144
        CYG_TRACE6( CYG_TRACE_USER_BOOL, _msg_, a,b,c,d,e,f )
1145
#define CYG_TRACE7B( _msg_, a,b,c,d,e,f,g ) \
1146
        CYG_TRACE7( CYG_TRACE_USER_BOOL, _msg_, a,b,c,d,e,f,g )
1147
#define CYG_TRACE8B( _msg_, a,b,c,d,e,f,g,h ) \
1148
        CYG_TRACE8( CYG_TRACE_USER_BOOL, _msg_, a,b,c,d,e,f,g,h )
1149
 
1150
// long hex versions
1151
 
1152
#define CYG_TRACE1X( _bool_, a ) \
1153
        CYG_TRACE1( _bool_, "%08x", a )
1154
#define CYG_TRACE2X( _bool_, a,b ) \
1155
        CYG_TRACE2( _bool_, "%08x %08x", a,b )
1156
#define CYG_TRACE3X( _bool_, a,b,c ) \
1157
        CYG_TRACE3( _bool_, "%08x %08x %08x", a,b,c )
1158
#define CYG_TRACE4X( _bool_, a,b,c,d ) \
1159
        CYG_TRACE4( _bool_, "%08x %08x %08x %08x", a,b,c,d )
1160
#define CYG_TRACE5X( _bool_, a,b,c,d,e ) \
1161
        CYG_TRACE5( _bool_, "%08x %08x %08x %08x %08x", a,b,c,d,e )
1162
#define CYG_TRACE6X( _bool_, a,b,c,d,e,f ) \
1163
        CYG_TRACE6( _bool_, "%08x %08x %08x %08x %08x %08x", \
1164
                    a,b,c,d,e,f )
1165
#define CYG_TRACE7X( _bool_, a,b,c,d,e,f,g ) \
1166
        CYG_TRACE7( _bool_, "%08x %08x %08x %08x %08x %08x %08x", \
1167
                    a,b,c,d,e,f,g )
1168
#define CYG_TRACE8X( _bool_, a,b,c,d,e,f,g,h ) \
1169
        CYG_TRACE8( _bool_, "%08x %08x %08x %08x %08x %08x %08x %08x", \
1170
                    a,b,c,d,e,f,g,h )
1171
 
1172
#define CYG_TRACE1XV( _bool_, a ) \
1173
        CYG_TRACE1( _bool_, # a "=%08x ", a ) 
1174
#define CYG_TRACE2XV( _bool_, a,b ) \
1175
        CYG_TRACE2( _bool_, \
1176
                    # a "=%08x " # b "=%08x " , a,b )
1177
#define CYG_TRACE3XV( _bool_, a,b,c ) \
1178
        CYG_TRACE3( _bool_, \
1179
                    # a "=%08x " # b "=%08x " # c "=%08x " , a,b,c )
1180
#define CYG_TRACE4XV( _bool_, a,b,c,d ) \
1181
        CYG_TRACE4( _bool_, \
1182
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1183
                    , a,b,c,d )
1184
#define CYG_TRACE5XV( _bool_, a,b,c,d,e ) \
1185
        CYG_TRACE5( _bool_, \
1186
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1187
                    # e "=%08x " \
1188
                    , a,b,c,d,e )
1189
#define CYG_TRACE6XV( _bool_, a,b,c,d,e,f ) \
1190
        CYG_TRACE6( _bool_, \
1191
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1192
                    # e "=%08x " # f "=%08x " \
1193
                    , a,b,c,d,e,f )
1194
#define CYG_TRACE7XV( _bool_, a,b,c,d,e,f,g ) \
1195
        CYG_TRACE7( _bool_, \
1196
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1197
                    # e "=%08x " # f "=%08x " # g "=%08x " \
1198
                    , a,b,c,d,e,f,g )
1199
#define CYG_TRACE8XV( _bool_, a,b,c,d,e,f,g,h ) \
1200
        CYG_TRACE8( _bool_, \
1201
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1202
                    # e "=%08x " # f "=%08x " # g "=%08x " # h "=%08x " \
1203
                    , a,b,c,d,e,f,g,h )
1204
 
1205
#define CYG_TRACE1XB( a ) \
1206
        CYG_TRACE1( CYG_TRACE_USER_BOOL, "%08x", a )
1207
#define CYG_TRACE2XB( a,b ) \
1208
        CYG_TRACE2( CYG_TRACE_USER_BOOL, "%08x %08x", a,b )
1209
#define CYG_TRACE3XB( a,b,c ) \
1210
        CYG_TRACE3( CYG_TRACE_USER_BOOL, "%08x %08x %08x", a,b,c )
1211
#define CYG_TRACE4XB( a,b,c,d ) \
1212
        CYG_TRACE4( CYG_TRACE_USER_BOOL, "%08x %08x %08x %08x", a,b,c,d )
1213
#define CYG_TRACE5XB( a,b,c,d,e ) \
1214
        CYG_TRACE5( CYG_TRACE_USER_BOOL, "%08x %08x %08x %08x %08x", a,b,c,d,e )
1215
#define CYG_TRACE6XB( a,b,c,d,e,f ) \
1216
        CYG_TRACE6( CYG_TRACE_USER_BOOL, "%08x %08x %08x %08x %08x %08x", \
1217
                    a,b,c,d,e,f )
1218
#define CYG_TRACE7XB( a,b,c,d,e,f,g ) \
1219
        CYG_TRACE7( CYG_TRACE_USER_BOOL, "%08x %08x %08x %08x %08x %08x %08x", \
1220
                    a,b,c,d,e,f,g )
1221
#define CYG_TRACE8XB( a,b,c,d,e,f,g,h ) \
1222
        CYG_TRACE8( CYG_TRACE_USER_BOOL, "%08x %08x %08x %08x %08x %08x %08x %08x", \
1223
                    a,b,c,d,e,f,g,h )
1224
 
1225
#define CYG_TRACE1XVB( a ) \
1226
        CYG_TRACE1( CYG_TRACE_USER_BOOL, # a "=%08x ", a ) 
1227
#define CYG_TRACE2XVB( a,b ) \
1228
        CYG_TRACE2( CYG_TRACE_USER_BOOL, \
1229
                    # a "=%08x " # b "=%08x " , a,b )
1230
#define CYG_TRACE3XVB( a,b,c ) \
1231
        CYG_TRACE3( CYG_TRACE_USER_BOOL, \
1232
                    # a "=%08x " # b "=%08x " # c "=%08x " , a,b,c )
1233
#define CYG_TRACE4XVB( a,b,c,d ) \
1234
        CYG_TRACE4( CYG_TRACE_USER_BOOL, \
1235
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1236
                    , a,b,c,d )
1237
#define CYG_TRACE5XVB( a,b,c,d,e ) \
1238
        CYG_TRACE5( CYG_TRACE_USER_BOOL, \
1239
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1240
                    # e "=%08x " \
1241
                    , a,b,c,d,e )
1242
#define CYG_TRACE6XVB( a,b,c,d,e,f ) \
1243
        CYG_TRACE6( CYG_TRACE_USER_BOOL, \
1244
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1245
                    # e "=%08x " # f "=%08x " \
1246
                    , a,b,c,d,e,f )
1247
#define CYG_TRACE7XVB( a,b,c,d,e,f,g ) \
1248
        CYG_TRACE7( CYG_TRACE_USER_BOOL, \
1249
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1250
                    # e "=%08x " # f "=%08x " # g "=%08x " \
1251
                    , a,b,c,d,e,f,g )
1252
#define CYG_TRACE8XVB( a,b,c,d,e,f,g,h ) \
1253
        CYG_TRACE8( CYG_TRACE_USER_BOOL, \
1254
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1255
                    # e "=%08x " # f "=%08x " # g "=%08x " # h "=%08x " \
1256
                    , a,b,c,d,e,f,g,h )
1257
 
1258
// decimal versions
1259
 
1260
#define CYG_TRACE1D( _bool_, a ) \
1261
        CYG_TRACE1( _bool_, "%d", a )
1262
#define CYG_TRACE2D( _bool_, a,b ) \
1263
        CYG_TRACE2( _bool_, "%d %d", a,b )
1264
#define CYG_TRACE3D( _bool_, a,b,c ) \
1265
        CYG_TRACE3( _bool_, "%d %d %d", a,b,c )
1266
#define CYG_TRACE4D( _bool_, a,b,c,d ) \
1267
        CYG_TRACE4( _bool_, "%d %d %d %d", a,b,c,d )
1268
#define CYG_TRACE5D( _bool_, a,b,c,d,e ) \
1269
        CYG_TRACE5( _bool_, "%d %d %d %d %d", a,b,c,d,e )
1270
#define CYG_TRACE6D( _bool_, a,b,c,d,e,f ) \
1271
        CYG_TRACE6( _bool_, "%d %d %d %d %d %d", \
1272
                    a,b,c,d,e,f )
1273
#define CYG_TRACE7D( _bool_, a,b,c,d,e,f,g ) \
1274
        CYG_TRACE7( _bool_, "%d %d %d %d %d %d %d", \
1275
                    a,b,c,d,e,f,g )
1276
#define CYG_TRACE8D( _bool_, a,b,c,d,e,f,g,h ) \
1277
        CYG_TRACE8( _bool_, "%d %d %d %d %d %d %d %d", \
1278
                    a,b,c,d,e,f,g,h )
1279
 
1280
#define CYG_TRACE1DV( _bool_, a ) \
1281
        CYG_TRACE1( _bool_, # a "=%d ", a ) 
1282
#define CYG_TRACE2DV( _bool_, a,b ) \
1283
        CYG_TRACE2( _bool_, \
1284
                    # a "=%d " # b "=%d " , a,b )
1285
#define CYG_TRACE3DV( _bool_, a,b,c ) \
1286
        CYG_TRACE3( _bool_, \
1287
                    # a "=%d " # b "=%d " # c "=%d " , a,b,c )
1288
#define CYG_TRACE4DV( _bool_, a,b,c,d ) \
1289
        CYG_TRACE4( _bool_, \
1290
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1291
                    , a,b,c,d )
1292
#define CYG_TRACE5DV( _bool_, a,b,c,d,e ) \
1293
        CYG_TRACE5( _bool_, \
1294
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1295
                    # e "=%d " \
1296
                    , a,b,c,d,e )
1297
#define CYG_TRACE6DV( _bool_, a,b,c,d,e,f ) \
1298
        CYG_TRACE6( _bool_, \
1299
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1300
                    # e "=%d " # f "=%d " \
1301
                    , a,b,c,d,e,f )
1302
#define CYG_TRACE7DV( _bool_, a,b,c,d,e,f,g ) \
1303
        CYG_TRACE7( _bool_, \
1304
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1305
                    # e "=%d " # f "=%d " # g "=%d " \
1306
                    , a,b,c,d,e,f,g )
1307
#define CYG_TRACE8DV( _bool_, a,b,c,d,e,f,g,h ) \
1308
        CYG_TRACE8( _bool_, \
1309
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1310
                    # e "=%d " # f "=%d " # g "=%d " # h "=%d " \
1311
                    , a,b,c,d,e,f,g,h )
1312
 
1313
#define CYG_TRACE1DB( a ) \
1314
        CYG_TRACE1( CYG_TRACE_USER_BOOL, "%d", a )
1315
#define CYG_TRACE2DB( a,b ) \
1316
        CYG_TRACE2( CYG_TRACE_USER_BOOL, "%d %d", a,b )
1317
#define CYG_TRACE3DB( a,b,c ) \
1318
        CYG_TRACE3( CYG_TRACE_USER_BOOL, "%d %d %d", a,b,c )
1319
#define CYG_TRACE4DB( a,b,c,d ) \
1320
        CYG_TRACE4( CYG_TRACE_USER_BOOL, "%d %d %d %d", a,b,c,d )
1321
#define CYG_TRACE5DB( a,b,c,d,e ) \
1322
        CYG_TRACE5( CYG_TRACE_USER_BOOL, "%d %d %d %d %d", a,b,c,d,e )
1323
#define CYG_TRACE6DB( a,b,c,d,e,f ) \
1324
        CYG_TRACE6( CYG_TRACE_USER_BOOL, "%d %d %d %d %d %d", \
1325
                    a,b,c,d,e,f )
1326
#define CYG_TRACE7DB( a,b,c,d,e,f,g ) \
1327
        CYG_TRACE7( CYG_TRACE_USER_BOOL, "%d %d %d %d %d %d %d", \
1328
                    a,b,c,d,e,f,g )
1329
#define CYG_TRACE8DB( a,b,c,d,e,f,g,h ) \
1330
        CYG_TRACE8( CYG_TRACE_USER_BOOL, "%d %d %d %d %d %d %d %d", \
1331
                    a,b,c,d,e,f,g,h )
1332
 
1333
#define CYG_TRACE1DVB( a ) \
1334
        CYG_TRACE1( CYG_TRACE_USER_BOOL, # a "=%d ", a ) 
1335
#define CYG_TRACE2DVB( a,b ) \
1336
        CYG_TRACE2( CYG_TRACE_USER_BOOL, \
1337
                    # a "=%d " # b "=%d " , a,b )
1338
#define CYG_TRACE3DVB( a,b,c ) \
1339
        CYG_TRACE3( CYG_TRACE_USER_BOOL, \
1340
                    # a "=%d " # b "=%d " # c "=%d " , a,b,c )
1341
#define CYG_TRACE4DVB( a,b,c,d ) \
1342
        CYG_TRACE4( CYG_TRACE_USER_BOOL, \
1343
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1344
                    , a,b,c,d )
1345
#define CYG_TRACE5DVB( a,b,c,d,e ) \
1346
        CYG_TRACE5( CYG_TRACE_USER_BOOL, \
1347
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1348
                    # e "=%d " \
1349
                    , a,b,c,d,e )
1350
#define CYG_TRACE6DVB( a,b,c,d,e,f ) \
1351
        CYG_TRACE6( CYG_TRACE_USER_BOOL, \
1352
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1353
                    # e "=%d " # f "=%d " \
1354
                    , a,b,c,d,e,f )
1355
#define CYG_TRACE7DVB( a,b,c,d,e,f,g ) \
1356
        CYG_TRACE7( CYG_TRACE_USER_BOOL, \
1357
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1358
                    # e "=%d " # f "=%d " # g "=%d " \
1359
                    , a,b,c,d,e,f,g )
1360
#define CYG_TRACE8DVB( a,b,c,d,e,f,g,h ) \
1361
        CYG_TRACE8( CYG_TRACE_USER_BOOL, \
1362
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1363
                    # e "=%d " # f "=%d " # g "=%d " # h "=%d " \
1364
                    , a,b,c,d,e,f,g,h )
1365
 
1366
// short hex versions
1367
 
1368
#define CYG_TRACE1Y( _bool_, a ) \
1369
        CYG_TRACE1( _bool_, "%x", a )
1370
#define CYG_TRACE2Y( _bool_, a,b ) \
1371
        CYG_TRACE2( _bool_, "%x %x", a,b )
1372
#define CYG_TRACE3Y( _bool_, a,b,c ) \
1373
        CYG_TRACE3( _bool_, "%x %x %x", a,b,c )
1374
#define CYG_TRACE4Y( _bool_, a,b,c,d ) \
1375
        CYG_TRACE4( _bool_, "%x %x %x %x", a,b,c,d )
1376
#define CYG_TRACE5Y( _bool_, a,b,c,d,e ) \
1377
        CYG_TRACE5( _bool_, "%x %x %x %x %x", a,b,c,d,e )
1378
#define CYG_TRACE6Y( _bool_, a,b,c,d,e,f ) \
1379
        CYG_TRACE6( _bool_, "%x %x %x %x %x %x", \
1380
                    a,b,c,d,e,f )
1381
#define CYG_TRACE7Y( _bool_, a,b,c,d,e,f,g ) \
1382
        CYG_TRACE7( _bool_, "%x %x %x %x %x %x %x", \
1383
                    a,b,c,d,e,f,g )
1384
#define CYG_TRACE8Y( _bool_, a,b,c,d,e,f,g,h ) \
1385
        CYG_TRACE8( _bool_, "%x %x %x %x %x %x %x %x", \
1386
                    a,b,c,d,e,f,g,h )
1387
 
1388
#define CYG_TRACE1YV( _bool_, a ) \
1389
        CYG_TRACE1( _bool_, # a "=%x ", a ) 
1390
#define CYG_TRACE2YV( _bool_, a,b ) \
1391
        CYG_TRACE2( _bool_, \
1392
                    # a "=%x " # b "=%x " , a,b )
1393
#define CYG_TRACE3YV( _bool_, a,b,c ) \
1394
        CYG_TRACE3( _bool_, \
1395
                    # a "=%x " # b "=%x " # c "=%x " , a,b,c )
1396
#define CYG_TRACE4YV( _bool_, a,b,c,d ) \
1397
        CYG_TRACE4( _bool_, \
1398
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1399
                    , a,b,c,d )
1400
#define CYG_TRACE5YV( _bool_, a,b,c,d,e ) \
1401
        CYG_TRACE5( _bool_, \
1402
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1403
                    # e "=%x " \
1404
                    , a,b,c,d,e )
1405
#define CYG_TRACE6YV( _bool_, a,b,c,d,e,f ) \
1406
        CYG_TRACE6( _bool_, \
1407
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1408
                    # e "=%x " # f "=%x " \
1409
                    , a,b,c,d,e,f )
1410
#define CYG_TRACE7YV( _bool_, a,b,c,d,e,f,g ) \
1411
        CYG_TRACE7( _bool_, \
1412
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1413
                    # e "=%x " # f "=%x " # g "=%x " \
1414
                    , a,b,c,d,e,f,g )
1415
#define CYG_TRACE8YV( _bool_, a,b,c,d,e,f,g,h ) \
1416
        CYG_TRACE8( _bool_, \
1417
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1418
                    # e "=%x " # f "=%x " # g "=%x " # h "=%x " \
1419
                    , a,b,c,d,e,f,g,h )
1420
 
1421
#define CYG_TRACE1YB( a ) \
1422
        CYG_TRACE1( CYG_TRACE_USER_BOOL, "%x", a )
1423
#define CYG_TRACE2YB( a,b ) \
1424
        CYG_TRACE2( CYG_TRACE_USER_BOOL, "%x %x", a,b )
1425
#define CYG_TRACE3YB( a,b,c ) \
1426
        CYG_TRACE3( CYG_TRACE_USER_BOOL, "%x %x %x", a,b,c )
1427
#define CYG_TRACE4YB( a,b,c,d ) \
1428
        CYG_TRACE4( CYG_TRACE_USER_BOOL, "%x %x %x %x", a,b,c,d )
1429
#define CYG_TRACE5YB( a,b,c,d,e ) \
1430
        CYG_TRACE5( CYG_TRACE_USER_BOOL, "%x %x %x %x %x", a,b,c,d,e )
1431
#define CYG_TRACE6YB( a,b,c,d,e,f ) \
1432
        CYG_TRACE6( CYG_TRACE_USER_BOOL, "%x %x %x %x %x %x", \
1433
                    a,b,c,d,e,f )
1434
#define CYG_TRACE7YB( a,b,c,d,e,f,g ) \
1435
        CYG_TRACE7( CYG_TRACE_USER_BOOL, "%x %x %x %x %x %x %x", \
1436
                    a,b,c,d,e,f,g )
1437
#define CYG_TRACE8YB( a,b,c,d,e,f,g,h ) \
1438
        CYG_TRACE8( CYG_TRACE_USER_BOOL, "%x %x %x %x %x %x %x %x", \
1439
                    a,b,c,d,e,f,g,h )
1440
 
1441
#define CYG_TRACE1YVB( a ) \
1442
        CYG_TRACE1( CYG_TRACE_USER_BOOL, # a "=%x ", a ) 
1443
#define CYG_TRACE2YVB( a,b ) \
1444
        CYG_TRACE2( CYG_TRACE_USER_BOOL, \
1445
                    # a "=%x " # b "=%x " , a,b )
1446
#define CYG_TRACE3YVB( a,b,c ) \
1447
        CYG_TRACE3( CYG_TRACE_USER_BOOL, \
1448
                    # a "=%x " # b "=%x " # c "=%x " , a,b,c )
1449
#define CYG_TRACE4YVB( a,b,c,d ) \
1450
        CYG_TRACE4( CYG_TRACE_USER_BOOL, \
1451
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1452
                    , a,b,c,d )
1453
#define CYG_TRACE5YVB( a,b,c,d,e ) \
1454
        CYG_TRACE5( CYG_TRACE_USER_BOOL, \
1455
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1456
                    # e "=%x " \
1457
                    , a,b,c,d,e )
1458
#define CYG_TRACE6YVB( a,b,c,d,e,f ) \
1459
        CYG_TRACE6( CYG_TRACE_USER_BOOL, \
1460
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1461
                    # e "=%x " # f "=%x " \
1462
                    , a,b,c,d,e,f )
1463
#define CYG_TRACE7YVB( a,b,c,d,e,f,g ) \
1464
        CYG_TRACE7( CYG_TRACE_USER_BOOL, \
1465
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1466
                    # e "=%x " # f "=%x " # g "=%x " \
1467
                    , a,b,c,d,e,f,g )
1468
#define CYG_TRACE8YVB( a,b,c,d,e,f,g,h ) \
1469
        CYG_TRACE8( CYG_TRACE_USER_BOOL, \
1470
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1471
                    # e "=%x " # f "=%x " # g "=%x " # h "=%x " \
1472
                    , a,b,c,d,e,f,g,h )
1473
 
1474
// -------------------------------------------------------------------------
1475
//
1476
// CYG_REPORT_FUNCARGn{[XDY]{V}}
1477
//
1478
// Convenience macros two: these fall into a few dimensions, with suffix letters:
1479
// First option:
1480
//     X: user need not supply a format string, %08x is used
1481
//     D: ditto but signed decimal, %d
1482
//     Y: ditto but just plain %x
1483
// Second option, only meaningful with one of XDY:
1484
//     V: "<var> = %..." is used, by stringifying the argument
1485
 
1486
// long hex versions
1487
 
1488
#define CYG_REPORT_FUNCARG1X( a ) \
1489
        CYG_REPORT_FUNCARG1( "%08x", a )
1490
#define CYG_REPORT_FUNCARG2X( a,b ) \
1491
        CYG_REPORT_FUNCARG2( "%08x %08x", a,b )
1492
#define CYG_REPORT_FUNCARG3X( a,b,c ) \
1493
        CYG_REPORT_FUNCARG3( "%08x %08x %08x", a,b,c )
1494
#define CYG_REPORT_FUNCARG4X( a,b,c,d ) \
1495
        CYG_REPORT_FUNCARG4( "%08x %08x %08x %08x", a,b,c,d )
1496
#define CYG_REPORT_FUNCARG5X( a,b,c,d,e ) \
1497
        CYG_REPORT_FUNCARG5( "%08x %08x %08x %08x %08x", a,b,c,d,e )
1498
#define CYG_REPORT_FUNCARG6X( a,b,c,d,e,f ) \
1499
        CYG_REPORT_FUNCARG6( "%08x %08x %08x %08x %08x %08x", \
1500
                    a,b,c,d,e,f )
1501
#define CYG_REPORT_FUNCARG7X( a,b,c,d,e,f,g ) \
1502
        CYG_REPORT_FUNCARG7( "%08x %08x %08x %08x %08x %08x %08x", \
1503
                    a,b,c,d,e,f,g )
1504
#define CYG_REPORT_FUNCARG8X( a,b,c,d,e,f,g,h ) \
1505
        CYG_REPORT_FUNCARG8( "%08x %08x %08x %08x %08x %08x %08x %08x", \
1506
                    a,b,c,d,e,f,g,h )
1507
 
1508
#define CYG_REPORT_FUNCARG1XV( a ) \
1509
        CYG_REPORT_FUNCARG1( # a "=%08x ", a ) 
1510
#define CYG_REPORT_FUNCARG2XV( a,b ) \
1511
        CYG_REPORT_FUNCARG2( \
1512
                    # a "=%08x " # b "=%08x " , a,b )
1513
#define CYG_REPORT_FUNCARG3XV( a,b,c ) \
1514
        CYG_REPORT_FUNCARG3( \
1515
                    # a "=%08x " # b "=%08x " # c "=%08x " , a,b,c )
1516
#define CYG_REPORT_FUNCARG4XV( a,b,c,d ) \
1517
        CYG_REPORT_FUNCARG4( \
1518
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1519
                    , a,b,c,d )
1520
#define CYG_REPORT_FUNCARG5XV( a,b,c,d,e ) \
1521
        CYG_REPORT_FUNCARG5( \
1522
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1523
                    # e "=%08x " \
1524
                    , a,b,c,d,e )
1525
#define CYG_REPORT_FUNCARG6XV( a,b,c,d,e,f ) \
1526
        CYG_REPORT_FUNCARG6( \
1527
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1528
                    # e "=%08x " # f "=%08x " \
1529
                    , a,b,c,d,e,f )
1530
#define CYG_REPORT_FUNCARG7XV( a,b,c,d,e,f,g ) \
1531
        CYG_REPORT_FUNCARG7( \
1532
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1533
                    # e "=%08x " # f "=%08x " # g "=%08x " \
1534
                    , a,b,c,d,e,f,g )
1535
#define CYG_REPORT_FUNCARG8XV( a,b,c,d,e,f,g,h ) \
1536
        CYG_REPORT_FUNCARG8( \
1537
                    # a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \
1538
                    # e "=%08x " # f "=%08x " # g "=%08x " # h "=%08x " \
1539
                    , a,b,c,d,e,f,g,h )
1540
 
1541
// decimal versions
1542
 
1543
 
1544
#define CYG_REPORT_FUNCARG1D( a ) \
1545
        CYG_REPORT_FUNCARG1( "%d", a )
1546
#define CYG_REPORT_FUNCARG2D( a,b ) \
1547
        CYG_REPORT_FUNCARG2( "%d %d", a,b )
1548
#define CYG_REPORT_FUNCARG3D( a,b,c ) \
1549
        CYG_REPORT_FUNCARG3( "%d %d %d", a,b,c )
1550
#define CYG_REPORT_FUNCARG4D( a,b,c,d ) \
1551
        CYG_REPORT_FUNCARG4( "%d %d %d %d", a,b,c,d )
1552
#define CYG_REPORT_FUNCARG5D( a,b,c,d,e ) \
1553
        CYG_REPORT_FUNCARG5( "%d %d %d %d %d", a,b,c,d,e )
1554
#define CYG_REPORT_FUNCARG6D( a,b,c,d,e,f ) \
1555
        CYG_REPORT_FUNCARG6( "%d %d %d %d %d %d", \
1556
                    a,b,c,d,e,f )
1557
#define CYG_REPORT_FUNCARG7D( a,b,c,d,e,f,g ) \
1558
        CYG_REPORT_FUNCARG7( "%d %d %d %d %d %d %d", \
1559
                    a,b,c,d,e,f,g )
1560
#define CYG_REPORT_FUNCARG8D( a,b,c,d,e,f,g,h ) \
1561
        CYG_REPORT_FUNCARG8( "%d %d %d %d %d %d %d %d", \
1562
                    a,b,c,d,e,f,g,h )
1563
 
1564
#define CYG_REPORT_FUNCARG1DV( a ) \
1565
        CYG_REPORT_FUNCARG1( # a "=%d ", a ) 
1566
#define CYG_REPORT_FUNCARG2DV( a,b ) \
1567
        CYG_REPORT_FUNCARG2( \
1568
                    # a "=%d " # b "=%d " , a,b )
1569
#define CYG_REPORT_FUNCARG3DV( a,b,c ) \
1570
        CYG_REPORT_FUNCARG3( \
1571
                    # a "=%d " # b "=%d " # c "=%d " , a,b,c )
1572
#define CYG_REPORT_FUNCARG4DV( a,b,c,d ) \
1573
        CYG_REPORT_FUNCARG4( \
1574
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1575
                    , a,b,c,d )
1576
#define CYG_REPORT_FUNCARG5DV( a,b,c,d,e ) \
1577
        CYG_REPORT_FUNCARG5( \
1578
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1579
                    # e "=%d " \
1580
                    , a,b,c,d,e )
1581
#define CYG_REPORT_FUNCARG6DV( a,b,c,d,e,f ) \
1582
        CYG_REPORT_FUNCARG6( \
1583
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1584
                    # e "=%d " # f "=%d " \
1585
                    , a,b,c,d,e,f )
1586
#define CYG_REPORT_FUNCARG7DV( a,b,c,d,e,f,g ) \
1587
        CYG_REPORT_FUNCARG7( \
1588
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1589
                    # e "=%d " # f "=%d " # g "=%d " \
1590
                    , a,b,c,d,e,f,g )
1591
#define CYG_REPORT_FUNCARG8DV( a,b,c,d,e,f,g,h ) \
1592
        CYG_REPORT_FUNCARG8( \
1593
                    # a "=%d " # b "=%d " # c "=%d " # d "=%d " \
1594
                    # e "=%d " # f "=%d " # g "=%d " # h "=%d " \
1595
                    , a,b,c,d,e,f,g,h )
1596
 
1597
// short hex versions
1598
 
1599
#define CYG_REPORT_FUNCARG1Y( a ) \
1600
        CYG_REPORT_FUNCARG1( "%x", a )
1601
#define CYG_REPORT_FUNCARG2Y( a,b ) \
1602
        CYG_REPORT_FUNCARG2( "%x %x", a,b )
1603
#define CYG_REPORT_FUNCARG3Y( a,b,c ) \
1604
        CYG_REPORT_FUNCARG3( "%x %x %x", a,b,c )
1605
#define CYG_REPORT_FUNCARG4Y( a,b,c,d ) \
1606
        CYG_REPORT_FUNCARG4( "%x %x %x %x", a,b,c,d )
1607
#define CYG_REPORT_FUNCARG5Y( a,b,c,d,e ) \
1608
        CYG_REPORT_FUNCARG5( "%x %x %x %x %x", a,b,c,d,e )
1609
#define CYG_REPORT_FUNCARG6Y( a,b,c,d,e,f ) \
1610
        CYG_REPORT_FUNCARG6( "%x %x %x %x %x %x", \
1611
                    a,b,c,d,e,f )
1612
#define CYG_REPORT_FUNCARG7Y( a,b,c,d,e,f,g ) \
1613
        CYG_REPORT_FUNCARG7( "%x %x %x %x %x %x %x", \
1614
                    a,b,c,d,e,f,g )
1615
#define CYG_REPORT_FUNCARG8Y( a,b,c,d,e,f,g,h ) \
1616
        CYG_REPORT_FUNCARG8( "%x %x %x %x %x %x %x %x", \
1617
                    a,b,c,d,e,f,g,h )
1618
 
1619
#define CYG_REPORT_FUNCARG1YV( a ) \
1620
        CYG_REPORT_FUNCARG1( # a "=%x ", a ) 
1621
#define CYG_REPORT_FUNCARG2YV( a,b ) \
1622
        CYG_REPORT_FUNCARG2( \
1623
                    # a "=%x " # b "=%x " , a,b )
1624
#define CYG_REPORT_FUNCARG3YV( a,b,c ) \
1625
        CYG_REPORT_FUNCARG3( \
1626
                    # a "=%x " # b "=%x " # c "=%x " , a,b,c )
1627
#define CYG_REPORT_FUNCARG4YV( a,b,c,d ) \
1628
        CYG_REPORT_FUNCARG4( \
1629
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1630
                    , a,b,c,d )
1631
#define CYG_REPORT_FUNCARG5YV( a,b,c,d,e ) \
1632
        CYG_REPORT_FUNCARG5( \
1633
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1634
                    # e "=%x " \
1635
                    , a,b,c,d,e )
1636
#define CYG_REPORT_FUNCARG6YV( a,b,c,d,e,f ) \
1637
        CYG_REPORT_FUNCARG6( \
1638
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1639
                    # e "=%x " # f "=%x " \
1640
                    , a,b,c,d,e,f )
1641
#define CYG_REPORT_FUNCARG7YV( a,b,c,d,e,f,g ) \
1642
        CYG_REPORT_FUNCARG7( \
1643
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1644
                    # e "=%x " # f "=%x " # g "=%x " \
1645
                    , a,b,c,d,e,f,g )
1646
#define CYG_REPORT_FUNCARG8YV( a,b,c,d,e,f,g,h ) \
1647
        CYG_REPORT_FUNCARG8( \
1648
                    # a "=%x " # b "=%x " # c "=%x " # d "=%x " \
1649
                    # e "=%x " # f "=%x " # g "=%x " # h "=%x " \
1650
                    , a,b,c,d,e,f,g,h )
1651
 
1652
 
1653
#endif // CYGONCE_INFRA_CYG_TRAC_H multiple inclusion protection
1654
// EOF cyg_trac.h

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.