I agree that step should work regardless of which SMP target the software
breakpoint was set on. Unfortunately there is no clean abstraction inside
OpenOCD for SMP groups, so it's just hacked into various places.
Specifically, there's a bunch of SMP-specific code inside gdb_server.c. I
think this leads to problems like you observed. Ideally an SMP target would
have the same interface as a regular target, so that regardless of whether
gdb or the telnet interface performs operations on it, they behave the
same. But that's a pretty significant refactoring and I have no plans for
it.

For RISC-V, I test heavily with gdb and not at all with the telnet
interface. There is a start of tests using the telnet interface at
https://github.com/riscv-software-src/riscv-tests/blob/master/debug/openocd.py,
but I'm unsure what its status is. Cleaning that up and adding it to the
Makefile there would go a long way towards getting this kind of thing
tested.

Tim

On Fri, Dec 2, 2022 at 4:25 AM Kirill Radkin <kirill.rad...@syntacore.com>
wrote:

> Could someone explain the difference between the following 2
> configurations?
>
> I'm using RISCV targets, but it may be the case that problem exists for
> other architectures.
>
> 1. Configuration #1.
>
> We have 2 target cpus, and we are connected to telnet server.
>
> That is `targets` command returns something like this:
>
>              0  core0.cpu  riscv ... halted
>
>              1* core1.cpu  riscv ... halted
>
> When software breakpoint is set it is recordered in an internal
> breakpoint list of the active target. Now, when we try to do a step
> operation the currently selected target is inspected, and if there is a
> breakpoint at the current pc - we can temporary remove it, do step and
> then breakpoint is restored.
>
> If we try to do step operation on a different target - then breakpoint
> won't be removed.
>
> 2. Configuration #2.
>
> It's the same as #1, but now we combine our targets in an smp target
> (and we specify -rtos hwthread), like this:
>
>              targets smp core0.cpu core1.cpu
>
> *Do note that we are still using telnet, not gdb*.
>
> Now, when we set a software breakpoint it is recordered in an internal
> breakpoint list of a single (usually the first) target regardless of the
> currenty selected target. In this case if we do a step operation it may
> not work if there is a breakpoint match, the potentially-matching
> breakpoint won't be disabled since the relevant code inspects the list
> only for the currenty selected targets).
>
> Could someone clarify if this is intentional? Looks like it does not,
> but I'm not sure.
>
>


Reply via email to