binutils-gdb/gdb/testsuite/gdb.arch/powerpc-altivec2.exp

179 lines
5.3 KiB
Plaintext
Raw Normal View History

GDB: Add support for the new set/show disassembler-options commands. This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28 19:32:07 +01:00
# Copyright 2014-2017 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.
# Test PowerPC instructions disassembly.
standard_testfile .s
set objfile [standard_output_file ${testfile}.o]
if {![istarget "powerpc*-*-*"]} then {
verbose "Skipping PowerPC instructions disassembly."
return
}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
untested "PowerPC instructions disassembly"
return -1
}
clean_restart ${objfile}
# Disassemble the function.
set func ""
gdb_test "set disassembler-options altivec"
set test "disass func"
gdb_test_multiple $test $test {
-re "\r\nDump of assembler code for function func:(\r\n.*\r\n)End of assembler dump.\r\n$gdb_prompt $" {
set func $expect_out(1,string)
pass $test
}
}
proc instr_to_patt {instr} {
global decimal hex
# 0x0000000000000018 <+24>: stxvd2x vs43,r4,r5
return "\[ \t\]*$hex <\\+$decimal>:\[ \t\]*[string_to_regexp $instr]"
}
proc func_check {instr} {
global func
set test "found: $instr"
if [regexp -nocase -line [instr_to_patt $instr] $func] {
pass $test
} else {
fail $test
}
}
func_check "lvepxl v3,0,r28"
func_check "lvepxl v19,r4,r18"
func_check "lvepx v27,0,r19"
func_check "lvepx v1,r25,r18"
func_check "lvexbx v31,0,r27"
func_check "lvexbx v28,r1,r12"
func_check "lvexhx v31,0,r14"
func_check "lvexhx v17,r16,r31"
func_check "lvexwx v22,0,r29"
func_check "lvexwx v23,r25,r5"
func_check "lvsm v3,0,r12"
func_check "lvsm v27,r29,r1"
func_check "lvswxl v7,0,r6"
func_check "lvswxl v7,r16,r8"
func_check "lvswx v14,0,r18"
func_check "lvswx v28,r28,r16"
func_check "lvtlxl v27,0,r12"
func_check "lvtlxl v27,r28,r0"
func_check "lvtlx v23,0,r25"
func_check "lvtlx v1,r25,r14"
func_check "lvtrxl v20,0,r24"
func_check "lvtrxl v22,r29,r24"
func_check "lvtrx v24,0,r8"
func_check "lvtrx v13,r23,r28"
func_check "mvidsplt v12,r28,r12"
func_check "mviwsplt v10,r27,r0"
func_check "stvepxl v27,0,r13"
func_check "stvepxl v2,r2,r31"
func_check "stvepx v3,0,r10"
func_check "stvepx v27,r28,r0"
func_check "stvexbx v13,0,r6"
func_check "stvexbx v13,r25,r3"
func_check "stvexhx v22,0,r1"
func_check "stvexhx v17,r14,r10"
func_check "stvexwx v21,0,r27"
func_check "stvexwx v31,r18,r1"
func_check "stvflxl v26,0,r13"
func_check "stvflxl v22,r13,r21"
func_check "stvflx v5,0,r9"
func_check "stvflx v21,r24,r1"
func_check "stvfrxl v13,0,r10"
func_check "stvfrxl v13,r17,r25"
func_check "stvfrx v17,0,r10"
func_check "stvfrx v8,r12,r31"
func_check "stvswxl v18,0,r29"
func_check "stvswxl v26,r14,r8"
func_check "stvswx v0,0,r15"
func_check "stvswx v13,r23,r7"
func_check "vabsdub v6,v17,v16"
func_check "vabsduh v21,v18,v4"
func_check "vabsduw v25,v20,v9"
func_check "vpermxor v6,v17,v20,v26"
func_check "vaddeuqm v29,v26,v15,v28"
func_check "vaddecuq v15,v8,v7,v24"
func_check "vsubeuqm v2,v6,v21,v1"
func_check "vsubecuq v29,v6,v0,v4"
func_check "vmulouw v14,v9,v3"
func_check "vmuluwm v24,v16,v18"
func_check "vaddudm v10,v17,v17"
func_check "vmaxud v30,v25,v4"
func_check "vrld v10,v6,v28"
func_check "vcmpequd v27,v7,v7"
func_check "vadduqm v22,v16,v25"
func_check "vaddcuq v1,v21,v29"
func_check "vmulosw v20,v11,v19"
func_check "vmaxsd v24,v19,v1"
func_check "vmuleuw v13,v27,v30"
func_check "vminud v9,v24,v17"
func_check "vcmpgtud v10,v18,v28"
func_check "vmulesw v0,v29,v22"
func_check "vminsd v13,v28,v1"
func_check "vsrad v10,v20,v5"
func_check "vcmpgtsd v27,v21,v5"
func_check "bcdadd. v0,v23,v30,1"
func_check "vpmsumb v25,v24,v26"
func_check "bcdsub. v8,v4,v4,1"
func_check "vpmsumh v16,v14,v26"
func_check "vpkudum v27,v2,v26"
func_check "vpmsumw v6,v23,v17"
func_check "vpmsumd v20,v6,v25"
func_check "vpkudus v27,v22,v16"
func_check "vsubudm v21,v20,v18"
func_check "vsubuqm v21,v20,v18"
func_check "vcipher v29,v29,v6"
func_check "vcipherlast v2,v13,v20"
func_check "vgbbd v20,v18"
func_check "vsubcuq v19,v8,v25"
func_check "vorc v9,v26,v29"
func_check "vncipher v20,v20,v13"
func_check "vncipherlast v15,v5,v27"
func_check "vbpermq v3,v19,v6"
func_check "vpksdus v30,v4,v28"
func_check "vnand v0,v4,v14"
func_check "vsld v17,v8,v29"
func_check "vsbox v29,v20"
func_check "vpksdss v11,v7,v11"
func_check "vcmpequd. v3,v19,v16"
func_check "vupkhsw v18,v17"
func_check "vshasigmaw v29,v8,0,13"
func_check "veqv v23,v28,v26"
func_check "vmrgew v29,v0,v2"
func_check "vmrgow v29,v0,v2"
func_check "vshasigmad v27,v19,0,0"
func_check "vsrd v20,v28,v28"
func_check "vupklsw v18,v21"
func_check "vclzb v30,v7"
func_check "vpopcntb v29,v21"
func_check "vclzh v25,v21"
func_check "vpopcnth v16,v30"
func_check "vclzw v28,v3"
func_check "vpopcntw v10,v9"
func_check "vclzd v22,v9"
func_check "vpopcntd v15,v30"
func_check "vcmpgtud. v2,v31,v6"
func_check "vcmpgtsd. v20,v15,v2"