diff options
author | Peter Bergner <bergner@vnet.ibm.com> | 2017-02-28 12:32:07 -0600 |
---|---|---|
committer | Peter Bergner <bergner@vnet.ibm.com> | 2017-02-28 12:32:07 -0600 |
commit | 65b48a81404cb058c75c562f7dfdeb74f07eba72 (patch) | |
tree | e377b88638eb395dabeac3d31c7199e1acd2edea /gdb/testsuite/gdb.arch/powerpc-vsx.exp | |
parent | 2979a883540d9ce6e41dd0509ea2a345de9cf050 (diff) | |
download | gdb-65b48a81404cb058c75c562f7dfdeb74f07eba72.zip gdb-65b48a81404cb058c75c562f7dfdeb74f07eba72.tar.gz gdb-65b48a81404cb058c75c562f7dfdeb74f07eba72.tar.bz2 |
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.
Diffstat (limited to 'gdb/testsuite/gdb.arch/powerpc-vsx.exp')
-rw-r--r-- | gdb/testsuite/gdb.arch/powerpc-vsx.exp | 225 |
1 files changed, 225 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx.exp b/gdb/testsuite/gdb.arch/powerpc-vsx.exp new file mode 100644 index 0000000..60fe9d4 --- /dev/null +++ b/gdb/testsuite/gdb.arch/powerpc-vsx.exp @@ -0,0 +1,225 @@ +# 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 vsx" +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 "lxsdx vs40,r10,r20" +func_check "lxvd2x vs40,r10,r20" +func_check "lxvdsx vs40,r10,r20" +func_check "lxvw4x vs40,r10,r20" +func_check "stxsdx vs40,r10,r20" +func_check "stxvd2x vs40,r10,r20" +func_check "stxvw4x vs40,r10,r20" +func_check "xsabsdp vs40,vs60" +func_check "xsadddp vs40,vs50,vs60" +func_check "xscmpodp cr1,vs50,vs60" +func_check "xscmpudp cr1,vs50,vs60" +func_check "xscpsgndp vs40,vs50,vs60" +func_check "xscvdpsp vs40,vs60" +func_check "xscvdpsxds vs40,vs60" +func_check "xscvdpsxws vs40,vs60" +func_check "xscvdpuxds vs40,vs60" +func_check "xscvdpuxws vs40,vs60" +func_check "xscvspdp vs40,vs60" +func_check "xscvsxddp vs40,vs60" +func_check "xscvuxddp vs40,vs60" +func_check "xsdivdp vs40,vs50,vs60" +func_check "xsmaddadp vs40,vs50,vs60" +func_check "xsmaddmdp vs40,vs50,vs60" +func_check "xsmaxdp vs40,vs50,vs60" +func_check "xsmindp vs40,vs50,vs60" +func_check "xsmsubadp vs40,vs50,vs60" +func_check "xsmsubmdp vs40,vs50,vs60" +func_check "xsmuldp vs40,vs50,vs60" +func_check "xsnabsdp vs40,vs60" +func_check "xsnegdp vs40,vs60" +func_check "xsnmaddadp vs40,vs50,vs60" +func_check "xsnmaddmdp vs40,vs50,vs60" +func_check "xsnmsubadp vs40,vs50,vs60" +func_check "xsnmsubmdp vs40,vs50,vs60" +func_check "xsrdpi vs40,vs60" +func_check "xsrdpic vs40,vs60" +func_check "xsrdpim vs40,vs60" +func_check "xsrdpip vs40,vs60" +func_check "xsrdpiz vs40,vs60" +func_check "xsredp vs40,vs60" +func_check "xsrsqrtedp vs40,vs60" +func_check "xssqrtdp vs40,vs60" +func_check "xssubdp vs40,vs50,vs60" +func_check "xstdivdp cr1,vs50,vs60" +func_check "xstsqrtdp cr1,vs60" +func_check "xvabsdp vs40,vs60" +func_check "xvabssp vs40,vs60" +func_check "xvadddp vs40,vs50,vs60" +func_check "xvaddsp vs40,vs50,vs60" +func_check "xvcmpeqdp vs40,vs50,vs60" +func_check "xvcmpeqdp. vs40,vs50,vs60" +func_check "xvcmpeqsp vs40,vs50,vs60" +func_check "xvcmpeqsp. vs40,vs50,vs60" +func_check "xvcmpgedp vs40,vs50,vs60" +func_check "xvcmpgedp. vs40,vs50,vs60" +func_check "xvcmpgesp vs40,vs50,vs60" +func_check "xvcmpgesp. vs40,vs50,vs60" +func_check "xvcmpgtdp vs40,vs50,vs60" +func_check "xvcmpgtdp. vs40,vs50,vs60" +func_check "xvcmpgtsp vs40,vs50,vs60" +func_check "xvcmpgtsp. vs40,vs50,vs60" +func_check "xvcpsgndp vs40,vs50,vs60" +func_check "xvmovdp vs40,vs60" +func_check "xvmovdp vs40,vs60" +func_check "xvcpsgnsp vs40,vs50,vs60" +func_check "xvmovsp vs40,vs60" +func_check "xvmovsp vs40,vs60" +func_check "xvcvdpsp vs40,vs60" +func_check "xvcvdpsxds vs40,vs60" +func_check "xvcvdpsxws vs40,vs60" +func_check "xvcvdpuxds vs40,vs60" +func_check "xvcvdpuxws vs40,vs60" +func_check "xvcvspdp vs40,vs60" +func_check "xvcvspsxds vs40,vs60" +func_check "xvcvspsxws vs40,vs60" +func_check "xvcvspuxds vs40,vs60" +func_check "xvcvspuxws vs40,vs60" +func_check "xvcvsxddp vs40,vs60" +func_check "xvcvsxdsp vs40,vs60" +func_check "xvcvsxwdp vs40,vs60" +func_check "xvcvsxwsp vs40,vs60" +func_check "xvcvuxddp vs40,vs60" +func_check "xvcvuxdsp vs40,vs60" +func_check "xvcvuxwdp vs40,vs60" +func_check "xvcvuxwsp vs40,vs60" +func_check "xvdivdp vs40,vs50,vs60" +func_check "xvdivsp vs40,vs50,vs60" +func_check "xvmaddadp vs40,vs50,vs60" +func_check "xvmaddmdp vs40,vs50,vs60" +func_check "xvmaddasp vs40,vs50,vs60" +func_check "xvmaddmsp vs40,vs50,vs60" +func_check "xvmaxdp vs40,vs50,vs60" +func_check "xvmaxsp vs40,vs50,vs60" +func_check "xvmindp vs40,vs50,vs60" +func_check "xvminsp vs40,vs50,vs60" +func_check "xvmsubadp vs40,vs50,vs60" +func_check "xvmsubmdp vs40,vs50,vs60" +func_check "xvmsubasp vs40,vs50,vs60" +func_check "xvmsubmsp vs40,vs50,vs60" +func_check "xvmuldp vs40,vs50,vs60" +func_check "xvmulsp vs40,vs50,vs60" +func_check "xvnabsdp vs40,vs60" +func_check "xvnabssp vs40,vs60" +func_check "xvnegdp vs40,vs60" +func_check "xvnegsp vs40,vs60" +func_check "xvnmaddadp vs40,vs50,vs60" +func_check "xvnmaddmdp vs40,vs50,vs60" +func_check "xvnmaddasp vs40,vs50,vs60" +func_check "xvnmaddmsp vs40,vs50,vs60" +func_check "xvnmsubadp vs40,vs50,vs60" +func_check "xvnmsubmdp vs40,vs50,vs60" +func_check "xvnmsubasp vs40,vs50,vs60" +func_check "xvnmsubmsp vs40,vs50,vs60" +func_check "xvrdpi vs40,vs60" +func_check "xvrdpic vs40,vs60" +func_check "xvrdpim vs40,vs60" +func_check "xvrdpip vs40,vs60" +func_check "xvrdpiz vs40,vs60" +func_check "xvredp vs40,vs60" +func_check "xvresp vs40,vs60" +func_check "xvrspi vs40,vs60" +func_check "xvrspic vs40,vs60" +func_check "xvrspim vs40,vs60" +func_check "xvrspip vs40,vs60" +func_check "xvrspiz vs40,vs60" +func_check "xvrsqrtedp vs40,vs60" +func_check "xvrsqrtesp vs40,vs60" +func_check "xvsqrtdp vs40,vs60" +func_check "xvsqrtsp vs40,vs60" +func_check "xvsubdp vs40,vs50,vs60" +func_check "xvsubsp vs40,vs50,vs60" +func_check "xvtdivdp cr1,vs50,vs60" +func_check "xvtdivsp cr1,vs50,vs60" +func_check "xvtsqrtdp cr1,vs60" +func_check "xvtsqrtsp cr1,vs60" +func_check "xxland vs40,vs50,vs60" +func_check "xxlandc vs40,vs50,vs60" +func_check "xxlnor vs40,vs50,vs60" +func_check "xxlor vs40,vs50,vs60" +func_check "xxlxor vs40,vs50,vs60" +func_check "xxmrghw vs40,vs50,vs60" +func_check "xxmrglw vs40,vs50,vs60" +func_check "xxmrghd vs40,vs50,vs60" +func_check "xxpermdi vs40,vs50,vs60,1" +func_check "xxpermdi vs40,vs50,vs60,2" +func_check "xxmrgld vs40,vs50,vs60" +func_check "xxspltd vs40,vs50,0" +func_check "xxspltd vs40,vs50,0" +func_check "xxspltd vs40,vs50,1" +func_check "xxspltd vs40,vs50,1" +func_check "xxmrghd vs40,vs50,vs60" +func_check "xxmrghd vs40,vs50,vs60" +func_check "xxmrgld vs40,vs50,vs60" +func_check "xxswapd vs40,vs50" +func_check "xxswapd vs40,vs50" +func_check "xxsel vs40,vs50,vs60,vs62" +func_check "xxsldwi vs40,vs50,vs60,2" +func_check "xxspltw vs40,vs60,2" +func_check "lxvd2x vs40,0,r20" +func_check "lxvd2x vs40,r10,r20" +func_check "stxvd2x vs40,0,r20" +func_check "stxvd2x vs40,r10,r20" |