aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-10-23gdb: remove LA_PRINT_TYPEDEF macroAndrew Burgess3-4/+7
Remove the LA_PRINT_TYPEDEF macro, replace the single use with the macros definition. There should be no user visible changes after this commit. gdb/ChangeLog: * language.h (LA_PRINT_TYPEDEF): Delete. * typeprint.c (typedef_print): Call print_typedef directly on the current_language object.
2020-10-23gdb: move Modula2 language class into a header fileAndrew Burgess6-270/+308
Move the m2_language class from m2-lang.c into m2-lang.h. The benefit of this move is that we can remove trampoline functions. Currently the language implementation is split of different m2-* files with m2-lang.h including declaration for all the language implementation functions. Currently the m2_language class in m2-lang.c has member functions that then call the global functions declared in m2-lang.h. After this change the m2_language class is declared in m2-lang.h, and the member functions are the implementations defined in all the m2-* files. There should be no user visible changes after this commit. gdb/ChangeLog: * m2-exp.y (m2_parse): Rename to... (m2_language::parser): ...this. Update function signature. * m2-lang.c (m2_printchar): Renamed to m2_language::printchar. (m2_op_print): Rename to... (m2_language::op_print_tab): ...this, and make const. (exp_descriptor_modula2): Rename to... (m2_language::exp_descriptor_modula2): ...this. (class m2_language): Move to m2-lang.h. (m2_language::language_arch_info): New function, moved out of class declaration. (m2_language::printchar): New function, body from m2_printchar. (m2_language::printstr): New function, moved out of class declaration. (m2_language::emitchar): Likewise. * m2-lang.h (m2_parse): Delete declaration. (m2_print_typedef): Delete declaration. (m2_value_print_inner): Delete declaration. (class m2_language): Class declaration moved from m2-lang.c, larger functions are left in m2-lang.c. * m2-typeprint.c (m2_print_typedef): Rename to... (m2_language::print_typedef): ...this, and update function signature. * m2-valprint.c (m2_value_print_inner): Rename to... (m2_language::value_print_inner): ...this, replace use of LA_PRINT_STRING with a direct call to printstr member function, and update recursive call.
2020-10-23gdb: Merge auto and unknown language implementationsAndrew Burgess2-155/+76
The auto_language and unknown_language classes are basically the same except for the language names and store_sym_names_in_linkage_form_p which the unknown_language overrides to return true, while auto_language returns the default false. This commit creates a new parent class from which both of these languages can inherit. The two base classes are now greatly reduced. Some of the static helper functions which previously were called from both of these languages are now only called from one place, and so I've inlined them into the new class. There should be no user visible changes after this commit. gdb/ChangeLog: * language.c (default_is_string_type_p): Delete, implementation moved into auto_or_unknown_language::is_string_type_p. (unk_op_print_tab): Moved into auto_or_unknown_language::opcode_print_table. (unknown_language_arch_info): Delete, implementation moved into auto_or_unknown_language::language_arch_info. (class auto_or_unknown_language): New class, member functions copied from unknown_language class, with some updates. (class unknown_language): Most member functions moved into auto_or_unknown_language class. Inherit from auto_or_unknown_language class. (class auto_language): Inherit from auto_or_unknown_language. Delete most member functions.
2020-10-23Automatic date update in version.inGDB Administrator1-1/+1
2020-10-22Remove gdb_assert for TYPE_CODE_METHOD in stabs readerHannes Domani2-3/+4
It's possible to come across TYPE_CODE_UNDEF at this point in read_member_functions, which according to a comment in read_type is used for forward references. gdb/ChangeLog: 2020-10-22 Hannes Domani <ssbssa@yahoo.de> * stabsread.c (read_member_functions): Remove gdb_assert.
2020-10-22Don't create _Complex type name if there is no target type nameHannes Domani2-1/+5
This causes gdb to crash in strlen. Happens if init_complex_type is called for a type created by dbx_init_float_type in stabsread.c. gdb/ChangeLog: 2020-10-22 Hannes Domani <ssbssa@yahoo.de> * gdbtypes.c (init_complex_type): Check target type name.
2020-10-22gdb: remove unused macros from target-debug.hSimon Marchi2-16/+12
I noticed some clearly stale entries in target-debug.h (which contained references to VEC). I commented everything in target-debug.h and then uncommented things until it built again, it pointed out a few unused macros. Remove them. gdb/ChangeLog: * target-debug.h (target_debug_print_struct_target_ops_p): Remove. (target_debug_print_async_callback_ftype_p): Remove. (target_debug_print_struct_trace_state_variable_p): Remove. (target_debug_print_struct_traceframe_info_p): Remove. (target_debug_print_VEC__btrace_block_s__pp): Remove. (target_debug_print_enum_btrace_format): Remove. (target_debug_print_enum_info_proc_what): Remove. (target_debug_print_thread_info_pp): Remove. Change-Id: I7943d21ac6e78751fd7c65a45b345018623ac2f2
2020-10-22gdb: make target_ops::make_corefile_notes return a unique ptrSimon Marchi8-57/+82
Since we converted gdbarch_make_corefile_notes to returning a gdb::unique_xmalloc_ptr, I figured it would make sense to converted target_ops::make_corefile_notes as well. The only implementation of that is in procfs.c, and it should ideally be re-written as a gdbarch method (see comment in write_gcore_file_1), but in the mean time I guess it doesn't hurt to throw some unique pointer at it. I tested that it builds on Solaris 11 (gcc compile farm machine gcc211), but I am not able to test it, because I can't get GDB to start a process (I'll look at that separately). gdb/ChangeLog: * target.h (struct target_ops) <make_corefile_notes>: Change return type to unique pointer. * target.c (dummy_make_corefile_notes): Likewise. * exec.c (struct exec_target) <make_corefile_notes>: Likewise. (exec_target::make_corefile_notes): Likewise. * procfs.c (class procfs_target) <make_corefile_notes>: Likewise. (procfs_do_thread_registers): Adjust to unique pointer. (struct procfs_corefile_thread_data): Add constructor. <note_data>: Change type to unique pointer. (procfs_corefile_thread_callback): Adjust to unique pointer. (procfs_target::make_corefile_notes): Change return type to unique pointer. * target-delegates.c: Re-generate. * gcore.c (write_gcore_file_1): Adjust. * target-debug.h (target_debug_print_gdb_unique_xmalloc_ptr_char): New. Change-Id: I768fb17ac0f7adc67d2fe95e952c784fe0ac37ab
2020-10-22[gdb/symtab] Make find_block_in_blockvector more robustTom de Vries2-0/+7
While working on PR25858 I noticed that the following trigger patch: ... @@ -2918,6 +2918,7 @@ find_pc_sect_compunit_symtab const struct blockvector *bv; bv = COMPUNIT_BLOCKVECTOR (cust); + (volatile int)blockvector_contains_pc (bv, pc); b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); if (BLOCK_START (b) <= pc ... triggers this assert, which checks that the returned block indeed contains pc: ... @@ -170,7 +170,10 @@ find_block_in_blockvector { b = BLOCKVECTOR_BLOCK (bl, bot); if (BLOCK_END (b) > pc) - return b; + { + gdb_assert (BLOCK_START (b) <= pc); + return b; + } bot--; } ... when running test-case gdb.ada/bp_c_mixed_case.exp. It's possible that the trigger patch breaks an undocumented invariant: I've tried a build and test run without the trigger patch and did not manage to trigger the assert. For robustness-sake, fix the assert by bailing out if 'BLOCK_START (b) <= pc' doesn't hold. Tested on x86_64-linux. gdb/ChangeLog: 2020-10-22 Tom de Vries <tdevries@suse.de> * block.c (find_block_in_blockvector): Make sure the returned block contains pc.
2020-10-22gdb/dwarf: fix reading subprogram with DW_AT_specification (PR gdb/26693)Simon Marchi4-6/+107
Fix a regression introduced by commit 7188ed02d2a7 ("Replace dwarf2_per_cu_data::cu backlink with per-objfile map"). This patch targets both master and gdb-10-branch, since this is a regression from GDB 9. Analysis -------- The DWARF generated by the included test case looks like: 0x0000000b: DW_TAG_compile_unit DW_AT_language [DW_FORM_sdata] (4) 0x0000000d: DW_TAG_base_type DW_AT_name [DW_FORM_string] ("int") DW_AT_byte_size [DW_FORM_data1] (0x04) DW_AT_encoding [DW_FORM_sdata] (5) 0x00000014: DW_TAG_subprogram DW_AT_name [DW_FORM_string] ("apply") 0x0000001b: DW_TAG_subprogram DW_AT_specification [DW_FORM_ref4] (0x00000014 "apply") DW_AT_low_pc [DW_FORM_addr] (0x0000000000001234) DW_AT_high_pc [DW_FORM_data8] (0x0000000000000020) 0x00000030: DW_TAG_template_type_parameter DW_AT_name [DW_FORM_string] ("T") DW_AT_type [DW_FORM_ref4] (0x0000000d "int") 0x00000037: NULL 0x00000038: NULL Simply loading the file in GDB makes it crash: $ ./gdb -nx --data-directory=data-directory testsuite/outputs/gdb.dwarf2/pr26693/pr26693 [1] 15188 abort (core dumped) ./gdb -nx --data-directory=data-directory The crash happens here, where htab (a dwarf2_cu::die_hash field) is unexpectedly NULL while generating partial symbols: #0 0x000055555fa28188 in htab_find_with_hash (htab=0x0, element=0x7fffffffbfa0, hash=27) at /home/simark/src/binutils-gdb/libiberty/hashtab.c:591 #1 0x000055555cb4eb2e in follow_die_offset (sect_off=(unknown: 27), offset_in_dwz=0, ref_cu=0x7fffffffc110) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22951 #2 0x000055555cb4edfb in follow_die_ref (src_die=0x0, attr=0x7fffffffc130, ref_cu=0x7fffffffc110) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22968 #3 0x000055555caa48c5 in partial_die_full_name (pdi=0x621000157e70, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8441 #4 0x000055555caa4d79 in add_partial_symbol (pdi=0x621000157e70, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8469 #5 0x000055555caa7d8c in add_partial_subprogram (pdi=0x621000157e70, lowpc=0x7fffffffc5c0, highpc=0x7fffffffc5e0, set_addrmap=1, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8737 #6 0x000055555caa265c in scan_partial_symbols (first_die=0x621000157e00, lowpc=0x7fffffffc5c0, highpc=0x7fffffffc5e0, set_addrmap=1, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8230 #7 0x000055555ca98e3f in process_psymtab_comp_unit_reader (reader=0x7fffffffc6b0, info_ptr=0x60600009650d "\003int", comp_unit_die=0x621000157d10, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7614 #8 0x000055555ca9aa2c in process_psymtab_comp_unit (this_cu=0x621000155510, per_objfile=0x613000009f80, want_partial_unit=false, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7712 #9 0x000055555caa051a in dwarf2_build_psymtabs_hard (per_objfile=0x613000009f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8073 The special thing about this DWARF is that the subprogram at 0x1b is a template specialization described with DW_AT_specification, and has no DW_AT_name in itself. To compute the name of this subprogram, partial_die_full_name needs to load the full DIE for this partial DIE. The name is generated from the templated function name and the actual tempalate parameter values of the specialization. To load the full DIE, partial_die_full_name creates a dummy DWARF attribute of form DW_FORM_ref_addr that points to our subprogram's DIE, and calls follow_die_ref on it. This eventually causes load_full_comp_unit to be called for the exact same CU we are currently making partial symbols for: #0 load_full_comp_unit (this_cu=0x621000155510, per_objfile=0x613000009f80, skip_partial=false, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:9238 #1 0x000055555cb4e943 in follow_die_offset (sect_off=(unknown: 27), offset_in_dwz=0, ref_cu=0x7fffffffc110) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22942 #2 0x000055555cb4edfb in follow_die_ref (src_die=0x0, attr=0x7fffffffc130, ref_cu=0x7fffffffc110) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22968 #3 0x000055555caa48c5 in partial_die_full_name (pdi=0x621000157e70, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8441 #4 0x000055555caa4d79 in add_partial_symbol (pdi=0x621000157e70, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8469 #5 0x000055555caa7d8c in add_partial_subprogram (pdi=0x621000157e70, lowpc=0x7fffffffc5c0, highpc=0x7fffffffc5e0, set_addrmap=1, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8737 #6 0x000055555caa265c in scan_partial_symbols (first_die=0x621000157e00, lowpc=0x7fffffffc5c0, highpc=0x7fffffffc5e0, set_addrmap=1, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8230 #7 0x000055555ca98e3f in process_psymtab_comp_unit_reader (reader=0x7fffffffc6b0, info_ptr=0x60600009650d "\003int", comp_unit_die=0x621000157d10, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7614 #8 0x000055555ca9aa2c in process_psymtab_comp_unit (this_cu=0x621000155510, per_objfile=0x613000009f80, want_partial_unit=false, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7712 #9 0x000055555caa051a in dwarf2_build_psymtabs_hard (per_objfile=0x613000009f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8073 load_full_comp_unit creates a cutu_reader for the CU. Since a dwarf2_cu object already exists for the CU, load_full_comp_unit is expected to find it and pass it to cutu_reader, so that cutu_reader doesn't create a new dwarf2_cu for the CU. And this is the difference between before and after the regression. Before commit 7188ed02d2a7, the dwarf2_per_cu_data -> dwarf2_cu link was a simple pointer in dwarf2_per_cu_data. This pointer was set up when starting the read the partial symbols. So it was already available at that point where load_full_comp_unit gets called. Post-7188ed02d2a7, this link is per-objfile, kept in the dwarf2_per_objfile::m_dwarf2_cus hash map. The entry is only put in the hash map once the partial symbols have been successfully read, when cutu_reader::keep is called. Therefore, it is _not_ set at the point load_full_comp_unit is called. As a consequence, a new dwarf2_cu object gets created and initialized by load_full_comp_unit (including initializing that dwarf2_cu::die_hash field). Meanwhile, the dwarf2_cu object created and used by the callers up the stack does not get initialized for full symbol reading, and the dwarf2_cu::die_hash field stays unexpectedly NULL. Solution -------- Since the caller of load_full_comp_unit knows about the existing dwarf2_cu object for the CU we are reading (the one load_full_comp_unit is expected to find), we can simply make it pass it down, instead of having load_full_comp_unit look up the per-objfile map. load_full_comp_unit therefore gets a new `existing_cu` parameter. All other callers get updated to pass `per_objfile->get_cu (per_cu)`, so the behavior shouldn't change for them, compared to the current HEAD. A test is added, which is the bare minimum to reproduce the issue. Notes ----- The original problem was reproduced by downloading https://github.com/oneapi-src/oneTBB/releases/download/v2020.3/tbb-2020.3-lin.tgz and loading libtbb.so in GDB. This code was compiled with the Intel C/C++ compiler. I was not able to reproduce the issue using GCC, I think because GCC puts a DW_AT_name in the specialized subprogram, so there's no need for partial_die_full_name to load the full DIE of the subprogram, and the faulty code doesn't execute. gdb/ChangeLog: PR gdb/26693 * dwarf2/read.c (load_full_comp_unit): Add existing_cu parameter. (load_cu): Pass existing CU. (process_imported_unit_die): Likewise. (follow_die_offset): Likewise. gdb/testsuite/ChangeLog: PR gdb/26693 * gdb.dwarf2/template-specification-full-name.exp: New test. Change-Id: I57c8042f96c45f15797a3848e4d384181c56bb44
2020-10-22Fix gdb.base/msym*.exp failuresLuis Machado3-5/+11
AArch64 generates functions without a prologue for these two testcases, therefore we shouldn't expect the function location to be displayed with an offset. gdb/testsuite/ChangeLog: 2020-10-22 Luis Machado <luis.machado@linaro.org> * gdb.base/msym-bp-shl.exp (test_break): Adjust pattern to not expected an offset from the function. * gdb.base/msym-bp.exp (test): Likewise.
2020-10-22[PATCH][GAS][AArch64] Define BRBE system registersPrzemyslaw Wirkus7-2/+531
This patch introduces BRBE (Branch Record Buffer Extension) system registers. Note: as this is register only extension we do not want to hide these registers behind -march flag going forward (they should be enabled by default). gas/ChangeLog: 2020-10-08 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com> * NEWS: Docs update. * testsuite/gas/aarch64/brbe-invalid.d: New test. * testsuite/gas/aarch64/brbe-invalid.l: New test. * testsuite/gas/aarch64/brbe-invalid.s: New test. * testsuite/gas/aarch64/brbe.d: New test. * testsuite/gas/aarch64/brbe.s: New test. opcodes/ChangeLog: 2020-10-08 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com> * aarch64-opc.c: Add BRBE system registers.
2020-10-22aarch64: Define CSRE system registersPrzemyslaw Wirkus7-1/+83
This patch introduces CSRE (Call Stack Recorder Extension) system registers. Note: as this is register only extension we do not want to hide these registers behind -march flag going forward (they should be enabled by default). CSRE feature adds CSR PDEC (Decrements Call stack pointer by the size of a Call stack record) instruction. This instruction will be added in a following, separate patch. This change only adds CSRE system registers. gas/ChangeLog: 2020-10-08 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com> * NEWS: Docs update. * testsuite/gas/aarch64/csre-invalid.d: New test. * testsuite/gas/aarch64/csre-invalid.l: New test. * testsuite/gas/aarch64/csre-invalid.s: New test. * testsuite/gas/aarch64/csre.d: New test. * testsuite/gas/aarch64/csre.s: New test. opcodes/ChangeLog: 2020-10-08 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com> * aarch64-opc.c: New CSRE system registers defined.
2020-10-22gold: Skip bootstrap-test/bootstrap-test-r for LTO buildH.J. Lu3-4/+32
Skip bootstrap-test and bootstrap-test-r for LTO build due to different build IDs. * Makefile.am (bootstrap-test): Skip for LTO build. (bootstrap-test-r): Likewise.
2020-10-22ld: Skip bootstrap tests for -fprofile-generate=H.J. Lu4-17/+31
Make plug_opt available to all linker tests. Skip bootstrap tests when linker is compiled with -fprofile-generate=. * testsuite/ld-plugin/lto.exp (plug_opt): Moved to ... * testsuite/config/default.exp (plug_opt): Here. New. * testsuite/ld-bootstrap/bootstrap.exp: Skip when linker is compiled with -fprofile-generate=.
2020-10-22Fix gdb.base/corefile2.exp regression when running Docker/AUFSLuis Machado2-4/+15
The following failures started showing up after commit bb2a67773c - "Use a std::vector in target_section_table": FAIL: gdb.base/corefile2.exp: renamed binfile: print/x mbuf_ro[0]@4 FAIL: gdb.base/corefile2.exp: renamed binfile: print/x mbuf_ro[pagesize-4]@4 FAIL: gdb.base/corefile2.exp: renamed binfile: print/x mbuf_ro[-3]@6 FAIL: gdb.base/corefile2.exp: renamed binfile: print/x mbuf_rw[pagesize-3]@6 FAIL: gdb.base/corefile2.exp: renamed binfile: print/x mbuf_ro[pagesize-3]@6 I tracked it down to a problem in core_target::xfer_partial, at this point: if (!m_core_file_mappings.empty ()) xfer_status = xfer_memory_via_mappings (readbuf, writebuf, offset, len, xfered_len); else xfer_status = this->beneath ()->xfer_partial (object, annex, readbuf, writebuf, offset, len, xfered_len); It seems commit bb2a67773c uncovered a latent bug when handling a particular case where things are running within a Docker container using the AUFS storage driver. When building the file mappings for a core file, we call gdbarch_read_core_file_mappings, which in turn passes a couple lambda callbacks. One pre-loop and one in-loop. The catch is that commit bb2a67773c reworked the pre-loop lambda and made it do nothing. Before that commit, we always allocated m_core_file_mappings in that lambda. Now, when calling the in-loop lambda, we don't touch m_core_file_mappings because the bfd is nullptr (given Docker leaks the host system path, and that file doesn't exist within the container itself). So, instead, we add an entry to the m_core_unavailable_mappings vector. When we reach core_target::xfer_partial, we're only checking for an empty m_core_file_mappings. Given it is now empty, we take the path of reading the contents from the file, not the core file. This reads back unexpected results. The following patch fixes this by also checking for m_core_unavailable_mappings, given core_target::xfer_memory_via_mappings already handles the Docker/AUFS situation. gdb/ChangeLog: 2020-10-22 Luis Machado <luis.machado@linaro.org> * corelow.c (core_target::xfer_partial): Also check for an empty m_core_unavailable_mappings vector.
2020-10-22ld: Pass -fno-lto to non LTO testsH.J. Lu12-27/+64
* testsuite/config/default.exp (NOLTO_CFLAGS): New. * ld/testsuite/ld-elfcomm/elfcomm.exp: Add $NOLTO_CFLAGS to CC. * testsuite/ld-elfvers/vers.exp: Likewise. * testsuite/ld-elfvsb/elfvsb.exp: Likewise. * testsuite/ld-gc/gc.exp: Likewise. * testsuite/ld-plugin/plugin.exp: Likewise. * testsuite/ld-scripts/crossref.exp: Likewise. * testsuite/ld-selective/selective.exp: Likewise. * testsuite/ld-undefined/undefined.exp: Likewise. * testsuite/ld-srec/srec.exp: Add $NOLTO_CFLAGS to CC. Override CXXFLAGS. * testsuite/lib/ld-lib.exp (run_ld_link_tests): Prepend -fno-lto to cflags.
2020-10-22sim: move ChangeLog entries into the correct filesAndrew Burgess3-5/+8
Moves some ChangeLog entries under sim/ into the correct files.
2020-10-22arm: Fix the wrong error message string for mve vldr/vstr (PR26763).Srinath Parvathaneni5-1/+864
For mve vldr/vstr instructions assembler is throwing wrong error message. Instead of 'Error: syntax error' assembler fails with 'Error: lo register required'. This patch fixes the issue. eg: $ cat x.s .syntax unified .thumb vldrb.s16 q0, r0 Before this patch: $ arm-none-eabi-as x.s -march=armv8.1-m.main+mve -mfloat-abi=hard x.s: Assembler messages: x.s:4: Error: lo register required -- `vldrb.s16 q0,r0' After this patch: $ arm-none-eabi-as x.s -march=armv8.1-m.main+mve -mfloat-abi=hard x.s: Assembler messages: x.s:4: Error: syntax error -- `vldrb.s16 q0,r0' gas/ChangeLog: 2020-10-21 Srinath Parvathaneni <srinath.parvathaneni@arm.com> PR target/26763 * config/tc-arm.c (parse_address_main): Add new MVE addressing mode check. * testsuite/gas/arm/mve-vldr-vstr-bad.d: New test. * testsuite/gas/arm/mve-vldr-vstr-bad.l: Likewise. * testsuite/gas/arm/mve-vldr-vstr-bad.s: Likewise.
2020-10-22opcodes/po/es.po: Remove the duplicated entryH.J. Lu2-8/+4
Remove the duplicated entry in opcodes/po/es.po: binutils-gdb/opcodes/po/es.po:749: duplicate message definition... binutils-gdb/opcodes/po/es.po:742: ...this is the location of the first definition * po/es.po: Remove the duplicated entry.
2020-10-22binutils: Report error message on errorH.J. Lu2-0/+6
* testsuite/binutils-all/objcopy.exp (objcopy_test): Report error message on error.
2020-10-22Fix printf formatting errors where "0x" is used as a prefix for a decimal ↵Dr. David Alan Gilbert13-5093/+5090
number. bfd * po/es.po: Fix printf format binutils * windmc.c: Fix printf format gas * config/tc-arc.c: Fix printf format opcodes * po/es.po: Fix printf format sim * arm/armos.c: Fix printf format * ppc/emul_netbsd.c: Fix printf format -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
2020-10-22gdb/fortran: add support for parsing array strides in expressionsAndrew Burgess8-1/+84
With this commit GDB now understands the syntax of Fortran array strides, a user can type an expression including an array stride, but they will only get an error informing them that array strides are not supported. This alone is an improvement on what we had before in GDB, better to give the user a helpful message that a particular feature is not supported than to just claim a syntax error. Before: (gdb) p array (1:10:2, 2:10:2) A syntax error in expression, near `:2, 2:10:2)'. Now: (gdb) p array (1:10:2, 2:10:2) Fortran array strides are not currently supported Later commits will allow GDB to handle array strides correctly. gdb/ChangeLog: * expprint.c (dump_subexp_body_standard): Print RANGE_HAS_STRIDE. * expression.h (enum range_type): Add RANGE_HAS_STRIDE. * f-exp.y (arglist): Allow for a series of subranges. (subrange): Add cases for subranges with strides. * f-lang.c (value_f90_subarray): Catch use of array strides and throw an error. * parse.c (operator_length_standard): Handle RANGE_HAS_STRIDE. gdb/testsuite/ChangeLog: * gdb.fortran/array-slices.exp: Add a new test.
2020-10-22gdb: rename 'enum range_type' to 'enum range_flag'Andrew Burgess7-27/+46
To avoid confusion with other parts of GDB relating to types and ranges, rename this enum to make it clearer that it is a set of individual flags rather than an enumeration of different types of range. There should be no user visible changes after this commit. gdb/ChangeLog: * expprint.c (print_subexp_standard): Change enum range_type to range_flag and rename variables to match. (dump_subexp_body_standard): Likewise. * expression.h (enum range_type): Rename to... (enum range_flag): ...this. (range_types): Rename to... (range_flags): ...this. * f-lang.c (value_f90_subarray): Change enum range_type to range_flag and rename variables to match. * parse.c (operator_length_standard): Likewise. * rust-exp.y (rust_parser::convert_ast_to_expression): Change enum range_type to range_flag. * rust-lang.c (rust_evaluate_funcall): Likewise. (rust_range): Likewise. (rust_compute_range): Likewise. (rust_subscript): Likewise.
2020-10-22gdb: Convert enum range_type to a bit field enumAndrew Burgess8-94/+87
The expression range_type enum represents the following ideas: - Lower bound is set to default, - Upper bound is set to default, - Upper bound is exclusive. There are currently 6 entries in the enum to represent the combination of all those ideas. In a future commit I'd like to add stride information to the range, this could in theory appear with any of the existing enum entries, so this would take us to 12 enum entries. This feels like its getting a little out of hand, so in this commit I switch the range_type enum over to being a flags style enum. There's one entry to represent no flags being set, then 3 flags to represent the 3 ideas above. Adding stride information will require adding only one more enum flag. I've then gone through and updated the code to handle this change. There should be no user visible changes after this commit. gdb/ChangeLog: * expprint.c (print_subexp_standard): Update to reflect changes to enum range_type. (dump_subexp_body_standard): Likewise. * expression.h (enum range_type): Convert to a bit field enum, and make the enum unsigned. * f-exp.y (subrange): Update to reflect changes to enum range_type. * f-lang.c (value_f90_subarray): Likewise. * parse.c (operator_length_standard): Likewise. * rust-exp.y (rust_parser::convert_ast_to_expression): Likewise. * rust-lang.c (rust_range): Likewise. (rust_compute_range): Likewise. (rust_subscript): Likewise.
2020-10-22Automatic date update in version.inGDB Administrator1-1/+1
2020-10-21gdb: fix two comments in infrunSimon Marchi2-3/+7
These comments are stale, they refer to non-existent parameters. Fix that. gdb/ChangeLog: * infrun.c (displaced_step_in_progress_thread): Fix comment. (displaced_step_in_progress): Fix comment. Change-Id: I7a39f1338fbfbf73153b49cbca0345d495d12762
2020-10-21Remove libctf/mkerrors.sedTom Tromey7-114/+104
This patch removes libctf/mkerrors.sed, replacing it with a macro in ctf-api.h. This simplifies the build and avoids possible unportable code in the sed script. 2020-10-21 Tom Tromey <tromey@adacore.com> * ctf-api.h (_CTF_ERRORS): New macro. libctf/ChangeLog 2020-10-21 Tom Tromey <tromey@adacore.com> * mkerrors.sed: Remove. * ctf-error.c (_CTF_FIRST): New define. (_CTF_ITEM): Define this, not _CTF_STR. (_ctf_errlist, _ctf_erridx): Use _CTF_ERRORS. (ERRSTRFIELD): Rewrite. (ERRSTRFIELD1): Remove. * Makefile.in: Rebuild. * Makefile.am (BUILT_SOURCES): Remove. (ctf-error.h): Remove.
2020-10-21aarch64: Add testcase for HCR_EL2 system registerPrzemyslaw Wirkus2-0/+11
HCR_EL2 is a 64-bit Hypervisor Configuration Register. gas/ChangeLog: 2020-10-16 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com> * testsuite/gas/aarch64/sysreg-6.d: New test. * testsuite/gas/aarch64/sysreg-6.s: New test.
2020-10-21Work around problem in DWARF decoding library which can result in attempts ↵Nick Clifton2-18/+36
to read arbitrary bytes as if they were an LEB128 encoded value. * dwarf.c (skip_attr_bytes): Accept DWARF versions higher than 4 when processing the DW_FORM_ref_addr form. Skip bytes in DW_FORM_block and DW_FORM_exprloc forms. Handle DW_FORM_indirect. (get_type_signedness): Allow a limited amount of recursion. Do not attempt to decode types that use the DW_FORM_ref_addr form. (read_and_display_attr_value): Do not attempt to decode types that use the DW_FORM_ref_addr form.
2020-10-21gdb: make gdbarch_make_corefile_notes return a unique ptrSimon Marchi7-122/+185
This patch starts by making the gdbarch_make_corefile_notes function return a gdb::unique_xmalloc_ptr<char> and takes care of the fallouts, mostly in linux-tdep.c and fbsd-tdep.c. The difficulty in these files is that they use the BFD API for writing core files, where you pass in a pointer to a malloc-ed buffer (or NULL in the beginning), it re-allocs it if needed, and returns you the possibly updated pointer. I therefore used this pattern everywhere: note_data.reset (elfcore_write_note (obfd, note_data.release (), ...) This hands over the ownership of note_data to the BFD function for the duration of the call, and then puts its back in note_data right after the call. gdb/ChangeLog: * gdbarch.sh (make_corefile_notes): Return unique pointer. * gdbarch.c: Re-generate. * gdbarch.h: Re-generate. * gcore.c (write_gcore_file_1): Adjust. * fbsd-tdep.c (struct fbsd_collect_regset_section_cb_data): Add constructor. <note_data>: Change type to unique pointer. <abort_iteration>: Change type to bool. (fbsd_collect_regset_section_cb): Adjust to unique pointer. (fbsd_collect_thread_registers): Return void, adjust. (struct fbsd_corefile_thread_data): Add construtor. <note_data>: Change type to unique pointer. (fbsd_corefile_thread): Adjust. (fbsd_make_corefile_notes): Return unique pointer, adjust. * linux-tdep.c (linux_make_mappings_corefile_notes): Change type to unique pointer, adjust. (struct linux_collect_regset_section_cb_data): Add constructor. <note_data>: Change type to unique pointer. <abort_iteration>: Change type to bool. (linux_collect_thread_registers): Return void, adjust. (struct linux_corefile_thread_data): Add constructor. <note_data>: Change type to unique pointer. (linux_corefile_thread): Adjust. (linux_make_corefile_notes): Return unique pointer, adjust. Change-Id: I1e03476bb47b87c6acb3e12204d193f38cc4e02b
2020-10-21gdbserver: fix overlap in sprintf argument and bufferSimon Marchi2-2/+9
While trying to build on Cygwin (gcc 10.2.0), I got: CXX server.o /home/Baube/src/binutils-gdb/gdbserver/server.cc: In function 'void handle_general_set(char*)': /home/Baube/src/binutils-gdb/gdbserver/server.cc:832:12: error: 'sprintf' argument 3 overlaps destination object 'own_buf' [-Werror=restrict] 832 | sprintf (own_buf, "E.Unknown thread-events mode requested: %s\n", | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 833 | mode); | ~~~~~ /home/Baube/src/binutils-gdb/gdbserver/server.cc:553:27: note: destination object referenced by 'restrict'-qualified argument 1 was declared here 553 | handle_general_set (char *own_buf) | ~~~~~~^~~~~~~ There is indeed a problem: mode points somewhere into own_buf. And by the time mode gets formatted as a %s, whatever it points to has been overwritten. I hacked gdbserver to coerce it into that error path, and this is the resulting message: (gdb) p own_buf $1 = 0x629000000200 "E.Unknown thread-events mode requested: ad-events mode requested: 00;10:9020fdf7ff7f0000;thread:p49388.49388;core:e;\n" Fix it by formatting the error string in an std::string first. gdbserver/ChangeLog: * server.cc (handle_general_set): Don't use sprintf with argument overlapping buffer. Change-Id: I4fdf05c0117f63739413dd67ddae7bd6ee414824
2020-10-21Fix gdb.mi/mi-fullname-deleted.exp with ClangGary Benson2-4/+27
gdb.mi/mi-fullname-deleted.exp attempts to generate an executable with a doubled slash in the source filename recorded in its debug info. This attempt fails when compiling using Clang, causing the substituted filename test to fail. This commit fixes this issue. It also expands the comments in the file, to clarify what the test is attempting to do, and to document where it doesn't succeed. gdb/testsuite/ChangeLog: * gdb.mi/mi-fullname-deleted.exp: Fix substituted fullname test with Clang. Also expand comments generally.
2020-10-21Automatic date update in version.inGDB Administrator1-1/+1
2020-10-20gdb: make gdbarch_displaced_step_hw_singlestep return boolSimon Marchi10-14/+28
Replace the int-used-as-a-bool with a bool. gdb/ChangeLog: * gdbarch.sh (displaced_step_hw_singlestep): Return bool. * gdbarch.c: Re-generate. * gdbarch.h: Re-generate. * aarch64-tdep.c (aarch64_displaced_step_hw_singlestep): Return bool. * aarch64-tdep.h (aarch64_displaced_step_hw_singlestep): Likewise. * arch-utils.h (default_displaced_step_hw_singlestep): Likewise. * arch-utils.c (default_displaced_step_hw_singlestep): Likewise. * rs6000-tdep.c (ppc_displaced_step_hw_singlestep): Likewise. * s390-tdep.c (s390_displaced_step_hw_singlestep): Likewise. Change-Id: I76a78366dc5c0afb03f8f4bddf9f4e8d68fe3114
2020-10-20gdb: make gdbarch predicates return boolSimon Marchi4-124/+130
gdbarch predicates (functions suffixed _p to check whether a gdbarch implements a given method) currently return int. Make them return bool. There is no expected behavior change. gdb/ChangeLog: * gdbarch.sh: Make generated predicates return bool. * gdbarch.c: Re-generate. * gdbarch.h: Re-generate. Change-Id: Ie7ebc1acae62df83da9085ba69327fca551c5a30
2020-10-20Remove varobj_item typedefTom Tromey2-2/+6
While working on some minor varobj cleanups, I noticed this obvious one: the varobj_item typedef isn't redundant in C++, and so can be removed. gdb/ChangeLog 2020-10-20 Tom Tromey <tom@tromey.com> * varobj-iter.h (struct varobj_item): Remove typedef.
2020-10-20Add AMD znver3 processor supportGanesh Gopalasubramanian25-4216/+4757
gas/ * config/tc-i386.c (cpu_arch): Add CPU_ZNVER3_FLAGS flags. (i386_align_code): Add PROCESSOR_ZNVER cases. * doc/c-i386.texi: Add znver3, snp, invlpgb and tlbsync. * gas/i386/i386.exp: Add new znver3 test cases. * gas/i386/arch-14-znver3.d: New. * gas/i386/arch-14.d: New. * gas/i386/arch-14.s: New. * gas/i386/invlpgb.d: New. * gas/i386/invlpgb64.d: New. * gas/i386/invlpgb.s: New. * gas/i386/snp.d: New. * gas/i386/snp64.d: New. * gas/i386/snp.s: New. * gas/i386/tlbsync.d: New. * gas/i386/tlbsync.s: New. * gas/i386/x86-64-arch-4-znver3.d: New. * gas/i386/x86-64-arch-4.d: New. * gas/i386/x86-64-arch-4.s: New. opcodes/ * i386-dis.c (rm_table): Add tlbsync, snp, invlpgb. * i386-gen.c (cpu_flag_init): Add new CPU_INVLPGB_FLAGS, CPU_TLBSYNC_FLAGS, and CPU_SNP_FLAGS. Add CPU_ZNVER3_FLAGS. (cpu_flags): Add CpuINVLPGB, CpuTLBSYNC, CpuSNP. * i386-opc.h: Add CpuINVLPGB, CpuTLBSYNC, CpuSNP. * i386-opc.tbl: Add invlpgb, tlbsync, psmash, pvalidate, rmpupdate, rmpadjust. * i386-init.h: Re-generated. * i386-tbl.h: Re-generated.
2020-10-20gdb: change some int to bool in infrun.cSimon Marchi2-70/+98
Change these int-used-as-a-bool to bool. I searched for "static int" in that file and changed what I found. gdb/ChangeLog: * infrun.c (currently_stepping): Change int to bool (maybe_software_singlestep): Likewise. (show_stop_on_solib_events): Likewise. (stepping_past_nonsteppable_watchpoint): Likewise. (displaced_step_in_progress_any_inferior): Likewise. (displaced_step_in_progress_thread): Likewise. (keep_going_stepped_thread): Likewise. (thread_still_needs_step_over): Likewise. (start_step_over): Likewise. (do_target_resume): Likewise. (resume_1): Likewise. (clear_proceed_status): Likewise. (thread_still_needs_step_over_bp): Likewise. (proceed): Likewise. (switch_back_to_stepped_thread): Likewise. (adjust_pc_after_break): Likewise. (stepped_in_from): Likewise. (handle_stop_requested): Likewise. (handle_syscall_event): Likewise. (handle_no_resumed): Likewise. (handle_inferior_event): Likewise. (finish_step_over): Likewise. (handle_signal_stop): Likewise. (process_event_stop_test): Likewise. Change-Id: I897527c4a3da5e647f9d97f7d4477649985b8b77
2020-10-20gdb: fix comment of get_displaced_stepping_stateSimon Marchi2-1/+5
The comment mentions PID instead of INF, fix that. gdb/ChangeLog: * infrun.c (get_displaced_stepping_state): Fix comment. Change-Id: Id9554807c50792db1fcdb7c14590397d1fa6f8f7
2020-10-20Fix undefined behavior in gdbserverTom Tromey2-1/+7
PR gdb/26742 points out some undefined behavior in gdbserver. The bug is that remove_thread does: free_one_thread (thread); if (current_thread == thread) current_thread = NULL; However, the equality check is undefined, because "thread" has already been freed. This patch fixes the bug by moving the check earlier. Tested on x86-64 Fedora 32. 2020-10-20 Tom Tromey <tromey@adacore.com> PR gdb/26742: * inferiors.cc (remove_thread): Clear current_thread before freeing the thread.
2020-10-20Fix help string of alias commandAndreas Schwab2-2/+6
* cli/cli-cmds.c (_initialize_cli_cmds): Fix alias command help.
2020-10-20[gdb/testsuite] Remove superfluous marker in pr13961.STom de Vries2-1/+4
When looking at readelf output for test-case gdb.dwarf2/pr13961.exp, we have: ... $ readelf -wi ./outputs/gdb.dwarf2/pr13961/pr13961 ... <0><14c>: Abbrev Number: 0 readelf: Warning: Bogus end-of-siblings marker detected at offset 14c in \ .debug_info section ... Fix this by removing the superfluous end-of-siblings marker. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-10-20 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/pr13961.S: Remove superfluous end-of-siblings marker.
2020-10-20[gdb/testsuite] Use main.c in gdb.dwarf2Tom de Vries21-232/+33
Eliminate copies of main.c in gdb.dwarf2. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-10-20 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/arr-stride.c: Remove. * gdb.dwarf2/arr-stride.exp: Use main.c. * gdb.dwarf2/arr-subrange.c: Remove. * gdb.dwarf2/arr-subrange.exp: Use main.c. * gdb.dwarf2/bad-regnum.c: Remove. * gdb.dwarf2/bad-regnum.exp: Use main.c. * gdb.dwarf2/corrupt.c: Remove. * gdb.dwarf2/corrupt.exp: Use main.c. * gdb.dwarf2/dw2-bad-elf.c: Remove. * gdb.dwarf2/dw2-bad-elf.exp: Use main.c. * gdb.dwarf2/dw2-icycle.c: Remove. * gdb.dwarf2/dw2-icycle.exp: Use main.c. * gdb.dwarf2/formdata16.c: Remove. * gdb.dwarf2/formdata16.exp: Use main.c. * gdb.dwarf2/implptrconst.c: Remove. * gdb.dwarf2/implptrconst.exp: Use main.c. * gdb.dwarf2/info-locals-optimized-out.c: Remove. * gdb.dwarf2/info-locals-optimized-out.exp: Use main.c. * gdb.dwarf2/opaque-type-lookup.c: Remove. * gdb.dwarf2/opaque-type-lookup.exp: Use main.c.
2020-10-20[gdb/testsuite] Clean up redundant info in gdb.dwarf2Tom de Vries3-2/+8
In gdb.dwarf2/ada-valprint-error.exp we find: ... untested ${testfile}.exp ... such that we have: ... UNTESTED: gdb.dwarf2/ada-valprint-error.exp: ada-valprint-error.exp ... Fix this and a likewise unsupported message in gdb.dwarf2/dw2-dir-file-name.exp. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-10-20 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/ada-valprint-error.exp: Remove redundant mention of .exp file. * gdb.dwarf2/dw2-dir-file-name.exp: Same.
2020-10-20[gdb/testsuite] Use $gdb_test_file_name in gdb.dwarf2Tom de Vries8-14/+22
In f.i. gdb.dwarf2/dw2-line-number-zero.exp we find: ... verbose "Skipping dw2-line-number-zero test." ... Make the skip messages use the gdb_test_file_name variable, to reduce the amount of changes that needs to be made when coping a test-case. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-10-20 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/dw2-error.exp: Use $gdb_test_file_name. * gdb.dwarf2/dw2-line-number-zero.exp: Same. * gdb.dwarf2/dw2-main-no-line-number.exp: Same. * gdb.dwarf2/dw2-ranges-base.exp: Same. * gdb.dwarf2/dw2-ranges.exp: Same. * gdb.dwarf2/dw2-vendor-extended-opcode.exp: Same. * gdb.dwarf2/var-access.exp: Same.
2020-10-20readelf.c display_lto_symtab offset outside bounds of constant stringAlan Modra2-37/+77
Using gcc-10 or current mainline gcc, binutils configured with --disable-nls results in: readelf.c: In function 'display_lto_symtab': readelf.c:12283:26: error: offset '17' outside bounds of constant string [-Werror=array-bounds] 12283 | SECTION_NAME (section) + strlen (".gnu.lto_.symtab.")) > 0 | ^ Which is actually a bogus warning in this case because we've already checked the name string for validity, so SECTION_NAME won't ever be "<none>", "<no-strings>" or "<corrupt>". This patch fixes the problem by making SECTION_NAME simply return the string from the string table. Other places also shouldn't be trying to match any of the error strings against a section name, so fix them too. * readelf.c: Delete whitespace at end of line throughout. (SECTION_NAME, SECTION_NAME_VALID): New. (SECTION_NAME_PRINT): Rename from SECTION_NAME. Formatting. (printable_section_name, dump_relocations): Use SECTION_NAME_PRINT. (process_section_headers, process_section_groups): Likewise. (shdr_to_ctf_sect): Likewise. (find_section, find_section_in_set): Use SECTION_NAME_VALID. (ia64_process_unwind, hppa_process_unwind): Likewise. (display_debug_section, initialise_dumps_byname): Likewise. (process_lto_symbol_tables): Likewise. Check trailing period of lto symbol table names. (display_lto_symtab): Use sizeof instead of strlen.
2020-10-20binutils: Add myself as RISC-V co-maintainer.Nelson Chu2-0/+5
binutils/ * MAINTAINERS (RISC-V): Add myself as RISC-V co-maintainer.
2020-10-20Automatic date update in version.inGDB Administrator1-1/+1
2020-10-19Don't erase TUI source window when switching focusTom Tromey5-7/+24
PR tui/26719 points out that switching the focus can erase the TUI source window. This is a regression introduced by the patch to switch the source window to using a pad. This patch fixes the bug by arranging to call prefresh whenever the window is refreshed. 2020-10-19 Tom Tromey <tromey@adacore.com> PR tui/26719 * tui/tui-winsource.h (struct tui_source_window_base) <refresh_window>: Rename from refresh_pad. * tui/tui-winsource.c (tui_source_window_base::refresh_window): Rename from refresh_pad. (tui_source_window_base::show_source_content) (tui_source_window_base::do_scroll_horizontal): Update. gdb/testsuite/ChangeLog 2020-10-19 Tom Tromey <tromey@adacore.com> PR tui/26719 * gdb.tui/list.exp: Check source window contents after focus change.