infinite Break Points

Greetings,

               sir/Madam the hardware break points use internal FPB comparators so that the address we update there are internally comare with program counter if value == program counter then automatically the core will be halted and ready to debug the internal registers.

coming to the software break point this will use "BKPT" instrruction so that when ever the address match with program counter user has to execute __ASM("BKPT"); which will case the target break and enter into halt so that user can further access the debug registers.

my doubt was how should i continuously check the program counter continuously so that i could break the target when ever address i supplied was match.

Correct me if i was wrong.

Thanks and Regards.

Harshan.

Parents
  • Hello

    It seems to me your question "how should i continuously check the program counter continuously so that i could break the target when ever address i supplied was match" may have some assumptions about the use of software breakpoints. The debugger does not continuously check the program counter...

    The user debugging her code will set a breakpoint somewhere in her code in a way allowed by the debugger (for example, in DS-5 see Setting or deleting an execution breakpoint and Working with breakpoints and watchpoints).

    For SW breakpoints, the debugger will then replace the assembly instruction at the location of the breakpoint with the BKPT assembly instruction so that when the user runs her code and this BKPT is executed the core enters debug mode and halts (stops execution).

    So the question is then: how does the debugger know when the BKPT has been executed? The common approach is to poll the Debug Halting Control and Status Register (DHCSR). The DHCSR is typically accessed by a debugger through the DAP, which is the block connected to your serial wire debug interface. In particular, the S_HALT, bit[17] in the DHCSR indicates whether the processor is in Debug state

    (refer to the ARM®v7-M Architecture Reference Manual):

    0 In Non-debug state.

    1 In Debug state.

    Hope this helps, and pardon my ramblings if I misunderstood the question.

Reply
  • Hello

    It seems to me your question "how should i continuously check the program counter continuously so that i could break the target when ever address i supplied was match" may have some assumptions about the use of software breakpoints. The debugger does not continuously check the program counter...

    The user debugging her code will set a breakpoint somewhere in her code in a way allowed by the debugger (for example, in DS-5 see Setting or deleting an execution breakpoint and Working with breakpoints and watchpoints).

    For SW breakpoints, the debugger will then replace the assembly instruction at the location of the breakpoint with the BKPT assembly instruction so that when the user runs her code and this BKPT is executed the core enters debug mode and halts (stops execution).

    So the question is then: how does the debugger know when the BKPT has been executed? The common approach is to poll the Debug Halting Control and Status Register (DHCSR). The DHCSR is typically accessed by a debugger through the DAP, which is the block connected to your serial wire debug interface. In particular, the S_HALT, bit[17] in the DHCSR indicates whether the processor is in Debug state

    (refer to the ARM®v7-M Architecture Reference Manual):

    0 In Non-debug state.

    1 In Debug state.

    Hope this helps, and pardon my ramblings if I misunderstood the question.

Children
More questions in this forum