rtos: server: target: ask the RTOS which target to set swbp on.

This is the result of squashing two commits from RISC-V OpenOCD:
- [1] ("Ask the RTOS which target to set swbp on. (#673)")
- [2] ("Fix breackpoint_add for rtos swbp (#734)")

The resulting change lets the RTOS pick the "current" target for setting
the software breakpoint on, which matters if address translation differs
between threads.

Link: https://github.com/riscv-collab/riscv-openocd/commit/52ca5d198e3b [1]
Link: https://github.com/riscv-collab/riscv-openocd/commit/8ae41e86e15d [2]
Change-Id: I67ce24d6aa0ca9225436b380065d1e265424e70f
Signed-off-by: Tim Newsome <tim@sifive.com>
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9176
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Tim Newsome
2022-01-31 09:23:38 -08:00
committed by Tomas Vanek
parent 7487fade75
commit 7b6496db7e
5 changed files with 40 additions and 12 deletions

View File

@@ -1814,7 +1814,15 @@ static int gdb_breakpoint_watchpoint_packet(struct connection *connection,
case 0:
case 1:
if (packet[0] == 'Z') {
retval = breakpoint_add(target, address, size, bp_type);
struct target *bp_target = target;
if (target->rtos && bp_type == BKPT_SOFT) {
bp_target = rtos_swbp_target(target, address, size, bp_type);
if (!bp_target) {
retval = ERROR_FAIL;
break;
}
}
retval = breakpoint_add(bp_target, address, size, bp_type);
} else {
assert(packet[0] == 'z');
retval = breakpoint_remove(target, address);