Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [Problem] gnu-v3 abi loaded wronly.
@ 2002-09-18  3:06 Pierre Muller
  2002-09-18  6:17 ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Pierre Muller @ 2002-09-18  3:06 UTC (permalink / raw)
  To: gdb-patches



   The code for loading gnu-v3-abi is symply to
look if there is a minimal symbol starting with 
  _Z
underscore followed by a capital Z:

Why is this test so imprecise?
To what symbol generated by GCC
v3 does it correspond?
Why is it not a full name test?

Currently this creates a problem for me when
I mix GCC 2.95.X code with Free Pascal generated
code on linux, because Free Pascal defines
a minimal symbol _ZONE_NAMES
that is recognized as a GCC v3 marker...

if you create a c code with a static variable 
called _Zzzz
you will probably get the same error...

I consider this to be a bug in GDB, but 
I would like to get the arguments of the 
interested people.





Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07  Fax : (33)-3-88-41-40-99


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Problem] gnu-v3 abi loaded wronly.
  2002-09-18  3:06 [Problem] gnu-v3 abi loaded wronly Pierre Muller
@ 2002-09-18  6:17 ` Daniel Jacobowitz
  2002-09-18  6:41   ` Pierre Muller
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2002-09-18  6:17 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

On Wed, Sep 18, 2002 at 12:00:22PM +0200, Pierre Muller wrote:
> 
> 
>    The code for loading gnu-v3-abi is symply to
> look if there is a minimal symbol starting with 
>   _Z
> underscore followed by a capital Z:
> 
> Why is this test so imprecise?
> To what symbol generated by GCC
> v3 does it correspond?
> Why is it not a full name test?
> 
> Currently this creates a problem for me when
> I mix GCC 2.95.X code with Free Pascal generated
> code on linux, because Free Pascal defines
> a minimal symbol _ZONE_NAMES
> that is recognized as a GCC v3 marker...
> 
> if you create a c code with a static variable 
> called _Zzzz
> you will probably get the same error...
> 
> I consider this to be a bug in GDB, but 
> I would like to get the arguments of the 
> interested people.

Every mangled name in v3 starts with _Z.  We've always held that if you
use names in the reserved namespace for your own functions, you get
what you deserve - but we hadn't thought any other compilers used this
namespace...

We could require that the first _Z symbol be a valid mangled C++ name.
That would sometimes break the test in the other direction if you had
v3 code linked with Free Pascal code.  Does Free Pascal define a large
number of symbols starting with _Z, or just the one?  If it's just the
one we can fix this by checking all _Z symbols until we find one that
is v3 mangled.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Problem] gnu-v3 abi loaded wronly.
  2002-09-18  6:17 ` Daniel Jacobowitz
@ 2002-09-18  6:41   ` Pierre Muller
  2002-09-18  7:51     ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Pierre Muller @ 2002-09-18  6:41 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

At 15:17 18/09/2002 , Daniel Jacobowitz a écrit:
>On Wed, Sep 18, 2002 at 12:00:22PM +0200, Pierre Muller wrote:
> > 
> > 
> >    The code for loading gnu-v3-abi is symply to
> > look if there is a minimal symbol starting with 
> >   _Z
> > underscore followed by a capital Z:
> > 
> > Why is this test so imprecise?
> > To what symbol generated by GCC
> > v3 does it correspond?
> > Why is it not a full name test?
> > 
> > Currently this creates a problem for me when
> > I mix GCC 2.95.X code with Free Pascal generated
> > code on linux, because Free Pascal defines
> > a minimal symbol _ZONE_NAMES
> > that is recognized as a GCC v3 marker...
> > 
> > if you create a c code with a static variable 
> > called _Zzzz
> > you will probably get the same error...
> > 
> > I consider this to be a bug in GDB, but 
> > I would like to get the arguments of the 
> > interested people.
>
>Every mangled name in v3 starts with _Z.  We've always held that if you
>use names in the reserved namespace for your own functions, you get
>what you deserve - but we hadn't thought any other compilers used this
>namespace...
>
>We could require that the first _Z symbol be a valid mangled C++ name.
>That would sometimes break the test in the other direction if you had
>v3 code linked with Free Pascal code.  Does Free Pascal define a large
>number of symbols starting with _Z, or just the one?  If it's just the

