Files
binutils-gdb/gdb/testsuite/gdb.python/py-disasm-exec.exp
Tom de Vries 61ed16ee63 [gdb/testsuite] Add gdb.python/py-disasm-{exec,obj}.exp
I tried to reproduce a problem in test-case gdb.python/py-disasm.exp on a
s390x machine, but when running with target board unix/-m31 I saw that the
required libraries were missing, so I couldn't generate an executable.

However, I realized that I did have an object file, and the test-case should
mostly also work with an object file.

I've renamed gdb.python/py-disasm.exp to gdb.python/py-disasm.exp.tcl and
included it from two new minimal test-case wrappers:
- gdb.python/py-disasm-exec.exp, and
- gdb.python/py-disasm-obj.exp
where the former uses an executable as before, and the latter uses an object
file.

Using an object file required changing the info.read_memory calls in
gdb.python/py-disasm.py:
...
-            info.read_memory(1, -info.address + 2)
+            info.read_memory(1, -info.address - 1)
...
because reading from address 2 succeeds.  Using address -1 instead does
generate the expected gdb.MemoryError.

Tested on x86_64-linux.
2024-07-31 13:24:20 +02:00

22 lines
832 B
Plaintext

# Copyright (C) 2024 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/>.
# This file is part of the GDB testsuite. It validates the Python
# disassembler API.
set kind exec
source $srcdir/$subdir/py-disasm.exp.tcl