Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Michael Elizabeth Chastain <mec.gnu@mindspring.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [rfc/cp] method stub assertions
Date: Tue, 06 Jan 2004 19:02:00 -0000	[thread overview]
Message-ID: <20040106190209.GA9422@nevyn.them.org> (raw)
In-Reply-To: <20040106182358.32BCA4B35A@berman.michael-chastain.com>

On Tue, Jan 06, 2004 at 01:23:58PM -0500, Michael Chastain wrote:
> > That's a nice hypothesis.  Unfortunately it's completely wrong :)
> > First of all, TYPE_CODE_MEMBER and TYPE_CODE_METHOD are siblings. 
> > MEMBER is used for data variables, not to wrap methods.
> 
> I think you mean: TYPE_CODE_MEMBER is used for pointers to data
> members.

Blah, no, it's supposed to be used for both pointer-to-member and
pointer-to-member-function.  You're right.

> It's a really bad name.  How about:
> 
>   TYPE_CODE_PTR		# pointer to memory
>   TYPE_CODE_PMD		# pointer to member data
>   TYPE_CODE_PMF_PLAIN 	# pointer to non-static non-virtual function
>   TYPE_CODE_PMF_VIRTUAL	# pointer to virtual function
> 
> TYPE_CODE_PTR has a raw CORE_ADDR, just like it does now.
> TYPE_CODE_PMD has a class type and a data offset.
> TYPE_CODE_PMF_PLAIN has a class type and a raw CORE_ADDR.
> TYPE_CODE_PMF_VIRTUAL has a class type and a vtbl offset.

No.  None of this are necessary.  The details of how a
pointer-to-member work should never be exposed to the GDB type
machinery; it's just a pointer-to-member, leave it at that.

If you want to be able to call through them use the DWARF-2 location
expression machinery and DW_AT_use_location.

> > The debug information for A::bad6 does not specify that it is a method. 
> > Rather only the debug info for class A specifies that it has a method
> > named A::bad6.  Take a look at a readelf -wi dump of your testcase to
> > see how this works.
> 
> Ouch.
> 
> How can we make &A::bad6 have a different type than &f1 ?

As I suggested in my last message, by making A::bad6 have a different
type than f1.

> > Currently they do appear as TYPE_CODE_METHOD.  I think that they
> > probably shouldn't.  A pointer to a static method is a function
> > pointer, not a pointer-to-member.  Similarly static variables should
> > probably not be TYPE_CODE_MEMBER.
> 
> I agree that &A::static_function should be TYPE_CODE_PTR.
> It's easy to figure that out even if A::static_function is
> TYPE_CODE_METHOD, because we can look at TYPE_FLAG_STATIC
> at the time we evalue the "&" operator.
> 
> Michael C
> 

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2004-01-06 19:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-06 18:24 Michael Elizabeth Chastain
2004-01-06 19:02 ` Daniel Jacobowitz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-01-06  4:28 Michael Elizabeth Chastain
2004-01-06  4:43 ` Daniel Jacobowitz
2004-01-06 17:05 ` Daniel Jacobowitz
2004-01-06 18:41   ` David Carlton
2004-01-06 19:05     ` Daniel Jacobowitz
2004-01-06  0:12 Michael Elizabeth Chastain
2004-01-06  2:51 ` Daniel Jacobowitz
2004-01-05 20:51 Michael Elizabeth Chastain
2004-01-05 11:50 [rfc/cp] take 2: method stubs asserts Michael Elizabeth Chastain
2004-01-05  0:50 ` [rfc/cp] method stub assertions Michael Elizabeth Chastain
2004-01-05  1:56   ` Daniel Jacobowitz
2004-01-05 19:23   ` Daniel Jacobowitz
2004-01-05  2:32 Michael Elizabeth Chastain
2004-01-05  2:33 ` Daniel Jacobowitz

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=20040106190209.GA9422@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=mec.gnu@mindspring.com \
    /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