public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* m68k exception handling
@ 2005-11-22 15:22 Kövesdi György
  2005-11-29  1:15 ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Kövesdi György @ 2005-11-22 15:22 UTC (permalink / raw)
  To: gcc

Hello!

I built an environment for my 68020 board using gcc-4.0.2 and
newlib-1.13.0. Everything seems good, but the exception handling is not
working.
If I throw anything, the program exits.
Do I need to call any initializer functions to make it work?
Can anybody explain me how the catchpoint is found?

I have a step-by-step trace list of the all procedure (from 'try...' to
the exit() call), I can send it, but it is large. At least I could not
find the way to the catchpoint in this list. :-(

Thanks in advance,
Gyorgy Kovesdi


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

* Re: m68k exception handling
  2005-11-22 15:22 m68k exception handling Kövesdi György
@ 2005-11-29  1:15 ` Jim Wilson
  2005-11-29  2:46   ` Hans-Peter Nilsson
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Wilson @ 2005-11-29  1:15 UTC (permalink / raw)
  To: Kövesdi György; +Cc: gcc

Kövesdi György wrote:
> I built an environment for my 68020 board using gcc-4.0.2 and
> newlib-1.13.0. Everything seems good, but the exception handling is not
> working.

Getting EH to work for a newlib using target board may be complicated.

How EH works depends on whether you are using DWARF2 unwind info, or 
builtin setjmp and longjmp.

The builtin setjmp and longjmp approach is easier to get working, but 
has a higher run time overhead when no exceptions are thrown.  In this 
scheme, we effectively execute a builtin setjmp everytime you enter an 
EH region, and a throw is just a builtin longjmp call.  This should work 
correctly if builtin_setjmp and builtin_longjmp are working correctly. 
See the docs for these builtin functions.

The DWARF2 unwind info method has little or no overhead until a 
exception is thrown.  This is the preferred method for most targets.  In 
this scheme, we read the DWARF2 unwind info from the executable when an 
exception is throw, parse the unwind tables, and then follow the 
directions encoded in the unwind tables until we reach a catch handler. 
  This approach has obvious problems if you are using a disk-less 
OS-less target board.  This approach also generally requires some C 
library support, which is present in glibc, but may not be present in 
newlib.  You can find info on this approach here
     http://gcc.gnu.org/ml/gcc/2004-03/msg01779.html
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com

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

* Re: m68k exception handling
  2005-11-29  1:15 ` Jim Wilson
@ 2005-11-29  2:46   ` Hans-Peter Nilsson
  0 siblings, 0 replies; 3+ messages in thread
From: Hans-Peter Nilsson @ 2005-11-29  2:46 UTC (permalink / raw)
  To: Jim Wilson; +Cc: Kövesdi György, gcc

On Mon, 28 Nov 2005, Jim Wilson wrote:
> The DWARF2 unwind info method has little or no overhead until a
> exception is thrown.  This is the preferred method for most targets.  In
> this scheme, we read the DWARF2 unwind info from the executable when an
> exception is throw, parse the unwind tables, and then follow the
> directions encoded in the unwind tables until we reach a catch handler.
>   This approach has obvious problems if you are using a disk-less
> OS-less target board.  This approach also generally requires some C
> library support, which is present in glibc, but may not be present in
> newlib.  You can find info on this approach here
>      http://gcc.gnu.org/ml/gcc/2004-03/msg01779.html

No, everything necessary support-wise is in gcc libraries, no
special stuff from newlib is needed.  Make sure to use the right
gcc-provided start-files, though: besides the usual crt0.o
(spelling varies), crti.o and crtn.o; gcc adds crtbegin.o and
crtend.o.

(You don't really read exception tables "manually"  from the
executable at exception time; it's linked in.  You don't do that
for the normal bunch of "hosted" systems either FWIW.  It may be
different for IA64.)

brgds, H-P

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

end of thread, other threads:[~2005-11-29  2:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-22 15:22 m68k exception handling Kövesdi György
2005-11-29  1:15 ` Jim Wilson
2005-11-29  2:46   ` Hans-Peter Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).