No, its just a static variable that starts with Z 
so there can be others around...
(Free Pascal adds a leading underscore to all
static variables, regardless of what GCC does...)

>one we can fix this by checking all _Z symbols until we find one that
>is v3 mangled.

I started to write a Free Pascal version of xx-abi.c
because there are other object/class related problems 
with Free Pascal.

The other solution would be to check for "fpc_compiled"
and then declare that its an Free Pascal  compiled object,
but that would not solve the problem of my
IDE that has both Free Pascal code and
GCC code of  libgdb...
because in that case it would mean that we need to decide 
which abi to use depending on the source file type,
would that be possible?



Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07  Fax : (33)-3-88-41-40-99


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Problem] gnu-v3 abi loaded wronly.
  2002-09-18  6:41   ` Pierre Muller
@ 2002-09-18  7:51     ` Daniel Jacobowitz
  2002-09-18  7:58       ` Pierre Muller
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2002-09-18  7:51 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

On Wed, Sep 18, 2002 at 03:35:41PM +0200, Pierre Muller wrote:
> At 15:17 18/09/2002 , Daniel Jacobowitz a écrit:
> >On Wed, Sep 18, 2002 at 12:00:22PM +0200, Pierre Muller wrote:
> > > 
> > > 
> > >    The code for loading gnu-v3-abi is symply to
> > > look if there is a minimal symbol starting with 
> > >   _Z
> > > underscore followed by a capital Z:
> > > 
> > > Why is this test so imprecise?
> > > To what symbol generated by GCC
> > > v3 does it correspond?
> > > Why is it not a full name test?
> > > 
> > > Currently this creates a problem for me when
> > > I mix GCC 2.95.X code with Free Pascal generated
> > > code on linux, because Free Pascal defines
> > > a minimal symbol _ZONE_NAMES
> > > that is recognized as a GCC v3 marker...
> > > 
> > > if you create a c code with a static variable 
> > > called _Zzzz
> > > you will probably get the same error...
> > > 
> > > I consider this to be a bug in GDB, but 
> > > I would like to get the arguments of the 
> > > interested people.
> >
> >Every mangled name in v3 starts with _Z.  We've always held that if you
> >use names in the reserved namespace for your own functions, you get
> >what you deserve - but we hadn't thought any other compilers used this
> >namespace...
> >
> >We could require that the first _Z symbol be a valid mangled C++ name.
> >That would sometimes break the test in the other direction if you had
> >v3 code linked with Free Pascal code.  Does Free Pascal define a large
> >number of symbols starting with _Z, or just the one?  If it's just the
> 
> No, its just a static variable that starts with Z 
> so there can be others around...
> (Free Pascal adds a leading underscore to all
> static variables, regardless of what GCC does...)

Blech.

> >one we can fix this by checking all _Z symbols until we find one that
> >is v3 mangled.
> 
> I started to write a Free Pascal version of xx-abi.c
> because there are other object/class related problems 
> with Free Pascal.
> 
> The other solution would be to check for "fpc_compiled"
> and then declare that its an Free Pascal  compiled object,
> but that would not solve the problem of my
> IDE that has both Free Pascal code and
> GCC code of  libgdb...
> because in that case it would mean that we need to decide 
> which abi to use depending on the source file type,
> would that be possible?

GDB is definitely not set up to do this.  If you mix code that requires
particular ABI support, you'll just confuse it hopelessly.  For
instance, we can determine the ABI without debug information (though we
don't use it for much in that case) - which ABI do you pick if two are
marked?

For C++ this is generally OK.  No one except Apple is crazy enough to
try to mix-n-match.  If Free Pascal code is commonly linked with C++
code, then we need to think about this further.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Problem] gnu-v3 abi loaded wronly.
  2002-09-18  7:51     ` Daniel Jacobowitz
