Commit Graph

102904 Commits

Author SHA1 Message Date
Pedro Alves
7dfecca0d2 Fix advance/until and multiple locations (PR gdb/26524)
If you do "advance LINESPEC", and LINESPEC expands to more than one
location, GDB just errors out:

   if (sals.size () != 1)
     error (_("Couldn't get information on specified line."));

For example, advancing to a line in an inlined function, inlined three
times:

 (gdb) b 21
 Breakpoint 1 at 0x55555555516f: advance.cc:21. (3 locations)
 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   <MULTIPLE>
 1.1                         y   0x000055555555516f in inline_func at advance.cc:21
 1.2                         y   0x000055555555517e in inline_func at advance.cc:21
 1.3                         y   0x000055555555518d in inline_func at advance.cc:21
 (gdb) advance 21
 Couldn't get information on specified line.
 (gdb)

Similar issue with the "until" command, as it shares the
implementation with "advance".

Since, as the comment in gdb.base/advance.exp says, "advance <location>"
is really just syntactic sugar for "tbreak <location>;continue",
fix this by making GDB insert a breakpoint at all the resolved
locations.

A new testcase is included, which exercises both "advance" and
"until", in two different cases expanding to multiple locations:

  - inlined functions
  - C++ overloads

This also exercises the inline frames issue fixed by the previous
patch.

gdb/ChangeLog:

	PR gdb/26524
	* breakpoint.c (until_break_fsm) <location_breakpoint,
	caller_breakpoint>: Delete fields.
	<breakpoints>: New field.
	<until_break_fsm>: Adjust to save a breakpoint vector instead of
	two individual breakpoints.
	(until_break_fsm::should_stop): Loop over breakpoints in the
	breakpoint vector.
	(until_break_fsm::clean_up): Adjust to clear the breakpoints
	vector.
	(until_break_command): Handle location expanding into multiple
	sals.

gdb/testsuite/ChangeLog:

	PR gdb/26523
	PR gdb/26524
	* gdb.base/advance-until-multiple-locations.cc: New.
	* gdb.base/advance-until-multiple-locations.exp: New.
2020-08-22 21:37:26 +01:00
Pedro Alves
e4e53e546c Fix advance/until and inline frames (PR gdb/26523)
If you do "tbreak LINENO; c" to advance to an inlined function, GDB
presents the stop at the inline frame instead of at the non-artificial
stack frame:

 (gdb) list 21
 18      static inline __attribute__ ((always_inline)) int
 19      inline_func (int i)
 20      {
 21        return i + 1;
 22      }

 (gdb) tbreak 21
 Temporary breakpoint 3 at 0x55555555516f: advance.cc:21.
 (gdb) c
 Continuing.

 Temporary breakpoint 3, inline_func (i=0) at advance.cc:21
 21        return i + 1;

The logic for this is in stopped_by_user_bp_inline_frame:

 /* Loop over the stop chain and determine if execution stopped in an
    inlined frame because of a breakpoint with a user-specified
    location set at FRAME_BLOCK.  */

 static bool
 stopped_by_user_bp_inline_frame (const block *frame_block, bpstat stop_chain)

If however, you do "advance LINENO" or "until LINENO" instead, GDB
presents the stop at the non-artificial frame:

 (gdb) advance 21
 main () at advance.cc:43
 43        i = inline_func (i);
 (gdb)

"advance" and "until" should really behave like user breakpoints here,
since their location is also user-specified.  As the comment in
gdb.base/advance.exp says, "advance <location>" is really just
syntactic sugar for "tbreak <location>; continue".

Fix this by making stopped_by_user_bp_inline_frame also consider
advance/until breakpoints.

A testcase covering this will be included in the next patch.

gdb/ChangeLog:

	PR gdb/26523
	* inline-frame.c (stopped_by_user_bp_inline_frame): Also consider
	bp_until breakpoints user-specified locations.  Update intro
	comment.
2020-08-22 00:26:58 +01:00
Tankut Baris Aktemur
33bf4c5c10 gdb: fix typo "breapoint" -> "breakpoint"
gdb/ChangeLog:
2020-08-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* infrun.c (process_event_stop_test): Fix typo "breapoint".

gdb/testsuite/ChangeLog:
2020-08-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* gdb.base/print-file-var.exp: Fix typo "breapoint".
	* gdb.trace/strace.exp: Ditto.
2020-08-20 14:26:55 +02:00
Nick Clifton
44466e45c5 Apply a workaround to mitigate a quadratic performance hit in the linker when writing out secondary reloc sections.
PR 26406
	* elf-bfd.h (struct bfd_elf_section_data): Add
	has_secondary_relocs field.
	* elf.c (_bfd_elf_copy_special_section_fields): Set the
	has_secondary_relocs field for sections which have associated
	secondary relocs.
	* elfcode.h (elf_write_relocs): Only call write_secondary_relocs
	on sections which have associated secondary relocs.
2020-08-20 10:19:47 +01:00
Alok Kumar Sharma
c2fd7faea8 Fix for incorrect breakpoint set in case of flang compiled binary
Currently, GDB is not able to set a breakpoint at subprogram post
prologue for flang generated binaries. This is due to clang having
two line notes one before and another after the prologue.
  Now the end of prologue is determined using symbol table, which was
the way for clang generated binaries already. Since clang and flang
both share same back-end it is true for flang as well.

gdb/ChangeLog

      * amd64-tdep.c (amd64_skip_prologue): Using symbol table
      to find the end of prologue for flang compiled binaries.
      * arm-tdep.c (arm_skip_prologue): Likewise.
      * i386-tdep.c (i386_skip_prologue): Likewise.
      * producer.c (producer_is_llvm): New function.
      (producer_parsing_tests): Added new tests for clang/flang.
      * producer.h (producer_is_llvm): New declaration.

gdb/testsuite/ChangeLog

      * gdb.fortran/vla-type.exp: Skip commands not required for
      the Flang compiled binaries after prologue fix.
