Skip to content

Commit 8ae41e8

Browse files
authored
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>
1 parent dc49ed8 commit 8ae41e8

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/server/gdb_server.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,13 @@ static int gdb_breakpoint_watchpoint_packet(struct connection *connection,
17851785
case 0:
17861786
case 1:
17871787
if (packet[0] == 'Z') {
1788-
retval = breakpoint_add(target, address, size, bp_type);
1788+
struct target *bp_target = target;
1789+
if (target->rtos && bp_type == BKPT_SOFT) {
1790+
bp_target = rtos_swbp_target(target, address, size, bp_type);
1791+
if (!bp_target)
1792+
return ERROR_FAIL;
1793+
}
1794+
retval = breakpoint_add(bp_target, address, size, bp_type);
17891795
if (retval != ERROR_OK) {
17901796
retval = gdb_error(connection, retval);
17911797
if (retval != ERROR_OK)

src/target/breakpoints.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -218,19 +218,10 @@ int breakpoint_add(struct target *target,
218218
uint32_t length,
219219
enum breakpoint_type type)
220220
{
221-
if (target->smp) {
222-
struct target_list *head;
223-
224-
if (type == BKPT_SOFT) {
225-
head = list_first_entry(target->smp_targets, struct target_list, lh);
226-
struct target *curr = head->target;
227-
if (target->rtos)
228-
curr = rtos_swbp_target(target, address, length, type);
229-
return breakpoint_add_internal(curr, address, length, type);
230-
}
231-
232-
foreach_smp_target(head, target->smp_targets) {
233-
struct target *curr = head->target;
221+
if (target->smp && type == BKPT_HARD) {
222+
struct target_list *list_node;
223+
foreach_smp_target(list_node, target->smp_targets) {
224+
struct target *curr = list_node->target;
234225
int retval = breakpoint_add_internal(curr, address, length, type);
235226
if (retval != ERROR_OK)
236227
return retval;

0 commit comments

Comments
 (0)