mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-18 05:12:33 +08:00
Allow breakpoint commands to be set from Python
This changes the Python API so that breakpoint commands can be set by writing to the "commands" attribute. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> PR python/22731: * NEWS: Mention that breakpoint commands are writable. * python/py-breakpoint.c (bppy_set_commands): New function. (breakpoint_object_getset) <"commands">: Use it. doc/ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> PR python/22731: * python.texi (Breakpoints In Python): Mention that "commands" is writable. testsuite/ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> PR python/22731: * gdb.python/py-breakpoint.exp: Test setting breakpoint commands.
This commit is contained in:
@ -197,8 +197,16 @@ proc_with_prefix test_bkpt_cond_and_cmds { } {
|
||||
|
||||
gdb_py_test_silent_cmd "python blist = gdb.breakpoints()" \
|
||||
"Get Breakpoint List" 0
|
||||
gdb_test "python print (blist\[len(blist)-1\].commands)" \
|
||||
gdb_py_test_silent_cmd "python last_bp = blist\[len(blist)-1\]" \
|
||||
"Find last breakpoint" 0
|
||||
gdb_test "python print (last_bp.commands)" \
|
||||
"print \"Command for breakpoint has been executed.\".*print result"
|
||||
|
||||
gdb_test_no_output "python last_bp.commands = 'echo hi\\necho there'" \
|
||||
"set commands"
|
||||
# Note the length is 3 because the string ends in a \n.
|
||||
gdb_test "python print (len(last_bp.commands.split('\\n')))" "3" \
|
||||
"check number of lines in commands"
|
||||
}
|
||||
|
||||
proc_with_prefix test_bkpt_invisible { } {
|
||||
|
Reference in New Issue
Block a user