navit
0.5.3-trunk
|
#include <stdarg.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | dbg_str2(x) #x |
#define | dbg_str1(x) dbg_str2(x) |
#define | dbg_module dbg_str1(MODULE) |
#define | dbg(level, ...) { if (max_debug_level >= level) debug_printf(level,dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),1,__VA_ARGS__); } |
#define | dbg_assert(expr) ((expr) ? (void) 0 : debug_assert_fail(dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),__FILE__,__LINE__,dbg_str1(expr))) |
#define | DEBUG_MODULE_GLOBAL "global" |
#define | g_free_func g_free |
#define | dbg_guard(x) x |
Enumerations | |
enum | dbg_level { lvl_unset =-1 , lvl_error , lvl_warning , lvl_info , lvl_debug } |
Functions | |
void | debug_init (const char *program_name) |
void | debug_level_set (const char *name, dbg_level level) |
struct debug * | debug_new (struct attr *parent, struct attr **attrs) |
dbg_level | debug_level_get (const char *name) |
void | debug_vprintf (dbg_level level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap) |
Write a log message. More... | |
void | debug_printf (dbg_level level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt,...) |
void | debug_assert_fail (const char *module, const int mlen, const char *function, const int flen, const char *file, int line, const char *expr) |
void | debug_destroy (void) |
void | debug_set_logfile (const char *path) |
void | debug_dump_mallocs (void) |
void * | debug_malloc (const char *where, int line, const char *func, int size) |
void * | debug_malloc0 (const char *where, int line, const char *func, int size) |
char * | debug_strdup (const char *where, int line, const char *func, const char *ptr) |
char * | debug_guard (const char *where, int line, const char *func, char *str) |
void | debug_free (const char *where, int line, const char *func, void *ptr) |
void | debug_free_func (void *ptr) |
void | debug_finished (void) |
void * | debug_realloc (const char *where, int line, const char *func, void *ptr, int size) |
void | debug_set_global_level (dbg_level level, int override_old_value) |
Variables | |
dbg_level | max_debug_level |
#define dbg | ( | level, | |
... | |||
) | { if (max_debug_level >= level) debug_printf(level,dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),1,__VA_ARGS__); } |
#define dbg_assert | ( | expr | ) | ((expr) ? (void) 0 : debug_assert_fail(dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),__FILE__,__LINE__,dbg_str1(expr))) |
#define dbg_guard | ( | x | ) | x |
#define dbg_module dbg_str1(MODULE) |
#define dbg_str1 | ( | x | ) | dbg_str2(x) |
#define dbg_str2 | ( | x | ) | #x |
#define DEBUG_MODULE_GLOBAL "global" |
#define g_free_func g_free |
enum dbg_level |
Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Possible debug levels (inspired by SLF4J).
void debug_assert_fail | ( | const char * | module, |
const int | mlen, | ||
const char * | function, | ||
const int | flen, | ||
const char * | file, | ||
int | line, | ||
const char * | expr | ||
) |
References debug_printf(), and lvl_error.
void debug_destroy | ( | void | ) |
References debug_fp.
Referenced by debug_finished(), and debug_set_logfile().
void debug_dump_mallocs | ( | void | ) |
References dbg, lvl_debug, malloc_heads, mallocs, malloc_head::next, malloc_head::return_address, malloc_head::size, and malloc_head::where.
Referenced by debug_finished().
void debug_finished | ( | void | ) |
References debug_destroy(), debug_dump_mallocs(), debug_hash, and gdb_program.
Referenced by main_real().
void debug_free | ( | const char * | where, |
int | line, | ||
const char * | func, | ||
void * | ptr | ||
) |
References debug_malloc_size, malloc_head::magic, malloc_tail::magic, malloc_heads, mallocs, malloc_head::next, malloc_head::prev, malloc_head::size, and malloc_head::where.
Referenced by debug_free_func(), and debug_realloc().
void debug_free_func | ( | void * | ptr | ) |
References debug_free().
char* debug_guard | ( | const char * | where, |
int | line, | ||
const char * | func, | ||
char * | str | ||
) |
References debug_strdup().
void debug_init | ( | const char * | program_name | ) |
References debug_fp, debug_hash, gdb_program, and sigsegv().
Referenced by main_real().
dbg_level debug_level_get | ( | const char * | name | ) |
References debug_hash, and DEFAULT_DEBUG_LEVEL.
Referenced by debug_vprintf(), gui_internal_box_render(), gui_internal_table_render(), and map_rect_new_csv().
void debug_level_set | ( | const char * | name, |
dbg_level | level | ||
) |
References debug_hash, DEBUG_MODULE_GLOBAL, debug_set_global_level(), debug_update_level(), name, segv_level, sigsegv(), and timestamp_prefix.
Referenced by debug_new().
void* debug_malloc | ( | const char * | where, |
int | line, | ||
const char * | func, | ||
int | size | ||
) |
References __builtin_return_address, dbg, debug_malloc_size, debug_malloc_size_m, lvl_debug, malloc_head::magic, malloc_tail::magic, malloc_heads, mallocs, malloc_head::next, malloc_head::prev, malloc_head::return_address, malloc_head::size, size, and malloc_head::where.
Referenced by debug_malloc0(), debug_realloc(), and debug_strdup().
void* debug_malloc0 | ( | const char * | where, |
int | line, | ||
const char * | func, | ||
int | size | ||
) |
References debug_malloc(), and size.
References attr_search(), attr::attrs, debug, debug_level_set(), dummy, lvl_unset, name, p, parse_dbg_level(), attr::str, and attr::u.
void debug_printf | ( | dbg_level | level, |
const char * | module, | ||
const int | mlen, | ||
const char * | function, | ||
const int | flen, | ||
int | prefix, | ||
const char * | fmt, | ||
... | |||
) |
References debug_vprintf().
Referenced by debug_assert_fail(), and profile_timer().
void* debug_realloc | ( | const char * | where, |
int | line, | ||
const char * | func, | ||
void * | ptr, | ||
int | size | ||
) |
References debug_free(), debug_malloc(), and size.
void debug_set_global_level | ( | dbg_level | level, |
int | override_old_value | ||
) |
References global_debug_level, GLOBAL_DEBUG_LEVEL_UNSET, and max_debug_level.
Referenced by debug_level_set(), and main_real().
void debug_set_logfile | ( | const char * | path | ) |
References debug_destroy(), and debug_fp.
Referenced by main_real().
char* debug_strdup | ( | const char * | where, |
int | line, | ||
const char * | func, | ||
const char * | ptr | ||
) |
References debug_malloc(), and size.
Referenced by debug_guard().
void debug_vprintf | ( | dbg_level | level, |
const char * | module, | ||
const int | mlen, | ||
const char * | function, | ||
const int | flen, | ||
int | prefix, | ||
const char * | fmt, | ||
va_list | ap | ||
) |
Write a log message.
level | The level of the message. The message will only be written if level is higher than the minimum (global, per module or per function) |
module | The name of the module that is initiating the log message |
mlen | The length of string module |
function | The name of the function that is initiating the log message |
flen | The length of string function |
prefix | Force prepending the message with context information (a timestamp, if timestamp_prefix is set), and the module and function name |
fmt | The format string that specifies how subsequent arguments are output |
ap | A list of arguments to use for substitution in the format string |
References dbg_assert, dbg_level_to_string(), debug_fp, debug_level_get(), debug_timestamp(), global_debug_level, and timestamp_prefix.
Referenced by debug_printf(), logfn(), and profile_timer().
|
extern |
Referenced by debug_set_global_level(), and debug_update_level().