# Test ' gdb --pid PID -ex "run" '. GDB used to have a bug where
# "run" would run before the attach finished - PR17347.
-proc test_command_line_attach_run {} {
+proc_with_prefix test_command_line_attach_run {} {
global gdb_prompt
global binfile
return 0
}
- with_test_prefix "cmdline attach run" {
- set test_spawn_id [spawn_wait_for_attach $binfile]
- set testpid [spawn_id_get_pid $test_spawn_id]
+ set test_spawn_id [spawn_wait_for_attach $binfile]
+ set testpid [spawn_id_get_pid $test_spawn_id]
- set test "run to prompt"
- gdb_exit
+ set test "run to prompt"
+ gdb_exit
- set res [gdb_spawn_with_cmdline_opts \
- "-quiet -iex \"set height 0\" -iex \"set width 0\" --pid=$testpid -ex \"start\""]
- if { $res != 0} {
- fail $test
- kill_wait_spawned_process $test_spawn_id
- return $res
- }
- gdb_test_multiple "" $test {
- -re {Attaching to.*Start it from the beginning\? \(y or n\) } {
- pass $test
- }
+ set res [gdb_spawn_with_cmdline_opts \
+ "-quiet -iex \"set height 0\" -iex \"set width 0\" --pid=$testpid -ex \"start\""]
+ if { $res != 0} {
+ fail $test
+ kill_wait_spawned_process $test_spawn_id
+ return $res
+ }
+ gdb_test_multiple "" $test {
+ -re {Attaching to.*Start it from the beginning\? \(y or n\) } {
+ pass $test
}
+ }
- send_gdb "y\n"
+ send_gdb "y\n"
- set test "run to main"
- gdb_test_multiple "" $test {
- -re "Temporary breakpoint .* main .*$gdb_prompt $" {
- pass $test
- }
+ set test "run to main"
+ gdb_test_multiple "" $test {
+ -re "Temporary breakpoint .* main .*$gdb_prompt $" {
+ pass $test
}
-
- # Get rid of the process
- kill_wait_spawned_process $test_spawn_id
}
+
+ # Get rid of the process
+ kill_wait_spawned_process $test_spawn_id
}