comp.lang.ada
 help / color / mirror / Atom feed
* not catching exceptions
@ 2010-10-19 23:40 mark
  2010-10-20  8:11 ` Ludovic Brenta
  0 siblings, 1 reply; 3+ messages in thread
From: mark @ 2010-10-19 23:40 UTC (permalink / raw)


Hi:

I'm targeting some Ada95 at three different systems.  One is a host 
system running Linux, Intel based.  Exceptions are caught just fine. 
Another is a bare board with a PowerPC running Linux.  Exceptions are 
also trapped fine.  The third is a system running Linux but instead of 
using glibc it uses uclibc.  Exceptions are not caught.  All I get is an 
abort message (abort).  The configure information for this one is below-

   $ ./powerpc-mpc8248-linux-uclibc-gcc -v
   Using built-in specs.
   Target: powerpc-mpc8248-linux-uclibc
   Configured with: ../../configure --prefix=/opt/atc/cpp_userchain
   /ppc8248-linux-toolchain --target=powerpc-mpc8248-linux-uclibc
   --with-cpu=603 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu
   --with-sysroot=/opt/atc/cpp_userchain/ppc8248-linux-toolchain/sysroot
   --enable-shared --enable-threads=gnat --disable-tls
   --disable__cxa_atexit --enable-languages=c,ada
    Thread model: gnat
    gcc version 4.1.2

I've tried this with both --enable-threads (POSIX model) and 
enable-threads=gnat.  I've tried with --enable__cxa_atexit and 
--disable__cxa_atexit.  I can't seem to catch exceptions.

A simple test program where I just raise and catch an exception gives 
the same result...abort.  Outside of not being able to catch exceptions, 
everything else works great (tasking, protected types, etc).

Any thoughts on why exceptions are not being trapped on the  would be 
appreciated.

Thanks.



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

* Re: not catching exceptions
  2010-10-19 23:40 not catching exceptions mark
@ 2010-10-20  8:11 ` Ludovic Brenta
  2010-10-21  1:25   ` mark
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Brenta @ 2010-10-20  8:11 UTC (permalink / raw)


mark wrote on comp.lang.ada:
> I'm targeting some Ada95 at three different systems.  One is a host
> system running Linux, Intel based.  Exceptions are caught just fine.
> Another is a bare board with a PowerPC running Linux.  Exceptions are
> also trapped fine.  The third is a system running Linux but instead of
> using glibc it uses uclibc.  Exceptions are not caught.  All I get is an
> abort message (abort).  The configure information for this one is below-
>
>    $ ./powerpc-mpc8248-linux-uclibc-gcc -v
>    Using built-in specs.
>    Target: powerpc-mpc8248-linux-uclibc
>    Configured with: ../../configure --prefix=/opt/atc/cpp_userchain
>    /ppc8248-linux-toolchain --target=powerpc-mpc8248-linux-uclibc
>    --with-cpu=603 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu
>    --with-sysroot=/opt/atc/cpp_userchain/ppc8248-linux-toolchain/sysroot
>    --enable-shared --enable-threads=gnat --disable-tls
>    --disable__cxa_atexit --enable-languages=c,ada
>     Thread model: gnat
>     gcc version 4.1.2
>
> I've tried this with both --enable-threads (POSIX model) and
> enable-threads=gnat.  I've tried with --enable__cxa_atexit and
> --disable__cxa_atexit.  I can't seem to catch exceptions.
>
> A simple test program where I just raise and catch an exception gives
> the same result...abort.  Outside of not being able to catch exceptions,
> everything else works great (tasking, protected types, etc).
>
> Any thoughts on why exceptions are not being trapped on the  would be
> appreciated.
>
> Thanks.

I found this which may help:

http://gcc.gnu.org/ml/gcc/2007-07/msg00290.html

IIUC, you can enable exceptions on uClibc either by configuring the
cross-compiler to use the setjump/longjump (SJLJ) mechanism or by
patching uClibc to support zero-cost exceptions (ZCX).  It is possible
that a newer version of uClibc is available that handles ZCX, possibly
with some configuration.

If you have more trouble, I suggest you ask on the GCC mailing list as
your question is quite technical and not specific to Ada (exceptions
are handled by the GCC back-end which is common to all languages).

--
Ludovic Brenta.



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

* Re: not catching exceptions
  2010-10-20  8:11 ` Ludovic Brenta
@ 2010-10-21  1:25   ` mark
  0 siblings, 0 replies; 3+ messages in thread
From: mark @ 2010-10-21  1:25 UTC (permalink / raw)


Thanks for the reply.  I did not realize this is a gcc overall question. 
  I'll post there.  Before I do, I'll create a C++ program to make sure 
I get the same result.

I looked at the link you gave and tried rebuilding the cross compiler 
with -enable-sjlj-exceptions.  Unfortunately, on the target (uclibc) I get

# ./testit
./testit: can't resolve symbol '_Unwind_SjLj_Register' in lib './testit.

I have to leave the target environment alone.  My application is not the 
only one that runs in it (although it is the only Ada one).  So, I can't 
really modify uclibc.


On 10/20/2010 04:11 AM, Ludovic Brenta wrote:
> mark wrote on comp.lang.ada:
>> I'm targeting some Ada95 at three different systems.  One is a host
>> system running Linux, Intel based.  Exceptions are caught just fine.
>> Another is a bare board with a PowerPC running Linux.  Exceptions are
>> also trapped fine.  The third is a system running Linux but instead of
>> using glibc it uses uclibc.  Exceptions are not caught.  All I get is an
>> abort message (abort).  The configure information for this one is below-
>>
>>     $ ./powerpc-mpc8248-linux-uclibc-gcc -v
>>     Using built-in specs.
>>     Target: powerpc-mpc8248-linux-uclibc
>>     Configured with: ../../configure --prefix=/opt/atc/cpp_userchain
>>     /ppc8248-linux-toolchain --target=powerpc-mpc8248-linux-uclibc
>>     --with-cpu=603 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu
>>     --with-sysroot=/opt/atc/cpp_userchain/ppc8248-linux-toolchain/sysroot
>>     --enable-shared --enable-threads=gnat --disable-tls
>>     --disable__cxa_atexit --enable-languages=c,ada
>>      Thread model: gnat
>>      gcc version 4.1.2
>>
>> I've tried this with both --enable-threads (POSIX model) and
>> enable-threads=gnat.  I've tried with --enable__cxa_atexit and
>> --disable__cxa_atexit.  I can't seem to catch exceptions.
>>
>> A simple test program where I just raise and catch an exception gives
>> the same result...abort.  Outside of not being able to catch exceptions,
>> everything else works great (tasking, protected types, etc).
>>
>> Any thoughts on why exceptions are not being trapped on the  would be
>> appreciated.
>>
>> Thanks.
>
> I found this which may help:
>
> http://gcc.gnu.org/ml/gcc/2007-07/msg00290.html
>
> IIUC, you can enable exceptions on uClibc either by configuring the
> cross-compiler to use the setjump/longjump (SJLJ) mechanism or by
> patching uClibc to support zero-cost exceptions (ZCX).  It is possible
> that a newer version of uClibc is available that handles ZCX, possibly
> with some configuration.
>
> If you have more trouble, I suggest you ask on the GCC mailing list as
> your question is quite technical and not specific to Ada (exceptions
> are handled by the GCC back-end which is common to all languages).
>
> --
> Ludovic Brenta.




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

end of thread, other threads:[~2010-10-21  1:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-19 23:40 not catching exceptions mark
2010-10-20  8:11 ` Ludovic Brenta
2010-10-21  1:25   ` mark

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