gdb_test "run" ".*event type: new_objfile.*new objfile name.*" "new objfile notification"
-gdb_test_no_output "set detach-on-fork off" ""
-
gdb_test "test-events" "Event testers registered."
gdb_breakpoint "first"
return ${process_id}
}
-set process_id [get_process_id "get inferior 1 process id"]
+set process_id [get_process_id "get inferior process id"]
gdb_test "continue" ".*event type: continue.*
-.*clear_objfiles\[\r\n\]*progspace: .*py-events.*
.*event type: exit.*
.*exit code: 12.*
.*exit inf: 1.*
.*exit pid: $process_id.*
-dir ok: True.*" "Inferior 1 terminated."
-
-gdb_test "inferior 2" ".*Switching to inferior 2.*"
-set process_id [get_process_id "get inferior 2 process id"]
-gdb_test "continue" ".*event type: continue.*
-.*event type: exit.*
-.*exit code: 12.*
-.*exit inf: 2.*
-.*exit pid: $process_id.*
-dir ok: True.*" "Inferior 2 terminated."
-
+dir ok: True.*" "inferior terminated"
# Test before_prompt event.
gdb_test_multiline "define new user command" \
gdb_test "print \$_foo" "= 2" "check foo after start continue"
}
-# Check that when GDB exits, we see gdb.ExitedEvent objects with no
-# 'exit_code' attribute, and that a gdb.GdbExitingEvent is emitted.
-with_test_prefix "gdb exiting: normal" {
+# Check that when GDB kills an inferior, we see gdb.ExitedEvent
+# objects with no 'exit_code' attribute.
+with_test_prefix "kill inferior" {
+ if {![runto_main]} {
+ return
+ }
gdb_test "test-exiting-event normal" "GDB exiting event registered\\."
+ gdb_test "with confirm off -- kill" \
+ "event type: exit\r\nexit code: not-present\r\nexit inf: $decimal\r\nexit pid: $decimal\r\ndir ok: False\r\n.*" \
+ "exit code not present"
+}
+
+# Check that when GDB exits, we see that a gdb.GdbExitingEvent is
+# emitted.
+with_test_prefix "gdb exiting: normal" {
set saw_exiting_event 0
- set saw_inferior_exit 0
- gdb_test_multiple "quit" "" {
- -re "Quit anyway\\? \\(y or n\\) $" {
- send_gdb "y\n"
- exp_continue
- }
+ gdb_test_multiple "with confirm off -- quit" "quit" {
-re "event type: gdb-exiting\r\nexit code: $decimal" {
incr saw_exiting_event
exp_continue
}
- -re "event type: exit\r\nexit code: not-present\r\nexit inf: $decimal\r\nexit pid: $decimal\r\ndir ok: False\r\n" {
- incr saw_inferior_exit
- exp_continue
- }
eof {
gdb_assert { $saw_exiting_event == 1 }
- gdb_assert { $saw_inferior_exit == 2 }
pass $gdb_test_name
}
}
}
}
}
+
+# Test clear_objfiles event.
+
+with_test_prefix "clear_objfiles" {
+ clean_restart ${testfile}
+
+ gdb_test_no_output "source ${pyfile}" "load python file"
+ gdb_test "test-objfile-events" "Object file events registered."
+
+ gdb_test "with confirm off -- file" \
+ "event type: clear_objfiles\r\nprogspace: None\r\n.*" \
+ "file cleared"
+}