tracing malloc/free call

Corinna Vinschen
Fri Jan 16 16:22:00 GMT 2015

On Jan 16 16:44, Corinna Vinschen wrote:
> On Jan 16 15:23, Marco Atzeri wrote:
> > Attached patch that allows tracking of original caller,
> > for the 4 memory allocation calls.
> Thanks for the patch, but it won't work nicely either this way.  The
> problem is that, in theory, the code has to differ between internal and
> external callers.  Internal callers (that is, Cygwin functions itself)
> don't hop into the function via _sigfe/_sigbe.  Thus the output for
> internal callers of malloc/free is now wrong with your patch.
> The solution for this problem would be a test which checks if the return
> address is the _sigbe function and if so, returns *(_my_tls.stackptr-1),
> otherwise __builtin_return_address(0).  However, the symbol _sigbe is
> not exported since, so far, it was only used inside _sigfe.  This needs
> a bit of tweaking.  I'll have a look.

I applied a patch to print the right caller address.  I created a new
macro caller_return_address() for reuse, should we have a desire to
print the caller address in other parts of the code.

I'm going to create a snapshot with this change.  Please give it
a try.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <>

More information about the Cygwin-patches mailing list