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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [infra/] [cyg_trac.h] - Blame information for rev 790

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

powered by: WebSVN 2.1.0

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