gdb: testsuite: use gdb_attach to fix jit-elf.exp
authorTiezhu Yang <yangtiezhu@loongson.cn>
Thu, 17 Mar 2022 02:55:35 +0000 (10:55 +0800)
committerTiezhu Yang <yangtiezhu@loongson.cn>
Wed, 23 Mar 2022 03:56:46 +0000 (11:56 +0800)
commitf629ad7dac5ff2d7ee92791071b731096dfa1eb5
treed4109f42ad6b0db4f5030caef6127d48307e8c8e
parent5b5442fbf0fab8bd3cb4d19e564b13501f547dac
gdb: testsuite: use gdb_attach to fix jit-elf.exp

If /proc/sys/kernel/yama/ptrace_scope is 1, when execute the following
command without superuser:

  make check-gdb TESTS="gdb.base/jit-elf.exp"

we can see the following messages in gdb/testsuite/gdb.log:

  (gdb) attach 1650108
  Attaching to program: /home/yangtiezhu/build/gdb/testsuite/outputs/gdb.base/jit-elf/jit-elf-main, process 1650108
  ptrace: Operation not permitted.
  (gdb) FAIL: gdb.base/jit-elf.exp: attach: one_jit_test-2: break here 1: attach

use gdb_attach to fix the above issue, at the same time, the clean_reattach
proc should return a value to indicate whether it worked, and the callers
should return early as well on failure.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
gdb/testsuite/gdb.base/jit-elf.exp