--- a/gdb/testsuite/gdb.base/dprintf.exp +++ b/gdb/testsuite/gdb.base/dprintf.exp @@ -108,6 +108,26 @@ gdb_test_multiple "set dprintf-style age } } +# Continue with target-side breakpoint commands will get error if GDB +# work with the gdbserver of some architecture doesn't support some "Zx" +# packets. +if $target_can_dprintf { + gdb_run_cmd + + gdb_test "" "Breakpoint" + + set msg "continue with target-side breakpoint commands" + gdb_test_multiple "continue" $msg { + -re "Cannot insert breakpoint $decimal\.\r\n.*\r\n$gdb_prompt $" { + set target_can_dprintf 0 + pass "$msg - cannot do" + } + -re ".*$gdb_prompt $" { + pass "$msg - can do" + } + } +} + if $target_can_dprintf { gdb_run_cmd @@ -120,7 +140,7 @@ if $target_can_dprintf { gdb_test_sequence "info breakpoints" "dprintf info 2" { "\[\r\n\]Num Type Disp Enb Address +What" "\[\r\n\]2 breakpoint" - "\[\r\n\]\tbreakpoint already hit 2 times" + "\[\r\n\]\tbreakpoint already hit 3 times" "\[\r\n\]3 dprintf" "\[\r\n\]\tbreakpoint already hit 2 times" "\[\r\n\] agent-printf \"At foo entry\\\\n\"" --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp @@ -139,6 +139,16 @@ gdb_expect { } } +# Continue with target-side breakpoint commands will get error if GDB +# work with The gdbserver of some architecture doesn't support some "Zx" +# packets. +if $target_can_dprintf { + if {[mi_run_cmd] == -1} { + pass "continue with target-side breakpoint commands - cannot do" + set target_can_dprintf 0 + } +} + if $target_can_dprintf { mi_run_cmd --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -843,6 +843,7 @@ proc mi_run_cmd_full {use_mi_command arg send_gdb "${run_prefix}continue\n" gdb_expect 60 { -re "${run_match}\\^running\[\r\n\]+\\*running,thread-id=\"\[^\"\]+\"\r\n$mi_gdb_prompt" {} + -re "\\^error.*\r\n$mi_gdb_prompt" { return -1 } default {} } return 0