[CLN-list] Options for FP errors in CLN?

Bruno Haible bruno at clisp.org
Fri Jul 29 13:31:37 CEST 2005


John Pye wrote:
> I can't use the suggested method from the manual either,
>
> > The library does type checks, range checks, consistency checks at many
> > places. When one of these fails, the function |cl_abort()| is called.
> > Its default implementation is to perform an |exit(1)|, so you won't
> > have a core dump. But for debugging, it is best to set a breakpoint at
> > this function:
> >
> >
> >(gdb) break cl_abort
> >
> >
> > When this breakpoint is hit, look at the stack's backtrace:
> >
> >
> >(gdb) where
>
> because my pre-compiled CLN doesn't seem to have debug symbols:
> > [john at jdpipe nla-ginac]$ gdb pipesystem
> > GNU gdb Red Hat Linux (6.1post-1.20040607.43rh)
>
> ...
>
> > This GDB was configured as "i386-redhat-linux-gnu"...Using host
> > libthread_db library "/lib/tls/libthread_db.so.1".
> >
> > (gdb) break cl_abort
> > Function "cl_abort" not defined.
> > Make breakpoint pending on future shared library load? (y or [n]) y
> > Breakpoint 1 (cl_abort) pending.
> > (gdb) run
> > Starting program: /home/john/nla-ginac/pipesystem
> > Reading symbols from shared object read from target memory...done.
> > Loaded system supplied DSO at 0xb7f9f000

The following often works better than the method you tried:

(gdb) break main
(gdb) run
Breakpoint main reached
(gdb) break cl_abort
(gdb) continue
Breakpoint cl_abort reached

Or, if that doesn't work, try the same with 'exit' instead of 'cl_abort'.
If that works but
   (gdb) break cl_abort
then try this:

   (gdb) set language c++
   (gdb) break cl_abort

> So, I'd like to suggest replacing cl_abort with either a SIGFPE or a
> standard exception of some sort.

We chose not to make a SIGFPE or SIGABRT out of it, since it usually
creates a core dump, whose size is often > 10 MB.

We also chose not to make it an exception, so that cln could be compiled
with -fno-exceptions (useful when g++ creates horrible code otherwise).

Bruno





More information about the CLN-list mailing list