Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@ges.redhat.com>
To: muller@cerbere.u-strasbg.fr
Cc: Kevin Buettner <kevinb@redhat.com>,
	Joel Brobecker <brobecker@gnat.com>,
	gdb-patches@sources.redhat.com
Subject: Re: New target method returning the name of the malloc  function?
Date: Mon, 09 Sep 2002 21:06:00 -0000	[thread overview]
Message-ID: <3D7D6FB2.8070205@ges.redhat.com> (raw)
In-Reply-To: <3.0.6.32.20020910005447.00f25b20@ics.u-strasbg.fr>

> At 16:10 09/09/02 -0400, Andrew Cagney wrote:
> 
>>> On Sep 6,  9:17am, Pierre Muller wrote:
>>> 
>>> 
> 
>>>> >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...
> 
>>
>>How does pascal allocate [raw] memory?
> 
> 
> The most basic function to get memory is 
>   GetMem(var p : pointer;size : longint);
> It is a procedure (function returning no value)
> passing two parameters:
>  one is a var parameter (analogus to the reference parameter in GNU C
> if I understood that correctly)

Yes.

> the second is the size.
>  The problem is that I am not even sure that GPC and Free Pascal 
> use exactly the same declaration and the same method to pass these parameters
> to the function.
>   For Free Pascal, I know that size is pushed first on stack
> followed by the pushing of the location of the p variable,
> but I don't know exactly for GPC and the feedback from GPC people 
> is rather rare.

Ah, ok.  I think this should be considered separatly.  Implementing it 
will involve reworking the function value_allocate_space_in_inferior() 
so that it is language aware.

Have you tried:

	nm pascalprogram | grep malloc

to see if there is any malloc like function in a pascal executable.

>>> This would suggest that something other than a target dependent method
>>> is needed.  (It seems to me that it's both target and language dependent.)
> 
>>
>>(Ah, the old ``which target'' problem --- target architecture, target 
>>os, target abi, target inferior, .... :-)
>>
>>Yes.  I think these are functions of the ABI and not the inferior.  Any 
>>interix inferior (local, remote) needs this override.  Hence they live 
>>in the architecture vector and not the target vector.
>>
>>I'm not sure what to do about the language side of this though.  It 
>>could always be parameterized with the current frame's language -> not 
>>sure if that is sufficient though.
> 
> 
> As said, GPC might need a different mecanism than Free Pascal
> (as GPC is based on the GCC compiler, its even possible 
> that malloc is always linked into the executable...)
> 
> 
> 



  reply	other threads:[~2002-09-10  4:06 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
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 [this message]
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=3D7D6FB2.8070205@ges.redhat.com \
    --to=ac131313@ges.redhat.com \
    --cc=brobecker@gnat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kevinb@redhat.com \
    --cc=muller@cerbere.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