More helpful debug output. (#374)
I often want to see what OpenOCD is telling gdb, and it's annoying to have to recompile. Change-Id: Icce07606f253d67e2523cf2732dbe5042c6e483e
This commit is contained in:
parent
5cb2f200f8
commit
da12994d9d
|
@ -359,9 +359,7 @@ static int gdb_put_packet_inner(struct connection *connection,
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned char my_checksum = 0;
|
unsigned char my_checksum = 0;
|
||||||
#ifdef _DEBUG_GDB_IO_
|
|
||||||
char *debug_buffer;
|
char *debug_buffer;
|
||||||
#endif
|
|
||||||
int reply;
|
int reply;
|
||||||
int retval;
|
int retval;
|
||||||
struct gdb_connection *gdb_con = connection->priv;
|
struct gdb_connection *gdb_con = connection->priv;
|
||||||
|
@ -369,7 +367,6 @@ static int gdb_put_packet_inner(struct connection *connection,
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
my_checksum += buffer[i];
|
my_checksum += buffer[i];
|
||||||
|
|
||||||
#ifdef _DEBUG_GDB_IO_
|
|
||||||
/*
|
/*
|
||||||
* At this point we should have nothing in the input queue from GDB,
|
* At this point we should have nothing in the input queue from GDB,
|
||||||
* however sometimes '-' is sent even though we've already received
|
* however sometimes '-' is sent even though we've already received
|
||||||
|
@ -394,14 +391,11 @@ static int gdb_put_packet_inner(struct connection *connection,
|
||||||
|
|
||||||
LOG_DEBUG("Discard unexpected char %c", reply);
|
LOG_DEBUG("Discard unexpected char %c", reply);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
#ifdef _DEBUG_GDB_IO_
|
|
||||||
debug_buffer = strndup(buffer, len);
|
debug_buffer = strndup(buffer, len);
|
||||||
LOG_DEBUG("sending packet '$%s#%2.2x'", debug_buffer, my_checksum);
|
LOG_DEBUG("sending packet '$%s#%2.2x'", debug_buffer, my_checksum);
|
||||||
free(debug_buffer);
|
free(debug_buffer);
|
||||||
#endif
|
|
||||||
|
|
||||||
char local_buffer[1024];
|
char local_buffer[1024];
|
||||||
local_buffer[0] = '$';
|
local_buffer[0] = '$';
|
||||||
|
@ -738,7 +732,8 @@ static void gdb_signal_reply(struct target *target, struct connection *connectio
|
||||||
struct target *ct;
|
struct target *ct;
|
||||||
if (target->rtos != NULL) {
|
if (target->rtos != NULL) {
|
||||||
target->rtos->current_threadid = target->rtos->current_thread;
|
target->rtos->current_threadid = target->rtos->current_thread;
|
||||||
LOG_DEBUG("current_threadid=%" PRId64, target->rtos->current_threadid);
|
LOG_DEBUG("[%s] current_threadid=%" PRId64, target_name(target),
|
||||||
|
target->rtos->current_threadid);
|
||||||
target->rtos->gdb_target_for_threadid(connection, target->rtos->current_threadid, &ct);
|
target->rtos->gdb_target_for_threadid(connection, target->rtos->current_threadid, &ct);
|
||||||
} else {
|
} else {
|
||||||
ct = target;
|
ct = target;
|
||||||
|
|
|
@ -30,7 +30,7 @@ int riscv_program_init(struct riscv_program *p, struct target *target)
|
||||||
int riscv_program_write(struct riscv_program *program)
|
int riscv_program_write(struct riscv_program *program)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < program->instruction_count; ++i) {
|
for (unsigned i = 0; i < program->instruction_count; ++i) {
|
||||||
LOG_DEBUG("%p: debug_buffer[%02x] = DASM(0x%08x)", program, i, program->debug_buffer[i]);
|
LOG_DEBUG("debug_buffer[%02x] = DASM(0x%08x)", i, program->debug_buffer[i]);
|
||||||
if (riscv_write_debug_buffer(program->target, i,
|
if (riscv_write_debug_buffer(program->target, i,
|
||||||
program->debug_buffer[i]) != ERROR_OK)
|
program->debug_buffer[i]) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
|
Loading…
Reference in New Issue