Centralize error handling for buggy register handling
git-svn-id: svn://svn.berlios.de/openocd/trunk@1019 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
parent
7b369df52c
commit
7fd9ba22ba
|
@ -936,11 +936,7 @@ int gdb_set_registers_packet(connection_t *connection, target_t *target, char *p
|
||||||
|
|
||||||
/* get register arch_type, and call set method */
|
/* get register arch_type, and call set method */
|
||||||
arch_type = register_get_arch_type(reg_list[i]->arch_type);
|
arch_type = register_get_arch_type(reg_list[i]->arch_type);
|
||||||
if (arch_type == NULL)
|
|
||||||
{
|
|
||||||
LOG_ERROR("BUG: encountered unregistered arch type");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
arch_type->set(reg_list[i], bin_buf);
|
arch_type->set(reg_list[i], bin_buf);
|
||||||
|
|
||||||
/* advance packet pointer */
|
/* advance packet pointer */
|
||||||
|
@ -1033,11 +1029,6 @@ int gdb_set_register_packet(connection_t *connection, target_t *target, char *pa
|
||||||
|
|
||||||
/* get register arch_type, and call set method */
|
/* get register arch_type, and call set method */
|
||||||
arch_type = register_get_arch_type(reg_list[reg_num]->arch_type);
|
arch_type = register_get_arch_type(reg_list[reg_num]->arch_type);
|
||||||
if (arch_type == NULL)
|
|
||||||
{
|
|
||||||
LOG_ERROR("BUG: encountered unregistered arch type");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
arch_type->set(reg_list[reg_num], bin_buf);
|
arch_type->set(reg_list[reg_num], bin_buf);
|
||||||
|
|
||||||
gdb_put_packet(connection, "OK", 2);
|
gdb_put_packet(connection, "OK", 2);
|
||||||
|
|
|
@ -99,6 +99,7 @@ reg_arch_type_t* register_get_arch_type(int id)
|
||||||
return arch_type;
|
return arch_type;
|
||||||
arch_type = arch_type->next;
|
arch_type = arch_type->next;
|
||||||
}
|
}
|
||||||
|
LOG_ERROR("BUG: encountered unregistered arch type 0x%08x", id);
|
||||||
|
exit(-1);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1212,7 +1212,7 @@ int target_checksum_memory(struct target_s *target, u32 address, u32 size, u32*
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((retval = target->type->checksum_memory(target, address,
|
if ((retval = target->type->checksum_memory(target, address,
|
||||||
size, &checksum)) == ERROR_TARGET_RESOURCE_NOT_AVAILABLE)
|
size, &checksum)) != ERROR_OK)
|
||||||
{
|
{
|
||||||
buffer = malloc(size);
|
buffer = malloc(size);
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
|
@ -1625,11 +1625,6 @@ int handle_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args
|
||||||
if (reg->valid == 0)
|
if (reg->valid == 0)
|
||||||
{
|
{
|
||||||
reg_arch_type_t *arch_type = register_get_arch_type(reg->arch_type);
|
reg_arch_type_t *arch_type = register_get_arch_type(reg->arch_type);
|
||||||
if (arch_type == NULL)
|
|
||||||
{
|
|
||||||
LOG_ERROR("BUG: encountered unregistered arch type");
|
|
||||||
return ERROR_OK;
|
|
||||||
}
|
|
||||||
arch_type->get(reg);
|
arch_type->get(reg);
|
||||||
}
|
}
|
||||||
value = buf_to_str(reg->value, reg->size, 16);
|
value = buf_to_str(reg->value, reg->size, 16);
|
||||||
|
@ -1645,12 +1640,6 @@ int handle_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args
|
||||||
str_to_buf(args[1], strlen(args[1]), buf, reg->size, 0);
|
str_to_buf(args[1], strlen(args[1]), buf, reg->size, 0);
|
||||||
|
|
||||||
reg_arch_type_t *arch_type = register_get_arch_type(reg->arch_type);
|
reg_arch_type_t *arch_type = register_get_arch_type(reg->arch_type);
|
||||||
if (arch_type == NULL)
|
|
||||||
{
|
|
||||||
LOG_ERROR("BUG: encountered unregistered arch type");
|
|
||||||
return ERROR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
arch_type->set(reg, buf);
|
arch_type->set(reg, buf);
|
||||||
|
|
||||||
value = buf_to_str(reg->value, reg->size, 16);
|
value = buf_to_str(reg->value, reg->size, 16);
|
||||||
|
|
Loading…
Reference in New Issue