2020-08-20 10:38:59 +05:30
Martin Liska
a0522545b6 Remove --reduce-memory-overheads and --hash-size arguments.
* NEWS: Mention --reduce-memory-overheads and --hash-size arguments
	options.
	* as.c: Remove the options from help.
	* doc/as.texi: Remove options.
	* doc/internals.texi: Remove hash from documentation.
	* hash.c (struct hash_entry): Remove.
	(struct hash_control): Likewise.
	(set_gas_hash_table_size): Likewise.
	(hash_new_sized): Likewise.
	(hash_new): Likewise.
	(hash_die): Likewise.
	(hash_lookup): Likewise.
	(hash_insert): Likewise.
	(hash_jam): Likewise.
	(hash_replace): Likewise.
	(hash_find): Likewise.
	(hash_find_n): Likewise.
	(hash_delete): Likewise.
	(hash_traverse): Likewise.
	(hash_print_statistics): Likewise.
	(TABLES): Likewise.
	(STATBUFSIZE): Likewise.
	(main): Likewise.
	(what): Likewise.
	(destroy): Likewise.
	(applicatee): Likewise.
	(whattable): Likewise.
	* hash.h (struct hash_control): Likewise.
	(set_gas_hash_table_size): Likewise.
	(hash_new): Likewise.
	(hash_new_sized): Likewise.
	(hash_die): Likewise.
	(hash_insert): Likewise.
	(hash_jam): Likewise.
	(hash_replace): Likewise.
	(hash_find): Likewise.
	(hash_find_n): Likewise.
	(hash_delete): Likewise.
	(hash_traverse): Likewise.
	(hash_print_statistics): Likewise.
