⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cyg_trac.h

📁 ecos为实时嵌入式操作系统
💻 H
📖 第 1 页 / 共 5 页
字号:
#else        if ( cond )            cyg_tracenomsg( func, file, lnum );#endif    };    Cyg_TraceFunction_Report_(        int condition, char *psz_func, char *psz_file,         cyg_uint32 linenum, char *psz_exitmsg )    {        cond = condition;        func = psz_func;        file = psz_file;        lnum = linenum;#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE        exitmsg = psz_exitmsg;        exitset  = UNSET;        if ( cond )            cyg_tracemsg( cyg_trace_enter, func, file, lnum, "enter");#else        CYG_UNUSED_PARAM( char *, psz_exitmsg );        if ( cond )            cyg_tracenomsg( func, file, lnum );#endif    };    inline void set_exitvoid( cyg_uint32 linenum )    {        lnum = linenum;#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE        CYG_ASSERT( NULL == exitmsg, "exitvoid used in typed function" );        CYG_ASSERT( UNSET == exitset, "exitvoid used when arg already set" );        exitset = VOID;#endif    }    inline void set_exitvalue( cyg_uint32 linenum, CYG_ADDRWORD retcode )    {        lnum = linenum;#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE        CYG_ASSERT( UNSET == exitset, "exitvalue used when arg already set" );        exitvalue = retcode;        exitset = SET;#else        CYG_UNUSED_PARAM( CYG_ADDRWORD, retcode );#endif    }    ~Cyg_TraceFunction_Report_()    {        if ( cond ) {#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE            if ( VOID == exitset )                cyg_tracemsg( cyg_trace_return, func, file, lnum,                              "return void");            else if ( UNSET == exitset )                cyg_tracemsg( cyg_trace_return, func, file, lnum,                              "RETURNING UNSET!");            else if ( NULL == exitmsg )                cyg_tracemsg2( cyg_trace_return, func, file, lnum,                               "return %08x", exitvalue, 0 );            else                cyg_tracemsg2( cyg_trace_return, func, file, lnum,                               exitmsg, exitvalue, 0 );#else            cyg_tracenomsg( func, file, lnum );#endif        }    }};// These have no CYG_MACRO_START,END around because it is required// that the scope of the object be the whole function body.  Get it?// These are the unconditional versions:#define CYG_REPORT_FUNCTION()                           \  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \        1, __PRETTY_FUNCTION__,                         \        __FILE__, __LINE__ )#define CYG_REPORT_FUNCTYPE( _exitmsg_ )                \  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \        1, __PRETTY_FUNCTION__,                         \        __FILE__, __LINE__, _exitmsg_ )#define CYG_REPORT_FUNCNAME( _name_ )                   \  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \        1, _name_,                                      \        __FILE__, __LINE__ )#define CYG_REPORT_FUNCNAMETYPE( _name_, _exitmsg_  )   \  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \        1, _name_,                                      \        __FILE__, __LINE__, _exitmsg_ )// These are conditioned on macro CYG_REPORT_USER_BOOL// (which you better have defined)#define CYG_REPORT_FUNCTIONC()                          \  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \        CYG_REPORT_USER_BOOL, __PRETTY_FUNCTION__,      \        __FILE__, __LINE__ )#define CYG_REPORT_FUNCTYPEC( _exitmsg_ )               \  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \        CYG_REPORT_USER_BOOL, __PRETTY_FUNCTION__,      \        __FILE__, __LINE__, _exitmsg_ )#define CYG_REPORT_FUNCNAMEC( _name_ )                  \  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \        CYG_REPORT_USER_BOOL, _name_,                   \        __FILE__, __LINE__ )#define CYG_REPORT_FUNCNAMETYPEC( _name_, _exitmsg_  )  \  Cyg_TraceFunction_Report_ cyg_tracefunction_report_(  \        CYG_REPORT_USER_BOOL, _name_,                   \        __FILE__, __LINE__, _exitmsg_ )#define CYG_REPORT_RETURN() CYG_MACRO_START             \    cyg_tracefunction_report_.set_exitvoid( __LINE__ ); \CYG_MACRO_END#define CYG_REPORT_RETVAL( _value_) CYG_MACRO_START     \    cyg_tracefunction_report_.set_exitvalue(            \        __LINE__, (CYG_ADDRWORD)(_value_) );            \CYG_MACRO_END#else   // not __cplusplusstruct Cyg_TraceFunction_Report_{    int   cond;    char *func;    char *file; /* not strictly needed in plain 'C' */    cyg_uint32 lnum; /* nor this */#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE    char *exitmsg;    CYG_ADDRWORD exitvalue;    int exitset;#endif};#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE#define CYG_REPORT_FUNCTION_ENTER_INTERNAL() CYG_MACRO_START            \  if ( cyg_tracefunction_report_.cond )                                 \    cyg_tracemsg( cyg_trace_enter,                                      \                  cyg_tracefunction_report_.func,                       \                  cyg_tracefunction_report_.file,                       \                  cyg_tracefunction_report_.lnum,                       \                  "enter" );                                            \CYG_MACRO_END#define CYG_REPORT_FUNCTION_CONSTRUCT( _c_, _fn_,_fl_,_l_,_xm_,_xv_,_xs_ ) \        { _c_, _fn_, _fl_, _l_, _xm_, _xv_, _xs_ }#else // do not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE#define CYG_REPORT_FUNCTION_ENTER_INTERNAL() CYG_MACRO_START            \  if ( cyg_tracefunction_report_.cond )                                 \    cyg_tracenomsg( cyg_tracefunction_report_.func,                     \                    cyg_tracefunction_report_.file,                     \                    cyg_tracefunction_report_.lnum );                   \CYG_MACRO_END#define CYG_REPORT_FUNCTION_CONSTRUCT( _c_, _fn_,_fl_,_l_,_xm_,_xv_,_xs_ ) \        { _c_, _fn_, _fl_, _l_ }#endif // not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE// These have no CYG_MACRO_START,END around because it is required// that the scope of the object be the whole function body.  Get it?// These are the unconditional versions:#define CYG_REPORT_FUNCTION()                                           \    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \        1, __PRETTY_FUNCTION__, __FILE__, __LINE__, NULL, 0, 0 );       \    CYG_REPORT_FUNCTION_ENTER_INTERNAL()#define CYG_REPORT_FUNCTYPE( _exitmsg_ )                                \    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \        1, __PRETTY_FUNCTION__, __FILE__, __LINE__, _exitmsg_, 0, 0 );  \    CYG_REPORT_FUNCTION_ENTER_INTERNAL()#define CYG_REPORT_FUNCNAME( _name_ )                                   \    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \        1, _name_, __FILE__, __LINE__, NULL, 0, 0 );                    \    CYG_REPORT_FUNCTION_ENTER_INTERNAL()#define CYG_REPORT_FUNCNAMETYPE( _name_, _exitmsg_  )                   \    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \        1, _name_, __FILE__, __LINE__, _exitmsg_, 0, 0 );               \    CYG_REPORT_FUNCTION_ENTER_INTERNAL()// These are conditioned on macro CYG_REPORT_USER_BOOL// (which you better have defined)#define CYG_REPORT_FUNCTIONC()                                          \    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \        CYG_REPORT_USER_BOOL,                                           \        __PRETTY_FUNCTION__, __FILE__, __LINE__, NULL, 0, 0 );          \    CYG_REPORT_FUNCTION_ENTER_INTERNAL()#define CYG_REPORT_FUNCTYPEC( _exitmsg_ )                               \    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \        CYG_REPORT_USER_BOOL,                                           \        __PRETTY_FUNCTION__, __FILE__, __LINE__, _exitmsg_, 0, 0 );     \    CYG_REPORT_FUNCTION_ENTER_INTERNAL()#define CYG_REPORT_FUNCNAMEC( _name_ )                                  \    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \        CYG_REPORT_USER_BOOL,                                           \        _name_, __FILE__, __LINE__, NULL, 0, 0 );                       \    CYG_REPORT_FUNCTION_ENTER_INTERNAL()#define CYG_REPORT_FUNCNAMETYPEC( _name_, _exitmsg_  )                  \    struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ =        \    CYG_REPORT_FUNCTION_CONSTRUCT(                                      \        CYG_REPORT_USER_BOOL,                                           \        _name_, __FILE__, __LINE__, _exitmsg_, 0, 0 );                  \    CYG_REPORT_FUNCTION_ENTER_INTERNAL()#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE#define CYG_REPORT_RETURN() CYG_MACRO_START                             \    CYG_ASSERT( NULL == cyg_tracefunction_report_.exitmsg,              \                "exitvoid used in typed function" );                    \    CYG_ASSERT( 0 == cyg_tracefunction_report_.exitset,                 \                "exitvoid used when arg already set" );                 \    cyg_tracefunction_report_.lnum = __LINE__;                          \    cyg_tracefunction_report_.exitset = 2;                              \    if ( cyg_tracefunction_report_.cond )                               \      cyg_tracemsg( cyg_trace_return,                                   \                    cyg_tracefunction_report_.func,                     \                    cyg_tracefunction_report_.file,                     \                    cyg_tracefunction_report_.lnum,                     \                    "return void" );                                    \CYG_MACRO_END#define CYG_REPORT_RETVAL( _value_ ) CYG_MACRO_START                    \    CYG_ASSERT( 0 == cyg_tracefunction_report_.exitset,                 \                "exitvalue used when arg already set" );                \    cyg_tracefunction_report_.lnum = __LINE__;                          \    cyg_tracefunction_report_.exitvalue = (CYG_ADDRWORD)(_value_);      \    cyg_tracefunction_report_.exitset = 1;                              \    if ( cyg_tracefunction_report_.cond )                               \      cyg_tracemsg2( cyg_trace_return,                                  \                     cyg_tracefunction_report_.func,                    \                     cyg_tracefunction_report_.file,                    \                     cyg_tracefunction_report_.lnum,                    \                     cyg_tracefunction_report_.exitmsg ?                \                        cyg_tracefunction_report_.exitmsg :             \                        "return %08x",                                  \                     cyg_tracefunction_report_.exitvalue, 0 );          \CYG_MACRO_END#else // do not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE#define CYG_REPORT_RETURN() CYG_MACRO_START                             \    cyg_tracefunction_report_.lnum = __LINE__;                          \    if ( cyg_tracefunction_report_.cond )                               \      cyg_tracenomsg( cyg_tracefunction_report_.func,                   \                      cyg_tracefunction_report_.file,                   \                      cyg_tracefunction_report_.lnum );                 \CYG_MACRO_END#define CYG_REPORT_RETVAL( _value_ ) CYG_MACRO_START                    \    CYG_REPORT_RETURN();                                                \CYG_MACRO_END#endif // not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE#endif // not __cplusplus#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE#define CYG_REPORT_FUNCARGVOID() CYG_MACRO_START                        \  if ( cyg_tracefunction_report_.cond )                                 \    cyg_tracemsg(  cyg_trace_args,                                      \                   cyg_tracefunction_report_.func,                      \                   cyg_tracefunction_report_.file,                      \                   cyg_tracefunction_report_.lnum,                      \                   "(void)"                                             \                   );                                                   \CYG_MACRO_END#define CYG_REPORT_FUNCARG1( _format_, a ) CYG_MACRO_START              \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -