From da12994d9d014a9e0060616e560d1ebd7c7f4472 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Thu, 16 May 2019 14:39:12 -0700 Subject: 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 --- src/server/gdb_server.c | 9 ++------- src/target/riscv/program.c | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 2961e70..48b312a 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -359,9 +359,7 @@ static int gdb_put_packet_inner(struct connection *connection, { int i; unsigned char my_checksum = 0; -#ifdef _DEBUG_GDB_IO_ char *debug_buffer; -#endif int reply; int retval; 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++) my_checksum += buffer[i]; -#ifdef _DEBUG_GDB_IO_ /* * At this point we should have nothing in the input queue from GDB, * 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); } -#endif while (1) { -#ifdef _DEBUG_GDB_IO_ debug_buffer = strndup(buffer, len); LOG_DEBUG("sending packet '$%s#%2.2x'", debug_buffer, my_checksum); free(debug_buffer); -#endif char local_buffer[1024]; local_buffer[0] = '$'; @@ -738,7 +732,8 @@ static void gdb_signal_reply(struct target *target, struct connection *connectio struct target *ct; if (target->rtos != NULL) { 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); } else { ct = target; diff --git a/src/target/riscv/program.c b/src/target/riscv/program.c index 5e899b2..f59ed82 100644 --- a/src/target/riscv/program.c +++ b/src/target/riscv/program.c @@ -30,7 +30,7 @@ int riscv_program_init(struct riscv_program *p, struct target *target) int riscv_program_write(struct riscv_program *program) { 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, program->debug_buffer[i]) != ERROR_OK) return ERROR_FAIL; -- cgit v1.1