@ 2002-09-18  7:58       ` Pierre Muller
  2002-09-18  8:28         ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Pierre Muller @ 2002-09-18  7:58 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

At 16:51 18/09/2002 , Daniel Jacobowitz a écrit:
>On Wed, Sep 18, 2002 at 03:35:41PM +0200, Pierre Muller wrote:
> > At 15:17 18/09/2002 , Daniel Jacobowitz a écrit:
> > >On Wed, Sep 18, 2002 at 12:00:22PM +0200, Pierre Muller wrote:
> > > > 
> > > > 
> > > >    The code for loading gnu-v3-abi is symply to
> > > > look if there is a minimal symbol starting with 
> > > >   _Z
> > > > underscore followed by a capital Z:
> > > > 
> > > > Why is this test so imprecise?
> > > > To what symbol generated by GCC
> > > > v3 does it correspond?
> > > > Why is it not a full name test?
> > > > 
> > > > Currently this creates a problem for me when
> > > > I mix GCC 2.95.X code with Free Pascal generated
> > > > code on linux, because Free Pascal defines
> > > > a minimal symbol _ZONE_NAMES
> > > > that is recognized as a GCC v3 marker...
> > > > 
> > > > if you create a c code with a static variable 
> > > > called _Zzzz
> > > > you will probably get the same error...
> > > > 
> > > > I consider this to be a bug in GDB, but 
> > > > I would like to get the arguments of the 
> > > > interested people.
> > >
> > >Every mangled name in v3 starts with _Z.  We've always held that if you
> > >use names in the reserved namespace for your own functions, you get
> > >what you deserve - but we hadn't thought any other compilers used this
> > >namespace...
> > >
> > >We could require that the first _Z symbol be a valid mangled C++ name.
> > >That would sometimes break the test in the other direction if you had
> > >v3 code linked with Free Pascal code.  Does Free Pascal define a large
> > >number of symbols starting with _Z, or just the one?  If it's just the
> > 
> > No, its just a static variable that starts with Z 
> > so there can be others around...
> > (Free Pascal adds a leading underscore to all
> > static variables, regardless of what GCC does...)
>
>Blech.
>
> > >one we can fix this by checking all _Z symbols until we find one that
> > >is v3 mangled.
> > 
> > I started to write a Free Pascal version of xx-abi.c
> > because there are other object/class related problems 
> > with Free Pascal.
> > 
> > The other solution would be to check for "fpc_compiled"
> > and then declare that its an Free Pascal  compiled object,
> > but that would not solve the problem of my
> > IDE that has both Free Pascal code and
> > GCC code of  libgdb...
> > because in that case it would mean that we need to decide 
> > which abi to use depending on the source file type,
> > would that be possible?
>
>GDB is definitely not set up to do this.  If you mix code that requires
>particular ABI support, you'll just confuse it hopelessly.  For
>instance, we can determine the ABI without debug information (though we
>don't use it for much in that case) - which ABI do you pick if two are
>marked?
>
>For C++ this is generally OK.  No one except Apple is crazy enough to
>try to mix-n-match.  If Free Pascal code is commonly linked with C++
>code, then we need to think about this further.

I have no C++ code in my problem...
Libgdb is only C code, but the problem arises nevertheless...




Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07  Fax : (33)-3-88-41-40-99


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Problem] gnu-v3 abi loaded wronly.
  2002-09-18  7:58       ` Pierre Muller
