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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [packages/] [infra/] [v2_0/] [include/] [cyg_trac.h] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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