Commit df4cf061 authored by zwelch's avatar zwelch
Browse files

Add target_get_gdb_reg_list wrapper:

- replaces all calls to target->type->get_gdb_reg_list.
- add documentation in target_s to warn not to invoke callback directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1964 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent 11edf227
...@@ -947,7 +947,7 @@ int gdb_get_registers_packet(connection_t *connection, target_t *target, char* p ...@@ -947,7 +947,7 @@ int gdb_get_registers_packet(connection_t *connection, target_t *target, char* p
LOG_DEBUG("-"); LOG_DEBUG("-");
#endif #endif
if ((retval = target->type->get_gdb_reg_list(target, &reg_list, &reg_list_size)) != ERROR_OK) if ((retval = target_get_gdb_reg_list(target, &reg_list, &reg_list_size)) != ERROR_OK)
{ {
return gdb_error(connection, retval); return gdb_error(connection, retval);
} }
...@@ -1005,7 +1005,7 @@ int gdb_set_registers_packet(connection_t *connection, target_t *target, char *p ...@@ -1005,7 +1005,7 @@ int gdb_set_registers_packet(connection_t *connection, target_t *target, char *p
return ERROR_SERVER_REMOTE_CLOSED; return ERROR_SERVER_REMOTE_CLOSED;
} }
if ((retval = target->type->get_gdb_reg_list(target, &reg_list, &reg_list_size)) != ERROR_OK) if ((retval = target_get_gdb_reg_list(target, &reg_list, &reg_list_size)) != ERROR_OK)
{ {
return gdb_error(connection, retval); return gdb_error(connection, retval);
} }
...@@ -1057,7 +1057,7 @@ int gdb_get_register_packet(connection_t *connection, target_t *target, char *pa ...@@ -1057,7 +1057,7 @@ int gdb_get_register_packet(connection_t *connection, target_t *target, char *pa
LOG_DEBUG("-"); LOG_DEBUG("-");
#endif #endif
if ((retval = target->type->get_gdb_reg_list(target, &reg_list, &reg_list_size)) != ERROR_OK) if ((retval = target_get_gdb_reg_list(target, &reg_list, &reg_list_size)) != ERROR_OK)
{ {
return gdb_error(connection, retval); return gdb_error(connection, retval);
} }
...@@ -1092,7 +1092,7 @@ int gdb_set_register_packet(connection_t *connection, target_t *target, char *pa ...@@ -1092,7 +1092,7 @@ int gdb_set_register_packet(connection_t *connection, target_t *target, char *pa
LOG_DEBUG("-"); LOG_DEBUG("-");
if ((retval = target->type->get_gdb_reg_list(target, &reg_list, &reg_list_size)) != ERROR_OK) if ((retval = target_get_gdb_reg_list(target, &reg_list, &reg_list_size)) != ERROR_OK)
{ {
return gdb_error(connection, retval); return gdb_error(connection, retval);
} }
......
...@@ -543,6 +543,12 @@ int target_bulk_write_memory(struct target_s *target, ...@@ -543,6 +543,12 @@ int target_bulk_write_memory(struct target_s *target,
} }
int target_get_gdb_reg_list(struct target_s *target,
struct reg_s **reg_list[], int *reg_list_size)
{
return target->type->get_gdb_reg_list(target, reg_list, reg_list_size);
}
int target_run_algorithm(struct target_s *target, int target_run_algorithm(struct target_s *target,
int num_mem_params, mem_param_t *mem_params, int num_mem_params, mem_param_t *mem_params,
int num_reg_params, reg_param_t *reg_param, int num_reg_params, reg_param_t *reg_param,
......
...@@ -151,7 +151,9 @@ typedef struct target_type_s ...@@ -151,7 +151,9 @@ typedef struct target_type_s
int (*soft_reset_halt_imp)(struct target_s *target); int (*soft_reset_halt_imp)(struct target_s *target);
int (*soft_reset_halt)(struct target_s *target); int (*soft_reset_halt)(struct target_s *target);
/* target register access for gdb. /**
* Target register access for GDB. Do @b not call this function
* directly, use target_get_gdb_reg_list() instead.
* *
* Danger! this function will succeed even if the target is running * Danger! this function will succeed even if the target is running
* and return a register list with dummy values. * and return a register list with dummy values.
...@@ -400,6 +402,14 @@ extern void target_set_examined(struct target_s *target); ...@@ -400,6 +402,14 @@ extern void target_set_examined(struct target_s *target);
/// Reset the @c examined flag for the given target. /// Reset the @c examined flag for the given target.
extern void target_reset_examined(struct target_s *target); extern void target_reset_examined(struct target_s *target);
/**
* Obtain the registers for GDB.
*
* This routine is a wrapper for target->type->get_gdb_reg_list.
*/
extern int target_get_gdb_reg_list(struct target_s *target,
struct reg_s **reg_list[], int *reg_list_size);
/** /**
* Run an algorithm on the @a target given. * Run an algorithm on the @a target given.
* *
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment