3.3.1 Breakpoint Commands

To display information about the breakpoints commands available in MDB, type help breakpoints. The following table provides additional information for this class of commands

Table 3-2. Breakpoint Commands
Command Description
Break Sets a breakpoint at the specified source line number.

Command format:

break filename:linenumber [passCount]

Example:

break newmain.c:142 4

Sets a breakpoint at an absolute address.

Command format:

break *address [passCount]

  • address – the address of the program memory to break on – use the command: 'print /a' to get a symbol address.
  • passCount – the parameter is optional. Indicates the number of times the break ‘on condition’ is met before the program halts.

Example:

break *0x9d0000cc 5

MDB assigns a breakpoint number and returns:Breakpoint 0 at 0x9d0000cc: file newmain.c, line 16.

Sets a breakpoint at the beginning of the function.

Command format:

break function_name [passCount]

Example:

break function_foo 5

Delete Deletes a breakpoint – if no argument is specified, this deletes all breakpoints.

You can abbreviate this command as d.

Command format:

delete [breakpoint number]

d [breakpoint number]

The breakpoint number is generated by MDB for the Break and/or Watch commands.

Examples:

delete or D

delete 1 or d 1

Halt Stops the debugger program.
Watch Sets a data breakpoint at the specified memory address, variable name, or an SFR (special function register).

Command format:

Watch address breakonType[:value] [passCount]

  • address – the name of a global variable, SFR, or data memory address to be watched.

    Use command 'print /a' to get a variable address.

  • breakonType:

    R -- Read.

    W -- Write.

    RW -- Read or Write.

  • value – this parameter is optional. If it is specified, the program will break only when the value held in the data memory matches the specified value.
  • passCount – this parameter is optional. The number of times the breakon condition is met before the program breaks.

Examples:

watch 0xa0007ff0 R:0xf 1

watch 0xa0007ff0 R:10 1

watch my_Variable W 4

MDB will assign and return the watchpoint number, for example: Watchpoint 1.