cortex-debug: How to insert hardware breakpoints?

I use the following configuration,But the gui can still only set software breakpoints。Unless I use the gdb command hbreak, launch.json

            "hardwareBreakpoints": {
                "require": true,
                "limit": 2
             }

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 28 (1 by maintainers)

Most upvoted comments

Hi, haneef:

I understand your difficulties. From my perspective, I don’t think you need to do so complicated management. Why do you do so complicated management, only to provide more breakpoints? In the case of problems (such as my cache consistency problem), being able to use is what I am concerned about.

We can make things simple and provide an option for all gdb breakpoints to become hardware breakpoints. Others may share the same opinion.

  1. We know that if the code is running on the flash, only hardware breakpoints can be set. Then I put the code into the ram to run and force the hardware breakpoint, which is exactly the same as when the code is run on the flash. I do not think that will result in worse results.
  2. For users, setting hardware breakpoints for some scenarios that may cause problems, such as my cache consistency problem, is a very effective way to solve the problem. In addition, I think this method may solve more problem scenarios.
  3. On some chips, of course, there are few hardware breakpoints. But better than nothing.

In addition, adding breakpoints through gdb is a way to solve the problem, but I think it is not very convenient, even through scripts.

I use openocd as gdb server and find the gdb_breakpoint_override command of openocd. Openocd can convert all gdb breakpoints into hardware breakpoints. I add this command to the openocd.cfg, and my project runs very well even cache enabled. However, I am not sure whether jlink and pyocd can do the same. I think it is better to do it on gdb.

@haneefdm