aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-12-04Update gdb/ChangeLog to reflect the PR for a bug fixShahab Vahedi1-0/+1
This is just an update in the gdb/ChangeLog to reflect a newly created PR [27015] for a bugfix commit: 10c19fad arc: Write correct "eret" value during register collection
2020-12-04Constify value_internal_function_nameTom Tromey3-2/+7
I noticed that value_internal_function_name should have a const return type. This patch makes this change. gdb/ChangeLog 2020-12-04 Tom Tromey <tromey@adacore.com> * value.c (value_internal_function_name): Make return type const. * value.h (value_internal_function_name): Make return type const.
2020-12-04Fix shifting of negative valueLuis Machado4-29/+32
When UBSan is enabled, I noticed runtime errors complaining of shifting of negative numbers. This patch fixes this by reusing existing macros from the ARM port. It also removes unused macros from AArch64's port. gdb/ChangeLog: 2020-12-04 Luis Machado <luis.machado@linaro.org> * aarch64-tdep.c (submask, bit, bits): Remove. * arch/aarch64-insn.c (extract_signed_bitfield): Remove. (aarch64_decode_adr, aarch64_decode_b aarch64_decode_bcond) (aarch64_decode_cb, aarch64_decode_tb) (aarch64_decode_ldr_literal): Use sbits to extract a signed immediate. * arch/aarch64-insn.h (submask, bits, bit, sbits): New macros.
2020-12-04[gdb/testsuite] Make gdb.arch/amd64-gs_base.exp unsupported for i386Tom de Vries2-1/+31
With target board unix/-m32 I run into: ... (gdb) print /x $fs_base^M $1 = void^M (gdb) FAIL: gdb.arch/amd64-gs_base.exp: print fs_base ... The problem is that the fs_base register is not supported for i386. Fix this by making the test unsupported if fs_base/gs_base don't show up in info register sys output. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-12-04 Tom de Vries <tdevries@suse.de> PR testsuite/26990 * gdb.arch/amd64-gs_base.exp: Handle -m32 where fs_base and gs_base are unsupported.
2020-12-04[gdb/tdep] Handle static field in i386_16_byte_align_pTom de Vries2-0/+7
When running test-case on gdb.cp/many-args.exp with target board unix/-m32, I run into: ... (gdb) p check_val (ref_val, ref_val, ... , ref_val, ref_val)^M $1 = false^M (gdb) FAIL: gdb.cp/many-args.exp: check passing many structures ... The test source contains struct ss: ... typedef int v4si __attribute__ ((vector_size (16))); struct ss { static v4si static_field; unsigned char aa; }; ... and i386_16_byte_align_p returns true for this type. Fix this by skipping static fields in i386_16_byte_align_p. Tested on x86_64-linux. gdb/ChangeLog: 2020-12-04 Tom de Vries <tdevries@suse.de> PR tdep/27007 * i386-tdep.c (i386_16_byte_align_p): Skip static fields.
2020-12-04[gdb/testsuite] Fix control-flow in gdb.reverse/insn-reverse.expTom de Vries2-11/+20
In gdb.reverse/insn-reverse.exp, we have loop containing a call to gdb_test_multiple, which itself contains a break: ... for {} {$count < 500} {incr count} { ... gdb_test_multiple "x/i \$pc" "" { ... break } ... On SLE-11 with: ... $ runtest --version Expect version is 5.44.1.11 Tcl version is 8.5 Framework version is 1.4.4 ... the break doesn't seem to have the effect of breaking out of the loop. The break does have the effect of terminating evaluation of the expect clause, which means we don't set insn_array, after which we run into: ... ERROR: tcl error sourcing src/gdb/testsuite/gdb.reverse/insn-reverse.exp. ERROR: can't read "insn_array(5)": no such element in array ... gdb/testsuite/ChangeLog: 2020-12-04 Tom de Vries <tdevries@suse.de> * gdb.reverse/insn-reverse.exp: Don't break inside gdb_test_multiple clause.
2020-12-04[gdb/testsuite] Fix count usage in gdb.reverse/insn-reverse.expTom de Vries2-2/+5
Consider the test-case gdb.reverse/insn-reverse.exp. After the loop setting count, the valid entries in various arrays range from 0 to $count - 1 inclusive. Then $count is decremented: ... incr count -1 ... after which the valid entries range from 0 to $count inclusive. The first subsequent loop handles that properly: ... for {set i $count} {$i >= 0} {incr i -1} { ... but the following loop does not, because it treats $count as exclusive bound: ... for {set i 0} {$i < $count} {incr i} { ... Fix this by removing the incr, and using $count - 1 as starting value in the first loop. gdb/testsuite/ChangeLog: 2020-12-04 Tom de Vries <tdevries@suse.de> * gdb.reverse/insn-reverse.exp: Fix count handling.
2020-12-04[gdb/testsuite] Fix gdb.reverse/insn-reverse-x86.c for -m32Tom de Vries2-0/+13
When running test-case gdb.reverse/insn-reverse.exp with target board unix/-m32, we get: ... spawn -ignore SIGHUP gcc -fno-stack-protector -fdiagnostics-color=never \ -c -g -m32 -o insn-reverse0.o insn-reverse.c^M insn-reverse-x86.c: Assembler messages:^M insn-reverse-x86.c:88: Error: bad register name `%r8w'^M .... Fix this by guarding x86_64 assembly in insn-reverse-x86.c with #ifdef __x86_64__. Tested on x86_64-linux, with native and unix/-m32. gdb/testsuite/ChangeLog: 2020-12-04 Tom de Vries <tdevries@suse.de> * gdb.reverse/insn-reverse-x86.c: Guard x86_64 assembly with #ifdef __x86_64__.
2020-12-04[gdb/testsuite] Handle SIGILL in gdb.reverse/insn-reverse.expTom de Vries3-6/+61
Consider test-case gdb.reverse/insn-reverse.exp. It runs a number of subtests, dependent on the architecture, f.i. for x86_64 it runs subtests rdrand and rdseed. For each subtest, it checks whether the subtest is supported and otherwise bails out of that subtest. However, there may be a problem with the support test or the information it relies on, and if it states that a subtest is supported while it is actually not, we may run into a SIGILL, as f.i. described in PR21166, which results in tcl errors like this: ... ERROR: tcl error sourcing src/gdb/testsuite/gdb.reverse/insn-reverse.exp. ERROR: can't read "insn_array(5)": no such element in array ... We can emulate this by inserting a sigfpe in function rdrand in insn-reverse-x86.c, like this: ... volatile int a = 0; volatile int b = 1; volatile int c = b / a; ... The problem is that the loop in the test-case attempts to stepi over of all insn in rdrand, but because of the signal it will never get to the last insn. Handle this by detecting that the stepi made no progress, and bailing out of the loop. Furthermore, make running of the subtests independent, such that a SIGILL in subtest rdrand does not affect running of subtest rdseed. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-12-04 Tom de Vries <tdevries@suse.de> * gdb.reverse/insn-reverse.c (test_nr): New var. (usage, parse_args): New function. (main): Call parse_args. Only run test for test_nr. * gdb.reverse/insn-reverse.exp: Detect lack of progress in stepi loop and bail out. Run subtests individually, using an inferior arg specifying the subtest.
2020-12-04IBM Z: Add risbgz and risbgnz extended mnemonicsAndreas Krebbel8-27/+56
These two extended mnemonics are documented in the Principles of Operations manual but currently not supported by Binutils. They provide aliases for already supported instructions with the zero flag being set. The flag otherwise is mingled into one of the immediate operands what makes asm code much harder to read. opcodes/ * s390-opc.txt: Add risbgz and risbgnz. * s390-opc.c (U6_26): New operand type. (INSTR_RIE_RRUUU2, MASK_RIE_RRUUU2): New instruction format and mask. gas/ * testsuite/gas/s390/zarch-z10.s: Add tests for risbgz. * testsuite/gas/s390/zarch-z10.d: Add regexp for risbgz. * testsuite/gas/s390/zarch-zEC12.s: Add tests for risbgnz. * testsuite/gas/s390/zarch-zEC12.d: Add regexp for risbgnz.
2020-12-04asan: readelf: memory leaksAlan Modra3-40/+65
This tidies some code used by readelf, hopefully fixing some intermittent oss-fuzz bug reports that likely could only be reproduced by feeding readelf two or more object files on the command line. The second and subsequent file may see non-zero state in .bss variables, and non-initial values in .data variables. This patch fixes some of those, and moves some .data variables to .rodata. * dwarf.c (frame_display_row): Do without static variable "sloc". (cu_tu_indexes_read): Move to file scope. (free_debug_memory): Reset it here, along with level_type_signed. Free and clear a number of other static variables. * readelf.c (arm_attr_public_tag <table>): Constify, updating.. (arm_attr_tag_*): ..all these uses. (process_mips_specific): Free "rels" on error path.
2020-12-04PR26978, Inconsistency for strong foo@v1 and weak foo@@v1Alan Modra8-33/+112
Prior to this patch ld -shared --version-script=pr26979.ver pr26978a.o pr26978b.o results in ld: pr26978b.o: in function `foo_v1': (.text+0x0): multiple definition of `foo@v1' ld: pr26978b.o:(*IND*+0x0): multiple definition of `foo' while ld -shared --version-script=pr26979.ver pr26978b.o pr26978a.o results in no error, but some odd dynamic symbols. ... 0 NOTYPE GLOBAL DEFAULT 7 foo@v1 ... 0 NOTYPE WEAK DEFAULT 7 foo@@v1 When linking an undecorated reference to foo against such a shared library, ld complains about multiple definitions of foo@v1 while gold creates a dynamic reference to foo@v1. That results in foo@v1 being used at runtime. While we could error in both cases, it is reasonable to say foo@v1 and foo@@v1 are in fact the same symbol. (Same name, same version. The only real difference is that foo@@v1 satisfies a reference to plain foo, while foo@v1 does not.) Just as merging a weak undecorated sym with a strong sym results in the strong sym prevailing, so should the strong foo@v1 prevail. And since there is a definition that satisfies plain foo, the foo@@v1 variety of dynamic symbol should be emitted at the foo@v1 value. That makes the testcase that currently links continue to produce a shared library, and that shared library can now be used by both ld and gold with the same runtime behaviour as when using gold with the odd dynamic symbol library. bfd/ PR 26978 * elflink.c (_bfd_elf_add_default_symbol): Handle the case where a new weak sym@@ver should be overridden by an existing sym@ver. (elf_link_add_object_symbols): Don't _bfd_elf_add_default_symbol for a new weak sym@ver when sym@@ver already exists. * linker.c (link_action): Choose MIND for previous indirect, current def, rather than MDEF. (_bfd_generic_link_add_one_symbol <MIND>): Handle redefinition of weak indirect symbol. ld/ * testsuite/ld-elf/pr26978a.d, * testsuite/ld-elf/pr26978a.s, * testsuite/ld-elf/pr26978b.d, * testsuite/ld-elf/pr26978b.s: New tests.
2020-12-04Automatic date update in version.inGDB Administrator1-1/+1
2020-12-03gdb: fix logic of find_comp_unit and set_comp_unitSimon Marchi2-4/+12
The logic in find_comp_unit and set_comp_unit is reversed. When the BFD requires relocation, we want to put the comp_unit structure in the map where the comp_unit objects are not shared, that is the one indexed by objfile. If the BFD does not require relocation, then, we can share a single comp_unit structure for all users of that BFD, so we want to put it in the BFD-indexed map. The comments on top of dwarf2_frame_bfd_data and dwarf2_frame_objfile_data make that clear. Fix it by swapping the two in find_comp_unit and set_comp_unit. I don't have a test for this, because I don't see how to write one in a reasonable amount of time. gdb/ChangeLog: PR gdb/26876 * dwarf2/frame.c (find_comp_unit, set_comp_unit): Reverse use of dwarf2_frame_bfd_data and dwarf2_frame_objfile_data. Change-Id: I80c1ee7ad8425fa4947de65b170973d05f5a52ec
2020-12-03IBM Z: Add support for HLASM extended mnemonicsAndreas Krebbel11-57/+194
Add extended mnemonics used in the HLASM assembler. All of them are just aliases for instructions we already support and help when assembling code which was written for the HLASM assembler. The HLASM mnemonics are documented here: https://www.ibm.com/support/knowledgecenter/SSENW6_1.6.0/com.ibm.hlasm.v1r6.asm/asmr1023.pdf See the 'Branching with extended mnemonic codes' chapter. objdump will still print the existing mnemonics with the exception of relative nop branches (i.e. conditional branches with an empty condition code mask). Now we have jnop and jgnop which will be used by objdump when possible. The same change have been applied to the LLVM assembler: https://reviews.llvm.org/D92185 opcodes/ * s390-opc.txt: Add extended mnemonics. gas/ * testsuite/gas/s390/esa-g5.s: Test new extended mnemonics. * testsuite/gas/s390/esa-g5.d: Likewise. * testsuite/gas/s390/esa-z900.s: Likewise. * testsuite/gas/s390/esa-z900.d: Likewise. * testsuite/gas/s390/zarch-z900.s: Likewise. * testsuite/gas/s390/zarch-z900.d: Likewise. ld/ * testsuite/ld-s390/tlsbin_64.dd: The newly added jgnop mnemonic replaces long relative branches with empty condition code mask.
2020-12-03VAX/LD/testsuite: Wrap excessively long linesMaciej W. Rozycki2-3/+11
A couple of lines in the vax-elf.exp test script exceed 80 characters; wrap them. ld/ * testsuite/ld-vax-elf/vax-elf.exp: Wrap excessively long lines throughout.
2020-12-03[GOLD] PR26936 testAlan Modra3-8/+14
Fails if you configure with --disable-x86-used-note. Fix that. * testsuite/Makefile.am (pr26936a.o): Pass -mx86-used-note=yes. (pr26936b.o, pr26936c.o, pr26936d.o): Likewise. * testsuite/Makefile.in: Regenerate.
2020-12-03Automatic date update in version.inGDB Administrator1-1/+1
2020-12-02testsuite/ld-elf/pr26936.d: Pass -W.Hans-Peter Nilsson2-1/+5
Required for the expected "CU:" to be emitted for long source-paths. See binutils/dwarf.c: if (do_wide || strlen (directory) < 76) printf (_("CU: %s/%s:\n"), directory, file_table[0].name); else printf ("%s:\n", file_table[0].name);
2020-12-02gdb/riscv: rewrite target description validation, add rv32e supportAndrew Burgess8-319/+533
This commit started as adding rv32e support to gdb. The rv32e architecture is a cut-down rv32i, it only has 16 x-registers compared to the usual 32, and an rv32e target should not have any floating point registers. In order to add this I needed to adjust the target description validation checks that are performed from riscv_gdbarch_init, and I finally got fed up with the current scheme of doing these checks and rewrote this code. Unfortunately the rv32e changes are currently mixed in with the rewrite of the validation scheme. I could split these apart if anyone is really interested in seeing these two ideas as separate patches. The main idea behind this change is that where previously I tried to have a purely data driven approach, a set of tables one for each expected feature, and then a single generic function that would validate a feature given a table, I have created a new class for each feature. Each class has its own check member function which allows the logic for how to check each feature to be different. I think the new scheme is much easier to follow. There are some other changes that I made to the validation code as part of this commit. I've relaxed some of the checks related to the floating point CSRs. Previously the 3 CSRs fflags, frm, and fcsr all had to be present in either the fpu feature or the csr feature. This requirement is now relaxed, if the CSRs are not present then gdb will not reject the target description. My thinking here is that there's no gdb functionality that specifically requires these registers, and so, if a target offers a description without these registers nothing else in gdb should stop working. And as part of the rv32e support targets now only have to provide the first 16 x-registers and $pc. The second half of the x-registers (x16 -> x31) are now optional. gdb/ChangeLog: * arch/riscv.c: Include 'rv32e-xregs.c'. (riscv_create_target_description): Update to handle rv32e. * arch/riscv.h (struct riscv_gdbarch_features) <embedded>: New member variable. <operator==>: Update to account for new field. <hash>: Likewise. * features/Makefile (FEATURE_XMLFILES): Add riscv/rv32e-xregs.xml. * features/riscv/rv32e-xregs.c: Generated. * features/riscv/rv32e-xregs.xml: New file. * riscv-tdep.c (riscv_debug_breakpoints): Move from later in the file. (riscv_debug_infcall): Likewise. (riscv_debug_unwinder): Likewise. (riscv_debug_gdbarch): Likewise. (enum riscv_register_required_status): Delete. (struct riscv_register_feature): Add constructor, delete default constructor, copy, and assign constructors. (struct riscv_register_feature::register_info) <required>: Delete. <check>: Update comment and arguments. (struct riscv_register_feature) <name>: Change to member function. <prefer_first_name>: Delete. <tdesc_feature>: New member function. <registers>: Rename to... <m_registers>: ...this. <m_feature_name>: New member variable. (riscv_register_feature::register_info::check): Update arguments. (riscv_xreg_feature): Rewrite as class, create a single static instance of the class. (riscv_freg_feature): Likewise. (riscv_virtual_feature): Likewise. (riscv_csr_feature): Likewise. (riscv_create_csr_aliases): Has become a member function inside riscv_csr_feature class. (riscv_abi_embedded): New function definition. (riscv_register_name): Adjust to use new feature objects. (struct riscv_call_info) <riscv_call_info>: Check for rv32e abi, and adjust available argument registers. (riscv_features_from_gdbarch_info): Check for EF_RISCV_RVE flag. (riscv_check_tdesc_feature): Delete. (riscv_tdesc_unknown_reg): Adjust to use new feature objects. (riscv_gdbarch_init): Delete target description checking code, and instead call to the new feature objects to perform the checks. Reorder handling of no abi information case, allows small code simplification. (_initialize_riscv_tdep): Remove call, this is now done in the riscv_csr_feature constructor. * riscv-tdep.h (riscv_abi_embedded): Declare.
2020-12-02gdb/riscv: remove csr aliases created with DECLARE_CSR_ALIASAndrew Burgess4-14/+9
In this commit: commit 767a879e31ce31179e6135c2f991f670a35709fa Date: Tue Jun 9 17:38:30 2020 +0100 gdb/riscv: Improved register alias name creation RISC-V GDB was changed to make use of the DECLARE_CSR_ALIAS macro to define register aliases for some CSRs. Actually, only one alias was created 'dscratch' as an alias for 'dscratch0'. All of the other DECLARE_CSR_ALIAS lines (from include/opcode/riscv-opc.h) were filtered out. In this commit: commit 08ccfccf0ed825be9be2972594d4be4a2207ef13 Date: Mon Jun 8 10:54:53 2020 +0800 RISC-V: Support debug and float CSR as the unprivileged ones. Changes were made to include/opcode/riscv-opc.h so that GDB no longer created even the dscratch alias. This caused a test failure in gdb.arch/riscv-tdesc-regs.exp. In looking at how to address this failure I think that the best strategy is, for now at least, to just remove the code that tries to create aliases with DECLARE_CSR_ALIAS. My thoughts are that: 1. At least some of the aliases are for CSRs where the register now has a completely different use. Being able to reference the CSR using a completely inappropriate name just seems confusing. This was solved by the filtering added in the first commit referenced above. But we certainly don't want to blindly add all aliases. 2. Names presented in a target description are always honoured, so if a user has a legacy target then they should just start sending a target description with their legacy register names in, this problem is then solved. 3. It's easy enough to figure out which CSRs a target has with the info registers command, so missing an alias shouldn't be a big issue. 4. Allowing users to use names for registers that differ from the names the target announces doesn't feel like a critical feature. If in the future targets want multiple names for a register then maybe we could/should extend target descriptions to allow the target to send aliases as well as the primary name.... but that can wait for another day. So in this commit I remove the use of DECLARE_CSR_ALIAS, and remove the test that was failing. gdb/ChangeLog: * riscv-tdep.c (riscv_create_csr_aliases): Remove use of DECLARE_CSR_ALIAS. gdb/testsuite/ChangeLog: * gdb.arch/riscv-tdesc-regs.exp: Remove unwanted test.
2020-12-02gdb/riscv: place unknown csrs into the correct register groupsAndrew Burgess4-16/+69
Unknown riscv CSRs should not be in the 'general' group, but should be in the system and csr register groups. To see this in action connect to QEMU, this target advertises two registers dscratch and mucounteren which are unknown to GDB (these are legacy CSRs). Before this commit these registers would show up in the output of: (gdb) info registers .... dscratch Could not fetch register "dscratch"; remote failure reply 'E14' mucounteren Could not fetch register "mucounteren"; remote failure reply 'E14' Ignore the errors, this is just a QEMU annoyance, it advertises these CSRs, but doesn't actually let GDB read them. These registers don't show up in the output of either: (gdb) info registers csr (gdb) info registers system After this commit this situation is reveresed, which makes more sense to me. gdb/ChangeLog: * riscv-tdep.c (riscv_is_unknown_csr): New function, implementation moved from riscv_register_reggroup_p. (riscv_register_reggroup_p): Update group handling for unknown CSRs. gdb/testsuite/ChangeLog: * gdb.arch/riscv-tdesc-regs.exp (get_expected_result): New proc, update test to use this.
2020-12-02Add gnu global outputs to .gitignoreEnze Li2-0/+10
GNU Global outputs can be safely ignored. ChangeLog: 2020-12-02 Enze Li <lienze2010@hotmail.com> * .gitignore: Add gnu global outputs. Change-Id: I04ce68ab3279426195793adb56f834a34ee72ea2
2020-12-02Sync .gitignore with gccSimon Marchi2-0/+8
Bring in a few lines that are in gcc's .gitignore but not binutils-gdb's .gitignore. ChangeLog: * .gitignore: Sync with gcc. Change-Id: I8900ddfbb5ab8cce6236e1905fdbb52fb4c291e2
2020-12-01Search for DWZ files in debug-file-directories as wellSergio Durigan Junior2-7/+107
When Debian (and Ubuntu) builds its binaries, it (still) doesn't use dwz's "--relative" option. This causes their debuginfo files to carry a .gnu_debugaltlink section containing a full pathname to the DWZ alt debug file, like this: $ readelf -wk /usr/bin/cat Contents of the .gnu_debugaltlink section: Separate debug info file: /usr/lib/debug/.dwz/x86_64-linux-gnu/coreutils.debug Build-ID (0x14 bytes): ee 76 5d 71 97 37 ce 46 99 44 32 bb e8 a9 1a ef 99 96 88 db Contents of the .gnu_debuglink section: Separate debug info file: 06d3bee37b8c7e67b31cb2689cb351102ae73b.debug CRC value: 0x53267655 This usually works OK, because most of the debuginfo files installed via apt will be present in /usr/lib/debug anyway. However, imagine the following scenario: - You are using /usr/bin/cat, it crashes on you and generates a corefile. - You don't want/need to "apt install" the debuginfo file for coreutils from the repositories. Instead, you already have the debuginfo files in a separate directory (e.g., $HOME/dbgsym). - You start GDB and "set debug-file-directory $HOME/dbgsym/usr/lib/debug". You then get the following message: $ gdb -ex 'set debug-file-directory ./dbgsym/usr/lib/debug' -ex 'file /bin/cat' -ex 'core-file ./cat.core' GNU gdb (Ubuntu 10.1-0ubuntu1) 10.1 ... Reading symbols from /bin/cat... Reading symbols from /home/sergio/gdb/dbgsym/usr/lib/debug/.build-id/bc/06d3bee37b8c7e67b31cb2689cb351102ae73b.debug... could not find '.gnu_debugaltlink' file for /home/sergio/gdb/dbgsym/usr/lib/debug/.build-id/bc/06d3bee37b8c7e67b31cb2689cb351102ae73b.debug This error happens because GDB is trying to locate the build-id link (inside /home/sergio/gdb/dbgsym/usr/lib/debug/.build-id) for the DWZ alt debug file, which doesn't exist. Arguably, this is a problem with how dh_dwz works in Debian, and it's something I'm also planning to tackle. But, back at the problem at hand. Besides not being able to find the build-id link in the directory mentioned above, GDB also tried to open the DWZ alt file using its filename. The problem here is that, since we don't have the distro's debuginfo installed, it can't find anything under /usr/lib/debug that satisfies it. It occurred to me that a good way to workaround this problem is to actually try to locate the DWZ alt debug file inside the debug-file-directories (that were likely provided by the user). So this is what the proposed patch does. The idea here is simple: get the filename extracted from the .gnu_debugaltlink section, and manipulate it in order to replace the initial part of the path (everything before "/.dwz/") by whatever debug-file-directories the user might have provided. I talked with Mark Wielaard and he agrees this is a sensible approach. In fact, apparently this is something that eu-readelf also does. I regtested this code, and no regressions were found. 2020-12-01 Sergio Durigan Junior <sergiodj@sergiodj.net> * dwarf2/read.c (dwz_search_other_debugdirs): New function. (dwarf2_get_dwz_file): Convert 'filename' to a std::string. Use dwz_search_other_debugdirs to search for DWZ files in the debug-file-directories provided by the user as well.
2020-12-01Use new+delete for struct expressionTom Tromey3-29/+56
In another series I'm working on, it is necessary to manage "struct expression" with new and delete. Because the patch is straightforward and could be extracted, I've done so here. gdb/ChangeLog 2020-12-01 Tom Tromey <tom@tromey.com> * parse.c (expr_builder::expr_builder): Initialize expout. (expr_builder::release): Use expression::resize. (expression::expression, expression::~expression) (expression::resize): New methods. (write_exp_elt): Use expression::resize. (prefixify_expression): Update. (increase_expout_size): Use expression::resize. * expression.h (struct expression): Add constructor, destructor. <resize>: New method. (expression_up): Change type.
2020-12-02Automatic date update in version.inGDB Administrator1-1/+1
2020-12-01gdb/testsuite: fix indentation in gdb.threads/non-ldr-exc-1.expSimon Marchi2-2/+6
gdb/testsuite/ChangeLog: * gdb.threads/non-ldr-exc-1.exp: Fix indentation. Change-Id: I02ba8a518aae9cb67106d09bef92968a7078e91e
2020-12-01gdb/testsuite: use foreach_with_prefix in gdb.threads/non-ldr-exc-*.expSimon Marchi5-127/+134
Replace the manual with_test_prefix in the do_test proc with using foreach_with_prefix at the top-level. This helps reduce the indentation level of the code a bit, and makes the test names in sync with the variable names used in the code. gdb/testsuite/ChangeLog: * gdb.threads/non-ldr-exc-1.exp: Use foreach_with_prefix. (do_test): Don't use with_test_prefix. * gdb.threads/non-ldr-exc-2.exp: Use foreach_with_prefix. (do_test): Don't use with_test_prefix. * gdb.threads/non-ldr-exc-3.exp: Use foreach_with_prefix. (do_test): Don't use with_test_prefix. * gdb.threads/non-ldr-exc-4.exp: Use foreach_with_prefix. (do_test): Don't use with_test_prefix. Change-Id: I3af1df2eee1a8add427a67b6048bb6dede41cbeb
2020-12-01PowerPC remove 512 bytes region limit if 2nd DAWR is avaliable.Rogerio Alves2-8/+23
Power 10 introduces the 2nd DAWR (second watchpoint) and also removed a restriction that limit the watch region to 512 bytes. 2020-11-08 Rogerio A. Cardoso <rcardoso@linux.ibm.com> /gdb * ppc-linux-nat.c: (PPC_DEBUG_FEATURE_DATA_BP_ARCH_31): New define. (region_ok_for_hw_watchpoint): Check if 2nd DAWR is avaliable before set region.
2020-12-01Add missing ChangeLog entry.Rogerio Alves1-0/+3
2020-12-01gdb/testsuite: fix comment in gdb.threads/non-ldr-exit.expSimon Marchi2-1/+5
Maybe there's something I don't understand in that test, but the comment seems wrong. It checks what happens when the non-leader thread does an exit, not the leader. gdb/testsuite/ChangeLog: * gdb.threads/non-ldr-exit.exp: Fix comment. Change-Id: I35c96a70c097fa9529737874f54f3f78036008a4
2020-12-01arc: Enable -Ttext-segmentH.J. Lu2-0/+9
Define TEXT_START_ADDR and SHLIB_TEXT_START_ADDR with SEGMENT_START to enable -Ttext-segment. PR ld/26970 * scripttempl/elfarc.sc (TEXT_START_ADDR): New. Add SEGMENT_START. (SHLIB_TEXT_START_ADDR): Likewise.
2020-12-01gdbsupport/tdesc: print enum fields using 'evalue' syntaxAndrew Burgess4-1/+25
Currently when printing an XML description GDB prints enum values like this: <enum id="levels_type" size="4"> <field name="low" start="0"/> <field name="high" start="1"/> </enum> This is incorrect, and is most likely a copy and paste error with the struct and flags printing code. The correct syntax is: <enum id="levels_type" size="4"> <evalue name="low" value="0"/> <evalue name="high" value="1"/> </enum> A test is included to cover this functionality. gdb/testsuite/ChangeLog: * gdb.xml/maint-xml-dump-03.xml: New file. gdbsupport/ChangeLog: * tdesc.cc (print_xml_feature::visit): Print enum fields using 'evalue' syntax.
2020-12-01gdbsupport/tdesc: print enum size attributeChungyi Chi2-0/+6
According to gdb online docs[1], XML target description enum types have both name and size attributes. Currently GDB does not print the size attribute. This commit fixes this. This change will be visible in the output of the command `maint print xml-tdesc`. There are other bugs with the print of enum types in XML target descriptions, the next commit will fix these and include a test that covers this patch. [1] https://sourceware.org/gdb/current/onlinedocs/gdb/Enum-Target-Types.html#Enum-Target-Types gdbsupport/ChangeLog: * tdesc.cc (print_xml_feature::visit): Print enum size attribute.
2020-12-01RISC-V: Fix the order checking for Z* extension.Nelson Chu2-2/+6
We have to check the first char of the Z* extensions, to make sure that they follow the order of the standard extensions. But we can not have the testcases for this patch, since we only support the zicsr and zifencei so far, both of them are the sub extensions of i. bfd/ * elfxx-riscv.c (riscv_parse_prefixed_ext): Use riscv_compare_subsets to check the Z* extensions' order.
2020-12-01RISC-V: Support to add implicit extensions for G.Nelson Chu9-9/+58
G is a special case, consider the ISA spec github issue as follows, https://github.com/riscv/riscv-isa-manual/issues/575 My understand is that - i, m, a, f and d extensions are not g's implicit extensions, they are g's expansions. The zifencei is the implicit extension of g, and so is zicsr, since it is implicited by f (or i2p1). However, we add the g with the RISCV_UNKNOWN_VERSION to the subset list, and it will not output to the arch string, it is only used to check what implicit extensions are need to be added. bfd/ * elfxx-riscv.c (riscv_parse_add_subset): Allow to add g with RISCV_UNKNOWN_VERSION versions. (riscv_parse_std_ext): Add g to the subset list, we only use it to add the implicit extensions, but won't output it to arch string. (riscv_parse_add_implicit_subsets): Add implicit zicsr and zifencei for g extension. (riscv_arch_str1): Do not output g to the arch string. * elfxx-riscv.h (RISCV_UNKNOWN_VERSION): Moved to include/opcode/riscv.h. gas/ * testsuite/gas/riscv/attribute-10.d: Updated. * testsuite/gas/riscv/march-imply-g.d: New testcase for g. * testsuite/gas/riscv/march-imply-unsupported.d: The zicsr and zifencei are not supported in the ISA spec v2.2, so don't add and output them. include/ * opcode/riscv.h (RISCV_UNKNOWN_VERSION): added.
2020-12-01RISC-V: Support to add implicit extensions.Nelson Chu16-69/+315
We have to parse and add all arch string extensions at first, and then start to add their implicit extensions. That means we can always add arch string extensions at the end of the subset list, but we need to search the right place to add their implicit extensions. For now we follow the following rules to add the implicit extensions, * Add zicsr and zifencei only when the i's version less than 2.1. * Add d, f and zicsr when q is found. * Add f and zicsr when d is found. * Add zicsr when f is found. Besides, we do not add the implicit extensions if they are already added in the subset list, or we cannot find their default versions according to the chosen ISA spec. bfd/ * elfnn-riscv.c (riscv_merge_std_ext): Updated since riscv_lookup_subset is changed. * elfxx-riscv.c (riscv_ext_order): New Array used to compare the extensions' order quickly. (riscv_init_ext_order): New function. Init the riscv_ext_order according to the riscv_supported_std_ext and parse_config[i].class automatically. (riscv_compare_subsets): New function. Similar to the strcmp, but compare the subsets with the specific order. (riscv_lookup_subset): Return TRUE and set `current` to the subset if it is found. Otherwise, return FALSE and set `current` to the place where we should insert the subset. (riscv_add_implicit_subset): New function. Search the list first, and then find the right place to add the implicit_subset. (riscv_parse_add_subset): Since We have to add all arch string extensions first, and then start to add their implicit extensions. We can add arch string extensions in order by the original riscv_add_subset, and then add the implicit subsets by the riscv_add_implicit_subset. Besides, do not add the implicit extensions if we failed to find their default versions. (riscv_parse_std_ext): Updated. (riscv_parse_add_implicit_subsets): New function. Add all implicit extensions according to the arch string extensions. (riscv_parse_subset): Call riscv_init_ext_order and riscv_parse_add_implicit_subsets, before and after parsing the arch string. Remove parts of the ISA conflict checking since the implicit extensions are added. * elfxx-riscv.h (riscv_lookup_subset): Updated. gas/ * config/tc-riscv.c (riscv_subset_supports): Updated. * testsuite/gas/riscv/march-imply-i2p0.d: New testcase. Need to add the implicit zicsr and zifencei when i's version less than 2.1. * testsuite/gas/riscv/march-imply-i2p1.d: New testcase. * testsuite/gas/riscv/march-imply-d.d: Likewise. * testsuite/gas/riscv/march-imply-f.d: Likewise. * testsuite/gas/riscv/march-imply-q.d: Likewise. * testsuite/gas/riscv/march-fail-rv32iq.l: Updated. * testsuite/gas/riscv/march-fail-rv32id.d: Removed. * testsuite/gas/riscv/march-fail-rv32id.l: Likewise. * testsuite/gas/riscv/march-fail-rv64iq.d: Likewise. * testsuite/gas/riscv/march-fail-rv64iq.l: Likewise.
2020-12-01RISC-V: Improve the version parsing for arch string.Nelson Chu28-223/+250
Keep the riscv_add_subset to do the same thing, and use a new function, riscv_parse_add_subset, to cover most of the things when parsing, including find the default versions for extensions, and check whether the versions are valid. The version 0p0 should be an invalid version, that is the mistake I made before. This patch clarify the version rules as follows, * We accept any version of extensions set by users, except 0p0. * The non-standard x extensions must be set with versions in arch string. * If user don't set the versions, or set 0p0 for the extensions, then try to find the supported versions according to the chosen ISA spec. Otherwise, report errors rather than output 0p0 for them. Besides, we use as_bad rather than as_fatal to report more errors for assembler. bfd/ * elfxx-riscv.c (riscv_lookup_subset): Moved to front. (riscv_add_subset): Likewise. (riscv_release_subset_list): Likewise. (riscv_parse_add_subset): New function. Find and check the versions before adding them by riscv_add_subset. (riscv_parsing_subset_version): Remove use_default_version and change the version type from unsigned to int. Set the versions to RISCV_UNKNOWN_VERSION if we can not find them in the arch string. (riscv_parse_std_ext): Updated. (riscv_parse_prefixed_ext): Updated. Since we use as_bad rather than as_fatal to report more errors, return NULL string if the parsed end_of_version is NULL, too. (riscv_parse_subset): Use a new boolean, no_conflict, to report more errors when we have more than one ISA conflicts. * elfxx-riscv.h (RISCV_DONT_CARE_VERSION): Changed to RISCV_UNKNOWN_VERSION. (riscv_lookup_subset_version): Removed. (riscv_parse_subset_t): Updated. gas/ * config/tc-riscv.c (riscv_get_default_ext_version): Change the version type from unsigned to int. (riscv_set_arch): Use as_bad rather than as_fatal to report more errors. * testsuite/gas/riscv/attribute-02.d: Updated since x must be set with versions. * testsuite/gas/riscv/attribute-03.d: Likewise. * testsuite/gas/riscv/march-ok-two-nse.d: Likewise. * testsuite/gas/riscv/attribute-09.d: zicsr wasn't supported in the spec 2.2, so choose the newer spec. * testsuite/gas/riscv/march-fail-base-01.l: Updated since as_bad. * testsuite/gas/riscv/march-fail-base-02.l: Likewise. * testsuite/gas/riscv/march-fail-order-std.l: Likewise. * testsuite/gas/riscv/march-fail-order-x.l: Likewise. * testsuite/gas/riscv/march-fail-order-z.l: Likewise. * testsuite/gas/riscv/march-fail-porder.l: Likewise. * testsuite/gas/riscv/march-fail-rv32ef.l: Likewise. * testsuite/gas/riscv/march-fail-rv32id.l: Likewise. * testsuite/gas/riscv/march-fail-rv32iq.l: Likewise. * testsuite/gas/riscv/march-fail-rv64iq.l: Likewise. * testsuite/gas/riscv/march-fail-single-char.l: Likewise. * testsuite/gas/riscv/march-fail-unknown-std.l: Likewise. * testsuite/gas/riscv/march-fail-unknown.l: Likewise. * testsuite/gas/riscv/march-fail-uppercase.l: Likewise. * testsuite/gas/riscv/march-fail-version.l: Likewise. * testsuite/gas/riscv/march-fail-isa-spec.d: Likewise. * testsuite/gas/riscv/march-fail-isa-spec.l: Likewise. include/ * opcode/riscv.h (riscv_ext_version): Change the version type from unsigned to int.
2020-12-01RISC-V: Remove the unimplemented extensions.Nelson Chu2-11/+5
Although spec had defined and ratified p, v and n extensions, but we don't have any related implementaitons so far, so keep them in the supported extension table looks weird. Remove them until we have the related implementations. opcodes/ * riscv-opc.c (riscv_ext_version_table): Remove the p, v, n and their versions.
2020-12-01RISC-V: Add zifencei and prefixed h class extensions.Nelson Chu12-4/+61
bfd/ * elfxx-riscv.c (riscv_parse_std_ext): Stop parsing standard extensions when parsed h keyword. (riscv_get_prefix_class): Support prefixed h class. (riscv_std_h_ext_strtab): Likewise. (riscv_ext_h_valid_p): Likewise. (parse_config): Likewise. (riscv_std_z_ext_strtab): Add zifencei. * elfxx-riscv.h (riscv_isa_ext_class): Add RV_ISA_CLASS_H. gas/ * testsuite/gas/riscv/march-fail-order-z.d: New testcase, check orders of prefixed z extensions. * testsuite/gas/riscv/march-fail-order-z.l: Likewise. * testsuite/gas/riscv/march-fail-single-char-h.d: New testcase. * testsuite/gas/riscv/march-fail-single-char.l: Updated. * testsuite/gas/riscv/march-fail-unknown-h.d: New testcase. * testsuite/gas/riscv/march-fail-unknown.l: Updated. opcodes/ * riscv-opc.c (riscv_ext_version_table): Add zifencei.
2020-12-01RISC-V: Don't allow any uppercase letter in the arch string.Nelson Chu6-3/+29
Although I cannot find any RISC-V specs said that uppercases are not allowed in the arhc string, but seems like it is an established fact both for GNU and LLVM. Therefore, we shouldn't allow the uppercases for the non-standard x extensions, too. bfd/ * elfxx-riscv.c (riscv_parse_subset): ISA string cannot contain any uppercase letter. gas/ * testsuite/gas/riscv/march-fail-uppercase-base.d: Updated. * testsuite/gas/riscv/march-fail-uppercase.l: Updated. * testsuite/gas/riscv/march-fail-uppercase-x.d: New testcase.
2020-12-01RISC-V: Minor cleanup and testcases improvement for arch string parser.Nelson Chu58-183/+283
Re-indent the related codes, unify and improve the related error messages and comments. Besies, also re-write the testcases to cover more cases. bfd/ * elfxx-riscv.c: Re-indent codes, unify and improve the error messages and comments. (riscv_parse_prefixed_ext): Stop parsing the prefixed class extensions if the class is RV_ISA_CLASS_UNKNOWN, I get internal errors before adding this check for march-fail-porder* testcases. (riscv_parse_subset): Move the rv32 with q checking in front. * elfxx-riscv.h: Likewise. gas/ (These are new testcases that cover more cases) * testsuite/gas/riscv/march-fail-base-01.d: The first extension must be e, i or g. * testsuite/gas/riscv/march-fail-base-01.l: Likewise. * testsuite/gas/riscv/march-fail-base-02.d: rv64e is an invalid base ISA. * testsuite/gas/riscv/march-fail-base-02.l: Likewise. * testsuite/gas/riscv/march-fail-order-std.d: Check orders of standard extensions. * testsuite/gas/riscv/march-fail-order-std.l: Likewise. * testsuite/gas/riscv/march-fail-order-x.d: Check orders of prefixed x extensions. * testsuite/gas/riscv/march-fail-order-x.l: Likewise. * testsuite/gas/riscv/march-fail-porder-x-std.d: Check orders when standard and prefixed extensions are set at the same time. * testsuite/gas/riscv/march-fail-porder-x-z.d: Likewise. * testsuite/gas/riscv/march-fail-porder-z-std.d: Likewise. * testsuite/gas/riscv/march-fail-porder.l: Likewise. * testsuite/gas/riscv/march-fail-single-char-s.d: Only standard extensions can use single char. * testsuite/gas/riscv/march-fail-single-char-x.d: Likewise. * testsuite/gas/riscv/march-fail-single-char-z.d: Likewise. * testsuite/gas/riscv/march-fail-single-char.l: Likewise. * testsuite/gas/riscv/march-fail-unknown-s.d: All extensions should be known, except the non-standard x extensions. * testsuite/gas/riscv/march-fail-unknown-std.d: Likewise. * testsuite/gas/riscv/march-fail-unknown-std.l: Likewise. * testsuite/gas/riscv/march-fail-unknown-z.d: Likewise. * testsuite/gas/riscv/march-fail-unknown.l: Likewise. * testsuite/gas/riscv/march-fail-uppercase-base.d: Do not allow any uppercase in the arch string. * testsuite/gas/riscv/march-fail-uppercase-std.d: Likewise. * testsuite/gas/riscv/march-fail-uppercase-z.d: Likewise. * testsuite/gas/riscv/march-fail-uppercase.l: Likewise. * testsuite/gas/riscv/march-fail-version-x.d: Failed to set versions. * testsuite/gas/riscv/march-fail-version-z.d: Likewise. * testsuite/gas/riscv/march-fail-version.l: Likewise. * testsuite/gas/riscv/march-fail-rv32ef.l: Updated. * testsuite/gas/riscv/march-fail-rv32id.d: Need f-ext. * testsuite/gas/riscv/march-fail-rv32iq.d: Should be rv64. * testsuite/gas/riscv/march-fail-rv32iq.l: Likewise. * testsuite/gas/riscv/march-fail-rv64iq.d: Need d-ext and f-ext. * testsuite/gas/riscv/march-fail-rv64iq.l: Likewise. (The following testcases are removed and covered by new testcases) * testsuite/gas/riscv/march-fail-rv32i.d: march-fail-uppercase-base. * testsuite/gas/riscv/march-fail-rv32i.l: Likewise. * testsuite/gas/riscv/march-fail-rv32iam.d: march-fail-order-std. * testsuite/gas/riscv/march-fail-rv32iam.l: Likewise. * testsuite/gas/riscv/march-fail-rv32ic.d: march-fail-uppercase-std. * testsuite/gas/riscv/march-fail-rv32ic.l: Likewise. * testsuite/gas/riscv/march-fail-rv32icx2p.d: march-fail-version-x. * testsuite/gas/riscv/march-fail-rv32icx2p.l: Likewise. * testsuite/gas/riscv/march-fail-rv32imc.d: march-fail-order-std. * testsuite/gas/riscv/march-fail-rv32imc.l: Likewise. * testsuite/gas/riscv/march-fail-rv64I.d: march-fail-uppercase-std. * testsuite/gas/riscv/march-fail-rv64I.l: Likewise. * testsuite/gas/riscv/march-fail-rv64e.d: march-fail-base-02. * testsuite/gas/riscv/march-fail-rv64e.l: Likewise. * testsuite/gas/riscv/march-fail-s-with-version.d: march-fail-unknown-s. * testsuite/gas/riscv/march-fail-s-with-version.l: Likewise. * testsuite/gas/riscv/march-fail-s.d: march-fail-unknown-s. * testsuite/gas/riscv/march-fail-s.l: Likewise. * testsuite/gas/riscv/march-fail-sx.d: march-fail-unknown-s. * testsuite/gas/riscv/march-fail-sx.l: Likewise.
2020-12-01tic6x elf testsuite fixAlan Modra3-3/+9
* testsuite/ld-elf/elf.exp: Set ASFLAGS for tic6x. * testsuite/ld-elf/reloc-discard.d: Remove tic6x xfail.
2020-12-01PR26979, Visibility of undefined foo@v1 should constrain foo@@v1Alan Modra19-29/+99
Also, undefined foo should constrain the visibility of foo@@v1 just as it does for a later plain foo definition. bfd/ PR 26979 * elf-bfd.h (elf_backend_merge_symbol_attribute): Update prototype. * elf32-m68hc1x.h (elf32_m68hc11_merge_symbol_attribute): Likewise. * elfxx-mips.h (_bfd_mips_elf_merge_symbol_attribute): Likewise. * elfxx-x86.h (_bfd_x86_elf_merge_symbol_attribute): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_merge_symbol_attribute): Replace isym parameter with st_other. Adjust code. * elf64-alpha.c (elf64_alpha_merge_symbol_attribute): Likewise. * elf64-ppc.c (ppc64_elf_merge_symbol_attribute): Likewise. * elfnn-aarch64.c (elfNN_aarch64_merge_symbol_attribute): Likewise. * elfxx-mips.c (_bfd_mips_elf_merge_symbol_attribute): Likewise. * elfxx-x86.c (_bfd_x86_elf_merge_symbol_attribute): Likewise. * elflink.c (elf_merge_st_other): Likewise. (_bfd_elf_merge_symbol, elf_link_add_object_symbols): Adjust to suit. (_bfd_elf_copy_link_hash_symbol_type): Likewise. (_bfd_elf_add_default_symbol): Merge st_other from undecorated symbol and @VER symbol to @@VER symbol. ld/ * testsuite/ld-elf/pr26979a.s, * testsuite/ld-elf/pr26979b.s, * testsuite/ld-elf/pr26979c.s, * testsuite/ld-elf/pr26979.ver, * testsuite/ld-elf/pr26979a.d, * testsuite/ld-elf/pr26979b.d: New tests.
2020-12-01Automatic date update in version.inGDB Administrator1-1/+1
2020-11-30ld: Xfail PR ld/26936 test if not supportedH.J. Lu2-0/+13
Linkonce sections and comdat groups can be mixed only if comdat groups have only a single member with matching symbol table entries. Xfail ld/26936 test: 1. If comdat groups always have more than one member. 2. If symbol table entries in linkonce and comdat group don't match. 3. If the assembly source file is renamed. PR ld/26936 * testsuite/ld-elf/pr26936.d: Xfail targets which don't support mixing linkonce and comdat sections.
2020-11-30Revert accidental empty commitsTom de Vries2-11/+0
Revert empty commits: - "[gdb] Don't return non-existing path in debuginfod_source_query" commit 59404f827cb1134b68dbf228d380ff86d15c9f01 - "[gdb/testsuite] Fix minimal encodings KPASSes" commit 61049d1ee59905589b2ad3f8140a2582e01add7a
2020-11-30[gdb/symtab] Fix gdb.base/vla-optimized-out.exp with clangTom de Vries4-8/+21
Consider test-case gdb.base/vla-optimized-out.exp, compiled using clang-10. GDB fails to get the size of the vla a: ... (gdb) p sizeof (a)^M Cannot access memory at address 0x6^M (gdb) FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of \ optimized out vla ... The relevant DWARF looks like this: the variable a: ... <2><12b>: Abbrev Number: 5 (DW_TAG_variable) <12c> DW_AT_name : a <132> DW_AT_type : <0x189> ... has type: ... <1><189>: Abbrev Number: 10 (DW_TAG_array_type) <18a> DW_AT_type : <0x198> <2><18e>: Abbrev Number: 11 (DW_TAG_subrange_type) <18f> DW_AT_type : <0x19f> <193> DW_AT_count : <0x117> ... with the count attribute equated to the value of this artificial variable: ... <2><117>: Abbrev Number: 4 (DW_TAG_variable) <118> DW_AT_location : 10 byte block: 75 1 10 ff ff ff ff f 1a 9f \ (DW_OP_breg5 (rdi): 1; DW_OP_constu: 4294967295; DW_OP_and; DW_OP_stack_value) <123> DW_AT_name : __vla_expr0 <127> DW_AT_type : <0x182> <12b> DW_AT_artificial : 1 ... The location description of the variable is terminated with DW_OP_stack_value, which according to the DWARF spec means that "the DWARF expression represents the actual value of the object, rather than its location". However, in attr_to_dynamic_prop, we set is_reference to true: ... baton->locexpr.is_reference = true; ... and use it in dwarf2_evaluate_property to dereference the value of the DWARF expression, which causes the access to memory at address 0x6. Fix this by ignoring the baton->locexpr.is_reference == true setting if the expression evaluation has ctx.location == DWARF_VALUE_STACK, such that we get: ... (gdb) p sizeof (a)^M $2 = 6^M (gdb) PASS: gdb.base/vla-optimized-out.exp: o1: printed size of \ optimized out vla ... Tested on x86_64-linux, with gcc. Tested the following test-cases (the ones mentioned in PR26905) on x86_64-linux with clang-10: - gdb.base/vla-optimized-out.exp - gdb.base/vla-ptr.exp - gdb.mi/mi-vla-c99 gdb/ChangeLog: 2020-11-30 Tom de Vries <tdevries@suse.de> PR symtab/26905 * dwarf2/loc.c (dwarf2_locexpr_baton_eval): Add and handle is_reference parameter. (dwarf2_evaluate_property): Update dwarf2_locexpr_baton_eval call. gdb/testsuite/ChangeLog: 2020-11-30 Tom de Vries <tdevries@suse.de> PR symtab/26905 * gdb.dwarf2/count.exp: Remove kfails.
2020-11-30[gdb/testsuite] Fix minimal encodings KPASSesTom de Vries1-0/+6
With current master I see a couple of KPASSes: ... KPASS: gdb.ada/enum_idx_packed.exp: scenario=minimal: ptype small \ (PRMS minimal encodings) ... KPASS: gdb.ada/mod_from_name.exp: scenario=minimal: print xp \ (PRMS minimal encodings) KPASS: gdb.ada/pckd_arr_ren.exp: scenario=minimal: print var \ (PRMS minimal encodings) ... The corresponding setup_kfail is called for everything before gnat 11. However, the test-cases also PASS for me with gnat-4.8, gnat-7.5.0 and gnat-8.4.0. Fix the KPASSes by limiting the setup_kfail to gnat 9 and 10. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-11-16 Tom de Vries <tdevries@suse.de> * gdb.ada/enum_idx_packed.exp: Limit setup_kfail to gnat 9 and 10. * gdb.ada/mod_from_name.exp: Same. * gdb.ada/pckd_arr_ren.exp: Same.