'LibPst'
debug.c File Reference
#include "define.h"
Include dependency graph for debug.c:

Go to the source code of this file.

Data Structures

struct  pst_debug_func
 

Macros

#define NUM_COL   32
 
#define MAX_DEPTH   32
 

Functions

void pst_debug_setlevel (int level)
 
void pst_debug_lock ()
 
void pst_debug_unlock ()
 
void pst_debug_init (const char *fname, void *output_mutex)
 
void pst_debug_func (int level, const char *function)
 
void pst_debug_func_ret (int level)
 
static void pst_debug_info (int level, int line, const char *file)
 
void pst_debug (int level, int line, const char *file, const char *fmt,...)
 
void pst_debug_hexdump (int level, int line, const char *file, const char *buf, size_t size, int cols, int delta)
 
void pst_debug_hexdumper (FILE *out, const char *buf, size_t size, int cols, int delta)
 
void pst_debug_close (void)
 
void * pst_malloc (size_t size)
 
void * pst_realloc (void *ptr, size_t size)
 

Variables

static struct pst_debug_funcfunc_head = NULL
 
static int func_depth = 0
 
static int pst_debuglevel = 0
 
static char indent [32 *4+1]
 
static FILE * debug_fp = NULL
 
static sem_t * debug_mutex = NULL
 

Macro Definition Documentation

◆ MAX_DEPTH

#define MAX_DEPTH   32

Definition at line 11 of file debug.c.

Referenced by pst_debug_hexdumper(), pst_debug_info(), and pst_debug_init().

◆ NUM_COL

#define NUM_COL   32

Definition at line 10 of file debug.c.

Referenced by pst_debug_hexdumper().

Function Documentation

◆ pst_debug()

void pst_debug ( int  level,
int  line,
const char *  file,
const char *  fmt,
  ... 
)

Definition at line 95 of file debug.c.

References debug_fp, pst_debug_info(), pst_debug_unlock(), and pst_debuglevel.

Here is the call graph for this function:

◆ pst_debug_close()

void pst_debug_close ( void  )

Definition at line 157 of file debug.c.

References debug_fp, func_head, pst_debug_func::name, and pst_debug_func::next.

Referenced by pst_debug_init().

◆ pst_debug_func()

void pst_debug_func ( int  level,
const char *  function 
)

Definition at line 59 of file debug.c.

References func_depth, func_head, pst_debug_func::name, pst_debug_func::next, pst_debuglevel, and pst_malloc().

Here is the call graph for this function:

◆ pst_debug_func_ret()

void pst_debug_func_ret ( int  level)

Definition at line 69 of file debug.c.

References DIE, func_depth, func_head, pst_debug_func::name, pst_debug_func::next, and pst_debuglevel.

◆ pst_debug_hexdump()

void pst_debug_hexdump ( int  level,
int  line,
const char *  file,
const char *  buf,
size_t  size,
int  cols,
int  delta 
)

Definition at line 109 of file debug.c.

References debug_fp, pst_debug_hexdumper(), pst_debug_info(), pst_debug_unlock(), and pst_debuglevel.

Here is the call graph for this function:

◆ pst_debug_hexdumper()

void pst_debug_hexdumper ( FILE *  out,
const char *  buf,
size_t  size,
int  cols,
int  delta 
)

Definition at line 119 of file debug.c.

References func_depth, indent, MAX_DEPTH, and NUM_COL.

Referenced by dumper(), main(), and pst_debug_hexdump().

◆ pst_debug_info()

static void pst_debug_info ( int  level,
int  line,
const char *  file 
)
static

Definition at line 85 of file debug.c.

References debug_fp, func_depth, func_head, indent, MAX_DEPTH, pst_debug_func::name, pst_debug_lock(), and pst_debuglevel.

Referenced by pst_debug(), and pst_debug_hexdump().

Here is the call graph for this function:

◆ pst_debug_init()

void pst_debug_init ( const char *  fname,
void *  output_mutex 
)

Definition at line 44 of file debug.c.

References debug_fp, debug_mutex, indent, MAX_DEPTH, and pst_debug_close().

Here is the call graph for this function:

◆ pst_debug_lock()

void pst_debug_lock ( )

Definition at line 28 of file debug.c.

References debug_mutex.

Referenced by close_enter_dir(), process(), and pst_debug_info().

◆ pst_debug_setlevel()

void pst_debug_setlevel ( int  level)

Definition at line 23 of file debug.c.

References pst_debuglevel.

Referenced by main().

◆ pst_debug_unlock()

void pst_debug_unlock ( )

Definition at line 36 of file debug.c.

References debug_mutex.

Referenced by close_enter_dir(), process(), pst_debug(), and pst_debug_hexdump().

◆ pst_malloc()

◆ pst_realloc()

void* pst_realloc ( void *  ptr,
size_t  size 
)

Definition at line 179 of file debug.c.

Referenced by pst_append_holder(), pst_build_id_ptr(), and pst_rfc2426_escape().

Variable Documentation

◆ debug_fp

FILE* debug_fp = NULL
static

Definition at line 17 of file debug.c.

Referenced by pst_debug(), pst_debug_close(), pst_debug_hexdump(), pst_debug_info(), and pst_debug_init().

◆ debug_mutex

sem_t* debug_mutex = NULL
static

Definition at line 19 of file debug.c.

Referenced by pst_debug_init(), pst_debug_lock(), and pst_debug_unlock().

◆ func_depth

int func_depth = 0
static

Definition at line 14 of file debug.c.

Referenced by pst_debug_func(), pst_debug_func_ret(), pst_debug_hexdumper(), and pst_debug_info().

◆ func_head

struct pst_debug_func* func_head = NULL
static

Definition at line 13 of file debug.c.

Referenced by pst_debug_close(), pst_debug_func(), pst_debug_func_ret(), and pst_debug_info().

◆ indent

char indent[32 *4+1]
static

Definition at line 16 of file debug.c.

Referenced by pst_debug_hexdumper(), pst_debug_info(), and pst_debug_init().

◆ pst_debuglevel

int pst_debuglevel = 0
static