[sr-dev] Compile modules with debug symbols

Daniel-Constantin Mierla miconda at gmail.com
Mon Sep 10 18:18:07 CEST 2012


Hello,

On 9/10/12 2:33 PM, Carlos Ruiz Díaz wrote:
> Hi Daniel,
>
> no, it's just a plain make && make install.
>
> I spent a few hours on debugging and I figured out that it was an off 
> by one error on a memcpy() on certain exceptional conditions. I fixed 
> that but then I found a memory leak that's causing the crash after 40k 
> calls but I'm having a hard time interpreting the dump provided after 
> sending the SIGUSR1 to the process. if I'm not mistaken, there are two 
> pkg_str_dup() leaks per call but I'm still searching where I'm missing 
> the pkg_free().
>
> Is there a way to know where in the code the pkg_str_dup was called?
>
> I tried with valgrind too, but after the macro expansion of the memory 
> management functions, is very hard to find where it was called.

here are some hints about troubleshooting memory:
http://www.asipto.com/pub/kamailio-devel-guide/#c04troubleshooting

if you set memdbg and memlog lower than debug global parameter, then you 
get all memory operations in the syslog (be sure you compile with 
MEMDBG=1). Also look at mem_summary:
http://www.kamailio.org/wiki/cookbooks/3.3.x/core#mem_summary

and cfgutils module readme for some functions that can be used in config 
to dump the memory usage.

Cheers,
Daniel


>
> Regards.
>
> Carlos.
>
>
>
> On Mon, Sep 10, 2012 at 4:02 AM, Daniel-Constantin Mierla 
> <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>
>     Hello,
>
>     yes, by default is with debug symbols on. Do you provide special
>     flags or parameters to the make command?
>
>     Cheers,
>     Daniel
>
>
>     On 9/8/12 9:39 PM, Carlos Ruiz Díaz wrote:
>>     Hello list,
>>
>>     I'm trying to debug my module after it crashed by SIGSEGV, but
>>     the problem is that I'm unable to see the relevant data in the
>>     core file that's being dumped after the crash.
>>
>>     For example, if I do /bt full, /I get:
>>
>>     0  0x0ef0f494 in append_string () from
>>     /opt/install/kamailio-3.2.3/lib/kamailio/modules_k/cnx3a.so
>>     No symbol table info available.
>>     #1  0x0eef9658 in build_message () from
>>     /opt/install/kamailio-3.2.3/lib/kamailio/modules_k/cnx3a.so
>>     No symbol table info available.
>>     Backtrace stopped: frame did not save the PC
>>
>>     Only the functions that were called but no parameter values.
>>
>>     AFAIK, if I compile kamailio from sources, it is by default
>>     compiled with the -g option, so, it looks like that I'm missing
>>     something else.
>>
>>     Regards.
>>
>>     Carlos.
>>
>>
>>     _______________________________________________
>>     sr-dev mailing list
>>     sr-dev at lists.sip-router.org  <mailto:sr-dev at lists.sip-router.org>
>>     http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
>     -- 
>     Daniel-Constantin Mierla -http://www.asipto.com
>     http://twitter.com/#!/miconda  <http://twitter.com/#%21/miconda>  -http://www.linkedin.com/in/miconda
>     Kamailio Advanced Training, Berlin, Nov 5-8, 2012 -http://asipto.com/u/kat
>     Kamailio Advanced Training, Miami, USA, Nov 12-14, 2012 -http://asipto.com/u/katu
>
>

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, Nov 5-8, 2012 - http://asipto.com/u/kat
Kamailio Advanced Training, Miami, USA, Nov 12-14, 2012 - http://asipto.com/u/katu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20120910/1c97fac2/attachment.htm>


More information about the sr-dev mailing list