I ran test-case gdb.base/gstack.exp on a machine with kernel.yama.ptrace_scope
set to 1 and ran into:
...
PASS: gdb.base/gstack.exp: spawn gstack
ptrace: Operation not permitted.^M
GSTACK-END^M
PASS: gdb.base/gstack.exp: gstack exits with no error
PASS: gdb.base/gstack.exp: gstack's exit status is 0
FAIL: gdb.base/gstack.exp: got backtrace
...
Fix this by requiring can_spawn_for_attach.
Tested on x86_64-linux.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
require !gdb_protocol_is_remote
+require can_spawn_for_attach
+
standard_testfile
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] == -1} {