aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-12-30Re: Revise sleb128 and uleb128 readerAlan Modra2-21/+28
A missing part of git commit cd30bcef4a685. * od-macho.c: Include elfcomm.h. (dump_dyld_info_rebase, dump_dyld_info_bind): Fix read_leb128 args. (dump_dyld_info_export_1, dump_segment_split_info): Likewise.
2019-12-30Re: Usage of unitialized heap in tic4x_print_condAlan Modra2-1/+6
PR 25319 * tic4x-dis.c (tic4x_print_cond): Correct order of xcalloc args.
2019-12-29Fix setting breakpoints or stepping on line 65535Bernd Edlinger5-6/+57
This removes code that was present from the very first git revisison 7b4ac7e1ed2c4616bce56d1760807798be87ac9e from 1988. It was in the gdb/dbxread.c at the time (and makes more sense for dbx line info format since line numbers are 16-bit entities in that debug format and debugging files with more than 65535 lines would not work anyway) but moved from there to gdb/buildsym.c which is used for dwarf line info as well, and excluding an arbitrary line number does certainly not make sense nowadays. Add a test case for line 65535 gdb: 2019-12-29 Bernd Edlinger <bernd.edlinger@hotmail.de> * buildsym.c (buildsym_compunit::record_line): Do no longer ignore line 65535. gdb/testsuite: 2019-12-29 Bernd Edlinger <bernd.edlinger@hotmail.de> * gdb.base/line65535.exp: New file. * gdb.base/line65535.c: New file.
2019-12-29ubsan: sparc: left shift cannot be represented in type 'int'Alan Modra2-9/+12
* sparc-dis.c (SEX): Don't use left and right shift to sign extend. (compare_opcodes): Avoid signed shift left overflow. (print_insn_sparc): Likewise.
2019-12-29Usage of unitialized heap in tic4x_print_condAlan Modra2-1/+6
PR 25319 * tic4x-dis.c (tic4x_print_cond): Init all of condtable.
2019-12-29ubsan: alpha-vms: shift exponent is too largeAlan Modra2-9/+14
* vms-alpha.c (_bfd_vms_slurp_egsd): Make base_addr a bfd_vma. Limit alignment power. Correct and simplify alignment expression. (evax_bfd_print_relocation_records): Avoid signed shift left.
2019-12-29asan: alpha-vms: memory leaksAlan Modra4-50/+99
* vms-misc.c (_bfd_vms_save_sized_string): Add abfd param, make size a size_t. Use bfd_alloc rather than bfd_malloc. (_bfd_vms_save_counted_string): Similarly. * vms.h (_bfd_vms_save_sized_string): Update prototype. (_bfd_vms_save_counted_string): Likewise. * vms-alpha.c (_bfd_vms_slurp_ehdr): Adjust _bfd_vms_save_counted_string and bfd_vms_save_sized_string calls. (_bfd_vms_slurp_egsd, parse_module): Likewise. (_bfd_vms_slurp_eisd): Likewise. Check return status. (alpha_vms_bfd_link_hash_table_free): New function. (alpha_vms_bfd_link_hash_table_create): Arrange to call it. (vms_close_and_cleanup): Free more memory. Don't release tdata.
2019-12-29coff_close_and_cleanupAlan Modra5-1/+27
Fixes leaks in _bfd_coff_get_external_symbols and _bfd_coff_read_string_table. * coffcode.h (coff_close_and_cleanup): Redefine to.. * coffgen.c (_bfd_coff_close_and_cleanup): ..this. New function. * libcoff-in.h (_bfd_coff_close_and_cleanup): Declare. * libcoff.h: Regenerate.
2019-12-29PR15350, Fix compressed debug sections for PE targetsAlan Modra2-43/+48
PR 15350 * bfd.c (bfd_update_compression_header): Write zlib header for formats other than ELF too.
2019-12-29Automatic date update in version.inGDB Administrator1-1/+1
2019-12-27[PATCH] Adjust test gdb.ada/ptype_tagged_param.exp for when GNAT runtime ↵Simon Marchi4-4/+71
does not have debug info This test verifies that GDB correctly identifies the run-time type of "s" as being the type "Circle". However, that can only be done correctly if the GNAT runtime has been compiled and shipped with debug information, so that GDB can poke in its internal data structures. Currently the test fails when when running against a GNAT runtime without debug info. This is the case, for example, on Arch Linux using the distribution package. This patch adds a helper in lib/ada.exp to check whether the GNAT runtime has debug info or not. It then uses it in gdb.ada/ptype_tagged_param.exp to expect a different result, depending on whether we have debug info or not in the runtime. At first, I made it so we would XFAIL the test, in the absence of debug info, but then I thought that we might as well test for the output we expect in the absence of debug info instead. gdb/testsuite/ChangeLog: * lib/ada.exp (gnat_runtime_has_debug_info): New proc. * lib/gnat_debug_info_test.adb: New file. * gdb.ada/ptype_tagged_param.exp: Use gnat_runtime_has_debug_info, expect a different output if runtime does not have debug info.
2019-12-28Automatic date update in version.inGDB Administrator1-1/+1
2019-12-27Remove dead code from TUITom Tromey3-58/+6
I found some dead code in the TUI -- some using #if 0, and some commented-out code. There's no reason to keep this, so this patch removes it. gdb/ChangeLog 2019-12-27 Tom Tromey <tom@tromey.com> * tui/tui-source.c (tui_source_window::do_scroll_vertical): Remove commented-out code. * tui/tui.c: Remove #if 0 code. Change-Id: Ie00933b2ba498417ce22e5da3f62f5a40c234f33
2019-12-27Reorder an "if" in print_disassemblyTom Tromey2-7/+7
I noticed that print_disassembly has two #if blocks for TUI code, where one would do. This patch rearranges the code slightly to remove a #if. gdb/ChangeLog 2019-12-27 Tom Tromey <tom@tromey.com> * cli/cli-cmds.c (print_disassembly): Reorder "if". Change-Id: I36f3f682f5685b3d9b148da5aed26eb3cc7d598e
2019-12-27Change tui_active to boolTom Tromey3-7/+16
This changes tui_active and tui_finish_init to have type "bool". gdb/ChangeLog 2019-12-27 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_active): Now bool. (tui_finish_init): Likewise. (tui_enable): Update. (tui_disable): Update. (tui_is_window_visible): Update. * tui/tui.h (tui_active): Now bool. Change-Id: Ia159ae9beb041137e34956b77f5bcf4e83eaf2b9
2019-12-27Remove tui_gen_win_info::viewport_heightTom Tromey6-17/+12
tui_gen_win_info::viewport_height is only used in a couple of spots, and is redundant with "height". This patch removes viewport_height. gdb/ChangeLog 2019-12-27 Tom Tromey <tom@tromey.com> * tui/tui-source.c (tui_source_window::maybe_update): Update. * tui/tui-regs.c (tui_data_window::display_registers_from): Update. * tui/tui-layout.c (tui_gen_win_info::resize): Update. * tui/tui-data.h (struct tui_gen_win_info) <viewport_height>: Remove. * tui/tui-command.c (tui_cmd_window::resize): Update. Change-Id: I020e026fbe289adda8e2fdfebca91bdbdbc312e8
2019-12-27x86: adjust ignored prefix warning for branchesJan Beulich5-14/+27
There's no reason to not also issue them in Intel syntax mode, and it can be quite helpful to mention the actual insn (after all there can be multiple on a single line).
2019-12-27x86-64: correct / adjust prefix emissionJan Beulich10-63/+72
First and foremost REX must come last. Next JumpInterSegment branches can't possibly have a REX prefix, as they're consistently CpuNo64. And finally make BND prefix handling in output_branch() consistent with that of other prefixes in the same function, and make its placement among prefixes consistent with output_jump() (which, oddly enough, still isn't the supposedly canonical order specified by the *_PREFIX definitions).
2019-12-27x86-64: fix Intel64 handling of branch with data16 prefixJan Beulich8-27/+85
The expectation of x86-64-branch-3 for "call" / "jmp" with an obvious direct destination to translate to an indirect _far_ branch is plain wrong. The operand size prefix should have no effect at all on the interpretation of the operand. The main underlying issue here is that the Intel64 templates of the direct branches don't include Disp16, yet various assumptions exist that it would always be there when there's also Disp32/Disp32S, toggled by the operand size prefix (which is being ignored by direct branches in Intel64 mode). Along these lines it was also wrong to base the displacement width decision solely on the operand size prefix: REX.W cancels this effect and hence needs taking into consideration, too. A disassembler change is needed here as well: XBEGIN was wrongly treated the same as direct CALL/JMP, which isn't the case - the operand size prefix does affect displacement size there, it's merely ignored when it comes to updating [ER]IP.
2019-12-27x86: consolidate Disp<NN> handling a littleJan Beulich8-167/+180
In memory operand addressing, which forms of displacement are permitted besides Disp8 is pretty clearly limited - outside of 64-bit mode, Disp16 or Disp32 only, depending on address size (MPX being special in not allowing Disp16), - in 64-bit mode, Disp32s or Disp64 without address size override, and solely Disp32 with one. Adjust assembler and i386-gen to match this, observing that templates already get adjusted before trying to match them against input depending on the presence of an address size prefix. This adjustment logic gets extended to all cases, as certain DispNN values should also be dropped when there's no such prefix. In fact behavior of the assembler, perhaps besides the exact diagnostics wording, should not differ between there being templates applicable to 64-bit and non-64-bit at the same time, or there being fully separate sets of templates, with their DispNN settings already reduced accordingly. This adjustment logic further gets guarded such that there wouldn't be and Disp<N> conversion based on address size prefix when this prefix doesn't control the width of the displacement (on branches other than absolute ones). These adjustments then also allow folding two MOV templates, which had been split between 64-bit and non-64-bits variants so far. Once in this area also - drop the bogus DispNN from JumpByte templates, leaving just the correct Disp8 there (compensated by i386_finalize_displacement() now setting Disp8 on their operands), - add the missing Disp32S to XBEGIN. Note that the changes make it necessary to temporarily mark a test as XFAIL; this will get taken care of by a subsequent patch. The failing parts are entirely bogus and will get replaced.
2019-12-27Make symbol_set_names a member functionChristian Biesinger14-81/+106
This also renames it to make it clearer that this is not a cheap function (to compute_and_set_names). Also renames name to m_name to make the implementation of the renamed function more readable. Most of the places that access sym->m_name directly were also changed to call linkage_name () instead, to make it clearer which name they are accessing. gdb/ChangeLog: 2019-12-26 Christian Biesinger <cbiesinger@google.com> * ada-lang.c (ada_decode_symbol): Update. * buildsym.c (add_symbol_to_list): Update. * coffread.c (process_coff_symbol): Update. * ctfread.c (ctf_add_enum_member_cb): Update. (new_symbol): Update. (ctf_add_var_cb): Update. * dwarf2read.c (fixup_go_packaging): Update. (dwarf2_compute_name): Update. (new_symbol): Update. * jit.c (finalize_symtab): Update. * language.c (language_alloc_type_symbol): Update. * mdebugread.c (new_symbol): Update. * minsyms.c (minimal_symbol_reader::record_full): Update. (minimal_symbol_reader::install): Update. * psymtab.c (print_partial_symbols): Update. (psymbol_hash): Update. (psymbol_compare): Update. (add_psymbol_to_bcache): Update. (maintenance_check_psymtabs): Update. * stabsread.c (define_symbol): Update. * symtab.c (symbol_set_names): Rename to... (general_symbol_info::compute_and_set_names): ...this. (general_symbol_info::natural_name): Update. (general_symbol_info::search_name): Update. (fixup_section): Update. * symtab.h (struct general_symbol_info) <name>: Rename to... <m_name>: ...this. <compute_and_set_names>: Rename from... (symbol_set_names): ...this. (SYMBOL_SET_NAMES): Remove. (struct symbol) <ctor>: Update. Change-Id: I8da1f10cab4e0b89f19d5750fa4e6e2ac8d2b24f
2019-12-27Automatic date update in version.inGDB Administrator1-1/+1
2019-12-26Add a NEWS entry for multithreaded symbol loadingChristian Biesinger2-0/+9
Now that we enabled it by default, this change adds a NEWS entry for it. gdb/ChangeLog: 2019-12-26 Christian Biesinger <cbiesinger@google.com> * NEWS: Mention that multithreaded symbol loading is now on by default. Change-Id: Ic344596a3b1b6e612a0071a50df49588b833c15d
2019-12-26Avoid ubsan bug complaining about &p->fieldAlan Modra9-25/+44
I reckon it's quite OK to write &p->field in C when p might be NULL, and lots of old C programmers probably agree with me. However, ubsan disagrees and so do some people I respect. I suspect C++ influence is to blame for the ubsan behaviour. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92634. So far no one has educated me as to why I'm wrong to claim that there isn't anything in the C standard to say that p->field is always (*p).field. Note 79 doesn't quite do that because it doesn't cover null pointers. If there was such an equivalence then you could claim &p->field has a null pointer reference when p is NULL, even though no C compiler would ever dereference p. Anyway, to silence ubsan I'm going to apply the following though I prefer to avoid casts when possible. And I'm using (void *) deliberately because this is C, not C++! * ldlang.c (lang_output_section_find_by_flags): Don't use &p->field when p might be NULL. * ldelf.c (output_rel_find, ldelf_place_orphan): Likewise. (insert_os_after, lang_insert_orphan, lookup_name): Likewise. (strip_excluded_output_sections, lang_clear_os_map): Likewise. (lang_check, lang_for_each_input_file): Likewise. (lang_reset_memory_regions, find_replacements_insert_point): Likewise. (find_rescan_insertion, lang_propagate_lma_regions): Likewise. (lang_record_phdrs): Likewise. * emultempl/alphaelf.em (alpha_after_open): Likewise. * emultempl/mmo.em (mmo_place_orphan): Likewise. * emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Likewise. * emultempl/pep.em (gld_${EMULATION_NAME}_place_orphan): Likewise. * emultempl/ppc32elf.em (ppc_after_check_relocs): Likewise. * emultempl/spuelf.em (spu_before_allocation): Likewise. (embedded_spu_file): Likewise.
2019-12-26ubsan: crx: index 5 out of bounds for type 'operand_desc const[5]'Alan Modra2-1/+6
* crx-dis.c (get_number_of_operands): Don't access operands[] out of bounds.
2019-12-26ubsan: v850: left shift cannot be represented in type 'int'Alan Modra2-7/+12
Another 1 << 31 complaint. * v850-dis.c (disassemble): Avoid signed overflow. Don't use long vars when unsigned int will do.
2019-12-26asan: som: heap-buffer-overflowAlan Modra2-48/+69
Triggered by overflow of size calulation resulting in a too small buffer. The testcase found one of the som_bfd_count_ar_symbols problems. * som.c (setup_sections): Don't overflow space_strings_size. Use bfd_malloc2 to catch overflow of size calculation. (som_prep_for_fixups): Use bfd_zalloc2 to catch overflow of size calculation. (som_build_and_write_symbol_table): Similarly use bfd_zmalloc2. (som_slurp_symbol_table): Similarly use bfd_zmalloc2, bfd_malloc2, and bfd_zalloc2. (bfd_som_attach_aux_hdr): Use size_t vars for string length. (som_bfd_count_ar_symbols): Use bfd_malloc2 to catch overflow of size calculation. Use size_t vars for length and catch overflow. (som_slurp_armap): Use bfd_alloc2 to catch overflow of size calculation. (som_bfd_ar_write_symbol_stuff): Similarly use bfd_zmalloc2 and bfd_malloc2. Perform size calculations in bfd_size_type.
2019-12-26Add profiling outputs to .gitignoreChristian Biesinger2-0/+7
"perf record" creates files perf.data/perf.data.old; these can be safely ignored in .gitignore, to avoid showing up in git status. ChangeLog: 2019-12-26 Christian Biesinger <cbiesinger@google.com> * .gitignore: Add perf.data and perf.data.old. Change-Id: I214ae9d6b7265c2cb1356f11c9b0b82e2b391352
2019-12-26pe_bfd_read_buildid memory leakHannes Domani2-0/+6
* peicode.h (pe_bfd_read_buildid): Free data.
2019-12-26Automatic date update in version.inGDB Administrator1-1/+1
2019-12-26Fix printing ULONGEST variables on x86-32Ruslan Kabatsayev2-3/+10
gdb/ChangeLog 2019-12-26 Ruslan Kabatsayev <b7.10110111@gmail.com> * dwarf2read.c (is_valid_DW_AT_defaulted) (is_valid_DW_AT_calling_convention_for_type) (is_valid_DW_AT_calling_convention_for_subroutine): Fix printing ULONGEST variables on x86-32.
2019-12-25Automatic date update in version.inGDB Administrator1-1/+1
2019-12-24ubsan: arm: shift exponent 32 is too large for 32-bit type 'unsigned int'Alan Modra2-3/+7
* arm-dis.c (print_insn_arm): Don't shift by 32 on unsigned int var.
2019-12-24Automatic date update in version.inGDB Administrator1-1/+1
2019-12-23Fix compilation of Readline on mingw.org's MinGWEli Zaretskii2-0/+27
readline/ChangeLog 2019-12-23 Eli Zaretskii <eliz@gnu.org> * posixstat.h (S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH) (S_IXOTH, S_IRWXG, S_IRWXO): Define if undefined, even if S_IRWXU is defined, because non-Posix systems may defined only the user bits.
2019-12-23Fix build 32-bit-host build error last for last binutils/dwarf2.c change.Hans-Peter Nilsson2-1/+6
* dwarf.c (display_debug_lines_decoded): Cast printf parameter to format type to correct last change.
2019-12-23ppc: misc minor build correctionsJan Beulich3-8/+14
Avoid shadowing a libiberty symbol (which oldish gcc warns about by default), and allow building cleanly on 32-bit distros.
2019-12-23asan: vms-alpha: heap-buffer-overflowAlan Modra2-16/+49
Two buffer overflows, and some over restrictive length checks. * vms-alpha.c (add_symbol): Add "max" parameter. Error on string length larger than max. (_bfd_vms_slurp_egsd): Ensure record is at least large enough to read string length byte, error if not. Pass size to add_symbol. (_bfd_vms_slurp_etir): Don't read past end of buffer when reading type and length. Allow read of last byte in buffer.
2019-12-23ubsan: score: left shift of 2 by 31 places cannot be represented in type 'int'Alan Modra2-25/+28
* score-dis.c (print_insn_score32): Avoid signed overflow. (print_insn_score48): Likewise. Don't cast to int when printing hex values.
2019-12-23ubsan: iq2000: left shift of negative valueAlan Modra4-2/+10
cpu/ * iq2000.cpu (f-offset): Avoid left shift of negative values. opcodes/ * iq2000-ibld.c: Regenerate.
2019-12-23ubsan: d30v: left shift cannot be represented in type 'long long'Alan Modra2-17/+25
* d30v-dis.c (extract_value): Make num param a uint64_t, constify oper. Use unsigned vars. (print_insn): Make num var uint64_t. Constify oper and remove now unnecessary casts on extract_value calls. (print_insn_d30v): Use unsigned vars. Adjust printf formats.
2019-12-23Revise sleb128 and uleb128 readerAlan Modra4-1065/+833
This patch catches and reports errors when reading leb128 values, addressing a FIXME in read_leb128. * dwarf.h (read_leb128): Update prototype. (report_leb_status): New inline function. (SKIP_ULEB, SKIP_SLEB, READ_ULEB, READ_SLEB): Define. * dwarf.c: Use above macros throughout file. Formatting. (read_leb128): Reorder params. Add status return param. Don't stop reading until finding terminator or end of data. Detect loss of significant bits. Sign extend only on terminating byte. (read_sleb128, read_uleb128): Delete functions. (SKIP_ULEB, SKIP_SLEB, READ_ULEB, READ_SLEB): Delete macros. (read_and_print_leb128): Rewrite. (process_extended_line_op): Return a size_t. Use size_t vars. Adjust to suit new macros. Add proper name size to "data" when processing DW_LNE_define_file. (process_abbrev_section): Adjust to suit new macros. (decode_location_expression, skip_attr_bytes): Likewise. (get_type_signedness): Likewise. (read_and_display_attr_value): Likewise. Consolidate block code. (process_debug_info): Adjust to suit new macros. (display_formatted_table, display_debug_lines_raw): Likewise. (display_debug_lines_decoded): Likewise. Properly check for end of DW_LNS_extended_op. (display_debug_macinfo): Adjust to suit new macros. (get_line_filename_and_dirname, display_debug_macro): Likewise. (display_view_pair_list): Likewise. Don't back off when hitting end of data. (display_loc_list): Adjust to suit new macros. (display_loclists_list, display_loc_list_dwo): Likewise. (display_debug_rnglists_list, read_cie): Likewise. (display_debug_frames): Likewise. * readelf.c: Use new ULEB macros throughout file. (read_uleb128): Delete. (decode_arm_unwind_bytecode): Use read_leb128. (decode_tic6x_unwind_bytecode): Likewise. (display_tag_value): Adjust to suit new macros. (display_arc_attribute, display_arm_attribute): Likewise. (display_gnu_attribute, display_power_gnu_attribute): Likewise. (display_s390_gnu_attribute, display_sparc_gnu_attribute): Likewise. (display_mips_gnu_attribute, display_tic6x_attribute): Likewise. (display_msp430x_attribute, display_msp430_gnu_attribute): Likewise. (display_riscv_attribute, process_attributes): Likewise.
2019-12-23ubsan: wasm: shift is too large for 64-bit type 'bfd_vma'Alan Modra4-19/+43
bfd/ * wasm-module.c (wasm_read_leb128): Don't allow oversize shifts. Catch value overflow. Sign extend only on terminating byte. opcodes/ * wasm32-dis.c (wasm_read_leb128): Don't allow oversize shifts. Catch value overflow. Sign extend only on terminating byte.
2019-12-23Automatic date update in version.inGDB Administrator1-1/+1
2019-12-22Automatic date update in version.inGDB Administrator1-1/+1
2019-12-21Fix disabling of solib probes when LD_AUDITingGeorge Barrett2-1/+26
The SVR4 solib event handler determines whether an event is related to a non-base link namespace by comparing the event's debug struct address to the debug struct address of the initial program image. However, this can fail when using LD_AUDIT as audit libraries are loaded before the loader has initialised the initial program image's debug struct. When the event handler fails to find the debug struct, the probe-based debugger interface is disabled and a warning is flagged to the user. This commit adds a fallback test to help determine whether an event is for a foreign link namespace when the debug struct isn't available. gdb/ChangeLog: 2019-12-15 George Barrett <bob@bob131.so> * solib-svr4.c (svr4_handle_solib_event): Add fallback link namespace test for when the debug struct isn't available.
2019-12-21Fix whitespace in last change in top.cEli Zaretskii1-1/+1
2019-12-21Include xxHash support status in GDB configuration reportEli Zaretskii2-8/+21
gdb/ChangeLog 2019-12-21 Eli Zaretskii <eliz@gnu.org> * top.c (print_gdb_configuration): Print "--with-xxhash" or "--without-xxhash" according to HAVE_LIBXXHASH.
2019-12-21Automatic date update in version.inGDB Administrator1-1/+1
2019-12-20Address Tom Tromey's comments on the CTF reader.Weimin Pan2-75/+75
* Use the type-safe registry for ctf_file_key; * Drop "typedef" when defining "struct ctf_context"; * Use ANOFFSET with SECT_OFF_TEXT to get the text base address; gdb/ChangeLog 2019-12-20 Weimin Pan <weimin.pan@oracle.com> * ctfread.c (ctf_file_key): Change type to objfile_key. (struct ctf_context): Remove typedef. (get_objfile_text_range): Use ANOFFSET to get text base.