-
Notifications
You must be signed in to change notification settings - Fork 477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot step over software breakpoint #1537
Comments
And yes I did try |
You're right, it's an issue. Thanks for all the details. Actually, I think there might be an issue in some cases even when pyocd manages the breakpoint… (Definitely doesn't happen when gdb is controlling things, which is the common case for most people, though of course that doesn't help with the API much!) The short term fix is basically what pyocd should do: before you run or single step, check whether the instruction at PC is a To advance past a potential breakpoint: pc = target.read_core_register('pc')
is_bkpt = (target.read16(pc) & 0xff00) == 0xbe00 # (mask corrected as below)
if is_bkpt:
target.write_core_register('pc', pc + 2) Longer term, the plan is to have a |
Ha, that indeed works! Just the parenthesis are wrong, you'd want is_bkpt = (self.target.read16(pc) & 0xbe00) == 0xbe00 and not the and-ing of PC itself. |
Hahh, that's what I get for writing it in the browser… Sorry about that. (Fixed.) |
shouldn't it be this?:
But for me it also doesn't step off |
@unsanded Ah, yeah, that change on the mask is correct. (I really shouldn't write code in the browser… What version of gdb are you using? In every version of gdb I've seen, it will always remove a breakpoint prior to stepping if the PC is currently on a breakpoint. |
But i should have been more clear. I was only talking about the how openocd does it |
Oh, so In any case, pyocd definitely needs to handle this for both sw breakpoints and |
Resuming over software breakpoints is not implemented yet because it requires an event when the core is halted which is currently not available outside the gdbserver. For pyocd#1537
Resuming over software breakpoints is not implemented yet because it requires an event when the core is halted which is currently not available outside the gdbserver. For pyocd#1537
Resuming over software breakpoints is not implemented yet because it requires an event when the core is halted which is currently not available outside the gdbserver. For pyocd#1537
Resuming over software breakpoints is not implemented yet because it requires an event when the core is halted which is currently not available outside the gdbserver. For pyocd#1537
Resuming over software breakpoints is not implemented yet because it requires an event when the core is halted which is currently not available outside the gdbserver. For pyocd#1537
Resuming over software breakpoints is not implemented yet because it requires an event when the core is halted which is currently not available outside the gdbserver. For pyocd#1537
OS: Ubuntu 22.10
PyOCD version: 0.34.3
Hardware: Dialog DA14695 (ARM Cortex-M33)
Description:
I'm trying to use PyOCD to control a firmware. The firmware itself places a breakpoint instruction in its code using a
Where
__BKPT(12);
maps toasm volatile("bkpt #12")
.I can load the firmware into the RAM and execute it just fine, waiting until it halts by itself after being started:
Outputs
As per https://armconverter.com/?disasm&code=0c%20be the decoding of "0c be" (little endian thumb is "bkpt #0xc", so it has reached the breakpoint instruction perfectly fine.
However, it is now eternally stuck there. I cannot get it to step over the breakpoint. I am trying to use the code
Which again outputs
breakpoint_clear_all: Halted at 0x1b0e because BREAKPOINT
, but it fails to go any further. Later code which writes something in memory and resumes the core just printsThe fundamental problem I'm seeing is that
self.target.remove_breakpoint(pc)
calls into the "breakpoint manager". It has its own list of breakpoints that were addded by the API withtarget.set_breakpoint()
. However, since I do not call that (the firmware already has the breakpoint in it), this just does absolutely nothing.pyOCD/pyocd/debug/breakpoints/manager.py
Lines 142 to 153 in 0a4b44c
In logs:
The question is: How can I use pyOCD to step over a
bkpt
instruction that was already present in the firmware and was not managed by pyOCD?The text was updated successfully, but these errors were encountered: