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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [infra/] [cyg_trac.h] - Blame information for rev 321

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

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

powered by: WebSVN 2.1.0

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