navit
0.5.3-trunk
|
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <glib.h>
#include <sys/time.h>
#include "config.h"
#include "file.h"
#include "item.h"
#include "debug.h"
#include <unistd.h>
Data Structures | |
struct | malloc_head |
struct | malloc_tail |
Macros | |
#define | DEFAULT_DEBUG_LEVEL lvl_error |
#define | GLOBAL_DEBUG_LEVEL_UNSET lvl_unset |
#define | __builtin_return_address(x) NULL |
Functions | |
static void | sigsegv (int sig) |
void | debug_init (const char *program_name) |
static void | debug_update_level (gpointer key, gpointer value, gpointer user_data) |
void | debug_set_global_level (dbg_level level, int override_old_value) |
void | debug_level_set (const char *name, dbg_level level) |
static dbg_level | parse_dbg_level (struct attr *dbg_level_attr, struct attr *level_attr) |
struct debug * | debug_new (struct attr *parent, struct attr **attrs) |
dbg_level | debug_level_get (const char *message_category) |
static void | debug_timestamp (char *buffer) |
Write a timestamp to a string buffer. More... | |
static char * | dbg_level_to_string (dbg_level level) |
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) |
void * | debug_realloc (const char *where, int line, const char *func, void *ptr, 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) |
Variables | |
dbg_level | max_debug_level =DEFAULT_DEBUG_LEVEL |
dbg_level | global_debug_level =GLOBAL_DEBUG_LEVEL_UNSET |
int | segv_level =0 |
int | timestamp_prefix =0 |
static int | dummy |
static GHashTable * | debug_hash |
static gchar * | gdb_program |
static FILE * | debug_fp |
struct malloc_head * | malloc_heads |
int | mallocs |
int | debug_malloc_size |
int | debug_malloc_size_m |
#define __builtin_return_address | ( | x | ) | NULL |
Referenced by debug_malloc().
#define DEFAULT_DEBUG_LEVEL lvl_error |
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 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 General Public License for more details.
You should have received a copy of the GNU 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.
Referenced by debug_level_get().
#define GLOBAL_DEBUG_LEVEL_UNSET lvl_unset |
Referenced by debug_set_global_level().
|
static |
References lvl_debug, lvl_error, lvl_info, lvl_unset, and lvl_warning.
Referenced by debug_vprintf().
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, 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 malloc_head::magic, malloc_tail::magic, malloc_heads, 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 * | message_category | ) |
References debug_hash, and DEFAULT_DEBUG_LEVEL.
Referenced by debug_vprintf(), 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(), segv_level, sigsegv(), and timestamp_prefix.
Referenced by debug_new().
References __builtin_return_address, dbg, lvl_debug, malloc_head::magic, malloc_tail::magic, malloc_heads, malloc_head::next, malloc_head::prev, malloc_head::return_address, size, malloc_head::size, and malloc_head::where.
Referenced by debug_malloc0(), debug_realloc(), and debug_strdup().
References debug_malloc().
References attr_search(), 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().
References debug_free(), and debug_malloc().
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().
|
static |
Write a timestamp to a string buffer.
Timestamp has the format "HH:MM:SS:mmm|" (with mmm=milliseconds), or under Windows "SSSSS:uuuuuu|" (with uuuuuu=microseconds)
[out] | buffer | The buffer to write to |
buffer
, if it is less than 14-bytes long (13 chars will be stored at max) References int().
Referenced by debug_vprintf().
|
static |
References max_debug_level.
Referenced by debug_level_set().
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().
References dbg, lvl_debug, lvl_error, lvl_info, lvl_unset, lvl_warning, attr::num, attr::str, and attr::u.
Referenced by debug_new().
|
static |
References exit, gdb_program, and segv_level.
Referenced by debug_init(), and debug_level_set().
|
static |
Referenced by debug_destroy(), debug_init(), debug_set_logfile(), and debug_vprintf().
|
static |
Referenced by debug_finished(), debug_init(), debug_level_get(), and debug_level_set().
int debug_malloc_size |
int debug_malloc_size_m |
|
static |
Referenced by debug_new().
|
static |
Referenced by debug_finished(), debug_init(), and sigsegv().
dbg_level global_debug_level =GLOBAL_DEBUG_LEVEL_UNSET |
Referenced by debug_set_global_level(), and debug_vprintf().
struct malloc_head * malloc_heads |
Referenced by debug_dump_mallocs(), debug_free(), and debug_malloc().
int mallocs |
dbg_level max_debug_level =DEFAULT_DEBUG_LEVEL |
Referenced by debug_set_global_level(), and debug_update_level().
int segv_level =0 |
Referenced by debug_level_set(), and sigsegv().
int timestamp_prefix =0 |
Referenced by debug_level_set(), and debug_vprintf().