aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-07-20Move struct buildsym_compunit to buildsym.hTom Tromey3-344/+365
This moves struct buildsym_compunit to buildsym.h. Now that the members are private, and it no longer affects any global state in buildsym.c, an instance can be used directly for symtab creation. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * buildsym.h (struct buildsym_compunit): Move from buildsym.c. * buildsym.c (struct buildsym_compunit): Move to buildsym.h. (buildsym_compunit::buildsym_compunit) (buildsym_compunit::~buildsym_compunit) (buildsym_compunit::get_macro_table): Define.
2018-07-20Remove reset_symtab_globalsTom Tromey2-16/+13
This patch arranges for the remaining buildsym global -- buildsym_compunit -- to only be cleared by the wrapper functions, not by methods on struct buildsym_compunit. In the process, reset_symtab_globals is removed. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * buildsym.c (reset_symtab_globals): Remove. (buildsym_compunit::end_symtab_from_static_block): Update. (buildsym_compunit::augment_type_symtab): Update. (end_symtab_from_static_block): Call free_buildsym_compunit. (augment_type_symtab, end_symtab, end_expandable_symtab): Likewise.
2018-07-20Do not use buildsym.h in some filesTom Tromey5-4/+7
A few files no longer need to include buildsym.h. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * arch-utils.c: Do not include buildsym.h. * mipsread.c: Do not include buildsym.h. * machoread.c: Do not include buildsym.h. * elfread.c: Do not include buildsym.h.
2018-07-20Add many methods to buildsym_compunitTom Tromey2-188/+455
This adds many methods to buildsym_compunit and makes the data members private. Essentially the entire buildsym API is now available as a method on buildsym_compunit. However, standalone functions are still provided, as this is what the sybmol readers actually use. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * buildsym.c (buildsym_compunit::buildsym_compunit): Do more initialization. (buildsym_compunit): Add new constructor. (struct buildsym_compunit) <get_last_source_file, finish_block, record_block_range, start_subfile, patch_subfile_names, push_subfile, pop_subfile, record_line, get_compunit_symtab, set_last_source_start_addr, get_last_source_start_addr, get_local_using_directives, set_local_using_directives, get_global_using_directives, outermost_context_p, get_current_context_stack, get_context_stack_depth, get_current_subfile, get_local_symbols, get_file_symbols, get_global_symbols, record_debugformat, record_producer, push_context, pop_context, end_symtab_get_static_block, end_symtab_from_static_block, end_symtab, end_expandable_symtab>: New public methods. <record_pending_block, finish_block_internal, make_blockvector, watch_main_source_file_lossage, end_symtab_with_blockvector>: New private methods. Update all users.
2018-07-20Remove parameter from record_pending_blockTom Tromey2-34/+31
This removes a redundant parameter from record_pending_block. It also moves record_pending_block earlier in the file, so that a forward declaration is no longer needed. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * buildsym.c (record_pending_block): Move earlier. Remove objfile parameter. (finish_block_internal): Update.
2018-07-20Remove EXTERN from buildsym.hTom Tromey3-18/+7
Nothing in buildsym.h relies on the "EXTERN" method of declaration/definition, so remove the traces. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * buildsym.h (EXTERN): Don't define or undef. * buildsym.c (EXTERN): Don't define.
2018-07-20Remove a TODOTom Tromey2-2/+5
This removes a TODO comment -- the work has been done. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * buildsym.c: Remove TODO comment.
2018-07-20Remove buildsym_initTom Tromey10-50/+27
Now that buildsym_init does nothing, it can be removed. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * coffread.c (coff_symtab_read): Update. * xcoffread.c (xcoff_psymtab_to_symtab_1): Update. (xcoff_new_init): Update. * mipsread.c (mipscoff_new_init): Update. * mdebugread.c (mdebug_build_psymtabs): Update. * elfread.c (elf_new_init): Update. * dwarf2read.c (process_full_comp_unit, process_full_type_unit): Update. * dbxread.c (dbx_new_init, dbx_psymtab_to_symtab_1) (coffstab_build_psymtabs, elfstab_build_psymtabs) (stabsect_build_psymtabs): Update. * buildsym.h (buildsym_init): Don't declare. * buildsym.c: Update comment. (prepare_for_building): Remove. (start_symtab, restart_symtab): Update. (reset_symtab_globals): Update comment. (buildsym_init): Remove.
2018-07-20Move the symbol lists to buildsym_compunitTom Tromey9-131/+180
This moves the global symbol lists into buildsym_compunit, adds accessors, and updates all the users. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * xcoffread.c (read_xcoff_symtab, process_xcoff_symbol): Update. * stabsread.c (patch_block_stabs, define_symbol, read_type) (read_enum_type, common_block_start, common_block_end) (cleanup_undefined_types_1, finish_global_stabs): Update. * mdebugread.c (psymtab_to_symtab_1): Update. * dwarf2read.c (fixup_go_packaging, read_func_scope) (read_lexical_block_scope, new_symbol): Update. * dbxread.c (process_one_symbol): Update. * coffread.c (coff_symtab_read, process_coff_symbol) (coff_read_enum_type): Update. * buildsym.h (file_symbols, global_symbols, local_symbols): Don't declare. (get_local_symbols, get_file_symbols, get_global_symbols): New functions. * buildsym.c (~buildsym_compunit): Clean up m_file_symbols and m_global_symbols. <m_file_symbols, m_local_symbols, m_global_symbols>: New members. (~scoped_free_pendings): Update. (finish_block, prepare_for_building, reset_symtab_globals) (end_symtab_get_static_block, end_symtab_with_blockvector) (augment_type_symtab, push_context): Update. (get_local_symbols, get_file_symbols, get_global_symbols): New functions. (buildsym_init): Update.
2018-07-20Set list_in_scope later in DWARF readerTom Tromey2-4/+8
Currently the DWARF reader sets the list_in_scope member of the CU when first starting to process symbols. Future changes will make this assert -- code will not be able to refer to these lists until after start_symtab has been called. This patch prepares for the problem by arranging to initialize list_in_scope in dwarf2_start_symtab. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * dwarf2read.c (process_full_comp_unit): Do not set list_in_scope. (process_full_type_unit): Likewise. (dwarf2_start_symtab): Set list_in_scope.
2018-07-20Do not look at file symbols when reading psymtabsTom Tromey2-3/+5
The DWARF reader was setting the list_in_scope member when reading partial symbols. however, this member is only useful when reading full symbols. Future patches will make this assert, so remove these unneeded initializations. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * dwarf2read.c (process_psymtab_comp_unit_reader) (build_type_psymtabs_reader): Do not set list_in_scope.
2018-07-20Remove free_pendingsTom Tromey2-25/+9
buildsym.c currently keeps a free list of "struct pending"s. However, this didn't seem necessary to me, and so this patch removes the free list. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * buildsym.c (free_pendings): Remove. (add_symbol_to_list, scoped_free_pendings) (finish_block_internal, buildsym_init): Update.
2018-07-20Remove the "listhead" argument from finish_blockTom Tromey7-13/+22
finish_block is only ever called with "&local_symbols" as the "listhead" argument. So, remove this argument. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * xcoffread.c (read_xcoff_symtab): Update. * dwarf2read.c (read_func_scope, read_lexical_block_scope): Update. * dbxread.c (process_one_symbol): Update. * coffread.c (coff_symtab_read): Update. * buildsym.h (finish_block): Update. * buildsym.c (finish_block): Remove "listhead" argument. (end_symtab_get_static_block): Update.
2018-07-20Move pending_blocks and pending_block_obstack to buildsym_compunitTom Tromey3-51/+49
This moves the pending_blocks and pending_block_obstack into buildsym_compunit. The obstack could perhaps be merged with the addrmap obstack, but I did not do that in this series. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * buildsym.h (class scoped_free_pendings): Remove constructor. * buildsym.c (struct buildsym_compunit) <free_pending_blocks>: New method. <m_pending_block_obstack, m_pending_blocks>: New members. (pending_block_obstack, pending_blocks): Remove. (scoped_free_pendings::scoped_free_pendings): Default. (~scoped_free_pendings): Update. (free_pending_blocks): Remove. (finish_block_internal, record_pending_block, make_blockvector) (end_symtab_get_static_block, augment_type_symtab, push_context) (buildsym_init): Update.
2018-07-20Move pending addrmap globals to buildsym_compunitTom Tromey2-37/+37
This moves the pending addrmap-related globals into buildsym_compunit. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * buildsym.c (struct buildsym_compunit) <m_pending_addrmap, m_pending_addrmap_obstack, m_pending_addrmap_interesting>: New members. (pending_addrmap, pending_addrmap_obstack) (pending_addrmap_interesting): Remove. (scoped_free_pendings, record_block_range, make_blockvector) (prepare_for_building, reset_symtab_globals, buildsym_init): Update.
2018-07-20Move current_subfile to buildsym_compunitTom Tromey9-36/+70
This moves the global current_subfile into buildsym_compunit. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * xcoffread.c (process_linenos): Update. * stabsread.c (define_symbol, read_type, read_enum_type): Update. * mdebugread.c (psymtab_to_symtab_1): Update. * dwarf2read.c (setup_type_unit_groups) (lnp_state_machine::handle_set_file, dwarf_record_line_p) (lnp_state_machine::record_line, dwarf_decode_lines): Update. * dbxread.c (process_one_symbol): Update. * coffread.c (coff_symtab_read, enter_linenos) (process_coff_symbol): Update. * buildsym.h (current_subfile): Don't declare. (get_current_subfile): Declare. * buildsym.c (struct buildsym_compunit) <m_current_subfile>: New member. (start_subfile, free_buildsym_compunit, push_subfile) (prepare_for_building, start_symtab): Update. (get_current_subfile): New function.
2018-07-20Move the context stack to buildsym_compunitTom Tromey7-119/+160
This moves the context stack globals to be members of buildsym_compunit, changing the type to a std::vector in the process. Because the callers expect the context stack object to be valid after being popped, at Simon's suggestion I've changed pop_context to return the object rather than the pointer. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * coffread.c (coff_symtab_read): Update. * xcoffread.c (read_xcoff_symtab): Update. * dwarf2read.c (new_symbol): Update. (read_func_scope, read_lexical_block_scope): Update. * dbxread.c (process_one_symbol): Update. * buildsym.h (context_stack, context_stack_depth): Don't declare. (outermost_context_p): Remove macro. (outermost_context_p, get_current_context_stack) (get_context_stack_depth): Declare. (pop_context): Return struct context_stack. * buildsym.c (struct buildsym_compunit) <m_context_stack: New member. (context_stack_size): Remove. (INITIAL_CONTEXT_STACK_SIZE): Remove. (prepare_for_building, end_symtab_get_static_block) (augment_type_symtab, push_context): Update. (pop_context): Return struct context_stack. (outermost_context_p, get_current_context_stack) (get_context_stack_depth): New functions. (buildsym_init): Update.
2018-07-20Make the Rust parser pureTom Tromey2-591/+621
This makes the Rust parser a pure parser and removes all the (non-constant) globals from rust-exp.y. This seemed like a nice simplification to me and I think it should probably be applied to all the parsers. Perhaps it would be good to go even one step farther and have all parsers derive from parser_state. Tested on x86-64 Fedora 26. gdb/ChangeLog 2018-07-20 Tom Tromey <tom@tromey.com> * rust-exp.y: Now a pure parser. Update all rules. (%union): Move earlier. (current_parser, work_obstack): Remove globals. (rust_parser, ~rust_parser): Update. (class rust_parser) <copy_name, concat3, crate_name, super_name, lex_character, lex_number, lex_string, lex_identifier, rust_lookup_type, convert_params_to_types, convert_ast_to_type, convert_name, convert_params_to_expression, convert_ast_to_expression, ast_basic_type, ast_operation, ast_compound_assignment, rust_op, ast_literal, ast_dliteral, ast_structop, ast_structop_anonymous, ast_unary, ast_cast, ast_call_ish, ast_path, ast_string, ast_struct, ast_range, ast_array_type, ast_slice_type, ast_reference_type, ast_pointer_type, ast_function_type, ast_tuple_type>: New methods. (rust_parse): Update. (rustyyerror, rustyylex): Add parser parameter. (rust_lex_test_one, rust_lex_int_test, rust_lex_exception_test) (rust_lex_stringish_test, rust_lex_test_sequence) (rust_lex_test_trailing_dot, rust_lex_test_completion) (rust_lex_test_push_back, rust_lex_tests): Update.
2018-07-20[PATCH, LD, AArch64] Fix ifunc testismsAndre Simoes Dias Vieira2-2/+3
This patch fixes some ifunc testisms after H.J. Lu's patch to enable the use of IFUNC pointers in position dependent code for binutils. See PR LD/23169 in binutils bugzilla. The aarch64 ifunc error message test was changed to no longer expect this error message as this is now an accepted combination. This patch also disables the executable tests added by H.J. Lu for aarch64, just as Alan Modra did with his patch, as these tests only seem to work on some architectures. ld/ChangeLog: 2018-07-19 Andre Vieira <andre.simoesdiasvieira@arm.com> * testsuite/ld-aarch64/ifunc-9.d: Remove no longer expected error. * testsuite/ld-ifunc/ifunc.exp: Disable tests for aarch64.
2018-07-20[gdb/testsuite] Make noclone conditional in vla-optimized-out.cTom de Vries3-2/+13
Make the noclone attribute on f1 in vla-optimized-out.c conditional. This makes the test-case by default identical to gcc/testsuite/gcc.dg/guality/vla-1.c. Tested on x86_64-linux. 2018-07-20 Tom de Vries <tdevries@suse.de> * gdb.base/vla-optimized-out.c: Make noclone attribute conditional on NOCLONE macro. * gdb.base/vla-optimized-out.exp: Use additional_flags -DNOCLONE.
2018-07-20Close memory and resource leaks detected by coverity in the binutils directory.Nick Clifton3-3/+53
* objcopy.c (add_specific_symbols): Free buffer on exit. (add_redefine_syms_file): Close file handle on exit. (copy_object): Close file handle on early exit. Free buffer on early exit. Free gaps buffers once they are no longer needed. * dwarf.c (display_debug_frames): Free allocated memory on exit. (load_separate_debug_info): Free allocate memory on early exit.
2018-07-20MIPS/GAS: Split Loongson MMI Instructions from loongson2f/3aChenghua Xu24-422/+591
The MMI instruction set has been implemented in many Loongson processors. There is a lot of software optimized for MMI. This patch splits MMI from loongson2f/3a, and adds GAS and disassembler options for MMI instructions. 2018-07-20 Chenghua Xu <paul.hua.gm@gmail.com> Maciej W. Rozycki <macro@mips.com> bfd/ * elfxx-mips.c (print_mips_ases): Add MMI extension. binutils/ * readelf.c (print_mips_ases): Add MMI extension. gas/ * NEWS: Mention MultiMedia extensions Instructions (MMI) support. * config/tc-mips.c (options): Add OPTION_LOONGSON_MMI and OPTION_NO_LOONGSON_MMI. (md_longopts): Likewise. (mips_ases): Define availability for MMI. (mips_convert_ase_flags): Map ASE_LOONGSON_MMI to AFL_ASE_LOONGSON_MMI. (mips_cpu_info_table): Add ASE_LOONGSON_MMI for loongson2f/3a. (md_show_usage): Add help for -mloongson-mmi and -mno-loongson-mmi. * doc/as.texi: Document -mloongson-mmi, -mno-loongson-mmi. * doc/c-mips.texi: Document -mloongson-mmi, -mno-loongson-mmi, .set loongson-mmi and .set noloongson-mmi. * testsuite/gas/mips/loongson-2f.d: Move mmi test to ... * testsuite/gas/mips/loongson-2f-mmi.d: Here. Add ISA/ASE flag verification. * testsuite/gas/mips/loongson-2f.s: Move mmi test to ... * testsuite/gas/mips/loongson-2f-mmi.s: Here. * testsuite/gas/mips/loongson-3a.d: Move mmi test to ... * testsuite/gas/mips/loongson-3a-mmi.d: Here. Add ISA/ASE flag verification. * testsuite/gas/mips/loongson-3a.s: Move mmi test to ... * testsuite/gas/mips/loongson-3a-mmi.s: Here. * testsuite/gas/mips/mips.exp: Run loongson-2f-mmi and loongson-3a-mmi tests. include/ * elf/mips.h (AFL_ASE_MMI): New macro. (AFL_ASE_MASK): Update to include AFL_ASE_LOONGSON_MMI. * opcode/mips.h (ASE_LOONGSON_MMI): New macro. opcodes/ * mips-dis.c (mips_arch_choices): Add MMI to loongson2f and loongson3a descriptors. (parse_mips_ase_option): Handle -M loongson-mmi option. (print_mips_disassembler_options): Document -M loongson-mmi. * mips-opc.c (LMMI): New macro. (mips_opcodes): Replace IL2F|IL3A marking with LMMI for MMI instructions.
2018-07-20MIPS/LD: Fix crashing with a discarded dynamic relocation sectionMaciej W. Rozycki6-1/+35
Fix a crash that occurs in `_bfd_mips_elf_finish_dynamic_sections' if a dynamic relocation section has been created, but marked to be discarded by an assignment to the /DISCARD/ output section in a linker script. In that case the output section is the absolute section, which has no ELF section data attached, so trying to set its `sh_size' parameter causes a null pointer dereference. This is only done as the value for the DT_RELSZ dynamic entry is being set, so fix the problem by not creating DT_REL, DT_RELSZ or DT_RELENT dynamic entries in the first place if the dynamic relocation section will not be output, as with no dynamic relocation data present these would not serve their purpose anyway. Add a generic ELF test case to verify that no dynamic relocation data is reported in the dynamic segment. bfd/ * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Do not create DT_REL, DT_RELSZ or DT_RELENT dynamic entries if the dynamic relocation section will be discarded from output. (_bfd_mips_elf_finish_dynamic_sections) <DT_RELSZ>: Assert that the dynamic relocation section will be retained in output. ld/ * testsuite/ld-elf/reloc-discard.d: New test. * testsuite/ld-elf/reloc-discard.ld: New test linker script. * testsuite/ld-elf/reloc-discard.s: New test source.
2018-07-20Specify architecture for SPARC gas testsRainer Orth2-23/+62
A couple of SPARC gas tests FAIL on Solaris/SPARC (both sparc-sun-solaris2.11 and sparcv9-sun-solaris2.11): FAIL: sparc PAUSE FAIL: sparc CBCOND FAIL: sparc CFR FAIL: sparc CRYPTO FAIL: sparc HPC+VIS3 FAIL: sparc IMA FAIL: sparc OSA2015 %mwait asr and MWAIT instruction FAIL: sparc OSA2015 %mcdper asr FAIL: sparc SPARC5 and VIS4.0 FAIL: OSA2015 crypto instructions FAIL: SPARC6 FAIL: FPCMPSHL OSA2017 instructions FAIL: OSA2017 ONADD/ONSUB/ONMUL/ONDIV instructions. FAIL: OSA2017 RLE instructions FAIL: sparc64 rdasr FAIL: sparc64 rdpr FAIL: sparc64 rdhpr FAIL: sparc64 wrasr FAIL: sparc64 wrpr It turns out there's a common pattern here: failures happen for all tests that use SPARC ISA extensions beyond sparcv9, e.g. for the sparc PAUSE test: regexp_diff match failure regexp "^ 0: b7 80 40 02 wr %g1, %g2, %pause$" line " 0: b7 80 40 02 wr %g1, %g2, %asr27" [...] regexp_diff match failure regexp "^ 8: b7 80 20 08 pause 8$" line " 8: b7 80 20 08 wr 8, %asr27" [...] The fix is easy, actually: just as the tests specify the ISA extension to use as a gas flag, the same needs to be done for objdump. For the test above, which has -Av9v, this means passing -msparc:v9v to objdump. Doing so makes all but two (unrelated; to be reported separately) failures go away. This doesn't happen on Linux/SPARC, where gas emits GNU object attributes matching the hardcare capabilities used. Since gas doesn't yet implement Solaris-style object capabilites, the explicit -march is needed, but only passed on Solaris. Tested on both sparc-sun-solaris2.11 and sparcv9-sun-solaris2.11. * testsuite/gas/sparc/sparc.exp (set_tests_arch): New proc. Prefix v9c, v9d, v9v, v9m, v9m8 tests with corresponding set_tests_arch.
2018-07-19Remove myself from target-specific MAINTAINERSDJ Delorie4-6/+12
[binutils] * MAINTAINERS (RL78, RX): Remove myself as maintainer. [sim] * MAINTAINERS (rl78, m32c, rx, v850): Remove myself as maintainer.
2018-07-20Automatic date update in version.inGDB Administrator1-1/+1
2018-07-19Eliminate remaining gdb/guile cleanupsPedro Alves9-80/+62
The remaining gdb/guile cleanups all handle the memory returned by gdbscm_scm_to_c_string. This commit makes gdbscm_scm_to_c_string return a gdb::unique_xmalloc_ptr instead of a naked pointer, and eliminates the remaining cleanups. gdb/ChangeLog: 2018-07-19 Pedro Alves <palves@redhat.com> * guile/guile-internal.h (gdbscm_scm_to_c_string): Now returns a gdb::unique_xmalloc_ptr. * guile/scm-breakpoint.c (gdbscm_set_breakpoint_condition_x): Adjust to use dbscm_wrap and gdb::unique_xmalloc_ptr. * guile/scm-exception.c (gdbscm_exception_message_to_string): Use copy-initialization. * guile/scm-pretty-print.c (ppscm_print_children): Use gdb::unique_xmalloc_ptr instead of cleanups. (gdbscm_apply_val_pretty_printer): Remove cleanups. * guile/scm-string.c (gdbscm_scm_to_c_string): Now returns a gdb::unique_xmalloc_ptr. * guile/scm-type.c (gdbscm_type_field, gdbscm_type_has_field_p): Adjust to use gdb::unique_xmalloc_ptr. * guile/scm-utils.c (extract_arg): Adjust. * guile/scm-value.c (gdbscm_value_field): Adjust to use gdb::unique_xmalloc_ptr instead of a cleanup.
2018-07-19Remove make_cleanup_value_free_to_markTom Tromey3-21/+6
Pedro's patch to introduce gdbscm_wrap removed the last caller of make_cleanup_value_free_to_mark. This patch removes this function. I'm checking this in as obvious. Tested by rebuilding, and by grepping. gdb/ChangeLog 2018-07-19 Tom Tromey <tom@tromey.com> * utils.c (do_value_free_to_mark) (make_cleanup_value_free_to_mark): Remove. * utils.h (make_cleanup_value_free_to_mark): Remove.
2018-07-19[gdb/testsuite] Fix regexp in list-thread-groups-available.expTom de Vries2-1/+6
I ran into a gdb.mi/list-thread-groups-available.exp failure: ... Running gdb/testsuite/gdb.mi/list-thread-groups-available.exp ... FAIL: gdb.mi/list-thread-groups-available.exp: list available thread groups (unexpected output) PASS: gdb.mi/list-thread-groups-available.exp: list available thread groups with filter ... When doing an experiment of running it 100 times in a row, the failure reproduced 3 times. Analyzing the original failure led to insufficient quoting of square brackets in a regexp. This patch fixes the regexp, which resulted in 0 failures in a 100-in-a-row run. Tested on x86_64-linux. 2018-07-19 Tom de Vries <tdevries@suse.de> * gdb.mi/list-thread-groups-available.exp (cores_re): Fix quoting in regular expression.
2018-07-19Fix GDB build using mingw.org's MinGWEli Zaretskii2-0/+10
libiberty/ 2018-07-18 Eli Zaretskii <eliz@gnu.org> PR gdb/23434 * libiberty/simple-object-elf.c (ENOTSUP): If not defined by errno.h, redirect ENOTSUP to ENOSYS.
2018-07-19Stop potential memory leaks in dwarf CIE reader.Nick Clifton3-13/+26
* dwarf.c (read_cie): Free allocated memory before returning with a failure result.
2018-07-19gdbscm_wrap, really forward argsPedro Alves2-1/+6
Commit 557e56be2648 ("Eliminate most remaining cleanups under gdb/guile/") missed adding the && to Args to really forward the arguments properly. Noticed by inspection. gdb/ChangeLog: 2018-07-19 Pedro Alves <palves@redhat.com> * guile/guile-internal.h (gdbscm_wrap): Really make 'args' a forwarding reference.
2018-07-19S/390: Set the htm flag on PPAAndreas Krebbel1-1/+1
The PPA instruction will be emitted by GCC transactional execution builtins so it needs to be accepted with just -mhtm and without -march=zEC12. opcodes/ChangeLog: 2018-07-19 Andreas Krebbel <krebbel@linux.ibm.com> * s390-opc.txt (PPA): Add the htm flag.
2018-07-19x86: fold narrowing VCVT* templatesJan Beulich3-286/+114
When multiple (here: two) forms of an insn take different width inputs but produce identical size outputs (here: RegXMM), the templates can be combined. Also drop IgnoreSize (and the now redundant size specifiers) wherever applicable.
2018-07-19x86: fold VFPCLASSP{D,S} templatesJan Beulich5-106/+55
These are special because they may not have a register operand to derive the vector length from, which requires to also deal with the braodcast case when determining vector length in build_evex_prefix(). Also drop IgnoreSize (and the now redundant size specifiers) from their suffixed counterparts.
2018-07-19x86: fold various AVX512* templatesJan Beulich3-1721/+218
2018-07-19x86: fold various AVX512DQ templatesJan Beulich3-881/+115
2018-07-19x86: fold various AVX512BW templatesJan Beulich5-4665/+560
2018-07-19x86: fold various AVX512CD templatesJan Beulich3-172/+28
2018-07-19x86: fold various AVX512VL templates into their AVX512F counterpartsJan Beulich7-14502/+1769
2018-07-19x86: pre-process opcodes table before parsingJan Beulich5-10/+49
Instead of expanding macro-like constructs in i386-gen, have the C pre- processor do this for us. Besides being a prerequisite for the next template folding steps, this also paves the way for removing various hidden dependencies between #define-s in i386-opc.h and plain literal numbers used in i386-opc.tbl. The #undef of None is solely to leave the generated i386-tbl.h entirely unchanged.
2018-07-19Automatic date update in version.inGDB Administrator1-1/+1
2018-07-18Eliminate cleanup in gdbscm_execute_gdb_commandPedro Alves2-21/+14
Note: the "may be modified" comment is no longer true nowadays. gdb/ChangeLog: 2018-07-18 Pedro Alves <palves@redhat.com> * guile/guile.c (gdbscm_execute_gdb_command): Adjust to use gdbscm_wrap. Use gdb::unique_xmalloc_ptr<char> instead of a cleanup.
2018-07-18Eliminate most remaining cleanups under gdb/guile/Pedro Alves7-561/+398
The main complication with the Guile code is that we have two types of exceptions to consider. GDB/C++ exceptions, and Guile/SJLJ exceptions. Code that is facing the Guile interpreter must not throw GDB exceptions, instead Scheme exceptions must be thrown. Also, because Guile exceptions are SJLJ based, Guile-facing code must not use local objects with dtors, unless wrapped in a scope with a TRY/CATCH, because the dtors won't otherwise be run when a Guile exceptions is thrown. This commit adds a new gdbscm_wrap wrapper function than encapsulates a pattern I noticed in many of the functions using GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS. The wrapper is written such that you can pass either a lambda to it, or a function plus a variable number of forwarded args. I used a lambda when its body would be reasonably short, and a separate function in the larger cases. This also convers a few functions that were using GDBSCM_HANDLE_GDB_EXCEPTION to use gdbscm_wrap too because they followed a similar pattern. A few cases of make_cleanup calls are replaced with explicit xfree calls. The make_cleanup/do_cleanups calls in those cases are pointless, because do_cleanups won't be called when a Scheme exception is thrown. We also have a couple cases of Guile-facing code using RAII-type objects to manage memory, but those are incorrect, exactly because their dtor won't be called if a Guile exception is thrown. gdb/ChangeLog: 2018-07-18 Pedro Alves <palves@redhat.com> * guile/guile-internal.h: Add comment about mixing GDB and Scheme exceptions. (GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS): Delete. (gdbscm_wrap): New. * guile/scm-frame.c (gdbscm_frame_read_register): Use xfree directly instead of a cleanup. * guile/scm-math.c (vlscm_unop_gdbthrow): New, factored out from ... (vlscm_unop): ... this. Reimplement using gdbscm_wrap. (vlscm_binop_gdbthrow): New, factored out from ... (vlscm_binop): ... this. Reimplement using gdbscm_wrap. (vlscm_rich_compare): Use gdbscm_wrap. * guile/scm-symbol.c (gdbscm_lookup_symbol): Use xfree directly instead of a cleanup. (gdbscm_lookup_global_symbol): Use xfree directly instead of a cleanup. * guile/scm-type.c (gdbscm_type_field, gdbscm_type_has_field_p): Use xfree directly instead of a cleanup. * guile/scm-value.c (gdbscm_make_value, gdbscm_make_lazy_value): Adjust to use gdbscm_wrap and scoped_value_mark. (gdbscm_value_optimized_out_p): Adjust to use gdbscm_wrap. (gdbscm_value_address, gdbscm_value_dereference) (gdbscm_value_referenced_value): Adjust to use gdbscm_wrap and scoped_value_mark. (gdbscm_value_dynamic_type): Use scoped_value_mark. (vlscm_do_cast, gdbscm_value_field): Adjust to use gdbscm_wrap and scoped_value_mark. (gdbscm_value_subscript, gdbscm_value_call): Adjust to use gdbscm_wrap and scoped_value_mark. (gdbscm_value_to_string): Use xfree directly instead of a cleanup. Move 'buffer' unique_ptr to TRY scope. (gdbscm_value_to_lazy_string): Use xfree directly instead of a cleanup. Move 'buffer' unique_ptr to TRY scope. Use scoped_value_mark. (gdbscm_value_fetch_lazy_x): Use gdbscm_wrap. (gdbscm_parse_and_eval): Adjust to use gdbscm_wrap and scoped_value_mark. (gdbscm_history_ref, gdbscm_history_append_x): Adjust to use gdbscm_wrap.
2018-07-18[gdb/exp] Fix printing of type of optimized out vlaTom de Vries5-0/+86
Consider this snippet from gcc/testsuite/gcc.dg/guality/vla-1.c: ... int __attribute__((noinline)) f1 (int i) { char a[i + 1]; a[0] = 5; /* { dg-final { gdb-test .+1 "i" "5" } } */ return a[0]; /* { dg-final { gdb-test . "sizeof (a)" "6" } } */ } ... When we compile the test-case with -O1 -g, and query the size of optimized out vla 'a', we get: ... $ ./gdb -batch -ex "b f1" -ex "r" -ex "p sizeof (a)" vla-1.exe Breakpoint 1 at 0x4004a8: file vla-1.c, line 17. Breakpoint 1, f1 (i=i@entry=5) at vla-1.c:17 17 return a[0]; $1 = 0 ... while we expect a size of '6'. The problem is that default_read_var_value does not resolve the dynamic type of a variable if the variable is optimized out. This patch fixes that, and consequently gdb prints '6', as expected. Tested on x86_64-linux. 2018-07-18 Tom de Vries <tdevries@suse.de> * findvar.c (default_read_var_value): Also resolve dynamic type for LOC_OPTIMIZED_OUT vars. * gdb.base/vla-optimized-out.c: New test. * gdb.base/vla-optimized-out.exp: New file.
2018-07-18microMIPS: Add SYSCALL instruction decodingMaciej W. Rozycki2-6/+29
Fix a bug with commit 4cc0665f24bb ("microMIPS support"), <https://sourceware.org/ml/gdb-patches/2012-05/msg00724.html>, and add missing microMIPS SYSCALL instruction decoding needed to determine the location to put a breakpoint at when single-stepping though a syscall. gdb/ * mips-tdep.c (micromips_next_pc): Add SYSCALL instruction decoding.
2018-07-18BFD/XCOFF: Fix storage class setting for weak defined symbolsMaciej W. Rozycki2-2/+7
Fix an issue with commit 8602d4fea60d ("Add AIX weak support"), <https://sourceware.org/ml/binutils/2009-03/msg00189.html>, and use the correct condition to set the storage class for weak defined symbols. The context here is as follows: else if ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && h->smclas == XMC_XO) { BFD_ASSERT (bfd_is_abs_section (h->root.u.def.section)); isym.n_value = h->root.u.def.value; isym.n_scnum = N_UNDEF; if (h->root.type == bfd_link_hash_undefweak && C_WEAKEXT == C_AIX_WEAKEXT) isym.n_sclass = C_WEAKEXT; else isym.n_sclass = C_EXT; aux.x_csect.x_smtyp = XTY_ER; } so clearly the inner condition can never be true. Correct the condition then to check for the `bfd_link_hash_defweak' symbol type instead here, and in a similar place a little further down in the same function. bfd/ * xcofflink.c (xcoff_write_global_symbol): Fix symbol type checks for defined weak symbols.
2018-07-18MIPS/GAS/testsuite: Correct whitespace issues with Loongson testsMaciej W. Rozycki12-294/+296
Remove CR characters, trailing whitespace and space characters appearing immediately before a tab character, and replace spaces with tabs, all across Loongson GAS tests. gas/ * testsuite/gas/mips/loongson-2e.d: Correct whitespace issues. * testsuite/gas/mips/loongson-2f.d: Likewise. * testsuite/gas/mips/loongson-2f-2.d: Likewise. * testsuite/gas/mips/loongson-2f-3.d: Likewise. * testsuite/gas/mips/loongson-3a.d: Likewise. * testsuite/gas/mips/loongson-3a-2.d: Likewise. * testsuite/gas/mips/loongson-2e.s: Likewise. * testsuite/gas/mips/loongson-2f.s: Likewise. * testsuite/gas/mips/loongson-2f-3.s: Likewise. * testsuite/gas/mips/loongson-3a.s: Likewise. * testsuite/gas/mips/loongson-3a-2.s: Likewise.
2018-07-18x86: Split vcvtps2{,u}qq and vcvttps2{,u}qqH.J. Lu7-21/+125
After commit 1b54b8d7e4fc8055f9220a5287e8a94d8a65a88d Author: Jan Beulich <jbeulich@novell.com> Date: Mon Dec 18 09:36:14 2017 +0100 x86: fold RegXMM/RegYMM/RegZMM into RegSIMD ... qualified by their respective sizes, allowing to drop FirstXmm0 at the same time. folded RegXMM, RegYMM and RegZMM into RegSIMD, it's no longer impossible to distinguish if Xmmword can represent a memory reference when operand specification contains SIMD register. For example, template operands specification like these RegXMM|...|Xmmword|... and RegXMM|... The Xmmword bitfield is always set by RegXMM which is represented by "RegSIMD|Xmmword". This patch splits each of vcvtps2qq, vcvtps2uqq, vcvttps2qq and vcvttps2uqq into 2 templates: one template only has RegXMM source operand and the other only has mempry source operand. gas/ PR gas/23418 * testsuite/gas/i386/xmmword.s: Add tests for vcvtps2qq, vcvtps2uqq, vcvttps2qq and vcvttps2uqq. * testsuite/gas/i386/xmmword.l: Updated. opcodes/ PR gas/23418 * i386-opc.h (Byte): Update comments. (Word): Likewise. (Dword): Likewise. (Fword): Likewise. (Qword): Likewise. (Tbyte): Likewise. (Xmmword): Likewise. (Ymmword): Likewise. (Zmmword): Likewise. * i386-opc.tbl: Split vcvtps2qq, vcvtps2uqq, vcvttps2qq and vcvttps2uqq. * i386-tbl.h: Regenerated.
2018-07-18S/390: Improve partial relro support for 64 bitAndreas Krebbel6-62/+188
Currently on S/390 the .got.plt always comes first which prevents the GNU_RELRO segment from being extended across the non-plt GOT entries. Just swapping both unfortunately is not that simple since our ABI requires the _GLOBAL_OFFSET_TABLE_ symbol to point to the very beginning of the entire GOT. Of the 3 magic GOT entries the first is accessed via got pointer while second and third are being accessed via DT_PLTGOT. In order to keep them together we make DT_PLTGOT to point to the .got instead of .got.plt. However, this violates an assumption in the dynamic linker prelink undo code about the GOTPLT entries starting at DT_PLTGOT + 3. We got rid of this requirement with a Glibc patch already in version 2.24: https://sourceware.org/ml/libc-alpha/2016-06/msg01302.html So the S/390 relro GOT layout will look like this with this patch: +----------------------------------+ |got[0]: DYNAMIC | <--- _GLOBAL_OFFSET_TABLE_ == DT_PLTGOT .got |got[1]: link_map parm | |got[2]: &_dl_runtime_resolve | +----------------------------------+ | | non-plt GOT entries | | | | +----------------------------------+ | | <--- .gotplt, PLT GOT entries | | | | | | +----------------------------------+ The patch detects the current layout in size_dynamic_section in order to deal also with linker scripts not generated by this ld version. With partial relro enabled we pick a linker script where .got and .got.plt are swapped which then triggers the rest of the logic. ld/ChangeLog: 2018-07-18 Andreas Krebbel <krebbel@linux.ibm.com> * emulparams/elf64_s390.sh: Define GENERATE_RELRO_SCRIPT and SEPARATE_GOTPLT. * testsuite/ld-s390/gotreloc_64-relro-1.dd: New test. * testsuite/ld-s390/gotreloc_64-norelro-1.dd: Renamed from ... * testsuite/ld-s390/gotreloc_64-1.dd: ... this. * testsuite/ld-s390/s390.exp: Split the GOT testcase into two. bfd/ChangeLog: 2018-07-18 Andreas Krebbel <krebbel@linux.ibm.com> * elf-s390-common.c (s390_gotplt_after_got_p): New function. (s390_got_pointer): New function. (s390_got_offset): New function. (s390_gotplt_offset): New function. * elf64-s390.c (allocate_dynrelocs): Adjust comment. (elf_s390_size_dynamic_sections): Move space for magic GOT entries from .got.plt to .got if necessary and pick the right location for _GLOBAL_OFFSET_TABLE_. (elf_s390_relocate_section): Use the wrapper functions from elf-s390-common.c to deal with both possible layouts (either .got or .got.plt first). (elf_s390_finish_dynamic_sections): Likewise. (elf_s390_finish_dynamic_symbol): Make the location of the GOT magic entries conditional.