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-power8.exp | |
parent | Revert "Add symbol called __nm_<name> to exported symbols created by dlltool." (diff) | |
download | binutils-gdb-65b48a81404cb058c75c562f7dfdeb74f07eba72.tar.gz binutils-gdb-65b48a81404cb058c75c562f7dfdeb74f07eba72.tar.bz2 binutils-gdb-65b48a81404cb058c75c562f7dfdeb74f07eba72.zip |
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-power8.exp')
-rw-r--r-- | gdb/testsuite/gdb.arch/powerpc-power8.exp | 248 |
1 files changed, 248 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.arch/powerpc-power8.exp b/gdb/testsuite/gdb.arch/powerpc-power8.exp new file mode 100644 index 00000000000..432dcb4a5c6 --- /dev/null +++ b/gdb/testsuite/gdb.arch/powerpc-power8.exp @@ -0,0 +1,248 @@ +# 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 power8" +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 "tabort. r5" +func_check "tabortwc. 7,r8,r16" +func_check "tabortdc. 20,r11,r10" +func_check "tabortwci. 17,r10,-13" +func_check "tabortdci. 29,r3,-5" +func_check "tbegin. " +func_check "tcheck cr7" +func_check "tend. " +func_check "tend. " +func_check "tendall." +func_check "tendall." +func_check "treclaim. r24" +func_check "trechkpt." +func_check "tsuspend." +func_check "tsuspend." +func_check "tresume." +func_check "tresume." +func_check "ori r2,r2,0" +func_check "nop" +func_check "ori r2,r2,0" +func_check "rfebb 0" +func_check "rfebb " +func_check "rfebb " +func_check "bctar- 12,4*cr5+gt" +func_check "bctarl- 4,4*cr1+so" +func_check "bctar+ 12,4*cr3+lt" +func_check "bctarl+ 4,eq" +func_check "bctar 4,4*cr2+lt,1" +func_check "bctarl 4,4*cr1+so,2" +func_check "waitasec" +func_check "msgsndp r8" +func_check "mtsle 1" +func_check "msgclrp r27" +func_check "stqcx. r10,r10,r12" +func_check "stqcx. r28,0,r7" +func_check "lqarx r24,r19,r11" +func_check "lqarx r22,0,r11" +func_check "mfbhrbe r20,6" +func_check "pbt. r29,r17,r16" +func_check "pbt. r14,0,r7" +func_check "clrbhrb" +func_check "vpermxor v11,v10,v0,v23" +func_check "vaddeuqm v24,v2,v7,v4" +func_check "vaddecuq v10,v10,v8,v2" +func_check "vsubeuqm v5,v15,v8,v19" +func_check "vsubecuq v12,v31,v16,v29" +func_check "vmulouw v20,v29,v13" +func_check "vmuluwm v29,v0,v26" +func_check "vaddudm v8,v21,v28" +func_check "vmaxud v1,v26,v1" +func_check "vrld v20,v3,v1" +func_check "vcmpequd v4,v19,v11" +func_check "vadduqm v23,v14,v30" +func_check "vaddcuq v8,v8,v13" +func_check "vmulosw v28,v27,v4" +func_check "vmaxsd v3,v4,v4" +func_check "vmuleuw v0,v19,v21" +func_check "vminud v24,v20,v19" +func_check "vcmpgtud v0,v28,v15" +func_check "vmulesw v21,v0,v2" +func_check "vminsd v9,v26,v9" +func_check "vsrad v25,v29,v11" +func_check "vcmpgtsd v11,v28,v11" +func_check "bcdadd. v5,v8,v26,1" +func_check "vpmsumb v4,v3,v12" +func_check "bcdsub. v26,v31,v21,1" +func_check "vpmsumh v5,v17,v16" +func_check "vpkudum v23,v17,v20" +func_check "vpmsumw v24,v21,v29" +func_check "vpmsumd v9,v22,v13" +func_check "vpkudus v18,v19,v18" +func_check "vsubuqm v30,v16,v22" +func_check "vcipher v14,v11,v7" +func_check "vcipherlast v10,v2,v22" +func_check "vgbbd v23,v13" +func_check "vsubcuq v16,v25,v16" +func_check "vorc v31,v1,v5" +func_check "vncipher v4,v17,v31" +func_check "vncipherlast v24,v2,v27" +func_check "vbpermq v23,v21,v23" +func_check "vpksdus v27,v18,v9" +func_check "vnand v27,v29,v27" +func_check "vsld v19,v19,v24" +func_check "vsbox v5,v13" +func_check "vpksdss v25,v3,v7" +func_check "vcmpequd. v28,v8,v0" +func_check "vupkhsw v26,v26" +func_check "vshasigmaw v5,v7,0,6" +func_check "veqv v28,v21,v14" +func_check "vmrgow v1,v8,v19" +func_check "vshasigmad v0,v10,0,10" +func_check "vsrd v5,v27,v14" +func_check "vupklsw v11,v13" +func_check "vclzb v14,v16" +func_check "vpopcntb v20,v27" +func_check "vclzh v28,v11" +func_check "vpopcnth v24,v9" +func_check "vclzw v27,v31" +func_check "vpopcntw v17,v19" +func_check "vclzd v12,v29" +func_check "vpopcntd v23,v22" +func_check "vcmpgtud. v24,v20,v29" +func_check "vcmpgtsd. v9,v6,v27" +func_check "lxsiwzx vs62,r14,r26" +func_check "lxsiwzx vs40,0,r25" +func_check "lxsiwax vs25,0,r26" +func_check "lxsiwax vs3,0,r3" +func_check "mfvsrd r12,vs62" +func_check "mffprwz r20,f12" +func_check "stxsiwx vs14,r9,r14" +func_check "stxsiwx vs21,0,r8" +func_check "mtvsrd vs48,r11" +func_check "mtvrwa v31,r23" +func_check "mtfprwz f16,r26" +func_check "lxsspx vs13,r19,r13" +func_check "lxsspx vs18,0,r13" +func_check "stxsspx vs43,r2,r4" +func_check "stxsspx vs55,0,r11" +func_check "xsaddsp vs54,vs48,vs25" +func_check "xsmaddasp vs14,vs50,vs1" +func_check "xssubsp vs26,vs22,vs42" +func_check "xsmaddmsp vs27,vs53,vs52" +func_check "xsrsqrtesp vs8,vs59" +func_check "xssqrtsp vs12,vs41" +func_check "xsmulsp vs57,vs11,vs32" +func_check "xsmsubasp vs38,vs20,vs26" +func_check "xsdivsp vs26,vs19,vs6" +func_check "xsmsubmsp vs35,vs37,vs55" +func_check "xsresp vs59,vs8" +func_check "xsnmaddasp vs44,vs33,vs33" +func_check "xsnmaddmsp vs17,vs62,vs30" +func_check "xsnmsubasp vs54,vs52,vs31" +func_check "xsnmsubmsp vs37,vs5,vs58" +func_check "xxlorc vs30,vs54,vs44" +func_check "xxlnand vs49,vs14,vs29" +func_check "xxleqv vs62,vs22,vs30" +func_check "xscvdpspn vs60,vs54" +func_check "xsrsp vs22,vs45" +func_check "xscvuxdsp vs26,vs59" +func_check "xscvsxdsp vs38,vs49" +func_check "xscvspdpn vs59,vs26" +func_check "fmrgow f24,f14,f2" +func_check "fmrgew f22,f7,f5" +func_check "msgsnd r14" +func_check "msgclr r23" +func_check "lxvd2x vs40,0,r5" +func_check "lxvd2x vs40,0,r5" +func_check "lxvd2x vs10,r20,r6" +func_check "lxvd2x vs10,r20,r6" +func_check "stxvd2x vs41,0,r7" +func_check "stxvd2x vs41,0,r7" +func_check "stxvd2x vs11,r21,r8" +func_check "stxvd2x vs11,r21,r8" +func_check "lbarx r20,0,r7" +func_check "lbarx r20,0,r7" +func_check "lbarx r20,0,r7,1" +func_check "lbarx r20,r1,r7" +func_check "lbarx r20,r1,r7" +func_check "lbarx r20,r1,r7,1" +func_check "ldarx r21,0,r8" +func_check "ldarx r21,0,r8" +func_check "ldarx r21,0,r8,1" +func_check "ldarx r21,r1,r8" +func_check "ldarx r21,r1,r8" +func_check "ldarx r21,r1,r8,1" +func_check "lharx r22,0,r9" +func_check "lharx r22,0,r9" +func_check "lharx r22,0,r9,1" +func_check "lharx r22,r1,r9" +func_check "lharx r22,r1,r9" +func_check "lharx r22,r1,r9,1" +func_check "lwarx r23,0,r10" +func_check "lwarx r23,0,r10" +func_check "lwarx r23,0,r10,1" +func_check "lwarx r23,r1,r10" +func_check "lwarx r23,r1,r10" +func_check "lwarx r23,r1,r10,1" +func_check "stbcx. r10,0,r7" +func_check "stbcx. r10,r1,r7" +func_check "sthcx. r11,0,r8" +func_check "sthcx. r11,r1,r8" +func_check "stwcx. r12,0,r9" +func_check "stwcx. r12,r1,r9" +func_check "stdcx. r13,0,r10" +func_check "stdcx. r13,r1,r10" |