Thanks, Jie. That sounds like a sensible implementation taking into account
that some targets cannot support swbreak+.

It looks like I can change decr_pc in the riscv gdb support, which also
makes the problem go away. Since that's a lot simpler, I'm planning to go
that route.

Tim

On Wed, Oct 5, 2016 at 11:18 AM, Jie Zhang <jzhang...@gmail.com> wrote:

> On Wed, Oct 5, 2016 at 11:30 AM, Tim Newsome <t...@sifive.com> wrote:
> > On Tue, Oct 4, 2016 at 2:08 PM, Andreas Fritiofson
> >> If we advertise swbreak in qSupported, won't we also have to actually
> send
> >> swbreak in gdb_signal_reply()? Currently we only send the watchpoint
> stop
> >> reasons. We'd need some mechanism to determine whether to send hwbreak
> or
> >> swbreak. Hopefully this can be done generically (like looking through
> the
> >> list of HW breakpoins and if none match $pc then it's a SW breakpoint
> >> perhaps).
> >
> If OpenOCD needs to look through the list of hardware breakpoints to
> figure out swbreak or hwbreak, we'd better let GDB do that. GDB
> already has the code to deal with such cases.
>
> Some processors can tell if a software breakpoint is hit or a hardware
> breakpoint is hit. For example, Cortex-A has such ability. The other
> processors cannot. For example, Cortex-M. For the former targets, we
> can modify the implementation in OpenOCD to return swbreak for
> software breakpoint hit and hwbreak for hardware breakpoint hit. For
> such targets, OpenOCD can reply swbreak+ when GDB queries what
> features OpenOCD supports. For the other targets, we will not reply
> swbreak+.
> >
> > Empirically the only change required is the one in my original mail. It
> does
> > seem good to tell gdb explicitly that a software breakpoint was hit, but
> the
> > problem goes away without doing it.
> >
> > Looking at gdb_signal_reply(), the obvious implementation is to add a
> > debug_reason that unambiguously specifies a software breakpoint. Targets
> > that run into this problem can start using it, while for others
> everything
> > will keep working as expected.
> >
> We will need to add a flag or something similar in targets so the
> generic code can query a target to know if it has such ability or not.
>
> Regards,
>
> Jie
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to