delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/04/19/12:04:41

Message-ID: <3EA137D9.A02AE97F@yahoo.com>
Date: Sat, 19 Apr 2003 07:49:45 -0400
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: nmalloc revisited
References: <200303141601 DOT RAA26911 AT lws256 DOT lu DOT erisoft DOT se> <3E7B8D9D DOT EEE854B1 AT yahoo DOT com> <9743-Sat19Apr2003115338+0300-eliz AT elta DOT co DOT il>
Reply-To: djgpp-workers AT delorie DOT com

Eli Zaretskii wrote:
> 
> > Date: Fri, 21 Mar 2003 17:09:33 -0500
> > From: CBFalconer <cbfalconer AT yahoo DOT com>
> >
> > The revised package is at:
> >
> >    <http://cbfalconer.home.att.net/download/nmalloc.zip>
> 
> Sorry for such a long delay.
> 
> I've finally looked at your implementation of malloc-debug facilities,
> and I have only one comment: I don't like the idea of redefining
> `malloc' to `_malloc', `free' to `_free', etc.  Unless I'm missing
> something, this precludes linking an application with the debuggery
> code without recompiling all the app's code from scratch.  It means,
> for example, that if I have a library for which I have no sources, and
> that library calls `malloc' et al, I'm toast if I want malloc-debug.
> 
> What's the problem to use the hooks as they are used in malldbg.c
> that's in the current DJGPP CVS?

I think there is a misunderstanding.  The action is the reverse -
the original code can be linked unchanged to malloc, free, etc. 
The redefines you mention allow this by letting the debuggery
code, named malloc, inject the hooks and then call the original
malloc, renamed _malloc.  This id, in the system domain, now
serves only to connect the prelinked malldbg package.

You might look at the tmalldbg source code for some usage.  It
doesn't declare any of those intermediate names, just the usual
malloc, free, etc.  The difference is in the link step.

-- 
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019