Module: sip-router Branch: master Commit: 8412526a4e638b8d72f5d718191bd3122c10cf95 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8412526a...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Thu Feb 4 20:36:34 2010 +0100
debugger: more parameters exported to cfg
---
modules/debugger/README | 83 +++++++++++++++++++++++- modules/debugger/debugger_mod.c | 26 ++++++++ modules/debugger/doc/debugger_admin.xml | 106 ++++++++++++++++++++++++++++++- 3 files changed, 212 insertions(+), 3 deletions(-)
diff --git a/modules/debugger/README b/modules/debugger/README index ecd5b3e..4b4149f 100644 --- a/modules/debugger/README +++ b/modules/debugger/README @@ -27,6 +27,11 @@ Daniel-Constantin Mierla
3.1. cfgtrace (int) 3.2. breakpoint (int) + 3.3. log_level (int) + 3.4. log_facility (str) + 3.5. log_prefix (str) + 3.6. step_usleep (int) + 3.7. step_loops (int)
4. Exported Functions
@@ -45,7 +50,12 @@ Daniel-Constantin Mierla
1.1. Set cfgtrace parameter 1.2. Set breakpoint parameter - 1.3. mt_match usage + 1.3. Set log_level parameter + 1.4. Set log_facility parameter + 1.5. Set log_prefix parameter + 1.6. Set step_usleep parameter + 1.7. Set step_loops parameter + 1.8. dbg_breakpoint usage
Chapter 1. Admin Guide
@@ -61,6 +71,11 @@ Chapter 1. Admin Guide
3.1. cfgtrace (int) 3.2. breakpoint (int) + 3.3. log_level (int) + 3.4. log_facility (str) + 3.5. log_prefix (str) + 3.6. step_usleep (int) + 3.7. step_loops (int)
4. Exported Functions
@@ -117,6 +132,11 @@ Chapter 1. Admin Guide
3.1. cfgtrace (int) 3.2. breakpoint (int) + 3.3. log_level (int) + 3.4. log_facility (str) + 3.5. log_prefix (str) + 3.6. step_usleep (int) + 3.7. step_loops (int)
3.1. cfgtrace (int)
@@ -141,6 +161,65 @@ modparam("debugger", "cfgtrace", 1) modparam("debugger", "breakpoint", 1) ...
+3.3. log_level (int) + + What log level to be used to print module specific messages. + + Default value is "-1" (L_ERR). + + Example 1.3. Set log_level parameter +... +modparam("debugger", "log_level", 1) +... + +3.4. log_facility (str) + + What log facility to be used to print module specific messages. + + Default value is "NULL" (default from core). + + Example 1.4. Set log_facility parameter +... +modparam("debugger", "log_facility", "LOG_DAEMON") +... + +3.5. log_prefix (str) + + String to print before any module specific messages. + + Default value is "*** cfgtrace:". + + Example 1.5. Set log_prefix parameter +... +modparam("debugger", "log_prefix", "from-debugger-with-love:") +... + +3.6. step_usleep (int) + + Microseconds to sleep before checking for new commands when waiting at + breakpoint + + Default value is "100000" (that is 0.1sec). + + Example 1.6. Set step_usleep parameter +... +modparam("debugger", "step_usleep", 500000) +... + +3.7. step_loops (int) + + How many sleeps of 'step_usleep' the RPC process performs when waiting + for a reply from worker process before responding to RPC. This avoids + blocking RPC process for ever in case the worker process 'forgets' to + write back a reply. + + Default value is "200". + + Example 1.7. Set step_loops parameter +... +modparam("debugger", "step_loops", 100) +... + 4. Exported Functions
4.1. dbg_breakpoint(mode) @@ -153,7 +232,7 @@ modparam("debugger", "breakpoint", 1) Note that this version does not export this anchors to RPC for interactive debugging (temporary disabled).
- Example 1.3. mt_match usage + Example 1.8. dbg_breakpoint usage ... if($si=="10.0.0.10") dbg_breakpoint("1"); diff --git a/modules/debugger/debugger_mod.c b/modules/debugger/debugger_mod.c index 326a75f..e0fa8f2 100644 --- a/modules/debugger/debugger_mod.c +++ b/modules/debugger/debugger_mod.c @@ -45,8 +45,16 @@ static void mod_destroy(void); static int w_dbg_breakpoint(struct sip_msg* msg, char* point, char* str2); static int fixup_dbg_breakpoint(void** param, int param_no);
+/* parameters */ extern int _dbg_cfgtrace; extern int _dbg_breakpoint; +extern int _dbg_cfgtrace_level; +extern int _dbg_cfgtrace_facility; +extern char *_dbg_cfgtrace_prefix; +extern int _dbg_step_usleep; +extern int _dbg_step_loops; + +static char * _dbg_cfgtrace_facility_str = 0;
static cmd_export_t cmds[]={ {"dbg_breakpoint", (cmd_function)w_dbg_breakpoint, 1, @@ -57,6 +65,11 @@ static cmd_export_t cmds[]={ static param_export_t params[]={ {"cfgtrace", INT_PARAM, &_dbg_cfgtrace}, {"breakpoint", INT_PARAM, &_dbg_breakpoint}, + {"log_level", INT_PARAM, &_dbg_cfgtrace_level}, + {"log_facility", STR_PARAM, &_dbg_cfgtrace_facility_str}, + {"log_prefix", STR_PARAM, &_dbg_cfgtrace_prefix}, + {"step_usleep", INT_PARAM, &_dbg_step_usleep}, + {"step_loops", INT_PARAM, &_dbg_step_loops}, {0, 0, 0} };
@@ -81,6 +94,19 @@ struct module_exports exports = { */ static int mod_init(void) { + int fl; + if (_dbg_cfgtrace_facility_str!=NULL) + { + fl = str2facility(_dbg_cfgtrace_facility_str); + if (fl != -1) + { + _dbg_cfgtrace_facility = fl; + } else { + LM_ERR("invalid log facility configured"); + return -1; + } + } + if(dbg_init_rpc()!=0) { LM_ERR("failed to register RPC commands\n"); diff --git a/modules/debugger/doc/debugger_admin.xml b/modules/debugger/doc/debugger_admin.xml index e812aba..c65851e 100644 --- a/modules/debugger/doc/debugger_admin.xml +++ b/modules/debugger/doc/debugger_admin.xml @@ -115,6 +115,110 @@ modparam("debugger", "breakpoint", 1) </example> </section>
+ <section> + <title><varname>log_level</varname> (int)</title> + <para> + What log level to be used to print module specific messages. + </para> + <para> + <emphasis> + Default value is <quote>-1</quote> (L_ERR). + </emphasis> + </para> + <example> + <title>Set <varname>log_level</varname> parameter</title> + <programlisting format="linespecific"> +... +modparam("debugger", "log_level", 1) +... +</programlisting> + </example> + </section> + + <section> + <title><varname>log_facility</varname> (str)</title> + <para> + What log facility to be used to print module specific messages. + </para> + <para> + <emphasis> + Default value is <quote>NULL</quote> (default from core). + </emphasis> + </para> + <example> + <title>Set <varname>log_facility</varname> parameter</title> + <programlisting format="linespecific"> +... +modparam("debugger", "log_facility", "LOG_DAEMON") +... +</programlisting> + </example> + </section> + + <section> + <title><varname>log_prefix</varname> (str)</title> + <para> + String to print before any module specific messages. + </para> + <para> + <emphasis> + Default value is <quote>*** cfgtrace:</quote>. + </emphasis> + </para> + <example> + <title>Set <varname>log_prefix</varname> parameter</title> + <programlisting format="linespecific"> +... +modparam("debugger", "log_prefix", "from-debugger-with-love:") +... +</programlisting> + </example> + </section> + + <section> + <title><varname>step_usleep</varname> (int)</title> + <para> + Microseconds to sleep before checking for new commands when + waiting at breakpoint + </para> + <para> + <emphasis> + Default value is <quote>100000</quote> (that is 0.1sec). + </emphasis> + </para> + <example> + <title>Set <varname>step_usleep</varname> parameter</title> + <programlisting format="linespecific"> +... +modparam("debugger", "step_usleep", 500000) +... +</programlisting> + </example> + </section> + + <section> + <title><varname>step_loops</varname> (int)</title> + <para> + How many sleeps of 'step_usleep' the RPC process performs when + waiting for a reply from worker process before responding to RPC. + This avoids blocking RPC process for ever in case the worker + process 'forgets' to write back a reply. + </para> + <para> + <emphasis> + Default value is <quote>200</quote>. + </emphasis> + </para> + <example> + <title>Set <varname>step_loops</varname> parameter</title> + <programlisting format="linespecific"> +... +modparam("debugger", "step_loops", 100) +... +</programlisting> + </example> + </section> + </section> <section> @@ -132,7 +236,7 @@ modparam("debugger", "breakpoint", 1) interactive debugging (temporary disabled). </para> <example> - <title><function>mt_match</function> usage</title> + <title><function>dbg_breakpoint</function> usage</title> <programlisting format="linespecific"> ... if($si=="10.0.0.10")