aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2018-08-28 14:46:58 -0700
committerGitHub <noreply@github.com>2018-08-28 14:46:58 -0700
commit074b4fabed1d57ebfc24fcef7cf000906f6d40b8 (patch)
tree849db60b65ec3718eed3dbeebcbf6bb67de9b6a9
parent58824330da72795db9313b1bddba058f3ee5bbf5 (diff)
downloadriscv-openocd-074b4fabed1d57ebfc24fcef7cf000906f6d40b8.zip
riscv-openocd-074b4fabed1d57ebfc24fcef7cf000906f6d40b8.tar.gz
riscv-openocd-074b4fabed1d57ebfc24fcef7cf000906f6d40b8.tar.bz2
Fix gdb_signal_reply() allocating too small buffer (#296)
In my test-case (64-bit OpenOCD, 64-bit target), OpenOCD ended up sending gdb '$T05rwatch:1212340a00;thread:0000000000000002#89' That's missing the final semi-colon after the thread id. This fix increases the buffer size, and also removes the 0 padding on the thread id. This bug showed up when running MulticoreRtosSwitchActiveHartTest against dual-hart, 64-bit spike. Change-Id: I8c7d88e2d37b00cf3099f226a1a32671219802d5
-rw-r--r--src/server/gdb_server.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index eb4eea9..58df51a 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -722,7 +722,7 @@ static int gdb_output(struct command_context *context, const char *line)
static void gdb_signal_reply(struct target *target, struct connection *connection)
{
struct gdb_connection *gdb_connection = connection->priv;
- char sig_reply[45];
+ char sig_reply[65];
char stop_reason[20];
char current_thread[25];
int sig_reply_len;
@@ -767,7 +767,7 @@ static void gdb_signal_reply(struct target *target, struct connection *connectio
current_thread[0] = '\0';
if (target->rtos != NULL) {
struct target *ct;
- snprintf(current_thread, sizeof(current_thread), "thread:%016" PRIx64 ";",
+ snprintf(current_thread, sizeof(current_thread), "thread:%" PRIx64 ";",
target->rtos->current_thread);
target->rtos->current_threadid = target->rtos->current_thread;
target->rtos->gdb_target_for_threadid(connection, target->rtos->current_threadid, &ct);