1

Assembler syntax BKPT # where: See Standard assembler syntax fields on page A6-7. Specifies an 8-bit value that is stored in the instruction. This value is ignored by the ARM hardware, but can be used by a debugger to store additional information about the breakpoint.

what should i pass to this function? where can i see that value when i am debugging?

BKPT #0 vs BKPT #1 - is their a difference?

  • Most likely, this field exists simply because of the instruction encoding. All ARM instructions are 32-bit (except for thumb mode), so it probably happened that the breakpoint instruction just "had room" for an immediate field, so why not include it? – Jonathon Reinhart Apr 4 '14 at 14:09
3

From http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/BABHCHGB.html:

Debug tools can use this to investigate system state when the instruction at a particular address is reached.

imm is ignored by the processor. If required, a debugger can use it to store additional information about the breakpoint.

BKPT #0x3   ; Breakpoint with immediate value set to 0x3 (debugger can
            ; extract the immediate value by locating it using the PC)

Based on what you pasted in your question, you can use any 8-bit value for imm for your ARM processor.

You can see the value of imm in your debugger by fetching the instruction at the PC (program counter) that caused the breakpoint and looking to see what value of imm was used in that instruction.

| improve this answer | |
0

The immediate value is not checked by the CPU but may be checked by the exception handler, e.g. to distinguish between breakpoints inserted by the debugger from those added by the programmer/compiler. For example, the ARM semihosting interface uses BKPT 0xAB on ARMv7-M and presumably won't work with other immediates.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.