Breakpoints stop the execution of the program. While the program is stopped, you can examine the state of the program, examine or modify variables, examine the call stack, etc. The Unified Breakpoint Manager lets you create or control one or more breakpoints. Depending on your target, you may see additional options, including watchpoints, trace triggers, count events, watchdog timers, or other trace actions.
Breakpoints can be set on a line of source code in the Source Code Window or a disassembled instruction in the Disassembly Window. After a breakpoint is set, it can be enabled or disabled. It can also have actions or conditions associated with it.
Software vs. Hardware Breakpoints There are two types of breakpoints: software breakpoints and hardware breakpoints. A software breakpoint is implemented as an opcode replacement, whereas a hardware breakpoint is implemented internally by the hardware. There is no limit to the number of software breakpoints you can set. However, because hardware breakpoints require on-chip analysis resources, you are limited to a maximum of 2-4 hardware resources. On simulator their is no limit for no. of hardware breakpoints. Hardware breakpoints can come in two types, program breakpoints and data breakpoints. Generally, hardware breakpoint capability is called Advanced Event Triggering inside CCS.
Intrusive vs. Nonintrusive Breakpoints An intrusive breakpoint halts the target. Breakpoints on simulators are always intrusive. A nonintrusive breakpoint won’t halt the target when evaluating a condition.
Setting Breakpoint via DSS
Breakpoint can be via DSS script including the breakpoint properties.
- Setting intrusive breakpoint - halts the target
var bp1 = debugSession.breakpoint.add("0x100") // breakpoint with address var main = debugSession.symbol.getAddress("main") // Query for address of label "main" var bp1 = debugSession.breakpoint.add(main) // set breakpoint based on the address "main"
- Setting non-intrusive breakpoint - perform an action on breakpoint hit
Breakpoint can be set by creating a breakpoint property object. Breakpoint properties are set via "setString()" DSS api. To get the property name and possible value, on CCS IDE right click on breakpoint & select the properties.
Propery name are directly dervied from the properties displayed along with thei hirearchy.
Ex. "Hardware Configuration.Location" "Debugger Response.Action.Expression" "Debugger Response.Skip Count" Note: Some of the properties are read-only, cannont be modified. Ex: "Hardware Configuration.Location.symbolic" & "Debugger Response.Skip Count.Current Count"
- Example script to set breakpoint, which execute GEL command as debugger action
// for setting breakpoint to perform gel command var bpProps2 = session.breakpoint.createProperties(1); bpProps2.setString("Miscellaneous.Name", "Breakpoint"); // Mandatory to select the breakpoint bpProps2.setString("Hardware Configuration.Location",0x500); // Breakpoing at PC address bpProps2.setString("Debugger Response.Action","Execute Expression(GEL)"); bpProps2.setString("Debugger Response.Action.Expression", "GEL_DriverString(\"SIM_EXCEPTION,ON\")"); // Set the gel command to be executed var bp2 = session.breakpoint.add(bpProps2); // add breakpoint
- Example script to set breakpoint, which control profiling for pause & resume profiling collection for profiler
// for setting breakpoint to perform profile control point var bpProps2 = session.breakpoint.createProperties(1); bpProps2.setString("Miscellaneous.Name", "Breakpoint"); bpProps2.setString("Hardware Configuration.Location",0x500); // Breakpoing at PC address bpProps2.setString("Debugger Response.Action","Control Profiling"); bpProps2.setString("Debugger Response.Action.Type", "Pause Profiling"); //Option for action type - "Pause Profiling","Resume Profiling" & "Terminate Profiling" var bp2 = session.breakpoint.add(bpProps2); // add breakpoint
- Example script to set breakpoint at the exit of the program. Convenient to add the the loadti tool (in main.js)
var bpExit = debugSession.breakpoint.add("C$$EXIT")