Skip to content

Commit 927f9d8

Browse files
committed
Update list of "threads" when harts are discovered.
This ensures that "info threads" is accurate as soon as gdb connects. Also print out number of triggers that is discovered in examine().
1 parent 8d79a7c commit 927f9d8

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/rtos/riscv_debug.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
#include "riscv_debug.h"
66
#include "target/target.h"
77
#include "target/riscv/riscv.h"
8-
#include "rtos.h"
98
#include "server/gdb_server.h"
109

11-
static int riscv_update_threads(struct rtos *rtos);
1210
static int riscv_gdb_thread_packet(struct connection *connection, const char *packet, int packet_size);
1311
static int riscv_gdb_v_packet(struct connection *connection, const char *packet, int packet_size);
1412

@@ -40,7 +38,7 @@ static int riscv_create_rtos(struct target *target)
4038
return JIM_OK;
4139
}
4240

43-
static int riscv_update_threads(struct rtos *rtos)
41+
int riscv_update_threads(struct rtos *rtos)
4442
{
4543
LOG_DEBUG("Updating the RISC-V Hart List");
4644

src/rtos/riscv_debug.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#ifndef RTOS__RISCV_H
22
#define RTOS__RISCV_H
33

4+
#include "rtos.h"
5+
46
struct riscv_rtos {
57
/* The index into the thread list used to handle */
68
int qs_thread_info_offset;
79
};
810

11+
int riscv_update_threads(struct rtos *rtos);
12+
913
#endif

src/target/riscv/riscv-013.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "target/breakpoints.h"
2121
#include "helper/time_support.h"
2222
#include "riscv.h"
23+
#include "rtos/riscv_debug.h"
2324
#include "debug_defines.h"
2425
#include "rtos/rtos.h"
2526
#include "program.h"
@@ -1192,14 +1193,19 @@ static int examine(struct target *target)
11921193
riscv_resume_all_harts(target);
11931194
target_set_examined(target);
11941195

1196+
if (target->rtos) {
1197+
riscv_update_threads(target->rtos);
1198+
}
1199+
11951200
// Some regression suites rely on seeing 'Examined RISC-V core' to know
11961201
// when they can connect with gdb/telnet.
11971202
// We will need to update those suites if we want to change that text.
11981203
LOG_INFO("Examined RISC-V core; found %d harts",
11991204
riscv_count_harts(target));
12001205
for (int i = 0; i < riscv_count_harts(target); ++i) {
1201-
LOG_INFO(" hart %d: XLEN=%d, program buffer at 0x%" PRIx64, i,
1202-
r->xlen[i], r->debug_buffer_addr[i]);
1206+
LOG_INFO(" hart %d: XLEN=%d, program buffer at 0x%" PRIx64
1207+
", %d triggers", i, r->xlen[i], r->debug_buffer_addr[i],
1208+
r->trigger_count[i]);
12031209
}
12041210
return ERROR_OK;
12051211
}

0 commit comments

Comments
 (0)