if (target == NULL)
{
- ERROR("BUG: current_target out of bounds");
+ LOG_ERROR("BUG: current_target out of bounds");
exit(-1);
}
script = open_file_from_path(target->reset_script, "r");
if (!script)
{
- ERROR("couldn't open script file %s", target->reset_script);
+ LOG_ERROR("couldn't open script file %s", target->reset_script);
return ERROR_OK;
}
- INFO("executing reset script '%s'", target->reset_script);
+ LOG_INFO("executing reset script '%s'", target->reset_script);
command_run_file(cmd_ctx, script, COMMAND_EXEC);
fclose(script);
target_register_event_callback(target_init_handler, cmd_ctx);
break;
default:
- ERROR("BUG: unknown target->reset_mode");
+ LOG_ERROR("BUG: unknown target->reset_mode");
}
target = target->next;
}
{
if ((now.tv_sec > timeout.tv_sec) || ((now.tv_sec == timeout.tv_sec) && (now.tv_usec >= timeout.tv_usec)))
{
- USER("Timed out waiting for reset");
+ LOG_USER("Timed out waiting for reset");
goto done;
}
/* this will send alive messages on e.g. GDB remote protocol. */
usleep(500*1000);
- USER_N("%s", ""); /* avoid warning about zero length formatting message*/
+ LOG_USER_N("%s", ""); /* avoid warning about zero length formatting message*/
goto again;
}
}
{
if (target->type->init_target(cmd_ctx, target) != ERROR_OK)
{
- ERROR("target '%s' init failed", target->type->name);
+ LOG_ERROR("target '%s' init failed", target->type->name);
exit(-1);
}
target_event_callback_t *callback = target_event_callbacks;
target_event_callback_t *next_callback;
- DEBUG("target event %i", event);
+ LOG_DEBUG("target event %i", event);
while (callback)
{
/* only allocate multiples of 4 byte */
if (size % 4)
{
- ERROR("BUG: code tried to allocate unaligned number of bytes, padding");
+ LOG_ERROR("BUG: code tried to allocate unaligned number of bytes, padding");
size = CEIL(size, 4);
}
u32 first_free = target->working_area;
u32 free_size = target->working_area_size;
- DEBUG("allocating new working area");
+ LOG_DEBUG("allocating new working area");
c = target->working_areas;
while (c)
if (free_size < size)
{
- WARNING("not enough working area available(requested %d, free %d)", size, free_size);
+ LOG_WARNING("not enough working area available(requested %d, free %d)", size, free_size);
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
}
int retval;
if (target==NULL)
{
- USER("No target has been configured");
+ LOG_USER("No target has been configured");
return ERROR_OK;
}
- USER("target state: %s", target_state_strings[target->state]);
+ LOG_USER("target state: %s", target_state_strings[target->state]);
if (target->state!=TARGET_HALTED)
return ERROR_OK;
{
int retval;
- DEBUG("writing buffer of %i byte at 0x%8.8x", size, address);
+ LOG_DEBUG("writing buffer of %i byte at 0x%8.8x", size, address);
if (((address % 2) == 0) && (size == 2))
{
{
int retval;
- DEBUG("reading buffer of %i byte at 0x%8.8x", size, address);
+ LOG_DEBUG("reading buffer of %i byte at 0x%8.8x", size, address);
if (((address % 2) == 0) && (size == 2))
{
buffer = malloc(size);
if (buffer == NULL)
{
- ERROR("error allocating buffer for section (%d bytes)", size);
+ LOG_ERROR("error allocating buffer for section (%d bytes)", size);
return ERROR_INVALID_ARGUMENTS;
}
retval = target_read_buffer(target, address, size, buffer);
if (retval == ERROR_OK)
{
*value = target_buffer_get_u32(target, value_buf);
- DEBUG("address: 0x%8.8x, value: 0x%8.8x", address, *value);
+ LOG_DEBUG("address: 0x%8.8x, value: 0x%8.8x", address, *value);
}
else
{
*value = 0x0;
- DEBUG("address: 0x%8.8x failed", address);
+ LOG_DEBUG("address: 0x%8.8x failed", address);
}
return retval;
if (retval == ERROR_OK)
{
*value = target_buffer_get_u16(target, value_buf);
- DEBUG("address: 0x%8.8x, value: 0x%4.4x", address, *value);
+ LOG_DEBUG("address: 0x%8.8x, value: 0x%4.4x", address, *value);
}
else
{
*value = 0x0;
- DEBUG("address: 0x%8.8x failed", address);
+ LOG_DEBUG("address: 0x%8.8x failed", address);
}
return retval;
if (retval == ERROR_OK)
{
- DEBUG("address: 0x%8.8x, value: 0x%2.2x", address, *value);
+ LOG_DEBUG("address: 0x%8.8x, value: 0x%2.2x", address, *value);
}
else
{
*value = 0x0;
- DEBUG("address: 0x%8.8x failed", address);
+ LOG_DEBUG("address: 0x%8.8x failed", address);
}
return retval;
int retval;
u8 value_buf[4];
- DEBUG("address: 0x%8.8x, value: 0x%8.8x", address, value);
+ LOG_DEBUG("address: 0x%8.8x, value: 0x%8.8x", address, value);
target_buffer_set_u32(target, value_buf, value);
if ((retval = target->type->write_memory(target, address, 4, 1, value_buf)) != ERROR_OK)
{
- DEBUG("failed: %i", retval);
+ LOG_DEBUG("failed: %i", retval);
}
return retval;
int retval;
u8 value_buf[2];
- DEBUG("address: 0x%8.8x, value: 0x%8.8x", address, value);
+ LOG_DEBUG("address: 0x%8.8x, value: 0x%8.8x", address, value);
target_buffer_set_u16(target, value_buf, value);
if ((retval = target->type->write_memory(target, address, 2, 1, value_buf)) != ERROR_OK)
{
- DEBUG("failed: %i", retval);
+ LOG_DEBUG("failed: %i", retval);
}
return retval;
{
int retval;
- DEBUG("address: 0x%8.8x, value: 0x%2.2x", address, value);
+ LOG_DEBUG("address: 0x%8.8x, value: 0x%2.2x", address, value);
if ((retval = target->type->read_memory(target, address, 1, 1, &value)) != ERROR_OK)
{
- DEBUG("failed: %i", retval);
+ LOG_DEBUG("failed: %i", retval);
}
return retval;
/* register target specific commands */
if (target_types[i]->register_commands(cmd_ctx) != ERROR_OK)
{
- ERROR("couldn't register '%s' commands", args[0]);
+ LOG_ERROR("couldn't register '%s' commands", args[0]);
exit(-1);
}
(*last_target_p)->endianness = TARGET_LITTLE_ENDIAN;
else
{
- ERROR("endianness must be either 'little' or 'big', not '%s'", args[1]);
+ LOG_ERROR("endianness must be either 'little' or 'big', not '%s'", args[1]);
return ERROR_COMMAND_SYNTAX_ERROR;
}
(*last_target_p)->reset_mode = RESET_RUN_AND_INIT;
else
{
- ERROR("unknown target startup mode %s", args[2]);
+ LOG_ERROR("unknown target startup mode %s", args[2]);
return ERROR_COMMAND_SYNTAX_ERROR;
}
(*last_target_p)->run_and_halt_time = 1000; /* default 1s */
/* no matching target found */
if (!found)
{
- ERROR("target '%s' not found", args[0]);
+ LOG_ERROR("target '%s' not found", args[0]);
return ERROR_COMMAND_SYNTAX_ERROR;
}
if (argc < 3)
{
- ERROR("incomplete target_script command");
+ LOG_ERROR("incomplete target_script command");
return ERROR_COMMAND_SYNTAX_ERROR;
}
}
else
{
- ERROR("unknown event type: '%s", args[1]);
+ LOG_ERROR("unknown event type: '%s", args[1]);
return ERROR_COMMAND_SYNTAX_ERROR;
}
}
else
{
- ERROR("unrecognized <backup|nobackup> argument (%s)", args[3]);
+ LOG_ERROR("unrecognized <backup|nobackup> argument (%s)", args[3]);
return ERROR_COMMAND_SYNTAX_ERROR;
}
if (target_continous_poll)
if ((retval = target->type->poll(target)) != ERROR_OK)
{
- ERROR("couldn't poll target(%d). It's due for a reset.", retval);
+ LOG_ERROR("couldn't poll target(%d). It's due for a reset.", retval);
}
}
int count = 0;
char *value;
- DEBUG("-");
+ LOG_DEBUG("-");
target = get_current_target(cmd_ctx);
reg_arch_type_t *arch_type = register_get_arch_type(reg->arch_type);
if (arch_type == NULL)
{
- ERROR("BUG: encountered unregistered arch type");
+ LOG_ERROR("BUG: encountered unregistered arch type");
return ERROR_OK;
}
arch_type->get(reg);
reg_arch_type_t *arch_type = register_get_arch_type(reg->arch_type);
if (arch_type == NULL)
{
- ERROR("BUG: encountered unregistered arch type");
+ LOG_ERROR("BUG: encountered unregistered arch type");
return ERROR_OK;
}
gettimeofday(&now, NULL);
if ((now.tv_sec > timeout.tv_sec) || ((now.tv_sec == timeout.tv_sec) && (now.tv_usec >= timeout.tv_usec)))
{
- ERROR("timed out while waiting for target %s", target_state_strings[state]);
+ LOG_ERROR("timed out while waiting for target %s", target_state_strings[state]);
break;
}
}
int retval;
target_t *target = get_current_target(cmd_ctx);
- DEBUG("-");
+ LOG_DEBUG("-");
if ((retval = target->type->halt(target)) != ERROR_OK)
{
}
}
- WARNING("invalid daemon_startup configuration directive: %s", args[0]);
+ LOG_WARNING("invalid daemon_startup configuration directive: %s", args[0]);
return ERROR_OK;
}
{
target_t *target = get_current_target(cmd_ctx);
- USER("requesting target halt and executing a soft reset");
+ LOG_USER("requesting target halt and executing a soft reset");
target->type->soft_reset_halt(target);
enum target_reset_mode reset_mode = target->reset_mode;
enum target_reset_mode save = target->reset_mode;
- DEBUG("-");
+ LOG_DEBUG("-");
if (argc >= 1)
{
{
target_t *target = get_current_target(cmd_ctx);
- DEBUG("-");
+ LOG_DEBUG("-");
if (argc == 0)
target->type->step(target, 1, 0, 1); /* current pc, addr = 0, handle breakpoints */
}
} else
{
- ERROR("Failure examining memory");
+ LOG_ERROR("Failure examining memory");
}
free(buffer);
}
if (retval!=ERROR_OK)
{
- ERROR("Failure examining memory");
+ LOG_ERROR("Failure examining memory");
}
return ERROR_OK;
if (!target)
{
- ERROR("no target selected");
+ LOG_ERROR("no target selected");
return ERROR_OK;
}
if ((retval = breakpoint_add(target, strtoul(args[0], NULL, 0), length, hw)) != ERROR_OK)
{
- ERROR("Failure setting breakpoints");
+ LOG_ERROR("Failure setting breakpoints");
}
else
{
if ((retval = watchpoint_add(target, strtoul(args[0], NULL, 0),
strtoul(args[1], NULL, 0), type, data_value, data_mask)) != ERROR_OK)
{
- ERROR("Failure setting breakpoints");
+ LOG_ERROR("Failure setting breakpoints");
}
}
else