2020-08-20 10:57:52 +09:30
Martin Liska
629310abec Port gas/config/* to str_htab.
* config/obj-coff-seh.c (seh_hash_insert): Port to use new
	str_htab type.
	(seh_hash_find): Likewise.
	(seh_hash_find_or_make): Likewise.
	* config/obj-coff.c (tag_init): Likewise.
	(tag_insert): Likewise.
	(tag_find): Likewise.
	* config/obj-elf.c (struct group_list): Likewise.
	(build_additional_section_info): Likewise.
	(free_section_idx): Likewise.
	(elf_adjust_symtab): Likewise.
	(elf_frob_file_after_relocs): Likewise.
	* config/tc-aarch64.c (INSN_SIZE): Likewise.
	(parse_reg): Likewise.
	(insert_reg_alias): Likewise.
	(create_register_alias): Likewise.
	(s_unreq): Likewise.
	(parse_shift): Likewise.
	(parse_pldop): Likewise.
	(parse_barrier): Likewise.
	(parse_barrier_psb): Likewise.
	(parse_bti_operand): Likewise.
	(parse_sys_reg): Likewise.
	(parse_sys_ins_reg): Likewise.
	(lookup_mnemonic): Likewise.
	(opcode_lookup): Likewise.
	(parse_operands): Likewise.
	(checked_hash_insert): Likewise.
	(sysreg_hash_insert): Likewise.
	(fill_instruction_hash_table): Likewise.
	(md_begin): Likewise.
	* config/tc-alpha.c (struct alpha_reloc_tag): Likewise.
	(get_alpha_reloc_tag): Likewise.
	(assemble_tokens_to_insn): Likewise.
	(assemble_tokens): Likewise.
	(md_begin): Likewise.
	* config/tc-arc.c (arc_find_opcode): Likewise.
	(arc_insert_opcode): Likewise.
	(find_opcode_match): Likewise.
	(declare_register): Likewise.
	(declare_addrtype): Likewise.
	(md_begin): Likewise.
	(arc_parse_name): Likewise.
	(tc_arc_regname_to_dw2regnum): Likewise.
	(arc_extcorereg): Likewise.
	* config/tc-arm.c (MVE_BAD_QREG): Likewise.
	(arm_reg_parse_multi): Likewise.
	(parse_reloc): Likewise.
	(insert_reg_alias): Likewise.
	(create_register_alias): Likewise.
	(s_unreq): Likewise.
	(parse_shift): Likewise.
	(parse_psr): Likewise.
	(parse_cond): Likewise.
	(parse_barrier): Likewise.
	(do_vfp_nsyn_opcode): Likewise.
	(opcode_lookup): Likewise.
	(arm_tc_equal_in_insn): Likewise.
	(md_begin): Likewise.
	* config/tc-avr.c (md_begin): Likewise.
	(avr_ldi_expression): Likewise.
	(md_assemble): Likewise.
	(avr_update_gccisr): Likewise.
	(avr_emit_insn): Likewise.
	* config/tc-cr16.c (get_register): Likewise.
	(get_register_pair): Likewise.
	(get_index_register): Likewise.
	(get_index_register_pair): Likewise.
	(get_pregister): Likewise.
	(get_pregisterp): Likewise.
	(initialise_reg_hash_table): Likewise.
	(md_begin): Likewise.
	(cr16_assemble): Likewise.
	(md_assemble): Likewise.
	* config/tc-cris.c (cris_insn_first_word_frag): Likewise.
	(md_begin): Likewise.
	(cris_process_instruction): Likewise.
	* config/tc-crx.c (get_register): Likewise.
	(get_copregister): Likewise.
	(md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-csky.c (md_begin): Likewise.
	(parse_opcode): Likewise.
	(get_operand_value): Likewise.
	(v1_work_jbsr): Likewise.
	(v2_work_rotlc): Likewise.
	(v2_work_bgeni): Likewise.
	(v2_work_not): Likewise.
	* config/tc-d10v.c (sizeof): Likewise.
	(md_begin): Likewise.
	(do_assemble): Likewise.
	(md_apply_fix): Likewise.
	* config/tc-d30v.c (sizeof): Likewise.
	(md_begin): Likewise.
	(do_assemble): Likewise.
	* config/tc-dlx.c (RELOC_DLX_VTENTRY): Likewise.
	(md_begin): Likewise.
	(machine_ip): Likewise.
	* config/tc-ft32.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-h8300.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-hppa.c (pa_ip): Likewise.
	(md_begin): Likewise.
	* config/tc-i386.c (md_begin): Likewise.
	(i386_print_statistics): Likewise.
	(parse_insn): Likewise.
	(process_operands): Likewise.
	(i386_index_check): Likewise.
	(parse_real_register): Likewise.
	* config/tc-ia64.c (dot_rot): Likewise.
	(dot_entry): Likewise.
	(declare_register): Likewise.
	(md_begin): Likewise.
	(ia64_parse_name): Likewise.
	(md_assemble): Likewise.
	(dot_alias): Likewise.
	(do_alias): Likewise.
	(ia64_adjust_symtab): Likewise.
	(do_secalias): Likewise.
	(ia64_frob_file): Likewise.
	* config/tc-m68hc11.c (m68hc11_print_statistics): Likewise.
	(md_begin): Likewise.
	(print_insn_format): Likewise.
	(md_assemble): Likewise.
	* config/tc-m68k.c (tc_gen_reloc): Likewise.
	(m68k_ip): Likewise.
	(md_begin): Likewise.
	* config/tc-mcore.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-microblaze.c (md_begin): Likewise.
	(md_assemble): Likewise.
	(md_apply_fix): Likewise.
	* config/tc-mips.c (nopic_need_relax): Likewise.
	(md_begin): Likewise.
	(macro_build): Likewise.
	(mips16_macro_build): Likewise.
	(mips_lookup_insn): Likewise.
	(mips_ip): Likewise.
	(mips16_ip): Likewise.
	* config/tc-mmix.c (sizeof): Likewise.
	(mmix_md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-mn10200.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-mn10300.c (HAVE_AM30): Likewise.
	(md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-moxie.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-msp430.c (md_begin): Likewise.
	(msp430_operands): Likewise.
	(md_assemble): Likewise.
	* config/tc-nds32.c (PV_DONT_CARE): Likewise.
	(builtin_isreg): Likewise.
	(builtin_regnum): Likewise.
	(nds32_init_nds32_pseudo_opcodes): Likewise.
	(nds32_lookup_pseudo_opcode): Likewise.
	(nds32_relax_hint): Likewise.
	(md_begin): Likewise.
	(nds32_find_reloc_table): Likewise.
	(nds32_elf_append_relax_relocs_traverse): Likewise.
	(nds32_relax_branch_instructions): Likewise.
	(md_convert_frag): Likewise.
	(nds32_elf_analysis_relax_hint): Likewise.
	(tc_nds32_regname_to_dw2regnum): Likewise.
	* config/tc-nios2.c (nios2_opcode_lookup): Likewise.
	(nios2_reg_lookup): Likewise.
	(nios2_ps_lookup): Likewise.
	(md_begin): Likewise.
	* config/tc-ns32k.c (struct hash_control): Likewise.
	(parse): Likewise.
	(md_begin): Likewise.
	* config/tc-pdp11.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-pj.c (fake_opcode): Likewise.
	(alias): Likewise.
	(md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-ppc.c (ppc_setup_opcodes): Likewise.
	(md_assemble): Likewise.
	* config/tc-pru.c (pru_opcode_lookup): Likewise.
	(pru_reg_lookup): Likewise.
	(md_begin): Likewise.
	(md_end): Likewise.
	* config/tc-riscv.c (init_ext_version_hash): Likewise.
	(riscv_get_default_ext_version): Likewise.
	(riscv_set_arch): Likewise.
	(init_opcode_names_hash): Likewise.
	(opcode_name_lookup): Likewise.
	(enum reg_class): Likewise.
	(hash_reg_name): Likewise.
	(riscv_init_csr_hash): Likewise.
	(reg_csr_lookup_internal): Likewise.
	(reg_lookup_internal): Likewise.
	(init_opcode_hash): Likewise.
	(md_begin): Likewise.
	(DECLARE_CSR): Likewise.
	(macro_build): Likewise.
	(riscv_ip): Likewise.
	* config/tc-s390.c (register_name): Likewise.
	(s390_setup_opcodes): Likewise.
	(md_begin): Likewise.
	(md_assemble): Likewise.
	(s390_insn): Likewise.
	* config/tc-score.c (struct s3_reg_map): Likewise.
	(s3_score_reg_parse): Likewise.
	(s3_dependency_type_from_insn): Likewise.
	(s3_parse_16_32_inst): Likewise.
	(s3_parse_48_inst): Likewise.
	(s3_insert_reg): Likewise.
	(s3_build_reg_hsh): Likewise.
	(s3_build_score_ops_hsh): Likewise.
	(s3_build_dependency_insn_hsh): Likewise.
	(s3_begin): Likewise.
	* config/tc-score7.c (struct s7_reg_map): Likewise.
	(s7_score_reg_parse): Likewise.
	(s7_dependency_type_from_insn): Likewise.
	(s7_parse_16_32_inst): Likewise.
	(s7_build_score_ops_hsh): Likewise.
	(s7_build_dependency_insn_hsh): Likewise.
	(s7_insert_reg): Likewise.
	(s7_build_reg_hsh): Likewise.
	(s7_begin): Likewise.
	* config/tc-sh.c (EMPTY): Likewise.
	(md_begin): Likewise.
	(find_cooked_opcode): Likewise.
	* config/tc-sparc.c (md_begin): Likewise.
	(sparc_ip): Likewise.
	* config/tc-spu.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-tic30.c (md_begin): Likewise.
	(tic30_operand): Likewise.
	(tic30_parallel_insn): Likewise.
	(md_assemble): Likewise.
	* config/tc-tic4x.c (TIC4X_ALT_SYNTAX): Likewise.
	(tic4x_asg): Likewise.
	(tic4x_inst_insert): Likewise.
	(tic4x_inst_add): Likewise.
	(md_begin): Likewise.
	(tic4x_operand_parse): Likewise.
	(md_assemble): Likewise.
	* config/tc-tic54x.c (MAX_SUBSYM_HASH): Likewise.
	(stag_add_field_symbols): Likewise.
	(tic54x_endstruct): Likewise.
	(tic54x_tag): Likewise.
	(tic54x_remove_local_label): Likewise.
	(tic54x_clear_local_labels): Likewise.
	(tic54x_var): Likewise.
	(tic54x_macro_start): Likewise.
	(tic54x_macro_info): Likewise.
	(tic54x_macro_end): Likewise.
	(subsym_isreg): Likewise.
	(subsym_structsz): Likewise.
	(md_begin): Likewise.
	(is_mmreg): Likewise.
	(is_type): Likewise.
	(encode_condition): Likewise.
	(encode_cc3): Likewise.
	(encode_cc2): Likewise.
	(encode_operand): Likewise.
	(tic54x_parse_insn): Likewise.
	(tic54x_parse_parallel_insn_firstline): Likewise.
	(subsym_create_or_replace): Likewise.
	(subsym_lookup): Likewise.
	(subsym_substitute): Likewise.
	(tic54x_undefined_symbol): Likewise.
	* config/tc-tic6x.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-tilegx.c (O_hw2_last_plt): Likewise.
	(INSERT_SPECIAL_OP): Likewise.
	(md_begin): Likewise.
	(tilegx_parse_name): Likewise.
	(parse_reg_expression): Likewise.
	(md_assemble): Likewise.
	* config/tc-tilepro.c (O_tls_ie_load): Likewise.
	(INSERT_SPECIAL_OP): Likewise.
	(tilepro_parse_name): Likewise.
	(parse_reg_expression): Likewise.
	(md_assemble): Likewise.
	* config/tc-v850.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-vax.c (md_ri_to_chars): Likewise.
	(vip_begin): Likewise.
	(vip): Likewise.
	(main): Likewise.
	(md_begin): Likewise.
	* config/tc-wasm32.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-xgate.c (xgate_parse_operand): Likewise.
	(md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-z8k.c (md_begin): Likewise.
	(md_assemble): Likewise.
2020-08-20 10:56:07 +09:30
Martin Liska
494b2fc807 Port dw2gencfi.c to str_htab.
* dw2gencfi.c (dwcfi_hash_insert): Use htab_t and str_hash_*
	functions.
	(dwcfi_hash_find): Likewise.
	(dwcfi_hash_find_or_make): Likewise.
2020-08-20 10:56:07 +09:30
Martin Liska
f7a5981beb Port ecoff.c to str_hash.
* ecoff.c (INIT_VARRAY): Use htab_t.
	(add_string): Likewise.
	(ecoff_read_begin_hook): Use new str_htab_create.
	(get_tag): Use htab_t.
	(add_file): Likewise.
2020-08-20 10:56:07 +09:30
Martin Liska
8d32ded0b1 Add new string hash table based on htab_t.
* hash.h (struct string_tuple): New.
	(hash_string_tuple): Likewise.
	(eq_string_tuple): Likewise.
	(string_tuple_alloc): Likewise.
	(str_hash_find): Likewise.
	(str_hash_find_n): Likewise.
	(str_hash_delete): Likewise.
	(str_hash_insert): Likewise.
	(str_htab_create): Likewise.
2020-08-20 10:56:07 +09:30
Martin Liska
d3b740ca99 Use libiberty hash in gas/symbols.c.
* symbols.c (struct symbol_entry): New.
	(hash_symbol_entry): Likewise.
	(eq_symbol_entry): Likewise.
	(symbol_entry_alloc): Likewise.
	(symbol_entry_find): Likewise.
	(local_symbol_make): Use htab hash table.
	(local_symbol_convert): Likewise.
	(symbol_table_insert): Likewise.
	(symbol_find_exact_noref): Likewise.
	(resolve_local_symbol): Likewise.
	(resolve_local_symbol_values): Likewise.
	(symbol_begin): Likewise.
	(symbol_print_statistics): Likewise.
2020-08-20 10:56:07 +09:30
Martin Liska
32e4c1c2d7 Use libiberty hash in gas/read.c.
* read.c (struct po_entry): New.
	(hash_po_entry): Likewise.
	(eq_po_entry): Likewise.
	(po_entry_alloc): Likewise.
	(po_entry_find): Likewise.
	(pop_insert): Likewise.
	(pobegin): Use htab hash table.
	(read_a_source_file): Likewise.
	(s_macro): Likewise.
	(read_print_statistics): Likewise.
	* config/tc-m68k.c (m68k_conditional_pseudoop): Add const qualifier.
	* config/tc-m68k.h (m68k_conditional_pseudoop): Likewise.
2020-08-20 10:56:07 +09:30
Martin Liska
2b272f449e Use libiberty hash in gas/macro.c.
* config/tc-iq2000.c (iq2000_add_macro): Use htab hash table.
	* macro.c (struct hash_control): Use htab.
	(macro_init): Likewise.
	(do_formals): Likewise.
	(free_macro): Likewise.
	(define_macro): Likewise.
	(sub_actual): Likewise.
	(macro_expand_body): Likewise.
	(macro_expand): Likewise.
	(check_macro): Likewise.
	(delete_macro): Likewise.
	(expand_irp): Likewise.
	* macro.h (struct macro_hash_entry): New struct.
	(hash_macro_entry): New.
	(eq_macro_entry): Likewise.
	(macro_entry_alloc): Likewise.
	(macro_entry_find): Likewise.
	(struct formal_hash_entry): Likewise.
	(hash_formal_entry): Likewise.
	(eq_formal_entry): Likewise.
	(formal_entry_alloc): Likewise.
	(formal_entry_find): Likewise.
2020-08-20 10:53:40 +09:30
Martin Liska
abebb03c3a gas/hash.c: add new functions
The first of a patch series deleting the gas/hash.c hash table
implementation and instead using libiberty/hashtab.c hash tables in
gas.

	* as.h: Include hashtab.h.
	* hash.c (htab_insert): New.
	(htab_print_statistics): Likewise.
	* hash.h (htab_insert): Likewise.
	(htab_print_statistics): Likewise.
2020-08-20 10:51:57 +09:30
GDB Administrator
c51ed085ab Automatic date update in version.in 2020-08-20 00:00:13 +00:00
Alan Modra
d1ce973eb3 PR26349, FAIL: binutils-all/pr25543 on hpux
The 't' length modifier isn't in SUSv2, unsurprisingly %tx isn't
recognized by older printf implementations.  So even though 't' is
correct for ptrdiff_t we can't use it.  Also, _bfd_int64_high and
_bfd_int64_low disappeared in 2008.

	PR 26349
	* readelf.c (dump_relocations): Use BFD_VMA_FMT to print offset
	and info fields.
	(dump_section_as_strings): Don't use %tx to display offset.
2020-08-19 21:25:47 +09:30
Simon Marchi
9327494e0e gdb: add linux_nat_debug_printf macro
The debug prints inside linux-nat.c almost all have a prefix that
indicate in which function they are located.  This prefix is an
abbreviation of the function name.  For example, this print is in the
`linux_nat_post_attach_wait` function:

    if (debug_linux_nat)
      fprintf_unfiltered (gdb_stdlog,
                          "LNPAW: Attaching to a stopped process\n");

Over time, the code has changed, things were moved, and many of these
prefixes are not accurate anymore.  Also, unless you know the
linux-nat.c file by heart, it's a bit cryptic what LLR, LNW, RSRL, etc,
all mean.

To address both of these issues, I suggest adding this macro for
printing debug statements, which automatically includes the function
name.  It also includes the `[linux-nat]` prefix to clarify which part
of GDB printed this (I think that, ideally, all debug prints would
include such a tag).

The `__func__` magic symbol is used to get the function name.
Unfortunately, in the case of methods, it only contains the method name,
not the class name.  So we'll get "wait", where I would have liked to
get "linux_nat_target::wait".  But at least with the `[linux-nat]` tag
in the front, it's not really ambiguous.

I've made the macro automatically include the trailing newline, because
it wouldn't make sense to call it twice to print two parts of one line,
the `[linux-nat]` tag would be printed in the middle.

An advantage of this (IMO) is that it's less verbose, we don't have to
check for `if (debug_linux_nat)` everywhere.

Another advantage is that it's easier to customize the output later,
without having to touch all call sites.

Here's an example of what it looks like in the end:

    [linux-nat] linux_nat_wait_1: enter
    [linux-nat] wait: [process -1], [TARGET_WNOHANG]

gdb/ChangeLog:

	* linux-nat.c (linux_nat_debug_printf): New function.
	(linux_nat_debug_printf_1): New macro.  Use throughout the file.

Change-Id: Ifcea3255b91400d3ad093cd0b75d3fac241cb998
2020-08-18 22:49:54 -04:00
GDB Administrator
6cdb985c45 Automatic date update in version.in 2020-08-19 00:00:06 +00:00
Alan Modra
18a8a00ebe Correct vcmpsq, vcmpuq and xvtlsbb BF field
These shouldn't be optional.  The record form of vector instructions
set CR6, giving an expectation that omitting BF should be the same as
specifying CR6.

opcodes/
	* ppc-opc.c (powerpc_opcodes): Replace OBF with BF for vcmpsq,
	vcmpuq and xvtlsbb.
gas/
	* testsuite/gas/ppc/int128.s: Correct vcmpuq.
	* testsuite/gas/ppc/int128.d: Update.
	* testsuite/gas/ppc/xvtlsbb.d: Update.
2020-08-19 08:47:35 +09:30
Aaron Merey
d138725a62 gdb/Makefile.in: Add DEBUGINFOD_CFLAGS, DEBUGINFOD_LIBS variables.
Introduce Makefile variables DEBUGINFOD_CFLAGS and DEBUGINFOD_LIBS
that map to the configuration variables of the same names.

Replace @DEBUGINFOD_LIBS@ with $(DEBUGINFOD_LIBS) in the definition
of CLIBS in order to conform to the usage of other *_LIBS variables
in Makefile.in.

Add DEBUGINFOD_CFLAGS to INTERNAL_CFLAGS_BASE. This fixes an issue
where GDB would fail to find debuginfod.h if it was not installed
in a default location searched by the compiler.

gdb/ChangeLog:

	* Makefile.in (DEBUGINFOD_CFLAGS, DEBUGINFOD_LIBS): New variables.
	(INTERNAL_CFLAGS_BASE): Add DEBUGINFOD_CFLAGS.
	(CLIBS): Add DEBUGINFOD_LIBS.
2020-08-18 18:02:26 -04:00
Peter Bergner
587a437176 Add ChangeLog entries for previous commit. 2020-08-18 12:48:42 -05:00
Peter Bergner
f5fc30d05c PowerPC: Rename xvcvbf16sp to xvcvbf16spn
The xvcvbf16sp mnemonic has been renamed to xvcvbf16spn, to be consistent
with the other non-signaling conversion instructions which all end with "n".

opcodes/
	* ppc-opc.c (powerpc_opcodes) <xvcvbf16sp>: Rename from this...
	<xvcvbf16spn>: ...to this.

gas/
	* testsuite/gas/ppc/vsx4.s: Update test to use new mnemonic.
	* testsuite/gas/ppc/vsx4.d: Likewise.
2020-08-18 12:43:46 -05:00
GDB Administrator
d2bb907b8b Automatic date update in version.in 2020-08-18 00:00:07 +00:00
Sergei Trofimovich
f9b11e6b18 gdb: fix IA64 build failure of linux-nat
On IA64 built failed as:

```
ia64-linux-nat.c:352:29: error: 'gdbarch_num_regs' was not declared in this scope
  352 |   if (regno < 0 || regno >= gdbarch_num_regs (gdbarch))
      |                             ^~~~~~~~~~~~~~~~
```

The fix includes "gdbarch.h" header where symbol is declared.

	* ia64-linux-nat.c: Include "gdbarch.h" to declare used
	'gdbarch_num_regs'.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2020-08-17 21:52:52 +01:00
Tom Tromey
326afb7229 Update xfail pattern in gdb.rust/simple.exp
In PR rust/26197, Tom de Vries notes that the variant part rewrite
caused some regressions for the Rust compiler he has.  This compiler
is unusual in that it combines a relatively recent rustc with a
relatively old LLVM -- so variant parts are not emitted using DWARF.

Most of the bugs in that PR were already fixed by earlier patches, but
some lingered.  After some research we found that some of these never
did work -- which is consistent with the investigations we did into
the debug info -- but instead were xfail'd.  This patch updates the
xfails to cope with the new output.  (After this, just one failure
remains.)

Tom de Vries tested this using his rustc and suggested a fix that
appears in this version.

gdb/testsuite/ChangeLog
2020-08-17  Tom de Vries  <tdevries@suse.de>
	    Tom Tromey  <tromey@adacore.com>

	PR rust/26197:
	* gdb.rust/simple.exp (xfail_pattern): Update for new failure.
2020-08-17 10:47:48 -06:00
Tom Tromey
3ae7ab9992 Fix MI crash with Ada string access
I happened to notice that using -var-create at a certain spot in an
Ada program caused a crash.  This happens because
ada_get_decoded_value can return NULL -- in particular, deeper in the
code it can hit this return in ada_type_of_array:

      descriptor = desc_bounds (arr);
      if (value_as_long (descriptor) == 0)
        return NULL;

This patch avoids the crash by handling this NULL return.

gdb/ChangeLog
2020-08-17  Tom Tromey  <tromey@adacore.com>

	* ada-varobj.c (ada_varobj_decode_var): Handle case where
	ada_get_decoded_value returns NULL.

gdb/testsuite/ChangeLog
2020-08-17  Tom Tromey  <tromey@adacore.com>

	* gdb.ada/mi_var_access.exp: New file.
	* gdb.ada/mi_var_access/mi_access.adb: New file.
	* gdb.ada/mi_var_access/pck.adb: New file.
	* gdb.ada/mi_var_access/pck.ads: New file.
2020-08-17 09:21:40 -06:00
Tom Tromey
b017825fab Convert CORE_ADDR to Python using gdb_py_object_from_ulongest
An internal test failed on a riscv64-elf cross build because
Inferior.search_memory returned a negative value.  I tracked this down
to to use of PyLong_FromLong in infpy_search_memory.  Then, I looked
at other conversions of CORE_ADDR to Python and fixed these as well.

I don't think there is a good way to write a test for this.

gdb/ChangeLog
2020-08-17  Tom Tromey  <tromey@adacore.com>

	* python/py-inferior.c (infpy_search_memory): Use
	gdb_py_object_from_ulongest.
	* python/py-infevents.c (create_inferior_call_event_object)
	(create_memory_changed_event_object): Use
	gdb_py_object_from_ulongest.
	* python/py-linetable.c (ltpy_entry_get_pc): Use
	gdb_py_object_from_ulongest.
2020-08-17 08:50:35 -06:00
Simon Marchi
7635cf797e gdb: fix wrong indentation in symbol_needs_eval_context
gdb/ChangeLog:

	* loc.c (class symbol_needs_eval_context): Fix indentation.

Change-Id: Ibf4e6a9ca9573b498737a61db116ee10b287b7f5
2020-08-17 06:02:24 -04:00
Simon Marchi
f54be24b10 gdb: use bool in dwarf2_loc_desc_get_symbol_read_needs
This variable is really a boolean, so use the bool type.

gdb/ChangeLog:

	* dwarf2/loc.c (dwarf2_loc_desc_get_symbol_read_needs): Use
	bool.

Change-Id: I814a47d1200f3b88722c54c822fd49607a6b77be
2020-08-17 05:57:16 -04:00
Alex Coplan
d4d05d13eb gas: Fix internal error in S_SET_SEGMENT
This patch fixes an internal error in GAS when defining a section using
a symbol that has already been named but not defined. For a minimal
reproducer, try the following input:

a=b
.sect a

The problem is that obj_elf_change_section() happily reuses the symbol
"a" created by equals() without clearing the sy_value field: prior to
this patch, it just set bsym. This caused a problem when attempting to
resolve the section symbol, since resolve_symbol_value() ended up
resolving the symbol as if it were the original symbol created by
equals(), which ends up leaving the section symbol in the undefined
section instead of in section a, hence the call to abort() in
S_SET_SEGMENT().

gas/ChangeLog:

	* config/obj-elf.c (obj_elf_change_section): When repurposing an
	existing symbol, ensure that we set sy_value as per other (fresh)
	section symbols.
	* testsuite/gas/elf/elf.exp: Add new test.
	* testsuite/gas/elf/section-symbol-redef.d: New test.
	* testsuite/gas/elf/section-symbol-redef.s: Input for test.
2020-08-17 14:23:14 +01:00
Tom de Vries
53d5a2a5c1 [gdb] Fix printing of unresolved dynamic type
When debugging gdb in batch mode with executable mixed-lang-stack and doing a
backtrace at breakpt:
...
$ gdb --args gdb \
  -batch \
  outputs/gdb.fortran/mixed-lang-stack/mixed-lang-stack \
  -ex "b breakpt" \
  -ex r \
  -ex bt
...
and stopping at resolve_dynamic_type to print the type:
...
(gdb) b resolve_dynamic_type
Breakpoint 1 at 0x6b020c: file gdbtypes.c, line 2633.
(gdb) commands
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
>call recursive_dump_type (type, 0)
>continue
>end
(gdb) run
...
we eventually run into an assert for the dynamic type of "str":
...
Thread 1 "gdb" hit Breakpoint 1, resolve_dynamic_type (type=0x22204f0, \
  valaddr=..., addr=4199408) at gdbtypes.c:2633
2633        = {check_typedef (type), valaddr, addr, NULL};
type node 0x22204f0
name '<NULL>' (0x0)
code 0xd (TYPE_CODE_STRING)
length 0
  ...
    nfields 0 0x22204b0
gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: \
  Assertion `m_kind == PROP_CONST' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
...
when trying to print the high bound of a TYPE_CODE_RANGE, which has m_kind
PROP_LOCEXPR, while the code in resolve_dynamic_type assumes PROP_CONST.

Fix this by extending the printing of TYPE_CODE_RANGE to allow
PROP_LOCEXPR/PROP_LOCLIST as well, such that we have instead:
...
    nfields 0 0x1fbc020
    low 1  high (dynamic)
...

Tested on x86_64-linux.

gdb/ChangeLog:

2020-08-17  Tom de Vries  <tdevries@suse.de>

	PR gdb/26393
	* gdbtypes.c (dump_dynamic_prop): New function.
	(recursive_dump_type): Use dump_dynamic_prop for TYPE_CODE_RANGE.
2020-08-17 09:54:37 +02:00
GDB Administrator
d3267445af Automatic date update in version.in 2020-08-17 00:00:07 +00:00
Alan Modra
0dbd452ad2 PowerPC64 inline PLT call tests
* testsuite/ld-powerpc/inline.s,
	* testsuite/ld-powerpc/inline-1.d,
	* testsuite/ld-powerpc/inline-2.d,
	* testsuite/ld-powerpc/inline-3.d,
	* testsuite/ld-powerpc/inline-4.d,
	* testsuite/ld-powerpc/inlinepcrel.s,
	* testsuite/ld-powerpc/inlinepcrel-1.d,
	* testsuite/ld-powerpc/inlinepcrel-2.d,
	* testsuite/ld-powerpc/inlinepcrel-3.d: New tests.
	* testsuite/ld-powerpc/powerpc.exp: Run them.
2020-08-16 23:00:34 +09:30
H.J. Lu
246b9ea198 ld: Add a PR binutils/26389 test
PR binutils/26389
	* testsuite/ld-plugin/lto.exp: Run PR binutils/26389 test.
	* testsuite/ld-plugin/pr26389.c: New file.
	* testsuite/ld-plugin/pr26389.d: Likewise.
2020-08-16 05:45:02 -07:00
Tom de Vries
f569c1c51a [gdb/testsuite] Add gdb.base/eh_return.exp
In PR25350, an internal error was reported:
...
(gdb) break *eh2+0x7e
Breakpoint 1 at 0x13e2: file small.c, line 38.
(gdb) run
Starting program: a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Breakpoint 1, 0x00005555555553e2 in eh2 (
frame.c:558: internal-error: frame_id get_frame_id(frame_info*): \
  Assertion `stashed' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
...

The internal error does not reproduce after recent commit 547ce8f00b
"[gdb/backtrace] Fix printing of fortran string args".

Add the corresponding test-case as regression test, given that the code is
rather atypical.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-08-16  Tom de Vries  <tdevries@suse.de>

	PR gdb/25350
	* gdb.base/eh_return.c: New test.
	* gdb.base/eh_return.exp: New file.
2020-08-16 13:30:34 +02:00
GDB Administrator
878000178e Automatic date update in version.in 2020-08-16 00:00:06 +00:00
Tom de Vries
3d11c30a6e [gdb/testsuite] Fix charlen type in mixed-lang-stack.c
In gdb.fortran/mixed-lang-stack.f90, we have fortran function mixed_func_1d:
...
subroutine mixed_func_1d(a, b, c, d, str)
  use, intrinsic :: iso_c_binding, only: c_int, c_float, c_double
  use, intrinsic :: iso_c_binding, only: c_float_complex
  implicit none
  integer(c_int) :: a
  real(c_float) :: b
  real(c_double) :: c
  complex(c_float_complex) :: d
  character(len=*) :: str
...
which we declare in C in gdb.fortran/mixed-lang-stack.c like this:
...
extern void mixed_func_1d_ (int *, float *, double *, complex float *,
                            char *, size_t);
...

The fortran string parameter str is passed as a char *, and an additional
argument str_ for the string length.  The type used for the string length
argument is size_t, but for gcc 7 and earlier, the actual type is int
instead ( see
https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html ).

Fix this by declaring the string length type depending on the gcc version:
...
 #if !defined (__GNUC__) || __GNUC__ > 7
 typedef size_t fortran_charlen_t;
 #else
 typedef int fortran_charlen_t;
...

Tested on x86_64-linux, with gcc-7 and gcc-8.

gdb/testsuite/ChangeLog:

2020-08-15  Tom de Vries  <tdevries@suse.de>

	* gdb.fortran/mixed-lang-stack.c (fortran_charlen_t): New type.
	(mixed_func_1d_): Use fortran_charlen_t in decl.
2020-08-15 11:59:18 +02:00
Tom de Vries
547ce8f00b [gdb/backtrace] Fix printing of fortran string args
When running test-case gdb.fortran/mixed-lang-stack.exp, it passes, but we
find in gdb.log:
...
 (gdb) bt^M
   ...
 #7  0x000000000040113c in mixed_func_1b (a=1, b=2, c=3, d=(4,5), \
   e=<error reading variable: value requires 140737488341744 bytes, which \
   is more than max-value-size>, g=..., _e=6) at mixed-lang-stack.f90:87^M
...
while a bit later in gdb.log, we have instead for the same frame (after
adding a gdb_test_no_output "set print frame-arguments all" to prevent
getting "e=..."):
...
 (gdb) up^M
 #7  0x000000000040113c in mixed_func_1b (a=1, b=2, c=3, d=(4,5), \
   e='abcdef', g=( a = 1.5, b = 2.5 ), _e=6) at mixed-lang-stack.f90:87^M
...

The difference is that in the latter case, we print the frame while it's
selected, while in the former, it's not.

The problem is that while trying to resolve the dynamic type of e in
resolve_dynamic_type, we call dwarf2_evaluate_property with a frame == NULL
argument, and then use the selected frame as the context in which to evaluate
the dwarf property, effectively evaluating a DW_OP_fbreg operation in the
wrong frame context.

Fix this by temporarily selecting the frame of which we're trying to print the
arguments in print_frame_args, borrowing code from print_frame_local_vars that
was added to fix a similar issue in commit 16c3b12f19 "error/internal-error
printing local variable during "bt full".

Build and tested on x86_64-linux.

gdb/ChangeLog:

2020-08-15  Tom de Vries  <tdevries@suse.de>

	PR backtrace/26390
	* stack.c (print_frame_args): Temporarily set the selected
	frame to FRAME while printing the frame's arguments.

gdb/testsuite/ChangeLog:

2020-08-15  Tom de Vries  <tdevries@suse.de>

	PR backtrace/26390
	* gdb.fortran/mixed-lang-stack.exp: Call bt with -frame-arguments all.
	Update expected pattern.
2020-08-15 10:19:13 +02:00
Alan Modra
10885e2436 Set SEC_SMALL_DATA on small common
Unlike the previous patch setting SEC_SMALL_DATA during
elf_backend_symbol_processing, this patch is mostly cosmetic.

	* elf32-frv.c (elf32_frv_add_symbol_hook): Set SEC_SMALL_DATA on
	small common section.
	* elf32-m32r.c (m32r_elf_add_symbol_hook): Likewise.
	* elf32-microblaze.c (microblaze_elf_add_symbol_hook): Likewise.
	* elf32-nds32.c (nds32_elf_add_symbol_hook): Likewise.
	* elf32-nios2.c (nios2_elf_add_symbol_hook): Likewise.
	* elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
	* elf32-score.c (s3_bfd_score_elf_add_symbol_hook): Likewise.
	* elf32-score7.c (s7_bfd_score_elf_add_symbol_hook): Likewise.
	* elf32-tic6x.c (elf32_tic6x_add_symbol_hook): Likewise.
	* elf32-v850.c (v850_elf_check_relocs): Likewise.
	(v850_elf_add_symbol_hook): Likewise.
	* elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise.
	* elf64-ia64-vms.c (elf64_ia64_add_symbol_hook): Likewise.
	* elfnn-ia64.c (elfNN_ia64_add_symbol_hook): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Likewise.
2020-08-15 15:14:42 +09:30
Alan Modra
4d1823674e PR26389, nm prints "c" for a common symbol with -flto and -fcommon
git commit 49d9fd42ac chose to make nm print 'C' for the normal
common section, and 'c' for other commons.  This was an attempt to
make common symbols in .scommon and other small common sections show
a 'c' type without a section name comparison, but it failed for
nm --plugin on lto objects where normal common symbols are stashed in
a "plug" section.  It's also wrong for large common symbols.  So
instead set SEC_SMALL_DATA on sections created for small commons, and
key off that flag to show 'c' type.  If your ELF target doesn't have
an elf_backend_symbol_processing function, then you won't see 'c' for
symbols in .scommon.

Note that due to bfd_decode_symclass decoding common symbols without
a chance for coff_section_type to treat .scommon specially, then
having .scommon in the array of special sections handled by
coff_section_type prior to 49d9fd42ac was entirely ineffective.
That fact escaped me when writing 49d9fd42ac.  Unless .scommon
didn't have SEC_IS_COMMON set, which would be a little weird.

	PR 26389
	* syms.c (bfd_decode_symclass): Choose 'c' for commons only when
	SEC_SMALL_DATA.
	* elf32-m32r.c (_bfd_m32r_elf_symbol_processing): Set SEC_SMALL_DATA
	on small common section.
	* elf32-score.c (s3_bfd_score_elf_symbol_processing): Likewise.
	* elf32-score7.c (s7_bfd_score_elf_symbol_processing): Likewise.
	* elf32-tic6x.c (elf32_tic6x_symbol_processing): Likewise.
	* elf32-v850.c (v850_elf_symbol_processing): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_symbol_processing): Likewise.
	* ecoff.c (ecoff_set_symbol_info, ecoff_link_add_externals): Likewise.
2020-08-15 14:16:02 +09:30
GDB Administrator
a9ca57d09a Automatic date update in version.in 2020-08-15 00:00:07 +00:00
Pedro Franco de Carvalho
6ea815e781 [PowerPC] Always clear watchpoint with PTRACE_SET_DEBUGREG
This patches changes low_prepare_to_resume in the ppc linux native target
to always clear the watchpoint when the old PTRACE_SET_DEBUGREG interface
is used, even if another watchpoint GDB requested to the target is
written right after using the same call.

The reason for this is that there were some older kernel versions for
which overwriting a watchpoint with PTRACE_SET_DEBUGREG would not
re-activate the watchpoint if it was previouly disabled following a hit.
This happened when the kernel was configured with CONFIG_HW_BREAKPOINT on
and uses perf events to install watchpoints.

Previously, the ppc linux native target would immediately remove or
insert watchpoints following a request from the upper layers.  This was
changed in commit 227c0bf4b3 to fix other
issues, which caused watchpoint requests to be applied to the inferior
only in low_prepare_to_resume, right before the inferior is resumed.

Usually, but maybe not always, after a hit, GDB will remove the
watchpoint, resume the inferior for a single-step, possibly report the
watchpoint hit to the user, and then re-insert the watchpoint before the
inferior is next resumed.  In this case there would be no problems, but
since I can't guarantee that there aren't other paths in GDB that allow
the user to set a new watchpoint after the first one hit, and after its
deletion by GDB, but before the inferior is resumed, there is a chance
that PTRACE_SET_DEBUGREG could be called directly without the watchpoint
first having been cleared, which could cause a false negative with the
older kernel versions.

This issue would affect kernel versions starting from this commit:

5aae8a53708025d4e718f0d2e7c2f766779ddc71

Up to the fix in this commit:

a53fd61ac2f411745471c1c877d5e072fbbf0e5c

gdb/ChangeLog:

	PR breakpoints/26385
	* ppc-linux-nat.c (ppc_linux_nat_target::low_prepare_to_resume):
	Always clear watchpoint with PTRACE_SET_DEBUGREG.
2020-08-14 15:41:14 -03:00
Pedro Franco de Carvalho
6e562fa3ba [PowerPC] Use < 0 and >= 0 for watchpoint ptrace calls
In commit 227c0bf4b3, which fixed some
watchpoint bugs, I compared the return value of some ptrace calls with ==
-1 and != -1.  Althought this should be correct, since the rest of the
file uses < 0 and >= 0, I have modified this for consistency.

gdb/ChangeLog:

	* ppc-linux-nat.c (ppc_linux_dreg_interface::detect)
	(ppc_linux_nat_target::low_prepare_to_resume): Use ptrace () < 0
	and >= to check return value instead of == -1 and != -1.
2020-08-14 15:41:13 -03:00
Simon Marchi
d369b608a1 gdb: add gdb_argv::as_array_view method
Introduce the gdb_argv::as_array_view method, as a way to easily pass
the parsed arguments array to a function taking an array view.  There is
currently one caller where we can use this (which prompted the
suggestion to implement this method).

Add some selftests for the new method, which at the same time test a
little bit gdb_argv.  As far as I know, it's not tested currently.

gdb/ChangeLog:

	* utils.h (class gdb_argv) <as_array_view>: New method.
	* utils.c (gdb_argv_as_array_view_test): New.
	(_initialize_utils): Register selftest.
	* maint.c (maintenance_selftest): Use the new method.

Change-Id: I0645037613ed6549aabe60f14a36f3494513b177
2020-08-14 12:27:22 -04:00
Alan Modra
19bddbe95c Allow larger bfd_default_hash_table_size
* hash.c (bfd_hash_set_default_size): Use higher_prime_number
	rather than another copy of primes.  Increase maximum default
	size allowed.
2020-08-14 21:37:24 +09:30
Alan Modra
82fcdb3938 PR26388, objdump debug dump memory leaks
num_debug_info_entries is used not just as a count but also as a flag
(DEBUG_INFO_UNAVAILABLE) after some errors.  That means
num_debug_info_entries can't be used when cleaning up malloc'd info.

	PR 26388
	* dwarf.c (free_debug_memory): Free alloc_num_debug_info_entries
	of debug_information.  Correct test of max_loc_offsets and
	max_range_lists.
	* rddbg.c (read_debugging_info): Free dhandle on error.
2020-08-14 21:31:22 +09:30
Alan Modra
fc0efc4bd7 Readelf demangling test typo
Using floating point data results in cris failing the test.

	* testsuite/binutils-all/mangled.s: Use dc.a rather than dc.d.
2020-08-14 21:29:57 +09:30
Tamar Christina
95c210664d AArch64: Relax thumb-plt testcases regexpr.
The regexpr in these two files are a bit strict in that they don't account for
the slight changes in tags in certain arm targets which cause our address
offsets to change.   This changes the tests to allow slight movement in
locations while still strictly checking the rest.

ld/ChangeLog:

2020-08-03  Tamar Christina  <tamar.christina@arm.com>

	* testsuite/ld-arm/thumb-plt-got.d: Relax regexpr.
	* testsuite/ld-arm/thumb-plt.d: Likewise.
2020-08-14 07:52:00 +01:00
GDB Administrator
dac736f6a1 Automatic date update in version.in 2020-08-14 00:00:07 +00:00
Kamil Rytarowski
a6e6223e9a gdb: Implement native dumpcore function for NetBSD
Define supports_dumpcore and dumpcore for NetBSD, that wraps
the ptrace(2) call with the PT_DUMPCORE operation.

gdb/ChangeLog:

       * nbsd-nat.h (nbsd_nat_target::supports_dumpcore)
       (nbsd_nat_target::dumpcore): New declarations.
       * nbsd-nat.c (nbsd_nat_target::supports_dumpcore)
       (nbsd_nat_target::dumpcore): New functions.
2020-08-14 00:10:06 +02:00