Hi,

The attached patch adds support for the GDB File I/O Remote Protocol as well
as allowing a target to return various signal numbers, as I mentioned last
week. 

This patch doesn't actually add support for these features to any of the
existing targets (ARM/MIPS), but just provides the hooks to do so. If a
target doesn't require these features, no modifications should be needed to
be made to that target. I have tested it with a target that is not currently
in SVN.

To add support for signals, a targets examine_debug_reason function needs to
be updated to detect the signal in the target and then set
target->debug_reason to DBG_REASON_SIGNAL, with the GDB signal number set in
target->signal. It may be necessary for a target to map the signal number
used on the target to one of the signal numbers used by GDB, which can be
found in src/target/gdb_signals.h.

To add support for the File I/O remote protocol, a targets
examine_debug_reason function needs to be updated to detect a system call in
the target and then set target->debug_reason to DBG_REASON_SYSCALL. The
system call number should be saved in target->syscall and the parameters in
target->syscall_params[]. Again, a target may need to map the targets system
call numbers, flags and data structures to those used by GDB, which can be
found in src/target/gdb_syscall.h. A new target function will also need to
be added, syscall_resume, which resumes execution after a system call has
been handled by GDB. The function has parameters for the return code and an
errno (if the return code indicates failure), which the function will need
to set in the targets registers or memory (depending upon the ABI) and then
resume execution after the system call instruction.

ChangeLog:

src/server/gdb_server.c (gdb_last_signal): Add signal and syscall debug
reasons. 
src/server/gdb_server.c (gdb_get_string_len): New function - calculate
length of null terminated string.
src/server/gdb_server.c (gdb_frontend_halted): Add F stop reply packet.
src/server/gdb_server.c (gdb_F_packet): New function - handle F packets.
src/server/gdb_server.c (gdb_log_callback): Add support for F packets.
src/target/target.c (nvp_target_debug_reason): Add signal and syscall debug
reasons.
src/target/target.c (target_syscall_resume): New function - call
syscall_resume in the target.
src/target/gdb_syscall.h: New file - defines and types used by GDB File I/O
remote protocol.
src/target/target.h (target_debug_reason): Add signal and syscall debug
reasons.
src/target/target.h (target_s): Add signal and syscall parameters.
src/target/target_type.h (target_type_s): Add syscall_resume function.
src/target/gdb_signals.h: New file - defines signal numbers used by GDB.

Cheers,
Jon


Attachment: syscall.patch
Description: Binary data

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to