server: rtos: don't fake step for hwthread rtos.

This is a cherry-pick of:
Link: efce094b40

Fake step is a hack introduced to make things work with real RTOSs that
have a concept of a current thread. The hwthread rtos always has access
to all threads, so doesn't need it.

This fixes a bug when running my MulticoreRegTest against HiFive
Unleashed where OpenOCD would return the registers of the wrong thread
after gdb stepped a hart.

Change-Id: I64f538a133fb078c05a0c6b8121388b0b9d7f1b8
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9177
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
This commit is contained in:
Tim Newsome
2019-08-14 11:56:44 -07:00
committed by Tomas Vanek
parent 52ac91a73e
commit 68b0f7bdff
4 changed files with 39 additions and 4 deletions

View File

@@ -79,6 +79,13 @@ struct rtos_type {
uint8_t *buffer);
int (*write_buffer)(struct rtos *rtos, target_addr_t address, uint32_t size,
const uint8_t *buffer);
/**
* Possibly work around an annoying gdb behaviour: when the current thread
* is changed in gdb, it assumes that the target can follow and also make
* the thread current. This is an assumption that cannot hold for a real
* target running a multi-threading OS. If an RTOS can do this, override
* needs_fake_step(). */
bool (*needs_fake_step)(struct target *target, int64_t thread_id);
};
struct stack_register_offset {
@@ -137,6 +144,7 @@ int rtos_read_buffer(struct target *target, target_addr_t address,
uint32_t size, uint8_t *buffer);
int rtos_write_buffer(struct target *target, target_addr_t address,
uint32_t size, const uint8_t *buffer);
bool rtos_needs_fake_step(struct target *target, int64_t thread_id);
// Keep in alphabetic order this list of rtos
extern const struct rtos_type chibios_rtos;