[ECOS] Calling exit in a Redboot standalone Arm program

Mark Salter msalter@redhat.com
Tue Apr 22 15:27:00 GMT 2003

>>>>> Pierre Habraken writes:

> Hello,
> I have a question about the way the exit() libc function is dealt with:

> With Angel, the native on board debug monitor shipped with the E7T, when
> a program calls exit(0) then the control is smoothly given back to gdb:
> ===========================================================
> (gdb) continue
> ...
> Program exited normally.
> (gdb)
> ===========================================================

> With the current version of RedBoot, control is given back to gdb by
> raising a SIGTRAP signal:
> ===========================================================
> (gdb) continue
> ...
> Program received signal SIGTRAP, Trace/breakpoint trap.
> 0x000101bc in _exit (stat=8)
>     at ../../../../../newlib-1.11.0/libgloss/arm/redboot-syscalls.c:54
> 54              __syscall(SYS_exit, stat);
> (gdb)
> ===========================================================

> These boards together with RedBoot are (will be) used by undergraduate
> unexperimented students. The above message displayed by gdb at the end
> of program execution is of no use for them and may confuse most of them.
> So, I'd like to get gdb+redboot have the same external behavior as
> gdb+angel, as far as possible.
> I did some investigations and tests that let me think that this goal
> could be achieved by applying the modification below to

The trap in exit was a conscious decision. Any patch to change this
behavior will need to be configurable.

> I assume (but am not sure) that eCos programs should not be concerned by
> such a change since the eCos implementation of exit() does not trigger a
> RedBoot syscall (?).

Right. Only newlib/libgloss based apps use those syscalls.

> Does such a modification to the exit syscall make sense ?

It makes sense, but reasonable arguments can be made for the current
behavior as well.

> Is it acceptable for any eCos (either redboot only or kernel based)
> application ?

Something to watch out for is that any patch not break the ability to
quit GDB and return to the RedBoot prompt. Also, I think changing the
current behavior will cause a problem with running the GDB testsuites
on RedBoot enabled boards.


Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

More information about the Ecos-discuss mailing list