Navigation


Changeset 174:2b2f78036749 in freeDiameter


Ignore:
Timestamp:
Feb 3, 2010, 3:58:56 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Added simple command-line switch to turn on full debug for specific function or file

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/main.c

    r142 r174  
    192192                { "quiet",      no_argument,            NULL, 'q' },
    193193                { "dbglocale",  optional_argument,      NULL, 'l' },
     194                { "dbg_func",   required_argument,      NULL, 'f' },
     195                { "dbg_file",   required_argument,      NULL, 'F' },
    194196                { NULL,         0,                      NULL, 0 }
    195197        };
     
    229231                        case 'd':       /* Increase verbosity of debug messages.  */
    230232                                fd_g_debug_lvl++;
     233                                break;
     234                               
     235                        case 'f':       /* Full debug for the function with this name.  */
     236                                fd_debug_one_function = optarg;
     237                                break;
     238                               
     239                        case 'F':       /* Full debug for the file with this name.  */
     240                                fd_debug_one_file = optarg;
    231241                                break;
    232242                               
  • include/freeDiameter/libfreeDiameter.h

    r168 r174  
    9898void fd_log_debug ( char * format, ... );
    9999extern pthread_mutex_t  fd_log_lock;
     100extern char * fd_debug_one_function;
     101extern char * fd_debug_one_file;
    100102
    101103/*
     
    166168
    167169/* Boolean for tracing at a certain level */
    168 #define TRACE_BOOL(_level_) ( (_level_) <= local_debug_level + fd_g_debug_lvl )
     170#define TRACE_BOOL(_level_) ( ((_level_) <= local_debug_level + fd_g_debug_lvl)                                         \
     171                                || (fd_debug_one_function && !strcmp(fd_debug_one_function, __PRETTY_FUNCTION__))       \
     172                                || (fd_debug_one_file && !strcmp(fd_debug_one_file, __FILE__) ) )
    169173
    170174/* The general debug macro, each call results in two lines of debug messages (change the macro for more compact output) */
  • libfreeDiameter/log.c

    r22 r174  
    4141pthread_key_t   fd_log_thname;
    4242int fd_g_debug_lvl = 0;
     43
     44/* These may be used to pass specific debug requests via the command-line parameters */
     45char * fd_debug_one_function = NULL;
     46char * fd_debug_one_file = NULL;
     47
    4348
    4449/* Log a debug message */
Note: See TracChangeset for help on using the changeset viewer.