|
@@ -35,6 +35,7 @@
|
|
|
#include "../../shm_init.h"
|
|
|
|
|
|
#include "debugger_api.h"
|
|
|
+#include "debugger_config.h"
|
|
|
|
|
|
MODULE_VERSION
|
|
|
|
|
@@ -57,9 +58,6 @@ extern int _dbg_step_loops;
|
|
|
|
|
|
static char * _dbg_cfgtrace_facility_str = 0;
|
|
|
|
|
|
-static int _dbg_mod_hash_size = 0;
|
|
|
-static int _dbg_mod_level = 0;
|
|
|
-
|
|
|
static cmd_export_t cmds[]={
|
|
|
{"dbg_breakpoint", (cmd_function)w_dbg_breakpoint, 1,
|
|
|
fixup_dbg_breakpoint, 0, ANY_ROUTE},
|
|
@@ -74,8 +72,8 @@ static param_export_t params[]={
|
|
|
{"log_prefix", STR_PARAM, &_dbg_cfgtrace_prefix},
|
|
|
{"step_usleep", INT_PARAM, &_dbg_step_usleep},
|
|
|
{"step_loops", INT_PARAM, &_dbg_step_loops},
|
|
|
- {"mod_hash_size", INT_PARAM, &_dbg_mod_hash_size},
|
|
|
- {"mod_level_mode", INT_PARAM, &_dbg_mod_level},
|
|
|
+ {"mod_hash_size", INT_PARAM, &default_dbg_cfg.mod_hash_size},
|
|
|
+ {"mod_level_mode", INT_PARAM, &default_dbg_cfg.mod_level_mode},
|
|
|
{"mod_level", STR_PARAM|USE_FUNC_PARAM, (void*)dbg_mod_level_param},
|
|
|
{0, 0, 0}
|
|
|
};
|
|
@@ -120,7 +118,16 @@ static int mod_init(void)
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- if(dbg_init_mod_levels(_dbg_mod_level, _dbg_mod_hash_size)<0)
|
|
|
+ if(cfg_declare("dbg", dbg_cfg_def, &default_dbg_cfg, cfg_sizeof(dbg), &dbg_cfg))
|
|
|
+ {
|
|
|
+ LM_ERR("Fail to declare the configuration\n");
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ LM_DBG("cfg level_mode:%d hash_size:%d\n",
|
|
|
+ cfg_get(dbg, dbg_cfg, mod_level_mode),
|
|
|
+ cfg_get(dbg, dbg_cfg, mod_hash_size));
|
|
|
+
|
|
|
+ if(dbg_init_mod_levels(cfg_get(dbg, dbg_cfg, mod_hash_size))<0)
|
|
|
{
|
|
|
LM_ERR("failed to init per module log level\n");
|
|
|
return -1;
|
|
@@ -210,7 +217,10 @@ static int dbg_mod_level_param(modparam_t type, void *val)
|
|
|
}
|
|
|
s.s = (char*)val;
|
|
|
s.len = p - s.s;
|
|
|
- if(dbg_init_mod_levels(_dbg_mod_level, _dbg_mod_hash_size)<0)
|
|
|
+ LM_DBG("cfg level_mode:%d hash_size:%d\n",
|
|
|
+ cfg_get(dbg, dbg_cfg, mod_level_mode),
|
|
|
+ cfg_get(dbg, dbg_cfg, mod_hash_size));
|
|
|
+ if(dbg_init_mod_levels(cfg_get(dbg, dbg_cfg, mod_hash_size))<0)
|
|
|
{
|
|
|
LM_ERR("failed to init per module log level\n");
|
|
|
return -1;
|