@ 2002-09-18  8:28         ` Daniel Jacobowitz
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2002-09-18  8:28 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

On Wed, Sep 18, 2002 at 04:52:54PM +0200, Pierre Muller wrote:
> At 16:51 18/09/2002 , Daniel Jacobowitz a écrit:
> >On Wed, Sep 18, 2002 at 03:35:41PM +0200, Pierre Muller wrote:
> > > At 15:17 18/09/2002 , Daniel Jacobowitz a écrit:
> > > >On Wed, Sep 18, 2002 at 12:00:22PM +0200, Pierre Muller wrote:
> > > > > 
> > > > > 
> > > > >    The code for loading gnu-v3-abi is symply to
> > > > > look if there is a minimal symbol starting with 
> > > > >   _Z
> > > > > underscore followed by a capital Z:
> > > > > 
> > > > > Why is this test so imprecise?
> > > > > To what symbol generated by GCC
> > > > > v3 does it correspond?
> > > > > Why is it not a full name test?
> > > > > 
> > > > > Currently this creates a problem for me when
> > > > > I mix GCC 2.95.X code with Free Pascal generated
> > > > > code on linux, because Free Pascal defines
> > > > > a minimal symbol _ZONE_NAMES
> > > > > that is recognized as a GCC v3 marker...
> > > > > 
> > > > > if you create a c code with a static variable 
> > > > > called _Zzzz
> > > > > you will probably get the same error...
> > > > > 
> > > > > I consider this to be a bug in GDB, but 
> > > > > I would like to get the arguments of the 
> > > > > interested people.
> > > >
> > > >Every mangled name in v3 starts with _Z.  We've always held that if you
> > > >use names in the reserved namespace for your own functions, you get
> > > >what you deserve - but we hadn't thought any other compilers used this
> > > >namespace...
> > > >
> > > >We could require that the first _Z symbol be a valid mangled C++ name.
> > > >That would sometimes break the test in the other direction if you had
> > > >v3 code linked with Free Pascal code.  Does Free Pascal define a large
> > > >number of symbols starting with _Z, or just the one?  If it's just the
> > > 
> > > No, its just a static variable that starts with Z 
> > > so there can be others around...
> > > (Free Pascal adds a leading underscore to all
> > > static variables, regardless of what GCC does...)
> >
> >Blech.
> >
> > > >one we can fix this by checking all _Z symbols until we find one that
> > > >is v3 mangled.
> > > 
> > > I started to write a Free Pascal version of xx-abi.c
> > > because there are other object/class related problems 
> > > with Free Pascal.
> > > 
> > > The other solution would be to check for "fpc_compiled"
> > > and then declare that its an Free Pascal  compiled object,
> > > but that would not solve the problem of my
> > > IDE that has both Free Pascal code and
> > > GCC code of  libgdb...
> > > because in that case it would mean that we need to decide 
> > > which abi to use depending on the source file type,
> > > would that be possible?
> >
> >GDB is definitely not set up to do this.  If you mix code that requires
> >particular ABI support, you'll just confuse it hopelessly.  For
> >instance, we can determine the ABI without debug information (though we
> >don't use it for much in that case) - which ABI do you pick if two are
> >marked?
> >
> >For C++ this is generally OK.  No one except Apple is crazy enough to
> >try to mix-n-match.  If Free Pascal code is commonly linked with C++
> >code, then we need to think about this further.
> 
> I have no C++ code in my problem...
> Libgdb is only C code, but the problem arises nevertheless...

Then there should be no problem with setting a new free-pascal ABI. 
The ABI only specifies things C++ (and now Pascal) specific; C code
doesn't use it at all.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-09-18 15:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-18  3:06 [Problem] gnu-v3 abi loaded wronly Pierre Muller
2002-09-18  6:17 ` Daniel Jacobowitz
2002-09-18  6:41   ` Pierre Muller
2002-09-18  7:51     ` Daniel Jacobowitz
2002-09-18  7:58       ` Pierre Muller
2002-09-18  8:28         ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox