gdb_server: support File-I/O Remote Protocol Extension
The File I/O remote protocol extension allows the target to use the host's file system and console I/O to perform various system calls. To use the function, targets need to prepare two callback functions: * get_gdb_finish_info: to get file I/O parameters from target * gdb_fileio_end: pass file I/O response to target As target is halted, gdb_server will try to get file-I/O information from target through target_get_gdb_fileio_info(). If the callback function returns ERROR_OK, gdb_server will initiate a file-I/O request to gdb. After gdb finishes system call, gdb will pass response of the system call to target through target_gdb_fileio_end() and continue to run(continue or step). To implement the function, I add a new data structure in struct target, called struct gdb_fileio_info, to record file I/O name and parameters. Details refer to GDB manual "File-I/O Remote Protocol Extension" Change-Id: I7f4d45e7c9e967b6d898dc79ba01d86bc46315d3 Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1102 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
committed by
Spencer Oliver
parent
80d412bafc
commit
0a4c8990c2
@@ -41,6 +41,7 @@ struct watchpoint;
|
||||
struct mem_param;
|
||||
struct reg_param;
|
||||
struct target_list;
|
||||
struct gdb_fileio_info;
|
||||
|
||||
/*
|
||||
* TARGET_UNKNOWN = 0: we don't know anything about the target yet
|
||||
@@ -191,6 +192,9 @@ struct target {
|
||||
* the target attached to the gdb is changing dynamically by changing
|
||||
* gdb_service->target pointer */
|
||||
struct gdb_service *gdb_service;
|
||||
|
||||
/* file-I/O information for host to do syscall */
|
||||
struct gdb_fileio_info *fileio_info;
|
||||
};
|
||||
|
||||
struct target_list {
|
||||
@@ -198,6 +202,14 @@ struct target_list {
|
||||
struct target_list *next;
|
||||
};
|
||||
|
||||
struct gdb_fileio_info {
|
||||
char *identifier;
|
||||
uint32_t param_1;
|
||||
uint32_t param_2;
|
||||
uint32_t param_3;
|
||||
uint32_t param_4;
|
||||
};
|
||||
|
||||
/** Returns the instance-specific name of the specified target. */
|
||||
static inline const char *target_name(struct target *target)
|
||||
{
|
||||
@@ -534,6 +546,22 @@ int target_blank_check_memory(struct target *target,
|
||||
uint32_t address, uint32_t size, uint32_t *blank);
|
||||
int target_wait_state(struct target *target, enum target_state state, int ms);
|
||||
|
||||
/**
|
||||
* Obtain file-I/O information from target for GDB to do syscall.
|
||||
*
|
||||
* This routine is a wrapper for target->type->get_gdb_fileio_info.
|
||||
*/
|
||||
int target_get_gdb_fileio_info(struct target *target, struct gdb_fileio_info *fileio_info);
|
||||
|
||||
/**
|
||||
* Pass GDB file-I/O response to target after finishing host syscall.
|
||||
*
|
||||
* This routine is a wrapper for target->type->gdb_fileio_end.
|
||||
*/
|
||||
int target_gdb_fileio_end(struct target *target, int retcode, int fileio_errno, bool ctrl_c);
|
||||
|
||||
|
||||
|
||||
/** Return the *name* of this targets current state */
|
||||
const char *target_state_name(struct target *target);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user