This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
gcc abi-2 status report
- From: mec dot gnu at mindspring dot com (Michael Elizabeth Chastain)
- To: gdb at sources dot redhat dot com
- Date: Fri, 2 Jan 2004 21:19:30 -0500 (EST)
- Subject: gcc abi-2 status report
This is a recap of my recent gdb.cp work.
gcc 3.4 will have a slightly different ABI from gcc 3.3. About a week
ago, gcc HEAD threw the switch from "ABI 1" to "ABI 2".
I don't know all the ABI differences. There might be differences that
affect gdb, especially in the advanced parts of C++ that we do not test
very much. It might be useful for someone to look in the gcc source.
Grep for 'flag_abi_version' and 'abi_version_at_least'.
One specific difference shows up in 'ptype' output.
Consider this class:
class Foo { public: int i; int method(); };
Here is the output of "ptype Foo" with four different configurations.
(Not shown: gcc 2.95.3, which is similar to gcc 3.3.2 in this regard).
# gcc 3.3.2 -gdwarf-2
# gcc HEAD -gdwarf-2
type = class Foo {
public:
int i;
int method();
}
# gcc 3.3.2 -gstabs+
type = class Foo {
public:
int i;
Foo & operator=(Foo const&);
void Foo(Foo const&);
void Foo();
int method();
}
# gcc HEAD -gstabs+
(gdb) ptype Foo
type = class Foo {
public:
int i;
int method();
Foo & operator=(Foo const&);
void Foo(Foo const&);
void Foo();
}
gcc synthesizes some methods: an assignment operator, a copy-ctor,
and a ctor. With ABI 1, the synthesized methods appear before the
user-specified methods. With ABI 2, the synthesized methods appear
after the user-specified methods.
If the synthesized methods include a virtual destructor (which this
class does not have), then the vtable will be laid down differently
between ABI 1 and ABI 2.
My concern is the output of 'ptype'. With dwarf-2, the synthesized
methods do not appear at all, so there is no problem. With stabs+,
the synthesized methods appear in different places, so the test suite
has to accommodate both orders.
Eight test scripts in gdb.cp/*.exp were affected:
classes.exp derivation.exp overload.exp virtfunc.exp
local.exp method.exp namespace.exp templates.exp
All of these files are full of clutter anyways. So I tried to:
(A) clean up the clutter
(B) fix a bunch of idiosyncracies
(C) fix the ABI 2 problem
Unfortunately, I mixed (ABC) together. This caused two problems: first
I broke Mark K's test bed because I use a different version of
TCL+Expect+Dejagnu than he does. Second, Daniel J chastised me for
mixing substantive changes in with rewrites. He was right.
So the current state is:
( A) (!B) (!C) classes.exp derivation.exp overload.exp virtfunc.exp
(!A) (!B) ( C) local.exp method.exp namespace.exp templates.exp
That is, the first group of files has been rewritten, but the results
are identical to the original version. The second group of files has
had some ABI-2 patterns sprinkled into them.
After one week passes, I'll come back to the first group of files and
make them work with ABI-2. And then all the tests will work with
ABI-1 or ABI-2.
Are there any actual bugs with ABI-2? I don't know yet. There were about
fifty of these ptype FAILs. After those are no longer in my face, I can
see if there are any other differences which indicate actual bugs.
Michael C