Allow breakpoint commands to be set from Python
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-breakpoint.exp
index 6e0ff88f87669dfb2266241b205ea4d4d50e45d1..3ce0ea11deae07348a89957171db755fb89f99b4 100644 (file)
@@ -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 { } {
This page took 0.024294 seconds and 4 git commands to generate.