Fix breackpoint_add for rtos swbp (#734)

breakpoint_add should use rtos only if request is done by gdb.

Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Change-Id: I779d1a905c6a3640869dca162e3cc001919e8f42

Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
This commit is contained in:
Evgeniy Naydanov 2022-11-16 22:03:43 +03:00 committed by GitHub
parent dc49ed8ae2
commit 8ae41e86e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 14 deletions

View File

@ -1785,7 +1785,13 @@ 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)
return ERROR_FAIL;
}
retval = breakpoint_add(bp_target, address, size, bp_type);
if (retval != ERROR_OK) {
retval = gdb_error(connection, retval);
if (retval != ERROR_OK)

View File

@ -218,19 +218,10 @@ int breakpoint_add(struct target *target,
uint32_t length,
enum breakpoint_type type)
{
if (target->smp) {
struct target_list *head;
if (type == BKPT_SOFT) {
head = list_first_entry(target->smp_targets, struct target_list, lh);
struct target *curr = head->target;
if (target->rtos)
curr = rtos_swbp_target(target, address, length, type);
return breakpoint_add_internal(curr, address, length, type);
}
foreach_smp_target(head, target->smp_targets) {
struct target *curr = head->target;
if (target->smp && type == BKPT_HARD) {
struct target_list *list_node;
foreach_smp_target(list_node, target->smp_targets) {
struct target *curr = list_node->target;
int retval = breakpoint_add_internal(curr, address, length, type);
if (retval != ERROR_OK)
return retval;