Hello,

On 2/11/10 5:42 PM, marius zbihlei wrote:
Daniel-Constantin Mierla wrote:
Hello,

On 2/9/10 4:00 PM, marius zbihlei wrote:
Hello (replying on myself)

Sorry for the broken output

Feb  9 16:46:03 marius ../../ser[32584]: ERROR: *** cfgtrace: c=[(null)] l=0 a=13 descr=seturi("sip:49721123456785@127.0.0.1:10000");
                     Feb  9 16:46:03 marius ../../ser[32584]: ERROR: *** cfgtrace: c=[30.cfg] l=33 a=17 descr=if (type<22>) {} else {};
Feb  9 16:46:03 marius ../../ser[32584]: ERROR: *** cfgtrace: c=[30.cfg] l=30 a=25 descr= external_module_call(f_ptr<0xb7dfc13c>, 0);

I will also check to see why the first line has no config file or line info...

it is in my roadmap to make it more verbose, but if you can do it is better :-) (so I can say was in my roadmap).

The name of the action is in the structure if it is a module function, for the core functions and statements (if, while, ...) I was thinking on having a mapping table (type, name).

Another idea was to open the cfg, read the respective line and print it next. But would be quite i/o intesive...

When you have the patch ready, send it over. I will look over it and if ok I will tell you to commit.

Thanks,
Daniel

Hello Daniel,

I have attacked a patch that enables print_action like printing of  module functions, core function and statements . It is usefull  if the action line is no longer that 512 characters(it truncates at 512 .. still to test)

The module export is printed like this (call to t_relay)
cfgtrace: c=[/home/marius/dev/sip-router/test/unit/30.cfg] l=30 a=25 descr=external_module_call(t_relay)(f_ptr<0xb7ee815c>, 0);

I also liked the file read solution but strangely for some action the file is NULL (*** cfgtrace: c=[(null)] l=0 a=13 descr=seturi("sip:49721123456787@127.0.0.1:8000");  )
I have to check, should be some value there...

BTW it is normal for a line like xlog(...) to appear as an action:
cfgtrace: c=[/home/marius/dev/sip-router/test/unit/30.cfg] l=30 a=17 descr=if (type<22>external_module_call(xlog)(f_ptr<0xb8062898>, 2, type<10>); drop(1, 1); } else {};
?

The patch is a little on the long side, and a bit intrusive to my liking , it you have other suggestion please let me now.

indeed a bit long. I was thinking to have some static tables:

struct action_info {
int type;
char *name;
};

struct action_info _sr_actions_list[] = {
  {FORWARD_T, "forward"},
  {IF_T, "if"},
...
  {0, 0}
};

Maybe same for expressions, operators, etc. Would become easy everywhere to get the action name (also easy to generate the list of actions for documentation purposes). The core print functions will get simplified a lot, since only few cases need special handling.

What I do not like about printing to buffer now is alloc every time. I was thinking to a less verbose version, just to print the action name, but more details are probably better when debugging.

Cheers,
Daniel
 

Cheers
Marius

_______________________________________________ sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla
SIP Server Professional Solutions
* http://www.asipto.com/