From: David Carlton <carlton@math.stanford.edu>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb-patches@sources.redhat.com
Cc: carlton@math.stanford.edu
Subject: Re: [RFA] dwarf2read.c: set TYPE_DOMAIN_TYPE correctly for methods
Date: Thu, 22 Aug 2002 13:56:00 -0000 [thread overview]
Message-ID: <ro1it22pqeh.fsf@jackfruit.Stanford.EDU> (raw)
In-Reply-To: <20020822204211.GA31727@nevyn.them.org>
In article <20020822204211.GA31727@nevyn.them.org>, Daniel Jacobowitz <drow@mvista.com> writes:
>> * dwarf2read.c (dwarf2_add_member_fn): Add back in the type
>> argument that was deleted on 2002-06-14: it was needed after all,
>> as PR gdb/653 demonstrates. Update call to smash_to_method_type.
>> (read_structure_scope): Update call to dwarf2_add_member_fn.
> Can you explain why this is necessary? I could not find any path to
> that point where type != die->type.
dwarf2_add_member_fn is called by read_structure_scope. The 'die'
argument to dwarf2_add_member_fn is the 'child_die' variable of
read_structure_scope. So what dwarf2_add_member_fn thinks of as
'die->type' is what read_structure_scope thinks of as
'child_die->type', in other words the type associated to the method
that is being added to the structure in question.
But the second argument to smash_to_method_type is supposed to be the
domain of the given method, i.e. the type of the structure owning the
method. This is dramatically different from read_structure_scope's
child_die->type; it equals read_structure_scope's die->type.
So that's why we want to pass in read_structure_scope's die->type as
an argument. (I don't see any way to recover die->type from
child_die, though admittedly I didn't try very hard.)
For a reasonably dramatic illustration of the effects of this, try
compiling the following program
/* Create some objects, and try to print out their methods. */
class A {
public:
virtual void virt() {};
void nonvirt() {};
};
int main()
{
A *theA = new A;
return 0;
}
and debug it with GDB from the current CVS. Run it until theA has
been created, and then try 'p theA->virt'.
David Carlton
carlton@math.stanford.edu
next prev parent reply other threads:[~2002-08-22 20:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-22 13:36 David Carlton
2002-08-22 13:52 ` Daniel Jacobowitz
2002-08-22 13:56 ` David Carlton [this message]
2002-08-22 14:19 ` Andrew Cagney
2002-08-22 14:26 ` David Carlton
2002-08-22 14:39 ` Andrew Cagney
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=ro1it22pqeh.fsf@jackfruit.Stanford.EDU \
--to=carlton@math.stanford.edu \
--cc=drow@mvista.com \
--cc=gdb-patches@sources.redhat.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