This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Calling exit in a Redboot standalone Arm program


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
redboot/current/src/syscall.c:
===========================================================
      ...
      case SYS_exit:
   if (gdb_active) {
       __send_exit_status((int)arg1); <<<<<< new code
       breakpoint();                  <<<<<< new code
       // *sig = SIGTRAP;             <<<<<< existing code
       // err = func;                 <<<<<< existing code
   } else {
       CYGACC_CALL_IF_MONITOR_RETURN(arg1);
       // never returns
   }
   break;
      ...      
===========================================================
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 (?).

Does such a modification to the exit syscall make sense ?
Is it acceptable for any eCos (either redboot only or kernel based)
application ?

Thanks in advance for any feedback.

Pierre
-- 
________________________________________________________________________
Pierre HABRAKEN - mailto:Pierre dot Habraken at imag dot fr
Tél: 04 76 82 72 83 - Fax: 04 76 82 72 87
IMAG-LSR BP72 38402 SAINT MARTIN D'HERES Cedex
________________________________________________________________________

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]