This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Question eCOS debugging. Thanks a lot.
- From: Jonathan Larmour <jifl at eCosCentric dot com>
- To: QiangHuang <jameshq at liverpool dot ac dot uk>
- Cc: 'Ecos-Discuss' <ecos-discuss at sources dot redhat dot com>
- Date: Fri, 01 Aug 2003 01:21:19 +0100
- Subject: Re: [ECOS] Question eCOS debugging. Thanks a lot.
- References: <ONEOIJPPOKNBBKJKCGLCMECDCCAA.jameshq@liv.ac.uk>
QiangHuang wrote:
Hi all:
I am trying to get a clear calling path of RedBoot with the hal stub
and GDB debugger. I can't understand the following, could anybody please
give me some idea? Thanks a lot.
In HAL/ARM function "hal_syscall_handler()" getting the saved ARM register
by calling:
hal_syscall_handler is called when a trap is made. This is intended to be
used by newlib based apps.
Step 1. func = get_register(R0); arg1 = get_register(R1); arg2 =
get_register(R2); arg3 = get_register(R3);
Step 2. and later call into RedBoot by function "__do_syscall(func, arg1,
arg2, arg3, arg4, &err, &sig)",
Step 3. in turns call into gdb_fileio function: "cyg_hal_gdbfileio_xxx()",
take write for example: cyg_hal_gdbfileio_write((int)arg1, (const void
*)arg2, (size_t)arg3, (int *)sig);
Here arg2 will be treated as a buffer pointer, but Isn't "arg2" = "saved ARM
register R2"? so where is this pointer pointing to?
Yes, R2 when the syscall was invoked. See newlib's
libgloss/arm/redboot-syscalls.c, e.g.
int
_write(int fd, const char *buf, int nbytes)
{
int err;
err = __syscall(SYS_write, fd, buf, nbytes);
if (err<0)
{
errno = -err;
return -1;
}
return err;
}
I would like to know how the processor registers are retrieved (by the HAL
Stub and RedBoot) and display on the GDB debugger(Insight)? Thanks a lot.
Loosely, processor context is saved in vectors.S. Exception handler VSR
chains to hal_misc.c's "exception_handler()" which calls into the GDB stub
with _handle_exception after setting the global _hal_registers to the
saved state. Later on the GDB stub then uses HAL_GET_GDB_REGISTERS from
the arch HAL's include/hal_arch.h to convert the saved register state into
the state GDB needs.
Jifl
--
eCosCentric http://www.eCosCentric.com/ The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss