Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Pierre Muller <muller@ics.u-strasbg.fr>
Cc: Joel Brobecker <brobecker@gnat.com>, gdb-patches@sources.redhat.com
Subject: Re: New target method returning the name of the malloc function?
Date: Fri, 06 Sep 2002 06:03:00 -0000	[thread overview]
Message-ID: <20020906130336.GA6908@nevyn.them.org> (raw)
In-Reply-To: <4.2.0.58.20020906091206.021019b8@ics.u-strasbg.fr>

On Fri, Sep 06, 2002 at 09:17:11AM +0200, Pierre Muller wrote:
> At 02:23 06/09/2002 , Joel Brobecker a écrit:
> >Hello,
> >
> >The name of the function used to allocate some memory in the inferior is
> >currently hard-coded to "malloc" in valops.c:
> >
> >      struct value *
> >      value_allocate_space_in_inferior (int len)
> >      {
> >        struct value *blocklen;
> >        struct value *val = find_function_in_inferior ("malloc");
> >                                                        ^^^^^^
> >
> >Unfortunately, on interix, the malloc function is not always there.
> >Quoting Donn Terry:
> ><<
> >malloc() won't necessarily be present; the way our namespace pollution
> >prevention stuff works, if the user application doesn't call an entry
> >point at all, it just won't be there.  However, _malloc is always
> >present (at least in any real program) because it's called from within
> >the library.
> > >>
> >
> >May I suggest a new architecture method called for instance
> >NAME_OF_MALLOC or MALLOC_FUNCTION_NAME? The default would be to return
> >"malloc", but we could then change it to "_malloc" for the interix
> >target.
> That would be great !
> Because Pascal also does not define malloc...
> By the way, how is this allocated memory freed after the call to the 
> inferior function ?
> Does it use another C function for this, or how is it done.
> if it also need to find free then we should 
> also add a NAME_OF_FREE.

It doesn't release the memory.  There's some comments in the code about
why not - we have no way of knowing whether the called function stored
a pointer in a global variable somewhere.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2002-09-06 13:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-05 17:23 Joel Brobecker
2002-09-06  0:22 ` Pierre Muller
2002-09-06  6:03   ` Daniel Jacobowitz [this message]
2002-09-06  9:14   ` Kevin Buettner
2002-09-09  9:48     ` Joel Brobecker
2002-09-09 13:10     ` Andrew Cagney
2002-09-09 15:44       ` muller
2002-09-09 21:06         ` Andrew Cagney
2002-09-06 11:04 ` Michael Snyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020906130336.GA6908@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=brobecker@gnat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=muller@ics.u-strasbg.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox