Navigation


Changeset 205:ff9ade352076 in freeDiameter


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

Simplified use of --dbg_file option

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/main.c

    r174 r205  
    234234                               
    235235                        case 'f':       /* Full debug for the function with this name.  */
     236                                #ifdef DEBUG
    236237                                fd_debug_one_function = optarg;
     238                                #else /* DEBUG */
     239                                TRACE_DEBUG(INFO, "Error: must compile with DEBUG support to use this feature");
     240                                return EINVAL;
     241                                #endif /* DEBUG */
    237242                                break;
    238243                               
    239244                        case 'F':       /* Full debug for the file with this name.  */
    240                                 fd_debug_one_file = optarg;
     245                                #ifdef DEBUG
     246                                fd_debug_one_file = basename(optarg);
     247                                #else /* DEBUG */
     248                                TRACE_DEBUG(INFO, "Error: must compile with DEBUG support to use this feature");
     249                                return EINVAL;
     250                                #endif /* DEBUG */
    241251                                break;
    242252                               
  • include/freeDiameter/libfreeDiameter.h

    r191 r205  
    7171#include <unistd.h>
    7272
     73#ifdef DEBUG
     74#include <libgen.h>     /* for basename if --dbg_file is specified */
     75#endif /* DEBUG */
     76
    7377/*============================================================*/
    7478/*                          DEBUG                             */
     
    167171#endif /* __PRETTY_FUNCTION__ */
    168172
     173/* A version of __FILE__ without the full path */
     174static char * file_bname = NULL;
     175#define __STRIPPED_FILE__       (file_bname ?: (file_bname = basename(__FILE__)))
     176
    169177/* Boolean for tracing at a certain level */
     178#ifdef DEBUG
    170179#define TRACE_BOOL(_level_) ( ((_level_) <= local_debug_level + fd_g_debug_lvl)                                         \
    171180                                || (fd_debug_one_function && !strcmp(fd_debug_one_function, __PRETTY_FUNCTION__))       \
    172                                 || (fd_debug_one_file && !strcmp(fd_debug_one_file, __FILE__) ) )
     181                                || (fd_debug_one_file && !strcmp(fd_debug_one_file, __STRIPPED_FILE__) ) )
     182#else /* DEBUG */
     183#define TRACE_BOOL(_level_) ((_level_) <= local_debug_level + fd_g_debug_lvl)
     184#endif /* DEBUG */
    173185
    174186/* The general debug macro, each call results in two lines of debug messages (change the macro for more compact output) */
Note: See TracChangeset for help on using the changeset viewer.