Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Berlin <dberlin@redhat.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Start abstraction of C++ abi's
Date: Mon, 19 Feb 2001 13:17:00 -0000	[thread overview]
Message-ID: <x7n1bi5q61.fsf@dynamic-addr-83-177.resnet.rochester.edu> (raw)
In-Reply-To: <3A917341.BDA8781B@cygnus.com>

Andrew Cagney <ac131313@cygnus.com> writes:

> Daniel Berlin wrote:
> > 
> > This patch, plus the attached files, start the abstraction of the C++
> > ABI's.
> > 
> > I've started by replacing the simple things, and will incrementally
> > replace the more complex things, and the things that require real code
> > changes, as time goes on.
> > 
> > The cp-abi directory, and it's files, are attached in a gzipped tar file.
> 
> FYI,
> 
> Moving stuff into a sub directory is a significant change and should
> really be discussed separatly - at present the only think in sub
> directories are UIs.  I tend to recommend leaving such cosmetic changes
> as a latter pass.

It's not moving stuff into a subdir, as it didn't exist before. I'm
creating it in a subdir. Why is it necessary to have a long discussion
about creating a directory for a bunch of related files? I'm happy to
see if anyone objects, but I don't see it as a significant change.
Maybe this is why it never gets done.

if you really want me to dirty the root directory with these new
files, i will, but i felt it made a lot more sense not to.There are
currently over 400 files in the root gdb directory. Besides the -nat
and -tdep files, I can't tell what a file does from it's name, because
they aren't logically divided into subdirs by functionality, and there
are just too damn many files.  Not that I expect to see this happen,
but to prove a point: 
Quick, what's kod.h?
ocd.c?
stuff.c?
Can you tell that ppc-bdm.c is related to ocd.c?

> 
> Also remember that it is always best to figure out what the issues with
> this change are likely to be and then discuss them publically.

None, as of yet. I've simply replaced macros with abstracted
functions, and provided the implementations of those functions for the
v2, and v3 abi.


> Can you
> walk people through exactly how you're introducing the C++ abi.

Errr, i'm not introducing a C++ abi, i'm introducing a structure so we
can remove the hardcoded dependencies on the C++ ABI's, by abstracting
what they do, and do differently, into functions that will have
different implemenation specifics, but do the same thing.

Fer instance, determining if some mangled name is a destructor.
We currently have a G++ specific macro used all over the place,
DESTRUCTOR_PREFIX_P.
This won't work for the v3 abi. 

We also have a bunch of code that does one thing if it's HP aCC, and
another if it's G++, but they both are performing the same actual
operation, just doing it in different ways because of abi specifics.

This happens all over the place. For instance, we have duplicate sets
of functions  that have large implementation differences (because the
abi's are very different) to search through virtual base classes for
HP aCC, and  G++. However, they both take the same actual parameters, and
return the same values.  We then have if blocks that say

if (hp_som_object)
{
<Whole bunch of HP specific code>
}
else
{
/* Assume it's G++ */
<Whole bunch of G++ specific code that does the same thing, with G++'s
abi>
}

all over the place (literally)


For a random example, from valops.c: 

        if (TYPE_HAS_VTABLE (type))
            {
              /* HP aCC compiled type, search for virtual base offset
               * according to HP/Taligent runtime spec.  */
              int skip;
              find_rt_vbase_offset (type, TYPE_BASECLASS (type, i),
                                    VALUE_CONTENTS_ALL (*argp),
                                    offset + VALUE_EMBEDDED_OFFSET (*argp),
                                    &base_offset, &skip);
              if (skip >= 0)
                error ("Virtual base class offset not found in vtable");
            }
          else
            {
              /* probably g++ runtime model */
              base_offset = VALUE_OFFSET (*argp) + offset;
              base_offset =
                baseclass_offset (type, i,
                                  VALUE_CONTENTS (*argp) + base_offset,
                                  VALUE_ADDRESS (*argp) + base_offset);
              if (base_offset == -1)
                error ("virtual baseclass botch");
            }

This is pretty dumb, they both do the same thing, just for different
ABI's.
This stuff is rampant.

This type of thing  will also be abstracted away, so it's just

base_offset = baseclass_offset (...)



This is necessary for the addition of the v3 G++ abi, unless you want
me to extend all the if blocks, and add more inline code into fifty
five places. And add another set of functions that do the same thing,
just have different implementations.


> 
> > This fixes some problems with the new-abi already, like not
> > being able to set breakpoints on destructors (if you try it,
> 
> This, unfortunatly, makes it sound like more than a cosmetic change :-(
> 

How so?
It wasn't able to detect destructors before, because it was looking
for the v2 abi stuff.
Now, it has the ability to detect both, without any changes to any
non C++ abi specific source. This is due to the added code in gnu-v3-abi.c.

Currently, you could view the stuff i've submitted so far as cosmetic,
if you really wanted to, but it's necessary to support both ABI's at
the same time. I also didn't want to submit too much at once, so that
nobody complained that i should break the patch down. Now it sounds
like your saying it doesn't do *enough* yet.

> As they say, sounds good in theory.


> 
> 	Andrew


  reply	other threads:[~2001-02-19 13:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-18 12:51 Daniel Berlin
2001-02-18 22:52 ` Eli Zaretskii
2001-02-19  0:02   ` Daniel Berlin
2001-02-19  3:06     ` Eli Zaretskii
2001-02-19  6:32       ` Daniel Berlin
2001-02-19  8:48 ` Elena Zannoni
2001-02-19 10:24   ` Daniel Berlin
2001-02-19 11:27 ` Andrew Cagney
2001-02-19 13:17   ` Daniel Berlin [this message]
2001-02-19 13:36     ` Andrew Cagney
2001-02-19 14:58     ` Stan Shebs
2001-02-19 15:13     ` Michael Snyder
2001-02-18 16:09 Michael Elizabeth Chastain
2001-02-18 16:51 ` Daniel Berlin
2001-02-18 16:58 Michael Elizabeth Chastain
2001-02-18 18:05 ` Daniel Berlin
     [not found] <200102192211.OAA18590@bosch.cygnus.com>
2001-02-19 14:32 ` Andrew Cagney
2001-02-19 15:01 ` Daniel Berlin
2001-02-19 15:08 Michael Elizabeth Chastain

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=x7n1bi5q61.fsf@dynamic-addr-83-177.resnet.rochester.edu \
    --to=dberlin@redhat.com \
    --cc=ac131313@cygnus.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