| # Copyright 2026 Free Software Foundation, Inc. |
| |
| # This program is free software; you can redistribute it and/or modify |
| # it under the terms of the GNU General Public License as published by |
| # the Free Software Foundation; either version 3 of the License, or |
| # (at your option) any later version. |
| # |
| # This program is distributed in the hope that it will be useful, |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| # GNU General Public License for more details. |
| # |
| # You should have received a copy of the GNU General Public License |
| # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| |
| # Test that the server properly returns an error response for packets |
| # that require the existence of a process. |
| |
| load_lib gdbserver-support.exp |
| |
| require allow_gdbserver_tests |
| |
| clean_restart |
| |
| # Make sure we're disconnected, in case we're testing with an |
| # extended-remote board, therefore already connected. |
| gdb_test "disconnect" ".*" |
| |
| set res [gdbserver_start "--multi" ""] |
| set gdbserver_gdbport [lindex $res 1] |
| gdb_assert {![gdb_target_cmd "extended-remote" $gdbserver_gdbport]} \ |
| "gdbserver connected" |
| |
| gdb_test_no_output "set debug remote on" |
| |
| set packets \ |
| { \ |
| "C" \ |
| "C00" \ |
| "g" \ |
| "G00" \ |
| "Hg0" \ |
| "m1234,1" \ |
| "M1234,1:00" \ |
| "qAttached" \ |
| "qC" \ |
| "qCRC:1234,1" \ |
| "qSearch:memory:1234;2;12" \ |
| "s" \ |
| "S00" \ |
| "T1" \ |
| "x1234,1" \ |
| "X1234,1:00" \ |
| "z0,0x1234,0" \ |
| "Z0,0x1234,0" \ |
| "z1,0x1234,0" \ |
| "Z1,0x1234,0" \ |
| "z2,0x1234,0" \ |
| "Z2,0x1234,0" \ |
| "z3,0x1234,0" \ |
| "Z3,0x1234,0" \ |
| "z4,0x1234,0" \ |
| "Z4,0x1234,0" \ |
| } |
| |
| foreach_with_prefix packet $packets { |
| gdb_test "maintenance packet $packet" \ |
| "received: \"E01\"" "server returns error" |
| } |
| |
| gdb_test_no_output "set debug remote off" |