static enum breakpoint_type gdb_breakpoint_override_type;
extern int gdb_error(connection_t *connection, int retval);
static enum breakpoint_type gdb_breakpoint_override_type;
extern int gdb_error(connection_t *connection, int retval);
static const char *DIGITS = "0123456789abcdef";
static void gdb_log_callback(void *priv, const char *file, int line,
static const char *DIGITS = "0123456789abcdef";
static void gdb_log_callback(void *priv, const char *file, int line,
/* fix a problem with some IAR tools */
gdb_putback_char( connection, reply );
LOG_DEBUG("Unexpected start of new packet");
/* fix a problem with some IAR tools */
gdb_putback_char( connection, reply );
LOG_DEBUG("Unexpected start of new packet");
local_buffer[len++] = '#';
local_buffer[len++] = DIGITS[(my_checksum >> 4) & 0xf];
local_buffer[len++] = DIGITS[my_checksum & 0xf];
local_buffer[len++] = '#';
local_buffer[len++] = DIGITS[(my_checksum >> 4) & 0xf];
local_buffer[len++] = DIGITS[my_checksum & 0xf];
log_remove_callback(gdb_log_callback, connection);
LOG_WARNING("negative reply, retrying");
}
log_remove_callback(gdb_log_callback, connection);
LOG_WARNING("negative reply, retrying");
}
LOG_ERROR("GDB missing ack(1) - assumed good");
gdb_putback_char( connection, reply );
return ERROR_OK;
LOG_ERROR("GDB missing ack(1) - assumed good");
gdb_putback_char( connection, reply );
return ERROR_OK;
LOG_ERROR("GDB missing ack(2) - assumed good");
gdb_putback_char( connection, reply );
return ERROR_OK;
LOG_ERROR("GDB missing ack(2) - assumed good");
gdb_putback_char( connection, reply );
return ERROR_OK;
- if ((retval=fetch_packet(connection, &checksum_ok, 1, len, buffer))!=ERROR_OK)
+ if ((retval=fetch_packet(connection, &checksum_ok, 1, len, buffer)) != ERROR_OK)
- if ((retval=fetch_packet(connection, &checksum_ok, 0, len, buffer))!=ERROR_OK)
+ if ((retval=fetch_packet(connection, &checksum_ok, 0, len, buffer)) != ERROR_OK)
break;
case TARGET_EVENT_GDB_FLASH_ERASE_START:
target_handle_event( target, TARGET_EVENT_OLD_gdb_program_config );
break;
case TARGET_EVENT_GDB_FLASH_ERASE_START:
target_handle_event( target, TARGET_EVENT_OLD_gdb_program_config );
{
char err[4];
snprintf(err, 4, "E%2.2X", the_error );
{
char err[4];
snprintf(err, 4, "E%2.2X", the_error );
-void gdb_target_to_reg(target_t *target, char *tstr, int str_len, u8 *bin)
+void gdb_target_to_reg(target_t *target, char *tstr, int str_len, uint8_t *bin)
t |= hextoint(tstr[i+1]);
int j = gdb_reg_pos(target, i/2, str_len/2);
t |= hextoint(tstr[i+1]);
int j = gdb_reg_pos(target, i/2, str_len/2);
int chars = (CEIL(reg_list[i]->size, 8) * 2);
if (packet_p + chars > packet + packet_size)
int chars = (CEIL(reg_list[i]->size, 8) * 2);
if (packet_p + chars > packet + packet_size)
int gdb_set_register_packet(connection_t *connection, target_t *target, char *packet, int packet_size)
{
char *separator;
int gdb_set_register_packet(connection_t *connection, target_t *target, char *packet, int packet_size)
{
char *separator;
int gdb_read_memory_packet(connection_t *connection, target_t *target, char *packet, int packet_size)
{
char *separator;
int gdb_read_memory_packet(connection_t *connection, target_t *target, char *packet, int packet_size)
{
char *separator;
- LOG_DEBUG("addr: 0x%8.8x, len: 0x%8.8x", addr, len);
+ LOG_DEBUG("addr: 0x%8.8" PRIx32 ", len: 0x%8.8" PRIx32 "", addr, len);
retval = target_read_buffer(target, addr, len, buffer);
retval = target_read_buffer(target, addr, len, buffer);
{
/* TODO : Here we have to lie and send back all zero's lest stack traces won't work.
* At some point this might be fixed in GDB, in which case this code can be removed.
{
/* TODO : Here we have to lie and send back all zero's lest stack traces won't work.
* At some point this might be fixed in GDB, in which case this code can be removed.
int gdb_write_memory_packet(connection_t *connection, target_t *target, char *packet, int packet_size)
{
char *separator;
int gdb_write_memory_packet(connection_t *connection, target_t *target, char *packet, int packet_size)
{
char *separator;
- LOG_DEBUG("addr: 0x%8.8x, len: 0x%8.8x", addr, len);
+ LOG_DEBUG("addr: 0x%8.8" PRIx32 ", len: 0x%8.8" PRIx32 "", addr, len);
int gdb_write_memory_binary_packet(connection_t *connection, target_t *target, char *packet, int packet_size)
{
char *separator;
int gdb_write_memory_binary_packet(connection_t *connection, target_t *target, char *packet, int packet_size)
{
char *separator;
- LOG_DEBUG("addr: 0x%8.8x, len: 0x%8.8x", addr, len);
+ LOG_DEBUG("addr: 0x%8.8" PRIx32 ", len: 0x%8.8" PRIx32 "", addr, len);
- retval = target_write_buffer(target, addr, len, (u8*)separator);
+ retval = target_write_buffer(target, addr, len, (uint8_t*)separator);
int gdb_step_continue_packet(connection_t *connection, target_t *target, char *packet, int packet_size)
{
int current = 0;
int gdb_step_continue_packet(connection_t *connection, target_t *target, char *packet, int packet_size)
{
int current = 0;
- retval=target->type->step(target, current, address, 0); /* step at current or address, don't handle breakpoints */
+ /* step at current or address, don't handle breakpoints */
+ retval = target_step(target, current, address, 0);
int type;
enum breakpoint_type bp_type = BKPT_SOFT /* dummy init to avoid warning */;
enum watchpoint_rw wp_type;
int type;
enum breakpoint_type bp_type = BKPT_SOFT /* dummy init to avoid warning */;
enum watchpoint_rw wp_type;
- snprintf(gdb_reply, 10, "C%8.8x", checksum);
+ snprintf(gdb_reply, 10, "C%8.8" PRIx32 "", checksum);
qsort(banks, flash_get_bank_count(), sizeof(flash_bank_t *), compare_bank);
qsort(banks, flash_get_bank_count(), sizeof(flash_bank_t *), compare_bank);
p->base, p->size, blocksize);
ram_start=p->base+p->size;
}
p->base, p->size, blocksize);
ram_start=p->base+p->size;
}
{
xml_printf(&retval, &xml, &pos, &size, "<memory type=\"ram\" start=\"0x%x\" length=\"0x%x\"/>\n",
ram_start, 0-ram_start);
{
xml_printf(&retval, &xml, &pos, &size, "<memory type=\"ram\" start=\"0x%x\" length=\"0x%x\"/>\n",
ram_start, 0-ram_start);
- if((retval = image_add_section(gdb_connection->vflash_image, addr, length, 0x0, (u8*)parse)) != ERROR_OK)
+ if ((retval = image_add_section(gdb_connection->vflash_image, addr, length, 0x0, (uint8_t*)parse)) != ERROR_OK)
log_add_callback(gdb_log_callback, connection);
target_call_event_callbacks(target, TARGET_EVENT_GDB_START);
int retval=gdb_step_continue_packet(connection, target, packet, packet_size);
log_add_callback(gdb_log_callback, connection);
target_call_event_callbacks(target, TARGET_EVENT_GDB_START);
int retval=gdb_step_continue_packet(connection, target, packet, packet_size);
{
/* we'll never receive a halted condition... issue a false one.. */
gdb_frontend_halted(target, connection);
{
/* we'll never receive a halted condition... issue a false one.. */
gdb_frontend_halted(target, connection);
add_service("gdb", CONNECTION_PIPE, 0, 1, gdb_new_connection, gdb_input, gdb_connection_closed, gdb_service);
add_service("gdb", CONNECTION_PIPE, 0, 1, gdb_new_connection, gdb_input, gdb_connection_closed, gdb_service);
add_service("gdb", CONNECTION_TCP, gdb_port + target->target_number, 1, gdb_new_connection, gdb_input, gdb_connection_closed, gdb_service);
add_service("gdb", CONNECTION_TCP, gdb_port + target->target_number, 1, gdb_new_connection, gdb_input, gdb_connection_closed, gdb_service);
- LOG_DEBUG("gdb service for target %s at port %i", target->type->name, gdb_port + target->target_number);
+ LOG_DEBUG("gdb service for target %s at port %i",
+ target_get_name(target),
+ gdb_port + target->target_number);