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().
This commit is contained in:
Tim Newsome 2017-06-19 08:58:07 -07:00
parent 8d79a7c18b
commit 927f9d8873
3 changed files with 13 additions and 5 deletions

View File

@ -5,10 +5,8 @@
#include "riscv_debug.h" #include "riscv_debug.h"
#include "target/target.h" #include "target/target.h"
#include "target/riscv/riscv.h" #include "target/riscv/riscv.h"
#include "rtos.h"
#include "server/gdb_server.h" #include "server/gdb_server.h"
static int riscv_update_threads(struct rtos *rtos);
static int riscv_gdb_thread_packet(struct connection *connection, const char *packet, int packet_size); static int riscv_gdb_thread_packet(struct connection *connection, const char *packet, int packet_size);
static int riscv_gdb_v_packet(struct connection *connection, const char *packet, int packet_size); static int riscv_gdb_v_packet(struct connection *connection, const char *packet, int packet_size);
@ -40,7 +38,7 @@ static int riscv_create_rtos(struct target *target)
return JIM_OK; return JIM_OK;
} }
static int riscv_update_threads(struct rtos *rtos) int riscv_update_threads(struct rtos *rtos)
{ {
LOG_DEBUG("Updating the RISC-V Hart List"); LOG_DEBUG("Updating the RISC-V Hart List");

View File

@ -1,9 +1,13 @@
#ifndef RTOS__RISCV_H #ifndef RTOS__RISCV_H
#define RTOS__RISCV_H #define RTOS__RISCV_H
#include "rtos.h"
struct riscv_rtos { struct riscv_rtos {
/* The index into the thread list used to handle */ /* The index into the thread list used to handle */
int qs_thread_info_offset; int qs_thread_info_offset;
}; };
int riscv_update_threads(struct rtos *rtos);
#endif #endif

View File

@ -20,6 +20,7 @@
#include "target/breakpoints.h" #include "target/breakpoints.h"
#include "helper/time_support.h" #include "helper/time_support.h"
#include "riscv.h" #include "riscv.h"
#include "rtos/riscv_debug.h"
#include "debug_defines.h" #include "debug_defines.h"
#include "rtos/rtos.h" #include "rtos/rtos.h"
#include "program.h" #include "program.h"
@ -1192,14 +1193,19 @@ static int examine(struct target *target)
riscv_resume_all_harts(target); riscv_resume_all_harts(target);
target_set_examined(target); target_set_examined(target);
if (target->rtos) {
riscv_update_threads(target->rtos);
}
// Some regression suites rely on seeing 'Examined RISC-V core' to know // Some regression suites rely on seeing 'Examined RISC-V core' to know
// when they can connect with gdb/telnet. // when they can connect with gdb/telnet.
// We will need to update those suites if we want to change that text. // We will need to update those suites if we want to change that text.
LOG_INFO("Examined RISC-V core; found %d harts", LOG_INFO("Examined RISC-V core; found %d harts",
riscv_count_harts(target)); riscv_count_harts(target));
for (int i = 0; i < riscv_count_harts(target); ++i) { for (int i = 0; i < riscv_count_harts(target); ++i) {
LOG_INFO(" hart %d: XLEN=%d, program buffer at 0x%" PRIx64, i, LOG_INFO(" hart %d: XLEN=%d, program buffer at 0x%" PRIx64
r->xlen[i], r->debug_buffer_addr[i]); ", %d triggers", i, r->xlen[i], r->debug_buffer_addr[i],
r->trigger_count[i]);
} }
return ERROR_OK; return ERROR_OK;
} }