Breakpoint implementation in RTOS + jtag

23 Views Asked by At

I thought breakpoint implementation like this (roughly) :

The NOP Placeholder Model

  1. Create a program with "empty spaces" (nop instructions) where you might want to set breakpoints.
  2. When you want to set a breakpoint, replace a nop instruction with an interrupt instruction that will stop the program execution.
  3. When the breakpoint is hit, the program stops.
  4. Debugger reads the program's information, providing you with details of the execution state.
  5. If the program continues execution, the instructions after the breakpoint (which was a nop) are executed as normal.

But a true fact looks like this :

The Standard Breakpoint Model (how breakpoints are usually implemented):

  1. Start with the normal compiled code of the program.
  2. When a breakpoint is set, the debugger replaces the instruction at that point in the code with an interrupt instruction (INT 3 on x86).
  3. When the breakpoint is hit, the program execution is interrupted and control is transferred to the debugger.
  4. The debugger reads the program's state and displays it to the user.
  5. Before continuing execution, the debugger replaces the interrupt instruction with the original instruction, ensuring the correct program behavior.

Question

If second model is true then, how does debugging in RTOS + jtag be possible?

0

There are 0 best solutions below