Commit Graph

217 Commits

Author SHA1 Message Date
Tom Tromey 08feed99cb Change get_objfile_arch to a method on objfile
This changes get_objfile_arch to be a new inline method,
objfile::arch.

To my surprise, this function came up while profiling DWARF psymbol
reading.  Making this change improved performance from 1.986 seconds
to 1.869 seconds.  Both measurements were done by taking the mean of
10 runs on a fixed copy of the gdb executable.

gdb/ChangeLog
2020-04-18  Tom Tromey  <tom@tromey.com>

	* xcoffread.c (enter_line_range, scan_xcoff_symtab): Update.
	* value.c (value_fn_field): Update.
	* valops.c (find_function_in_inferior)
	(value_allocate_space_in_inferior): Update.
	* tui/tui-winsource.c (tui_update_source_windows_with_line):
	Update.
	* tui/tui-source.c (tui_source_window::set_contents): Update.
	* symtab.c (lookup_global_or_static_symbol)
	(find_function_start_sal_1, skip_prologue_sal)
	(print_msymbol_info, find_gnu_ifunc, symbol_arch): Update.
	* symmisc.c (dump_msymbols, dump_symtab_1)
	(maintenance_print_one_line_table): Update.
	* symfile.c (init_entry_point_info, section_is_mapped)
	(list_overlays_command, simple_read_overlay_table)
	(simple_overlay_update_1): Update.
	* stap-probe.c (handle_stap_probe): Update.
	* stabsread.c (dbx_init_float_type, define_symbol)
	(read_one_struct_field, read_enum_type, read_range_type): Update.
	* source.c (info_line_command): Update.
	* python/python.c (gdbpy_source_objfile_script)
	(gdbpy_execute_objfile_script): Update.
	* python/py-type.c (save_objfile_types): Update.
	* python/py-objfile.c (py_free_objfile): Update.
	* python/py-inferior.c (python_new_objfile): Update.
	* psymtab.c (psym_find_pc_sect_compunit_symtab, dump_psymtab)
	(dump_psymtab_addrmap_1, maintenance_info_psymtabs)
	(maintenance_check_psymtabs): Update.
	* printcmd.c (info_address_command): Update.
	* objfiles.h (struct objfile) <arch>: New method, from
	get_objfile_arch.
	(get_objfile_arch): Don't declare.
	* objfiles.c (get_objfile_arch): Remove.
	(filter_overlapping_sections): Update.
	* minsyms.c (msymbol_is_function): Update.
	* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines)
	(output_nondebug_symbol): Update.
	* mdebugread.c (parse_symbol, basic_type, parse_partial_symbols)
	(mdebug_expand_psymtab): Update.
	* machoread.c (macho_add_oso_symfile): Update.
	* linux-tdep.c (linux_infcall_mmap, linux_infcall_munmap):
	Update.
	* linux-fork.c (checkpoint_command): Update.
	* linespec.c (convert_linespec_to_sals): Update.
	* jit.c (finalize_symtab): Update.
	* infrun.c (insert_exception_resume_from_probe): Update.
	* ia64-tdep.c (ia64_find_unwind_table): Update.
	* hppa-tdep.c (internalize_unwinds): Update.
	* gdbtypes.c (get_type_arch, init_float_type, objfile_type):
	Update.
	* gcore.c (call_target_sbrk): Update.
	* elfread.c (record_minimal_symbol, elf_symtab_read)
	(elf_rel_plt_read, elf_gnu_ifunc_record_cache)
	(elf_gnu_ifunc_resolve_by_got): Update.
	* dwarf2/read.c (create_addrmap_from_index)
	(create_addrmap_from_aranges, dw2_find_pc_sect_compunit_symtab)
	(read_debug_names_from_section)
	(process_psymtab_comp_unit_reader, add_partial_symbol)
	(add_partial_subprogram, process_full_comp_unit)
	(read_file_scope, read_func_scope, read_lexical_block_scope)
	(read_call_site_scope, dwarf2_ranges_read)
	(dwarf2_record_block_ranges, dwarf2_add_field)
	(mark_common_block_symbol_computed, read_tag_pointer_type)
	(read_tag_string_type, dwarf2_init_float_type)
	(dwarf2_init_complex_target_type, read_base_type)
	(partial_die_info::read, partial_die_info::read)
	(read_attribute_value, dwarf_decode_lines_1, new_symbol)
	(dwarf2_fetch_die_loc_sect_off): Update.
	* dwarf2/loc.c (dwarf2_find_location_expression)
	(class dwarf_evaluate_loc_desc, rw_pieced_value)
	(dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval)
	(dwarf2_loc_desc_get_symbol_read_needs)
	(locexpr_describe_location_piece, locexpr_describe_location_1)
	(loclist_describe_location): Update.
	* dwarf2/index-write.c (write_debug_names): Update.
	* dwarf2/frame.c (dwarf2_build_frame_info): Update.
	* dtrace-probe.c (dtrace_process_dof): Update.
	* dbxread.c (read_dbx_symtab, dbx_end_psymtab)
	(process_one_symbol): Update.
	* ctfread.c (ctf_init_float_type, read_base_type): Update.
	* coffread.c (coff_symtab_read, enter_linenos, decode_base_type)
	(coff_read_enum_type): Update.
	* cli/cli-cmds.c (edit_command, list_command): Update.
	* buildsym.c (buildsym_compunit::finish_block_internal): Update.
	* breakpoint.c (create_overlay_event_breakpoint)
	(create_longjmp_master_breakpoint)
	(create_std_terminate_master_breakpoint)
	(create_exception_master_breakpoint, get_sal_arch): Update.
	* block.c (block_gdbarch): Update.
	* annotate.c (annotate_source_line): Update.
2020-04-18 08:35:04 -06:00
Tom de Vries c1a66c0629 [gdb] Expand symbolless symtabs using maint expand-symtabs
Consider this test-case, consisting of header file hello.h:
...
inline static const char*
foo (void)
{
  return "foo";
}
...
and source file hello.c:
...
int
main (void)
{
  printf ("hello: %s\n", foo ());
  return 0;
}
...
compiled with -g:
...
$ gcc hello.c -g
...

When trying to expand the partial symtab for hello.h:
...
$ gdb -batch \
  -iex "set language c" \
  a.out \
  -ex "maint expand-symtabs hello.h" \
  -ex "maint info psymtabs"
...
we in fact find that the partial symtab for hello.h (and corresponding
includer partial symtab hello.c) have not been expanded:
...
  { psymtab hello.h ((struct partial_symtab *) 0x27cf070)
    readin no
  ...
  { psymtab hello.c ((struct partial_symtab *) 0x2cf09e0)
    readin no
...

This is due to the recursively_search_psymtabs call in
psym_expand_symtabs_matching:
...
      if (recursively_search_psymtabs (ps, objfile, domain,
                                      lookup_name, symbol_matcher))
...
which always returns false for symbolless partial symtabs.

The same problem occurs with CUs where the dwarf is generated by gas
--gdwarf-2 for a foo.S: if we read such a test-case with -readnow, we'll have
a symbolless symtab for foo.S.  But if we read the test-case with partial
symtabs, and expand those using "maint expand-symtabs", the foo.S psymtab
remains unexpanded.

Fix this by passing a NULL symbol_matcher and lookup_name to
expand_symtabs_matching in maintenance_expand_symtabs, and skipping the call
to recursively_search_psymtabs if symbol_matcher == NULL and
lookup_name == NULL.

Build and tested on x86_64-linux, with native.

In addition, tested test-case with target boards cc-with-gdb-index.exp,
cc-with-debug-names.exp and readnow.exp.

gdb/ChangeLog:

2020-04-14  Tom de Vries  <tdevries@suse.de>

	PR symtab/25720
	* symmisc.c (maintenance_expand_symtabs): Call expand_symtabs_matching
	with NULL symbol_matcher and lookup_name.
	* psymtab.c (psym_expand_symtabs_matching): Handle NULL symbol_matcher
	and lookup_name.
	* dwarf2/read.c (dw2_expand_symtabs_matching)
	(dw2_debug_names_expand_symtabs_matching): Same.
	* symfile.h (struct quick_symbol_functions::expand_symtabs_matching):
	Make lookup_name a pointer.  Update comment.
	* symtab.c (global_symbol_searcher::expand_symtabs): Handle
	lookup_name being a pointer.
	* symfile.c (expand_symtabs_matching): Same.
	* symfile-debug.c (debug_qf_expand_symtabs_matching): Same.
	* linespec.c (iterate_over_all_matching_symtabs): Same.

gdb/testsuite/ChangeLog:

2020-04-14  Tom de Vries  <tdevries@suse.de>

	PR symtab/25720
	* gdb.base/maint-expand-symbols-header-file.c: New test.
	* gdb.base/maint-expand-symbols-header-file.exp: New file.
	* gdb.base/maint-expand-symbols-header-file.h: New test.
2020-04-14 15:08:42 +02:00
Tom de Vries 7b1eff95be [gdb] Print user/includes fields for maint commands
The type struct compunit_symtab contains two fields (disregarding field next)
that express relations with other compunit_symtabs: user and includes.

These fields are currently not printed with "maint info symtabs" and
"maint print symbols".

Fix this such that for "maint info symtabs" we print:
...
   { ((struct compunit_symtab *) 0x23e8450)
     debugformat DWARF 2
     producer (null)
     dirname (null)
     blockvector ((struct blockvector *) 0x23e8590)
+    user ((struct compunit_symtab *) 0x2336280)
+    ( includes
+      ((struct compunit_symtab *) 0x23e85e0)
+      ((struct compunit_symtab *) 0x23e8960)
+    )
         { symtab <unknown> ((struct symtab *) 0x23e85b0)
           fullname (null)
           linetable ((struct linetable *) 0x0)
         }
   }
...

And for "maint print symbols" we print:
...
-Symtab for file <unknown>
+Symtab for file <unknown> at 0x23e85b0
 Read from object file /data/gdb_versions/devel/a.out (0x233ccf0)
 Language: c

 Blockvector:

 block #000, object at 0x23e8530, 0 syms/buckets in 0x0..0x0
   block #001, object at 0x23e84d0 under 0x23e8530, 0 syms/buckets in 0x0..0x0

+Compunit user: 0x2336300
+Compunit include: 0x23e8900
+Compunit include: 0x23dd970
...
Note: for user and includes we don't list the actual compunit_symtab address,
but instead the corresponding symtab address, which allows us to find that
symtab elsewhere in the output (given that we also now print the address of
symtabs).

gdb/ChangeLog:

2020-03-25  Tom de Vries  <tdevries@suse.de>

	* symtab.h (is_main_symtab_of_compunit_symtab): New function.
	* symmisc.c (dump_symtab_1): Print user and includes fields.
	(maintenance_info_symtabs): Same.
2020-03-25 12:38:05 +01:00
Tom Tromey 1773be9ea2 Fix column alignment in "maint info line-table"
Andrew Burgess pointed out on irc that "maint info line-table" doesn't
properly align the table headers.  This patch fixes the problem by
switching the table to use ui-out.

This required a small tweak to one test case, as ui-out will pad a
field using spaces, even at the end of a line.

gdb/ChangeLog
2020-03-20  Tom Tromey  <tromey@adacore.com>

	* symmisc.c (maintenance_print_one_line_table): Use ui_out.

gdb/testsuite/ChangeLog
2020-03-20  Tom Tromey  <tromey@adacore.com>

	* gdb.dwarf2/dw2-ranges-base.exp: Update regular expressions.
2020-03-20 08:28:52 -06:00
Andrew Burgess 8c95582da8 gdb: Add support for tracking the DWARF line table is-stmt field
This commit brings support for the DWARF line table is_stmt field to
GDB.  The is_stmt field is used by the compiler when a single source
line is split into multiple assembler instructions, especially if the
assembler instructions are interleaved with instruction from other
source lines.

The compiler will set the is_stmt flag false from some instructions
from the source lines, these instructions are not a good place to
insert a breakpoint in order to stop at the source line.
Instructions which are marked with the is_stmt flag true are a good
place to insert a breakpoint for that source line.

Currently GDB ignores all instructions for which is_stmt is false.
This is fine in a lot of cases, however, there are some cases where
this means the debug experience is not as good as it could be.

Consider stopping at a random instruction, currently this instruction
will be attributed to the last line table entry before this point for
which is_stmt was true - as these are the only line table entries that
GDB tracks.  This can easily be incorrect in code with even a low
level of optimisation.

With is_stmt tracking in place, when stopping at a random instruction
we now attribute the instruction back to the real source line, even
when is_stmt is false for that instruction in the line table.

When inserting breakpoints we still select line table entries for
which is_stmt is true, so the breakpoint placing behaviour should not
change.

When stepping though code (at the line level, not the instruction
level) we will still stop at instruction where is_stmt is true, I
think this is more likely to be the desired behaviour.

Instruction stepping is, of course, unchanged, stepping one
instruction at a time, but we should now report more accurate line
table information with each instruction step.

The original motivation for this work was a patch posted by Bernd
here:
  https://sourceware.org/ml/gdb-patches/2019-11/msg00792.html

As part of that thread it was suggested that many issues would be
resolved if GDB supported line table views, this isn't something I've
attempted in this patch, though reading the spec, it seems like this
would be a useful feature to support in GDB in the future.  The spec
is here:
  http://dwarfstd.org/ShowIssue.php?issue=170427.1

And Bernd gives a brief description of the benefits here:
  https://sourceware.org/ml/gdb-patches/2020-01/msg00147.html

With that all said, I think that there is benefit to having proper
is_stmt support regardless of whether we have views support, so I
think we should consider getting this in first, and then building view
support on top of this.

The gdb.cp/step-and-next-inline.exp test is based off a test proposed
by Bernd Edlinger in this message:
  https://sourceware.org/ml/gdb-patches/2019-12/msg00842.html

gdb/ChangeLog:

	* buildsym-legacy.c (record_line): Pass extra parameter to
	record_line.
	* buildsym.c (buildsym_compunit::record_line): Take an extra
	parameter, reduce duplication in the line table, and record the
	is_stmt flag in the line table.
	* buildsym.h (buildsym_compunit::record_line): Add extra
	parameter.
	* disasm.c (do_mixed_source_and_assembly_deprecated): Ignore
	non-statement lines.
	* dwarf2/read.c (dwarf_record_line_1): Add extra parameter, pass
	this to the symtab builder.
	(dwarf_finish_line): Pass extra parameter to dwarf_record_line_1.
	(lnp_state_machine::record_line): Pass a suitable is_stmt flag
	through to dwarf_record_line_1.
	* infrun.c (process_event_stop_test): When stepping, don't stop at
	a non-statement instruction, and only refresh the step info when
	we land in the middle of a line's range.  Also add an extra
	comment.
	* jit.c (jit_symtab_line_mapping_add_impl): Initialise is_stmt
	field.
	* record-btrace.c (btrace_find_line_range): Only record lines
	marked as is-statement.
	* stack.c (frame_show_address): Show the frame address if we are
	in a non-statement sal.
	* symmisc.c (dump_symtab_1): Print the is_stmt flag.
	(maintenance_print_one_line_table): Print a header for the is_stmt
	column, and include is_stmt information in the output.
	* symtab.c (find_pc_sect_line): Find lines marked as statements in
	preference to non-statements.
	(find_pcs_for_symtab_line): Prefer is-statement entries.
	(find_line_common): Likewise.
	* symtab.h (struct linetable_entry): Add is_stmt field.
	(struct symtab_and_line): Likewise.
	* xcoffread.c (arrange_linetable): Initialise is_stmt field when
	arranging the line table.

gdb/testsuite/ChangeLog:

	* gdb.cp/step-and-next-inline.cc: New file.
	* gdb.cp/step-and-next-inline.exp: New file.
	* gdb.cp/step-and-next-inline.h: New file.
	* gdb.dwarf2/dw2-is-stmt.c: New file.
	* gdb.dwarf2/dw2-is-stmt.exp: New file.
	* gdb.dwarf2/dw2-is-stmt-2.c: New file.
	* gdb.dwarf2/dw2-is-stmt-2.exp: New file.
	* gdb.dwarf2/dw2-ranges-base.exp: Update line table pattern.
2020-03-10 22:32:07 +00:00
Tom Tromey be1e3d3eab Introduce objfile::intern
This introduces a string cache on the per-BFD object, replacing the
macro and filename caches.  Both of these caches just store strings,
so this consolidation by itself saves a little memory (about the size
of a bcache per objfile).

Then this patch switches some allocations on the objfile obstack to
use this bcache instead.  This saves more space; and turns out to be a
bit faster as well.

Here are the before and after "maint time" + "maint space" results of
"file ./gdb":

    Command execution time: 4.664021 (cpu), 4.728518 (wall)
    Space used: 39190528 (+29212672 for this command)

    Command execution time: 4.216209 (cpu), 4.107023 (wall)
    Space used: 36667392 (+26689536 for this command)

The main interface to the string cache is a new pair of overloaded
methods, objfile::intern.

gdb/ChangeLog
2020-03-04  Tom Tromey  <tom@tromey.com>

	* symmisc.c (print_symbol_bcache_statistics)
	(print_objfile_statistics): Update.
	* symfile.c (allocate_symtab): Use intern.
	* psymtab.c (partial_symtab::partial_symtab): Use intern.
	* objfiles.h (struct objfile_per_bfd_storage) <filename_cache,
	macro_cache>: Remove.
	<string_cache>: New member.
	(struct objfile) <intern>: New methods.
	* elfread.c (elf_symtab_read): Use intern.
	* dwarf2/read.c (fixup_go_packaging): Intern package name.
	(dwarf2_compute_name, dwarf2_physname)
	(create_dwo_unit_in_dwp_v1, create_dwo_unit_in_dwp_v2): Intern
	names.
	(guess_partial_die_structure_name): Update.
	(partial_die_info::fixup): Intern name.
	(dwarf2_canonicalize_name): Change parameter to objfile.  Intern
	name.
	(dwarf2_name): Intern name.  Update.
	* buildsym.c (buildsym_compunit::get_macro_table): Use
	string_cache.
2020-03-04 16:34:49 -07:00
Andrew Burgess 94a72be708 gdb: Include end of sequence markers in the line table
In this commit:

  commit d9b3de22f3
  Date:   Wed May 27 14:44:29 2015 -0700

      Add struct to record dwarf line number state machine.

I believe an unintended change was made to how we store the DWARF line
table, the end of sequence markers between sequences of lines were
lost from the line table.

This commit fixes this small oversight and restores the end of
sequence markers.

Given that we've survived this long without noticing is clearly an
indication that this isn't that serious, however, a later patch that I
am developing would benefit from having the markers in place, so I'd
like to restore them.

Having the markers also means that the output of 'maintenance info
line-table' now more closely reflects the DWARF line table.

I've taken this opportunity to improve how 'maintenance info
line-table' displays the end of sequence markers - it now uses the END
keyword, rather than just printing an entry with line number 0.  So we
see this:

  INDEX    LINE ADDRESS
  0          12 0x00000000004003b0
  1          17 0x00000000004003b0
  2          18 0x00000000004003b0
  3         END 0x00000000004003b7
  4           5 0x00000000004004a0
  5           6 0x00000000004004a0
  6         END 0x00000000004004a7

Instead of what we would have seen, which was this:

  INDEX    LINE ADDRESS
  0          12 0x00000000004003b0
  1          17 0x00000000004003b0
  2          18 0x00000000004003b0
  3           0 0x00000000004003b7
  4           5 0x00000000004004a0
  5           6 0x00000000004004a0
  6           0 0x00000000004004a7

I've added a small test that uses 'maintenance info line-table' to
ensure that we don't regress this again.

gdb/ChangeLog:

	* dwarf2read.c (lnp_state_machine::record_line): Include
	end_sequence parameter in debug print out.  Record the line if we
	are at an end_sequence marker even if it's not the start of a
	statement.
	* symmisc.c (maintenance_print_one_line_table): Print end of
	sequence markers with 'END' not '0'.

gdb/testsuite/ChangeLog:

	* gdb.base/maint.exp: Update line table parsing test.
	* gdb.dwarf2/dw2-ranges-base.exp: Add new line table parsing test.

Change-Id: I002f872248db82a1d4fefdc6b51ff5dbf932d8a8
2020-01-24 23:39:31 +00:00
Simon Marchi 6c2659886f gdb: add back declarations for _initialize functions
I'd like to enable the -Wmissing-declarations warning.  However, it
warns for every _initialize function, for example:

      CXX    dcache.o
    /home/smarchi/src/binutils-gdb/gdb/dcache.c: In function ‘void _initialize_dcache()’:
    /home/smarchi/src/binutils-gdb/gdb/dcache.c:688:1: error: no previous declaration for ‘void _initialize_dcache()’ [-Werror=missing-declarations]
     _initialize_dcache (void)
     ^~~~~~~~~~~~~~~~~~

The only practical way forward I found is to add back the declarations,
which were removed by this commit:

    commit 481695ed5f
    Author: John Baldwin <jhb@FreeBSD.org>
    Date:   Sat Sep 9 11:02:37 2017 -0700

        Remove unnecessary function prototypes.

I don't think it's a big problem to have the declarations for these
functions, but if anybody has a better solution for this, I'll be happy
to use it.

gdb/ChangeLog:

	* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Add declaration.
	* aarch64-fbsd-tdep.c (_initialize_aarch64_fbsd_tdep): Add declaration.
	* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Add declaration.
	* aarch64-linux-tdep.c (_initialize_aarch64_linux_tdep): Add declaration.
	* aarch64-newlib-tdep.c (_initialize_aarch64_newlib_tdep): Add declaration.
	* aarch64-tdep.c (_initialize_aarch64_tdep): Add declaration.
	* ada-exp.y (_initialize_ada_exp): Add declaration.
	* ada-lang.c (_initialize_ada_language): Add declaration.
	* ada-tasks.c (_initialize_tasks): Add declaration.
	* agent.c (_initialize_agent): Add declaration.
	* aix-thread.c (_initialize_aix_thread): Add declaration.
	* alpha-bsd-nat.c (_initialize_alphabsd_nat): Add declaration.
	* alpha-linux-nat.c (_initialize_alpha_linux_nat): Add declaration.
	* alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Add declaration.
	* alpha-nbsd-tdep.c (_initialize_alphanbsd_tdep): Add declaration.
	* alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Add declaration.
	* alpha-tdep.c (_initialize_alpha_tdep): Add declaration.
	* amd64-darwin-tdep.c (_initialize_amd64_darwin_tdep): Add declaration.
	* amd64-dicos-tdep.c (_initialize_amd64_dicos_tdep): Add declaration.
	* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Add declaration.
	* amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Add declaration.
	* amd64-linux-nat.c (_initialize_amd64_linux_nat): Add declaration.
	* amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Add declaration.
	* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Add declaration.
	* amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Add declaration.
	* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Add declaration.
	* amd64-obsd-tdep.c (_initialize_amd64obsd_tdep): Add declaration.
	* amd64-sol2-tdep.c (_initialize_amd64_sol2_tdep): Add declaration.
	* amd64-tdep.c (_initialize_amd64_tdep): Add declaration.
	* amd64-windows-nat.c (_initialize_amd64_windows_nat): Add declaration.
	* amd64-windows-tdep.c (_initialize_amd64_windows_tdep): Add declaration.
	* annotate.c (_initialize_annotate): Add declaration.
	* arc-newlib-tdep.c (_initialize_arc_newlib_tdep): Add declaration.
	* arc-tdep.c (_initialize_arc_tdep): Add declaration.
	* arch-utils.c (_initialize_gdbarch_utils): Add declaration.
	* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Add declaration.
	* arm-fbsd-tdep.c (_initialize_arm_fbsd_tdep): Add declaration.
	* arm-linux-nat.c (_initialize_arm_linux_nat): Add declaration.
	* arm-linux-tdep.c (_initialize_arm_linux_tdep): Add declaration.
	* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Add declaration.
	* arm-nbsd-tdep.c (_initialize_arm_netbsd_tdep): Add declaration.
	* arm-obsd-tdep.c (_initialize_armobsd_tdep): Add declaration.
	* arm-pikeos-tdep.c (_initialize_arm_pikeos_tdep): Add declaration.
	* arm-symbian-tdep.c (_initialize_arm_symbian_tdep): Add declaration.
	* arm-tdep.c (_initialize_arm_tdep): Add declaration.
	* arm-wince-tdep.c (_initialize_arm_wince_tdep): Add declaration.
	* auto-load.c (_initialize_auto_load): Add declaration.
	* auxv.c (_initialize_auxv): Add declaration.
	* avr-tdep.c (_initialize_avr_tdep): Add declaration.
	* ax-gdb.c (_initialize_ax_gdb): Add declaration.
	* bfin-linux-tdep.c (_initialize_bfin_linux_tdep): Add declaration.
	* bfin-tdep.c (_initialize_bfin_tdep): Add declaration.
	* break-catch-sig.c (_initialize_break_catch_sig): Add declaration.
	* break-catch-syscall.c (_initialize_break_catch_syscall): Add declaration.
	* break-catch-throw.c (_initialize_break_catch_throw): Add declaration.
	* breakpoint.c (_initialize_breakpoint): Add declaration.
	* bsd-uthread.c (_initialize_bsd_uthread): Add declaration.
	* btrace.c (_initialize_btrace): Add declaration.
	* charset.c (_initialize_charset): Add declaration.
	* cli/cli-cmds.c (_initialize_cli_cmds): Add declaration.
	* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
	* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
	* cli/cli-logging.c (_initialize_cli_logging): Add declaration.
	* cli/cli-script.c (_initialize_cli_script): Add declaration.
	* cli/cli-style.c (_initialize_cli_style): Add declaration.
	* coff-pe-read.c (_initialize_coff_pe_read): Add declaration.
	* coffread.c (_initialize_coffread): Add declaration.
	* compile/compile-cplus-types.c (_initialize_compile_cplus_types): Add declaration.
	* compile/compile.c (_initialize_compile): Add declaration.
	* complaints.c (_initialize_complaints): Add declaration.
	* completer.c (_initialize_completer): Add declaration.
	* copying.c (_initialize_copying): Add declaration.
	* corefile.c (_initialize_core): Add declaration.
	* corelow.c (_initialize_corelow): Add declaration.
	* cp-abi.c (_initialize_cp_abi): Add declaration.
	* cp-namespace.c (_initialize_cp_namespace): Add declaration.
	* cp-support.c (_initialize_cp_support): Add declaration.
	* cp-valprint.c (_initialize_cp_valprint): Add declaration.
	* cris-linux-tdep.c (_initialize_cris_linux_tdep): Add declaration.
	* cris-tdep.c (_initialize_cris_tdep): Add declaration.
	* csky-linux-tdep.c (_initialize_csky_linux_tdep): Add declaration.
	* csky-tdep.c (_initialize_csky_tdep): Add declaration.
	* ctfread.c (_initialize_ctfread): Add declaration.
	* d-lang.c (_initialize_d_language): Add declaration.
	* darwin-nat-info.c (_initialize_darwin_info_commands): Add declaration.
	* darwin-nat.c (_initialize_darwin_nat): Add declaration.
	* dbxread.c (_initialize_dbxread): Add declaration.
	* dcache.c (_initialize_dcache): Add declaration.
	* disasm-selftests.c (_initialize_disasm_selftests): Add declaration.
	* disasm.c (_initialize_disasm): Add declaration.
	* dtrace-probe.c (_initialize_dtrace_probe): Add declaration.
	* dummy-frame.c (_initialize_dummy_frame): Add declaration.
	* dwarf-index-cache.c (_initialize_index_cache): Add declaration.
	* dwarf-index-write.c (_initialize_dwarf_index_write): Add declaration.
	* dwarf2-frame-tailcall.c (_initialize_tailcall_frame): Add declaration.
	* dwarf2-frame.c (_initialize_dwarf2_frame): Add declaration.
	* dwarf2expr.c (_initialize_dwarf2expr): Add declaration.
	* dwarf2loc.c (_initialize_dwarf2loc): Add declaration.
	* dwarf2read.c (_initialize_dwarf2_read): Add declaration.
	* elfread.c (_initialize_elfread): Add declaration.
	* exec.c (_initialize_exec): Add declaration.
	* extension.c (_initialize_extension): Add declaration.
	* f-lang.c (_initialize_f_language): Add declaration.
	* f-valprint.c (_initialize_f_valprint): Add declaration.
	* fbsd-nat.c (_initialize_fbsd_nat): Add declaration.
	* fbsd-tdep.c (_initialize_fbsd_tdep): Add declaration.
	* filesystem.c (_initialize_filesystem): Add declaration.
	* findcmd.c (_initialize_mem_search): Add declaration.
	* findvar.c (_initialize_findvar): Add declaration.
	* fork-child.c (_initialize_fork_child): Add declaration.
	* frame-base.c (_initialize_frame_base): Add declaration.
	* frame-unwind.c (_initialize_frame_unwind): Add declaration.
	* frame.c (_initialize_frame): Add declaration.
	* frv-linux-tdep.c (_initialize_frv_linux_tdep): Add declaration.
	* frv-tdep.c (_initialize_frv_tdep): Add declaration.
	* ft32-tdep.c (_initialize_ft32_tdep): Add declaration.
	* gcore.c (_initialize_gcore): Add declaration.
	* gdb-demangle.c (_initialize_gdb_demangle): Add declaration.
	* gdb_bfd.c (_initialize_gdb_bfd): Add declaration.
	* gdbarch-selftests.c (_initialize_gdbarch_selftests): Add declaration.
	* gdbarch.c (_initialize_gdbarch): Add declaration.
	* gdbtypes.c (_initialize_gdbtypes): Add declaration.
	* gnu-nat.c (_initialize_gnu_nat): Add declaration.
	* gnu-v2-abi.c (_initialize_gnu_v2_abi): Add declaration.
	* gnu-v3-abi.c (_initialize_gnu_v3_abi): Add declaration.
	* go-lang.c (_initialize_go_language): Add declaration.
	* go32-nat.c (_initialize_go32_nat): Add declaration.
	* guile/guile.c (_initialize_guile): Add declaration.
	* h8300-tdep.c (_initialize_h8300_tdep): Add declaration.
	* hppa-linux-nat.c (_initialize_hppa_linux_nat): Add declaration.
	* hppa-linux-tdep.c (_initialize_hppa_linux_tdep): Add declaration.
	* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Add declaration.
	* hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Add declaration.
	* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Add declaration.
	* hppa-obsd-tdep.c (_initialize_hppabsd_tdep): Add declaration.
	* hppa-tdep.c (_initialize_hppa_tdep): Add declaration.
	* i386-bsd-nat.c (_initialize_i386bsd_nat): Add declaration.
	* i386-cygwin-tdep.c (_initialize_i386_cygwin_tdep): Add declaration.
	* i386-darwin-nat.c (_initialize_i386_darwin_nat): Add declaration.
	* i386-darwin-tdep.c (_initialize_i386_darwin_tdep): Add declaration.
	* i386-dicos-tdep.c (_initialize_i386_dicos_tdep): Add declaration.
	* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Add declaration.
	* i386-fbsd-tdep.c (_initialize_i386fbsd_tdep): Add declaration.
	* i386-gnu-nat.c (_initialize_i386gnu_nat): Add declaration.
	* i386-gnu-tdep.c (_initialize_i386gnu_tdep): Add declaration.
	* i386-go32-tdep.c (_initialize_i386_go32_tdep): Add declaration.
	* i386-linux-nat.c (_initialize_i386_linux_nat): Add declaration.
	* i386-linux-tdep.c (_initialize_i386_linux_tdep): Add declaration.
	* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Add declaration.
	* i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Add declaration.
	* i386-nto-tdep.c (_initialize_i386nto_tdep): Add declaration.
	* i386-obsd-nat.c (_initialize_i386obsd_nat): Add declaration.
	* i386-obsd-tdep.c (_initialize_i386obsd_tdep): Add declaration.
	* i386-sol2-nat.c (_initialize_amd64_sol2_nat): Add declaration.
	* i386-sol2-tdep.c (_initialize_i386_sol2_tdep): Add declaration.
	* i386-tdep.c (_initialize_i386_tdep): Add declaration.
	* i386-windows-nat.c (_initialize_i386_windows_nat): Add declaration.
	* ia64-libunwind-tdep.c (_initialize_libunwind_frame): Add declaration.
	* ia64-linux-nat.c (_initialize_ia64_linux_nat): Add declaration.
	* ia64-linux-tdep.c (_initialize_ia64_linux_tdep): Add declaration.
	* ia64-tdep.c (_initialize_ia64_tdep): Add declaration.
	* ia64-vms-tdep.c (_initialize_ia64_vms_tdep): Add declaration.
	* infcall.c (_initialize_infcall): Add declaration.
	* infcmd.c (_initialize_infcmd): Add declaration.
	* inflow.c (_initialize_inflow): Add declaration.
	* infrun.c (_initialize_infrun): Add declaration.
	* interps.c (_initialize_interpreter): Add declaration.
	* iq2000-tdep.c (_initialize_iq2000_tdep): Add declaration.
	* jit.c (_initialize_jit): Add declaration.
	* language.c (_initialize_language): Add declaration.
	* linux-fork.c (_initialize_linux_fork): Add declaration.
	* linux-nat.c (_initialize_linux_nat): Add declaration.
	* linux-tdep.c (_initialize_linux_tdep): Add declaration.
	* linux-thread-db.c (_initialize_thread_db): Add declaration.
	* lm32-tdep.c (_initialize_lm32_tdep): Add declaration.
	* m2-lang.c (_initialize_m2_language): Add declaration.
	* m32c-tdep.c (_initialize_m32c_tdep): Add declaration.
	* m32r-linux-nat.c (_initialize_m32r_linux_nat): Add declaration.
	* m32r-linux-tdep.c (_initialize_m32r_linux_tdep): Add declaration.
	* m32r-tdep.c (_initialize_m32r_tdep): Add declaration.
	* m68hc11-tdep.c (_initialize_m68hc11_tdep): Add declaration.
	* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Add declaration.
	* m68k-bsd-tdep.c (_initialize_m68kbsd_tdep): Add declaration.
	* m68k-linux-nat.c (_initialize_m68k_linux_nat): Add declaration.
	* m68k-linux-tdep.c (_initialize_m68k_linux_tdep): Add declaration.
	* m68k-tdep.c (_initialize_m68k_tdep): Add declaration.
	* machoread.c (_initialize_machoread): Add declaration.
	* macrocmd.c (_initialize_macrocmd): Add declaration.
	* macroscope.c (_initialize_macroscope): Add declaration.
	* maint-test-options.c (_initialize_maint_test_options): Add declaration.
	* maint-test-settings.c (_initialize_maint_test_settings): Add declaration.
	* maint.c (_initialize_maint_cmds): Add declaration.
	* mdebugread.c (_initialize_mdebugread): Add declaration.
	* memattr.c (_initialize_mem): Add declaration.
	* mep-tdep.c (_initialize_mep_tdep): Add declaration.
	* mi/mi-cmd-env.c (_initialize_mi_cmd_env): Add declaration.
	* mi/mi-cmds.c (_initialize_mi_cmds): Add declaration.
	* mi/mi-interp.c (_initialize_mi_interp): Add declaration.
	* mi/mi-main.c (_initialize_mi_main): Add declaration.
	* microblaze-linux-tdep.c (_initialize_microblaze_linux_tdep): Add declaration.
	* microblaze-tdep.c (_initialize_microblaze_tdep): Add declaration.
	* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Add declaration.
	* mips-fbsd-tdep.c (_initialize_mips_fbsd_tdep): Add declaration.
	* mips-linux-nat.c (_initialize_mips_linux_nat): Add declaration.
	* mips-linux-tdep.c (_initialize_mips_linux_tdep): Add declaration.
	* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Add declaration.
	* mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Add declaration.
	* mips-sde-tdep.c (_initialize_mips_sde_tdep): Add declaration.
	* mips-tdep.c (_initialize_mips_tdep): Add declaration.
	* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Add declaration.
	* mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Add declaration.
	* mipsread.c (_initialize_mipsread): Add declaration.
	* mn10300-linux-tdep.c (_initialize_mn10300_linux_tdep): Add declaration.
	* mn10300-tdep.c (_initialize_mn10300_tdep): Add declaration.
	* moxie-tdep.c (_initialize_moxie_tdep): Add declaration.
	* msp430-tdep.c (_initialize_msp430_tdep): Add declaration.
	* nds32-tdep.c (_initialize_nds32_tdep): Add declaration.
	* nios2-linux-tdep.c (_initialize_nios2_linux_tdep): Add declaration.
	* nios2-tdep.c (_initialize_nios2_tdep): Add declaration.
	* nto-procfs.c (_initialize_procfs): Add declaration.
	* objc-lang.c (_initialize_objc_language): Add declaration.
	* observable.c (_initialize_observer): Add declaration.
	* opencl-lang.c (_initialize_opencl_language): Add declaration.
	* or1k-linux-tdep.c (_initialize_or1k_linux_tdep): Add declaration.
	* or1k-tdep.c (_initialize_or1k_tdep): Add declaration.
	* osabi.c (_initialize_gdb_osabi): Add declaration.
	* osdata.c (_initialize_osdata): Add declaration.
	* p-valprint.c (_initialize_pascal_valprint): Add declaration.
	* parse.c (_initialize_parse): Add declaration.
	* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Add declaration.
	* ppc-fbsd-tdep.c (_initialize_ppcfbsd_tdep): Add declaration.
	* ppc-linux-nat.c (_initialize_ppc_linux_nat): Add declaration.
	* ppc-linux-tdep.c (_initialize_ppc_linux_tdep): Add declaration.
	* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Add declaration.
	* ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Add declaration.
	* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Add declaration.
	* ppc-obsd-tdep.c (_initialize_ppcobsd_tdep): Add declaration.
	* printcmd.c (_initialize_printcmd): Add declaration.
	* probe.c (_initialize_probe): Add declaration.
	* proc-api.c (_initialize_proc_api): Add declaration.
	* proc-events.c (_initialize_proc_events): Add declaration.
	* proc-service.c (_initialize_proc_service): Add declaration.
	* procfs.c (_initialize_procfs): Add declaration.
	* producer.c (_initialize_producer): Add declaration.
	* psymtab.c (_initialize_psymtab): Add declaration.
	* python/python.c (_initialize_python): Add declaration.
	* ravenscar-thread.c (_initialize_ravenscar): Add declaration.
	* record-btrace.c (_initialize_record_btrace): Add declaration.
	* record-full.c (_initialize_record_full): Add declaration.
	* record.c (_initialize_record): Add declaration.
	* regcache-dump.c (_initialize_regcache_dump): Add declaration.
	* regcache.c (_initialize_regcache): Add declaration.
	* reggroups.c (_initialize_reggroup): Add declaration.
	* remote-notif.c (_initialize_notif): Add declaration.
	* remote-sim.c (_initialize_remote_sim): Add declaration.
	* remote.c (_initialize_remote): Add declaration.
	* reverse.c (_initialize_reverse): Add declaration.
	* riscv-fbsd-nat.c (_initialize_riscv_fbsd_nat): Add declaration.
	* riscv-fbsd-tdep.c (_initialize_riscv_fbsd_tdep): Add declaration.
	* riscv-linux-nat.c (_initialize_riscv_linux_nat): Add declaration.
	* riscv-linux-tdep.c (_initialize_riscv_linux_tdep): Add declaration.
	* riscv-tdep.c (_initialize_riscv_tdep): Add declaration.
	* rl78-tdep.c (_initialize_rl78_tdep): Add declaration.
	* rs6000-aix-tdep.c (_initialize_rs6000_aix_tdep): Add declaration.
	* rs6000-lynx178-tdep.c (_initialize_rs6000_lynx178_tdep):
	Add declaration.
	* rs6000-nat.c (_initialize_rs6000_nat): Add declaration.
	* rs6000-tdep.c (_initialize_rs6000_tdep): Add declaration.
	* run-on-main-thread.c (_initialize_run_on_main_thread): Add declaration.
	* rust-exp.y (_initialize_rust_exp): Add declaration.
	* rx-tdep.c (_initialize_rx_tdep): Add declaration.
	* s12z-tdep.c (_initialize_s12z_tdep): Add declaration.
	* s390-linux-nat.c (_initialize_s390_nat): Add declaration.
	* s390-linux-tdep.c (_initialize_s390_linux_tdep): Add declaration.
	* s390-tdep.c (_initialize_s390_tdep): Add declaration.
	* score-tdep.c (_initialize_score_tdep): Add declaration.
	* ser-go32.c (_initialize_ser_dos): Add declaration.
	* ser-mingw.c (_initialize_ser_windows): Add declaration.
	* ser-pipe.c (_initialize_ser_pipe): Add declaration.
	* ser-tcp.c (_initialize_ser_tcp): Add declaration.
	* ser-uds.c (_initialize_ser_socket): Add declaration.
	* ser-unix.c (_initialize_ser_hardwire): Add declaration.
	* serial.c (_initialize_serial): Add declaration.
	* sh-linux-tdep.c (_initialize_sh_linux_tdep): Add declaration.
	* sh-nbsd-nat.c (_initialize_shnbsd_nat): Add declaration.
	* sh-nbsd-tdep.c (_initialize_shnbsd_tdep): Add declaration.
	* sh-tdep.c (_initialize_sh_tdep): Add declaration.
	* skip.c (_initialize_step_skip): Add declaration.
	* sol-thread.c (_initialize_sol_thread): Add declaration.
	* solib-aix.c (_initialize_solib_aix): Add declaration.
	* solib-darwin.c (_initialize_darwin_solib): Add declaration.
	* solib-dsbt.c (_initialize_dsbt_solib): Add declaration.
	* solib-frv.c (_initialize_frv_solib): Add declaration.
	* solib-svr4.c (_initialize_svr4_solib): Add declaration.
	* solib-target.c (_initialize_solib_target): Add declaration.
	* solib.c (_initialize_solib): Add declaration.
	* source-cache.c (_initialize_source_cache): Add declaration.
	* source.c (_initialize_source): Add declaration.
	* sparc-linux-nat.c (_initialize_sparc_linux_nat): Add declaration.
	* sparc-linux-tdep.c (_initialize_sparc_linux_tdep): Add declaration.
	* sparc-nat.c (_initialize_sparc_nat): Add declaration.
	* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Add declaration.
	* sparc-nbsd-tdep.c (_initialize_sparcnbsd_tdep): Add declaration.
	* sparc-obsd-tdep.c (_initialize_sparc32obsd_tdep): Add declaration.
	* sparc-sol2-tdep.c (_initialize_sparc_sol2_tdep): Add declaration.
	* sparc-tdep.c (_initialize_sparc_tdep): Add declaration.
	* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Add declaration.
	* sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Add declaration.
	* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Add declaration.
	* sparc64-linux-tdep.c (_initialize_sparc64_linux_tdep): Add declaration.
	* sparc64-nat.c (_initialize_sparc64_nat): Add declaration.
	* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Add declaration.
	* sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Add declaration.
	* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Add declaration.
	* sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Add declaration.
	* sparc64-sol2-tdep.c (_initialize_sparc64_sol2_tdep): Add declaration.
	* sparc64-tdep.c (_initialize_sparc64_adi_tdep): Add declaration.
	* stabsread.c (_initialize_stabsread): Add declaration.
	* stack.c (_initialize_stack): Add declaration.
	* stap-probe.c (_initialize_stap_probe): Add declaration.
	* std-regs.c (_initialize_frame_reg): Add declaration.
	* symfile-debug.c (_initialize_symfile_debug): Add declaration.
	* symfile-mem.c (_initialize_symfile_mem): Add declaration.
	* symfile.c (_initialize_symfile): Add declaration.
	* symmisc.c (_initialize_symmisc): Add declaration.
	* symtab.c (_initialize_symtab): Add declaration.
	* target.c (_initialize_target): Add declaration.
	* target-connection.c (_initialize_target_connection): Add
	declaration.
	* target-dcache.c (_initialize_target_dcache): Add declaration.
	* target-descriptions.c (_initialize_target_descriptions): Add declaration.
	* thread.c (_initialize_thread): Add declaration.
	* tic6x-linux-tdep.c (_initialize_tic6x_linux_tdep): Add declaration.
	* tic6x-tdep.c (_initialize_tic6x_tdep): Add declaration.
	* tilegx-linux-nat.c (_initialize_tile_linux_nat): Add declaration.
	* tilegx-linux-tdep.c (_initialize_tilegx_linux_tdep): Add declaration.
	* tilegx-tdep.c (_initialize_tilegx_tdep): Add declaration.
	* tracectf.c (_initialize_ctf): Add declaration.
	* tracefile-tfile.c (_initialize_tracefile_tfile): Add declaration.
	* tracefile.c (_initialize_tracefile): Add declaration.
	* tracepoint.c (_initialize_tracepoint): Add declaration.
	* tui/tui-hooks.c (_initialize_tui_hooks): Add declaration.
	* tui/tui-interp.c (_initialize_tui_interp): Add declaration.
	* tui/tui-layout.c (_initialize_tui_layout): Add declaration.
	* tui/tui-regs.c (_initialize_tui_regs): Add declaration.
	* tui/tui-stack.c (_initialize_tui_stack): Add declaration.
	* tui/tui-win.c (_initialize_tui_win): Add declaration.
	* tui/tui.c (_initialize_tui): Add declaration.
	* typeprint.c (_initialize_typeprint): Add declaration.
	* ui-style.c (_initialize_ui_style): Add declaration.
	* unittests/array-view-selftests.c (_initialize_array_view_selftests): Add declaration.
	* unittests/child-path-selftests.c (_initialize_child_path_selftests): Add declaration.
	* unittests/cli-utils-selftests.c (_initialize_cli_utils_selftests): Add declaration.
	* unittests/common-utils-selftests.c (_initialize_common_utils_selftests): Add declaration.
	* unittests/copy_bitwise-selftests.c (_initialize_copy_bitwise_utils_selftests): Add declaration.
	* unittests/environ-selftests.c (_initialize_environ_selftests): Add declaration.
	* unittests/filtered_iterator-selftests.c
	(_initialize_filtered_iterator_selftests): Add declaration.
	* unittests/format_pieces-selftests.c (_initialize_format_pieces_selftests): Add declaration.
	* unittests/function-view-selftests.c (_initialize_function_view_selftests): Add declaration.
	* unittests/help-doc-selftests.c (_initialize_help_doc_selftests): Add declaration.
	* unittests/lookup_name_info-selftests.c (_initialize_lookup_name_info_selftests): Add declaration.
	* unittests/main-thread-selftests.c
	(_initialize_main_thread_selftests): Add declaration.
	* unittests/memory-map-selftests.c (_initialize_memory_map_selftests): Add declaration.
	* unittests/memrange-selftests.c (_initialize_memrange_selftests): Add declaration.
	* unittests/mkdir-recursive-selftests.c (_initialize_mkdir_recursive_selftests): Add declaration.
	* unittests/observable-selftests.c (_initialize_observer_selftest): Add declaration.
	* unittests/offset-type-selftests.c (_initialize_offset_type_selftests): Add declaration.
	* unittests/optional-selftests.c (_initialize_optional_selftests): Add declaration.
	* unittests/parse-connection-spec-selftests.c (_initialize_parse_connection_spec_selftests): Add declaration.
	* unittests/rsp-low-selftests.c (_initialize_rsp_low_selftests): Add declaration.
	* unittests/scoped_fd-selftests.c (_initialize_scoped_fd_selftests): Add declaration.
	* unittests/scoped_mmap-selftests.c (_initialize_scoped_mmap_selftests): Add declaration.
	* unittests/scoped_restore-selftests.c (_initialize_scoped_restore_selftests): Add declaration.
	* unittests/string_view-selftests.c (_initialize_string_view_selftests): Add declaration.
	* unittests/style-selftests.c (_initialize_style_selftest): Add declaration.
	* unittests/tracepoint-selftests.c (_initialize_tracepoint_selftests): Add declaration.
	* unittests/tui-selftests.c (_initialize_tui_selftest): Add
	declaration.
	* unittests/unpack-selftests.c (_initialize_unpack_selftests): Add declaration.
	* unittests/utils-selftests.c (_initialize_utils_selftests): Add declaration.
	* unittests/vec-utils-selftests.c (_initialize_vec_utils_selftests): Add declaration.
	* unittests/xml-utils-selftests.c (_initialize_xml_utils): Add declaration.
	* user-regs.c (_initialize_user_regs): Add declaration.
	* utils.c (_initialize_utils): Add declaration.
	* v850-tdep.c (_initialize_v850_tdep): Add declaration.
	* valops.c (_initialize_valops): Add declaration.
	* valprint.c (_initialize_valprint): Add declaration.
	* value.c (_initialize_values): Add declaration.
	* varobj.c (_initialize_varobj): Add declaration.
	* vax-bsd-nat.c (_initialize_vaxbsd_nat): Add declaration.
	* vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Add declaration.
	* vax-tdep.c (_initialize_vax_tdep): Add declaration.
	* windows-nat.c (_initialize_windows_nat): Add declaration.
	(_initialize_check_for_gdb_ini): Add declaration.
	(_initialize_loadable): Add declaration.
	* windows-tdep.c (_initialize_windows_tdep): Add declaration.
	* x86-bsd-nat.c (_initialize_x86_bsd_nat): Add declaration.
	* x86-linux-nat.c (_initialize_x86_linux_nat): Add declaration.
	* xcoffread.c (_initialize_xcoffread): Add declaration.
	* xml-support.c (_initialize_xml_support): Add declaration.
	* xstormy16-tdep.c (_initialize_xstormy16_tdep): Add declaration.
	* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Add declaration.
	* xtensa-linux-tdep.c (_initialize_xtensa_linux_tdep): Add declaration.
	* xtensa-tdep.c (_initialize_xtensa_tdep): Add declaration.

Change-Id: I13eec7e0ed2b3c427377a7bdb055cf46da64def9
2020-01-13 14:01:38 -05:00
Tom Tromey 6a053cb1ff Change section_offsets to a std::vector
This changes section_offsets to be specialization of a std::vector and
updates all the users.  It also removes the ANOFFSET and
SIZEOF_N_SECTION_OFFSETS macros.

Most of this is just a generic sort of cleanup, that reduces the
number of lines of code.  However, a couple spots were doing weird
things.

objfile_relocate did:

-      std::vector<struct section_offsets>
-	new_debug_offsets (SIZEOF_N_SECTION_OFFSETS (debug_objfile->num_sections));

... which seems to greatly over-estimate the number of elements
needed.

This appeared in set_objfile_default_section_offset:

-  std::vector<struct section_offsets> offsets (objf->num_sections,
-					       { { offset } });

... which makes sense due to type safety, but is also actively
confusing given that section_offsets was previously also a kind of
vector type.

Tested on x86-64 Fedora 30.

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

	* xcoffread.c (enter_line_range, read_xcoff_symtab)
	(process_xcoff_symbol, xcoff_symfile_offsets): Update.
	* symtab.h (MSYMBOL_VALUE_ADDRESS): Update.
	(struct section_offsets, ANOFFSET, SIZEOF_N_SECTION_OFFSETS):
	Remove.
	(section_offsets): New typedef.
	* symtab.c (fixup_section, get_msymbol_address): Update.
	* symmisc.c (dump_msymbols): Update.
	* symfile.h (relative_addr_info_to_section_offsets)
	(symfile_map_offsets_to_segments): Update.
	* symfile.c (build_section_addr_info_from_objfile)
	(init_objfile_sect_indices): Update.
	(struct place_section_arg): Change type of "offsets".
	(place_section): Update.
	(relative_addr_info_to_section_offsets): Change type of
	"section_offsets".  Remove "num_sections" parameter.
	(default_symfile_offsets, syms_from_objfile_1)
	(set_objfile_default_section_offset): Update.
	(reread_symbols): No need to preserve section offsets by hand.
	(symfile_map_offsets_to_segments): Change type of "offsets".
	* stap-probe.c (relocate_address): Update.
	* stabsread.h (process_one_symbol): Update.
	* solib-target.c (struct lm_info_target) <offsets>: Change type.
	(solib_target_relocate_section_addresses): Update.
	* solib-svr4.c (enable_break, svr4_relocate_main_executable):
	Update.
	* solib-frv.c (frv_relocate_main_executable): Update.
	* solib-dsbt.c (dsbt_relocate_main_executable): Update.
	* solib-aix.c (solib_aix_get_section_offsets): Change return
	type.
	(solib_aix_solib_create_inferior_hook): Update.
	* remote.c (remote_target::get_offsets): Update.
	* psymtab.c (find_pc_sect_psymtab): Update.
	* psympriv.h (struct partial_symbol) <address, text_low,
	text_high>: Update.
	* objfiles.h (obj_section_offset): Update.
	(struct objfile) <section_offsets>: Change type.
	<num_sections>: Remove.
	(objfile_relocate): Update.
	* objfiles.c (entry_point_address_query): Update
	(relocate_one_symbol): Change type of "section_offsets".
	(objfile_relocate1, objfile_relocate1): Change type of
	"new_offsets".
	(objfile_rebase1): Update.
	* mipsread.c (mipscoff_symfile_read): Update.
	(read_alphacoff_dynamic_symtab): Remove "section_offsets"
	parameter.
	* mdebugread.c (parse_symbol): Change type of "section_offsets".
	(parse_external, psymtab_to_symtab_1): Update.
	* machoread.c (macho_symfile_offsets): Update.
	* ia64-tdep.c (ia64_find_unwind_table): Update.
	* hppa-tdep.c (read_unwind_info): Update.
	* hppa-bsd-tdep.c (hppabsd_find_global_pointer): Update.
	* dwarf2read.c (create_addrmap_from_index)
	(create_addrmap_from_aranges, dw2_find_pc_sect_compunit_symtab)
	(process_psymtab_comp_unit_reader, add_partial_symbol)
	(add_partial_subprogram, process_full_comp_unit)
	(read_file_scope, read_func_scope, read_lexical_block_scope)
	(read_call_site_scope, dwarf2_rnglists_process)
	(dwarf2_ranges_process, dwarf2_ranges_read)
	(dwarf_decode_lines_1, var_decode_location, new_symbol)
	(dwarf2_fetch_die_loc_sect_off, dwarf2_per_cu_text_offset):
	Update.
	* dwarf2-frame.c (execute_cfa_program, dwarf2_frame_find_fde):
	Update.
	* dtrace-probe.c (dtrace_probe::get_relocated_address): Update.
	* dbxread.c (read_dbx_symtab, read_ofile_symtab): Update.
	(process_one_symbol): Change type of "section_offsets".
	* ctfread.c (get_objfile_text_range): Update.
	* coffread.c (coff_symtab_read, enter_linenos)
	(process_coff_symbol): Update.
	* coff-pe-read.c (add_pe_forwarded_sym): Update.
	* amd64-windows-tdep.c (amd64_windows_find_unwind_info): Update.

Change-Id: I147eb967e9b44d82f4048039de7bb44b80cd72fb
2020-01-08 15:32:41 -07:00
Joel Brobecker b811d2c292 Update copyright year range in all GDB files.
gdb/ChangeLog:

        Update copyright year range in all GDB files.
2020-01-01 10:20:53 +04:00
Christian Biesinger 987012b89b Replace SYMBOL_*_NAME accessors with member functions
Similar to the MSYMBOL version of this patch, improves readability
and will eventually allow making name private.

gdb/ChangeLog:

2019-11-22  Christian Biesinger  <cbiesinger@google.com>

	* ada-exp.y: Update.
	* ada-lang.c (sort_choices): Update.
	(ada_print_symbol_signature): Update.
	(resolve_subexp): Update.
	(ada_parse_renaming): Update.
	(ada_read_renaming_var_value): Update.
	(lesseq_defined_than): Update.
	(remove_extra_symbols): Update.
	(remove_irrelevant_renamings): Update.
	(ada_add_block_symbols): Update.
	(ada_collect_symbol_completion_matches): Update.
	(ada_is_renaming_symbol): Update.
	(aggregate_assign_from_choices): Update.
	(ada_evaluate_subexp): Update.
	(ada_has_this_exception_support): Update.
	(ada_is_non_standard_exception_sym): Update.
	(ada_add_exceptions_from_frame): Update.
	(ada_add_global_exceptions): Update.
	(ada_print_subexp): Update.
	* ax-gdb.c (gen_var_ref): Update.
	(gen_maybe_namespace_elt): Update.
	(gen_expr_for_cast): Update.
	(gen_expr): Update.
	* block.h: Update.
	* blockframe.c (find_pc_partial_function): Update.
	* breakpoint.c (print_breakpoint_location): Update.
	(update_static_tracepoint): Update.
	* btrace.c (ftrace_print_function_name): Update.
	(ftrace_function_switched): Update.
	* buildsym.c (find_symbol_in_list): Update.
	* c-exp.y: Update.
	* c-typeprint.c (c_print_typedef): Update.
	(c_type_print_template_args): Update.
	* cli/cli-cmds.c (edit_command): Update.
	(list_command): Update.
	(print_sal_location): Update.
	* coffread.c (patch_opaque_types): Update.
	(process_coff_symbol): Update.
	(coff_read_enum_type): Update.
	* compile/compile-c-symbols.c (c_symbol_substitution_name): Update.
	(convert_one_symbol): Update.
	(hash_symname): Update.
	(eq_symname): Update.
	* compile/compile-cplus-symbols.c (convert_one_symbol): Update.
	* compile/compile-cplus-types.c (debug_print_scope): Update.
	* compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Update.
	* compile/compile-object-load.c (get_out_value_type): Update.
	* cp-namespace.c (cp_scan_for_anonymous_namespaces): Update.
	(search_symbol_list): Update.
	(cp_lookup_symbol_imports_or_template): Update.
	* cp-support.c (overload_list_add_symbol): Update.
	* ctfread.c (psymtab_to_symtab): Update.
	* dbxread.c (cp_set_block_scope): Update.
	* dictionary.c (iter_match_first_hashed): Update.
	(iter_match_next_hashed): Update.
	(insert_symbol_hashed): Update.
	(iter_match_next_linear): Update.
	* dictionary.h: Update.
	* dwarf2loc.c (func_get_frame_base_dwarf_block): Update.
	(locexpr_describe_location_piece): Update.
	(locexpr_describe_location_1): Update.
	(locexpr_generate_c_location): Update.
	(loclist_describe_location): Update.
	(loclist_generate_c_location): Update.
	* dwarf2read.c (dw2_debug_names_lookup_symbol): Update.
	(read_func_scope): Update.
	(process_enumeration_scope): Update.
	(new_symbol): Update.
	(dwarf2_const_value): Update.
	(dwarf2_symbol_mark_computed): Update.
	* eval.c (evaluate_funcall): Update.
	(evaluate_subexp_standard): Update.
	* expprint.c (print_subexp_standard): Update.
	(dump_subexp_body_standard): Update.
	* f-valprint.c (info_common_command_for_block): Update.
	* findvar.c (get_hosting_frame): Update.
	(default_read_var_value): Update.
	* go-lang.c (go_symbol_package_name): Update.
	* guile/scm-block.c (bkscm_print_block_smob): Update.
	* guile/scm-symbol.c (syscm_print_symbol_smob): Update.
	(gdbscm_symbol_name): Update.
	(gdbscm_symbol_linkage_name): Update.
	(gdbscm_symbol_print_name): Update.
	* infcall.c (get_function_name): Update.
	* infcmd.c (jump_command): Update.
	(finish_command): Update.
	* infrun.c (insert_exception_resume_breakpoint): Update.
	* linespec.c (canonicalize_linespec): Update.
	(create_sals_line_offset): Update.
	(convert_linespec_to_sals): Update.
	(complete_label): Update.
	(find_label_symbols_in_block): Update.
	* m2-typeprint.c (m2_print_typedef): Update.
	* mdebugread.c (mdebug_reg_to_regnum): Update.
	(parse_symbol): Update.
	(mylookup_symbol): Update.
	* mi/mi-cmd-stack.c (list_arg_or_local): Update.
	(list_args_or_locals): Update.
	* objc-lang.c (compare_selectors): Update.
	(info_selectors_command): Update.
	(compare_classes): Update.
	(info_classes_command): Update.
	(find_imps): Update.
	* p-typeprint.c (pascal_print_typedef): Update.
	* printcmd.c (build_address_symbolic): Update.
	(info_address_command): Update.
	(print_variable_and_value): Update.
	* python/py-framefilter.c (extract_sym): Update.
	(py_print_single_arg): Update.
	* python/py-symbol.c (sympy_str): Update.
	(sympy_get_name): Update.
	(sympy_get_linkage_name): Update.
	* python/python.c (gdbpy_rbreak): Update.
	* record-btrace.c (btrace_get_bfun_name): Update.
	(btrace_call_history): Update.
	* rust-lang.c (rust_print_typedef): Update.
	* solib-frv.c (frv_fdpic_find_canonical_descriptor): Update.
	* stabsread.c (stab_reg_to_regnum): Update.
	(define_symbol): Update.
	(read_enum_type): Update.
	(common_block_end): Update.
	(cleanup_undefined_types_1): Update.
	(scan_file_globals): Update.
	* stack.c (print_frame_arg): Update.
	(print_frame_args): Update.
	(find_frame_funname): Update.
	(info_frame_command_core): Update.
	(iterate_over_block_locals): Update.
	(print_block_frame_labels): Update.
	(do_print_variable_and_value): Update.
	(iterate_over_block_arg_vars): Update.
	(return_command): Update.
	* symmisc.c (dump_symtab_1): Update.
	(print_symbol): Update.
	* symtab.c (eq_symbol_entry): Update.
	(symbol_cache_dump): Update.
	(lookup_language_this): Update.
	(find_pc_sect_line): Update.
	(skip_prologue_sal): Update.
	(symbol_search::compare_search_syms): Update.
	(treg_matches_sym_type_name): Update.
	(search_symbols): Update.
	(print_symbol_info): Update.
	(rbreak_command): Update.
	(completion_list_add_symbol): Update.
	(find_gnu_ifunc): Update.
	(get_symbol_address): Update.
	(search_module_symbols): Update.
	(info_module_subcommand): Update.
	* symtab.h (SYMBOL_NATURAL_NAME): Remove.
	(SYMBOL_LINKAGE_NAME): Remove.
	(SYMBOL_DEMANGLED_NAME): Remove.
	(SYMBOL_PRINT_NAME): Remove.
	(SYMBOL_SEARCH_NAME): Remove.
	* tracepoint.c (set_traceframe_context): Update.
	(validate_actionline): Update.
	(collection_list::collect_symbol): Update.
	(encode_actions_1): Update.
	(info_scope_command): Update.
	(print_one_static_tracepoint_marker): Update.
	* typeprint.c (typedef_hash_table::add_template_parameters): Update.
	* valops.c (address_of_variable): Update.
	(find_overload_match): Update.
	(find_oload_champ): Update.

Change-Id: I76bdc8b44eea6876bf03af9d351f8e90cc0154b2
2019-11-22 12:05:14 -06:00
Christian Biesinger c9d95fa3d0 Replace the MSYMBOL_*_NAME macros with member functions
Improves readability. In the future, it will also allow making the name
private, once the name setter functions become member functions.

gdb/ChangeLog:

2019-11-22  Christian Biesinger  <cbiesinger@google.com>

	* ada-lang.c (ada_lookup_simple_minsym): Update.
	(ada_collect_symbol_completion_matches): Update.
	* ada-tasks.c (read_atcb): Update.
	* amd64-windows-tdep.c (amd64_skip_main_prologue): Update.
	(amd64_windows_skip_trampoline_code): Update.
	* arm-tdep.c (skip_prologue_function): Update.
	(arm_skip_stack_protector): Update.
	* arm-wince-tdep.c (arm_pe_skip_trampoline_code): Update.
	(arm_wince_skip_main_prologue): Update.
	* ax-gdb.c (gen_expr): Update.
	* block.c (call_site_for_pc): Update.
	* blockframe.c (find_pc_partial_function): Update.
	* breakpoint.c (set_breakpoint_location_function): Update.
	* btrace.c (ftrace_print_function_name): Update.
	(ftrace_function_switched): Update.
	* c-valprint.c (print_unpacked_pointer): Update.
	* coffread.c (coff_symfile_read): Update.
	* compile/compile-c-symbols.c (convert_symbol_bmsym): Update.
	* compile/compile-cplus-symbols.c (convert_symbol_bmsym): Update.
	* dwarf-index-write.c (write_psymbols): Update.
	* dwarf2loc.c (call_site_to_target_addr): Update.
	(func_verify_no_selftailcall): Update.
	(tailcall_dump): Update.
	(call_site_find_chain_1): Update.
	(dwarf_expr_reg_to_entry_parameter): Update.
	* elfread.c (elf_gnu_ifunc_record_cache): Update.
	* eval.c (evaluate_funcall): Update.
	(evaluate_subexp_standard): Update.
	(evaluate_subexp_for_sizeof): Update.
	* expprint.c (print_subexp_standard): Update.
	(dump_subexp_body_standard): Update.
	* frame.c (get_prev_frame_always_1): Update.
	* frv-tdep.c (frv_skip_main_prologue): Update.
	* gnu-v2-abi.c (gnuv2_value_rtti_type): Update.
	* gnu-v3-abi.c (gnuv3_rtti_type): Update.
	(gnuv3_get_typename_from_type_info): Update.
	(gnuv3_skip_trampoline): Update.
	* hppa-tdep.c (hppa_lookup_stub_minimal_symbol): Update.
	* i386-tdep.c (i386_skip_main_prologue): Update.
	(i386_pe_skip_trampoline_code): Update.
	* ia64-tdep.c (ia64_convert_from_func_ptr_addr): Update.
	* infcall.c (get_function_name): Update.
	* linespec.c (minsym_found): Update.
	* linux-fork.c (info_checkpoints_command): Update.
	* m32c-tdep.c (m32c_m16c_address_to_pointer): Update.
	(m32c_m16c_pointer_to_address): Update.
	* maint.c (maintenance_translate_address): Update.
	* minsyms.c (add_minsym_to_hash_table): Update.
	(add_minsym_to_demangled_hash_table): Update.
	(lookup_minimal_symbol_mangled): Update.
	(lookup_minimal_symbol_demangled): Update.
	(lookup_minimal_symbol_linkage): Update.
	(lookup_minimal_symbol_text): Update.
	(lookup_minimal_symbol_by_pc_name): Update.
	(minimal_symbol_is_less_than): Update.
	(compact_minimal_symbols): Update.
	(build_minimal_symbol_hash_tables): Update.
	(find_solib_trampoline_target): Update.
	* mips-tdep.c (mips_stub_frame_sniffer): Update.
	(mips_skip_pic_trampoline_code): Update.
	* msp430-tdep.c (msp430_skip_trampoline_code): Update.
	* objc-lang.c (info_selectors_command): Update.
	(info_classes_command): Update.
	(find_methods): Update.
	(find_imps): Update.
	* p-valprint.c (pascal_val_print): Update.
	* ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code): Update.
	* ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update.
	* printcmd.c (build_address_symbolic): Update.
	(info_symbol_command): Update.
	* psymtab.c (psymbol_name_matches): Update.
	(match_partial_symbol): Update.
	(lookup_partial_symbol): Update.
	(print_partial_symbols): Update.
	(sort_pst_symbols): Update.
	(maintenance_check_psymtabs): Update.
	* python/py-framefilter.c (py_print_frame): Update.
	* python/python.c (gdbpy_rbreak): Update.
	* record-btrace.c (btrace_get_bfun_name): Update.
	(btrace_call_history): Update.
	* rs6000-tdep.c (rs6000_skip_main_prologue): Update.
	(rs6000_skip_trampoline_code): Update.
	* sol-thread.c (info_cb): Update.
	* stabsread.c (scan_file_globals): Update.
	* stack.c (find_frame_funname): Update.
	(info_frame_command_core): Update.
	* symmisc.c (dump_msymbols): Update.
	* symtab.c (symbol_natural_name): Rename to..,
	(general_symbol_info::natural_name): ...this.
	(symbol_demangled_name): Rename to...
	(general_symbol_info::demangled_name): ...this.
	(symbol_search_name): Rename to...
	(general_symbol_info::search_name): ...this.
	(symbol_matches_search_name): Update.
	(find_pc_sect_line): Update.
	(skip_prologue_sal): Update.
	(search_symbols): Update.
	(print_msymbol_info): Update.
	(rbreak_command): Update.
	(completion_list_add_msymbol): Update.
	(completion_list_objc_symbol): Update.
	(get_msymbol_address): Update.
	* symtab.h (struct general_symbol_info): Add member functions
	natural_name (), linkage_name (), print_name (), demangled_name (),
	and search_name ().
	(SYMBOL_NATURAL_NAME): Update.
	(symbol_natural_name): Move to a member function on general_symbol_info.
	(SYMBOL_DEMANGLED_NAME): Update.
	(symbol_demangled_name): Move to a member function on
	general_symbol_info.
	(SYMBOL_SEARCH_NAME): Update.
	(symbol_search_name): Move to a member function on general_symbol_info.
	(MSYMBOL_NATURAL_NAME): Remove.
	(MSYMBOL_LINKAGE_NAME): Remove.
	(MSYMBOL_PRINT_NAME): Remove.
	(MSYMBOL_DEMANGLED_NAME): Remove.
	(MSYMBOL_SEARCH_NAME): Remove.
	* x86-tdep.c (x86_in_indirect_branch_thunk): Update.

Change-Id: I65aa529843a9903e174ce799037e41f954a9fcee
2019-11-22 12:05:14 -06:00
Tom Tromey e0eac551da Remove some includes of readline.h
I went through most of the spots that include readline.h and, when
appropriate, either removed the include or changed it to include
tilde.h.

Note that remote-sim.c and bsd-kvm.c could probably include tilde.h
instead, but I did not change these.  I think I can't build the
latter, and I didn't want to set up a sim build for the former.

Tested by rebuilding.

gdb/ChangeLog
2019-11-06  Tom Tromey  <tom@tromey.com>

	* tui/tui-interp.c: Don't include readline.h.
	* tui/tui-hooks.c: Don't include readline.h.
	* symmisc.c: Include tilde.h, not readline.h.
	* symfile.c: Include tilde.h, not readline.h.
	* source.c: Include tilde.h, not readline.h.
	* solib.c: Include tilde.h, not readline.h.
	* psymtab.c: Include tilde.h, not readline.h.
	* exec.c: Include tilde.h, not readline.h.
	* corelow.c: Include tilde.h, not readline.h.
	* cli/cli-dump.c: Include tilde.h, not readline.h.
	* cli/cli-cmds.c: Don't include readline.h.

Change-Id: I60487a190c43128b800ef77517d1ab42957571d7
2019-11-06 07:29:43 -07:00
Tom Tromey 4b610737f0 Handle copy relocations
In ELF, if a data symbol is defined in a shared library and used by
the main program, it will be subject to a "copy relocation".  In this
scenario, the main program has a copy of the symbol in question, and a
relocation that tells ld.so to copy the data from the shared library.
Then the symbol in the main program is used to satisfy all references.

This patch changes gdb to handle this scenario.  Data symbols coming
from ELF shared libraries get a special flag that indicates that the
symbol's address may be subject to copy relocation.

I looked briefly into handling copy relocations by looking at the
actual relocations in the main program, but this seemed difficult to
do with BFD.

Note that no caching is done here.  Perhaps this could be changed if
need be; I wanted to avoid possible problems with either objfile
lifetimes and changes, or conflicts with the long-term (vapor-ware)
objfile splitting project.

gdb/ChangeLog
2019-10-02  Tom Tromey  <tromey@adacore.com>

	* symmisc.c (dump_msymbols): Don't use MSYMBOL_VALUE_ADDRESS.
	* ada-lang.c (lesseq_defined_than): Handle
	LOC_STATIC.
	* dwarf2read.c (dwarf2_per_objfile): Add can_copy
	parameter.
	(dwarf2_has_info): Likewise.
	(new_symbol): Set maybe_copied on symbol when
	appropriate.
	* dwarf2read.h (dwarf2_per_objfile): Add can_copy
	parameter.
	<can_copy>: New member.
	* elfread.c (record_minimal_symbol): Set maybe_copied
	on symbol when appropriate.
	(elf_symfile_read): Update call to dwarf2_has_info.
	* minsyms.c (lookup_minimal_symbol_linkage): New
	function.
	* minsyms.h (lookup_minimal_symbol_linkage): Declare.
	* symtab.c (get_symbol_address, get_msymbol_address):
	New functions.
	* symtab.h (get_symbol_address, get_msymbol_address):
	Declare.
	(SYMBOL_VALUE_ADDRESS, MSYMBOL_VALUE_ADDRESS): Handle
	maybe_copied.
	(struct symbol, struct minimal_symbol) <maybe_copied>:
	New member.
2019-10-02 09:53:17 -06:00
Alan Modra fd3619828e bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions.  The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections.  Those sections shouldn't be modified
anyway.

The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma.  I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section.  This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.

bfd/
	* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
	(bfd_get_section_lma, bfd_get_section_alignment),
	(bfd_get_section_size, bfd_get_section_flags),
	(bfd_get_section_userdata): Delete.
	(bfd_section_name, bfd_section_size, bfd_section_vma),
	(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
	(bfd_section_flags, bfd_section_userdata): New.
	(bfd_is_com_section): Rename parameter.
	* section.c (bfd_set_section_userdata, bfd_set_section_vma),
	(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
	(bfd_set_section_size): Delete bfd parameter, rename section parameter.
	(bfd_set_section_lma): New.
	* bfd-in2.h: Regenerate.
	* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
	update callers.
	* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
	* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
	* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
	* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
	* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
	* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
	* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
	* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
	* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
	* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
	* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
	* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
	* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
	* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
	* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
	* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
	* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
	* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
	* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
	* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
	* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
	* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
	* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
	* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
	* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
	* xcofflink.c: Update throughout for bfd section macro and function
	changes.
binutils/
	* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
	* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
	* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
	* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
	throughout for bfd section macro and function changes.
gas/
	* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
	* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
	* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
	* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
	* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
	* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
	* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
	* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
	* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
	* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
	* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
	* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
	* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
	* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
	* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
	* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
	* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
	* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
	* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
	* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
	* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
	* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
	* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
	bfd section macro and function changes.
	* write.c (compress_debug): Use bfd_rename_section.
gdb/
	* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
	* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
	* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
	* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
	* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
	* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
	* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
	* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
	* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
	* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
	* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
	* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
	* solib-spu.c, * solib-svr4.c, * solib-target.c,
	* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
	* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
	* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
	* mi/mi-interp.c: Update throughout for bfd section macro and
	function changes.
	* gcore (gcore_create_callback): Use bfd_set_section_lma.
	* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
	* corefile.c, * symtab.c: Update throughout for bfd section
	macro and function changes.
ld/
	* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
	* emultempl/aarch64elf.em, * emultempl/aix.em,
	* emultempl/armcoff.em, * emultempl/armelf.em,
	* emultempl/cr16elf.em, * emultempl/cskyelf.em,
	* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
	* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
	* emultempl/mmo.em, * emultempl/msp430.em,
	* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
	* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
	throughout for bfd section macro and function changes.
libctf/
	* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
	* arc-ext.c: Update throughout for bfd section macro changes.
sim/
	* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
	* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
	* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
	* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
	* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-19 09:40:13 +09:30
Tom Tromey 230d2906b9 Rename gdb exception types
This renames the gdb exception types.  The old types were only needed
due to the macros in common-exception.h that are now gone.

The intermediate layer of gdb_exception_RETURN_MASK_ALL did not seem
needed, so this patch removes it entirely.

gdb/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

	* common/common-exceptions.h (gdb_exception_RETURN_MASK_ALL):
	Remove.
	(gdb_exception_error): Rename from
	gdb_exception_RETURN_MASK_ERROR.
	(gdb_exception_quit): Rename from gdb_exception_RETURN_MASK_QUIT.
	(gdb_quit_bad_alloc): Update.
	* aarch64-tdep.c: Update.
	* ada-lang.c: Update.
	* ada-typeprint.c: Update.
	* ada-valprint.c: Update.
	* amd64-tdep.c: Update.
	* arch-utils.c: Update.
	* break-catch-throw.c: Update.
	* breakpoint.c: Update.
	* btrace.c: Update.
	* c-varobj.c: Update.
	* cli/cli-cmds.c: Update.
	* cli/cli-interp.c: Update.
	* cli/cli-script.c: Update.
	* common/common-exceptions.c: Update.
	* common/new-op.c: Update.
	* common/selftest.c: Update.
	* compile/compile-c-symbols.c: Update.
	* compile/compile-cplus-symbols.c: Update.
	* compile/compile-object-load.c: Update.
	* compile/compile-object-run.c: Update.
	* completer.c: Update.
	* corelow.c: Update.
	* cp-abi.c: Update.
	* cp-support.c: Update.
	* cp-valprint.c: Update.
	* darwin-nat.c: Update.
	* disasm-selftests.c: Update.
	* dtrace-probe.c: Update.
	* dwarf-index-cache.c: Update.
	* dwarf-index-write.c: Update.
	* dwarf2-frame-tailcall.c: Update.
	* dwarf2-frame.c: Update.
	* dwarf2loc.c: Update.
	* dwarf2read.c: Update.
	* eval.c: Update.
	* event-loop.c: Update.
	* event-top.c: Update.
	* exec.c: Update.
	* f-valprint.c: Update.
	* fbsd-tdep.c: Update.
	* frame-unwind.c: Update.
	* frame.c: Update.
	* gdbtypes.c: Update.
	* gnu-v3-abi.c: Update.
	* guile/guile-internal.h: Update.
	* guile/scm-block.c: Update.
	* guile/scm-breakpoint.c: Update.
	* guile/scm-cmd.c: Update.
	* guile/scm-disasm.c: Update.
	* guile/scm-frame.c: Update.
	* guile/scm-lazy-string.c: Update.
	* guile/scm-math.c: Update.
	* guile/scm-param.c: Update.
	* guile/scm-ports.c: Update.
	* guile/scm-pretty-print.c: Update.
	* guile/scm-symbol.c: Update.
	* guile/scm-symtab.c: Update.
	* guile/scm-type.c: Update.
	* guile/scm-value.c: Update.
	* i386-linux-tdep.c: Update.
	* i386-tdep.c: Update.
	* inf-loop.c: Update.
	* infcall.c: Update.
	* infcmd.c: Update.
	* infrun.c: Update.
	* jit.c: Update.
	* language.c: Update.
	* linespec.c: Update.
	* linux-fork.c: Update.
	* linux-nat.c: Update.
	* linux-tdep.c: Update.
	* linux-thread-db.c: Update.
	* main.c: Update.
	* mi/mi-cmd-break.c: Update.
	* mi/mi-cmd-stack.c: Update.
	* mi/mi-interp.c: Update.
	* mi/mi-main.c: Update.
	* objc-lang.c: Update.
	* p-valprint.c: Update.
	* parse.c: Update.
	* ppc-linux-tdep.c: Update.
	* printcmd.c: Update.
	* python/py-arch.c: Update.
	* python/py-breakpoint.c: Update.
	* python/py-cmd.c: Update.
	* python/py-finishbreakpoint.c: Update.
	* python/py-frame.c: Update.
	* python/py-framefilter.c: Update.
	* python/py-gdb-readline.c: Update.
	* python/py-inferior.c: Update.
	* python/py-infthread.c: Update.
	* python/py-lazy-string.c: Update.
	* python/py-linetable.c: Update.
	* python/py-objfile.c: Update.
	* python/py-param.c: Update.
	* python/py-prettyprint.c: Update.
	* python/py-progspace.c: Update.
	* python/py-record-btrace.c: Update.
	* python/py-record.c: Update.
	* python/py-symbol.c: Update.
	* python/py-type.c: Update.
	* python/py-unwind.c: Update.
	* python/py-utils.c: Update.
	* python/py-value.c: Update.
	* python/python.c: Update.
	* record-btrace.c: Update.
	* record-full.c: Update.
	* remote-fileio.c: Update.
	* remote.c: Update.
	* riscv-tdep.c: Update.
	* rs6000-aix-tdep.c: Update.
	* rs6000-tdep.c: Update.
	* rust-exp.y: Update.
	* rust-lang.c: Update.
	* s390-tdep.c: Update.
	* selftest-arch.c: Update.
	* solib-dsbt.c: Update.
	* solib-frv.c: Update.
	* solib-spu.c: Update.
	* solib-svr4.c: Update.
	* solib.c: Update.
	* sparc64-linux-tdep.c: Update.
	* stack.c: Update.
	* symfile-mem.c: Update.
	* symmisc.c: Update.
	* target.c: Update.
	* thread.c: Update.
	* top.c: Update.
	* tracefile-tfile.c: Update.
	* tui/tui.c: Update.
	* typeprint.c: Update.
	* unittests/cli-utils-selftests.c: Update.
	* unittests/parse-connection-spec-selftests.c: Update.
	* valops.c: Update.
	* valprint.c: Update.
	* value.c: Update.
	* varobj.c: Update.
	* windows-nat.c: Update.
	* x86-linux-nat.c: Update.
	* xml-support.c: Update.

gdb/gdbserver/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

	* gdbreplay.c: Update.
	* linux-low.c: Update.
	* server.c: Update.
2019-04-08 09:05:40 -06:00
Tom Tromey a70b814420 Rewrite TRY/CATCH
This rewrites gdb's TRY/CATCH to plain C++ try/catch.  The patch was
largely written by script, though one change (to a comment in
common-exceptions.h) was reverted by hand.

gdb/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

	* xml-support.c: Use C++ exception handling.
	* x86-linux-nat.c: Use C++ exception handling.
	* windows-nat.c: Use C++ exception handling.
	* varobj.c: Use C++ exception handling.
	* value.c: Use C++ exception handling.
	* valprint.c: Use C++ exception handling.
	* valops.c: Use C++ exception handling.
	* unittests/parse-connection-spec-selftests.c: Use C++ exception
	handling.
	* unittests/cli-utils-selftests.c: Use C++ exception handling.
	* typeprint.c: Use C++ exception handling.
	* tui/tui.c: Use C++ exception handling.
	* tracefile-tfile.c: Use C++ exception handling.
	* top.c: Use C++ exception handling.
	* thread.c: Use C++ exception handling.
	* target.c: Use C++ exception handling.
	* symmisc.c: Use C++ exception handling.
	* symfile-mem.c: Use C++ exception handling.
	* stack.c: Use C++ exception handling.
	* sparc64-linux-tdep.c: Use C++ exception handling.
	* solib.c: Use C++ exception handling.
	* solib-svr4.c: Use C++ exception handling.
	* solib-spu.c: Use C++ exception handling.
	* solib-frv.c: Use C++ exception handling.
	* solib-dsbt.c: Use C++ exception handling.
	* selftest-arch.c: Use C++ exception handling.
	* s390-tdep.c: Use C++ exception handling.
	* rust-lang.c: Use C++ exception handling.
	* rust-exp.y: Use C++ exception handling.
	* rs6000-tdep.c: Use C++ exception handling.
	* rs6000-aix-tdep.c: Use C++ exception handling.
	* riscv-tdep.c: Use C++ exception handling.
	* remote.c: Use C++ exception handling.
	* remote-fileio.c: Use C++ exception handling.
	* record-full.c: Use C++ exception handling.
	* record-btrace.c: Use C++ exception handling.
	* python/python.c: Use C++ exception handling.
	* python/py-value.c: Use C++ exception handling.
	* python/py-utils.c: Use C++ exception handling.
	* python/py-unwind.c: Use C++ exception handling.
	* python/py-type.c: Use C++ exception handling.
	* python/py-symbol.c: Use C++ exception handling.
	* python/py-record.c: Use C++ exception handling.
	* python/py-record-btrace.c: Use C++ exception handling.
	* python/py-progspace.c: Use C++ exception handling.
	* python/py-prettyprint.c: Use C++ exception handling.
	* python/py-param.c: Use C++ exception handling.
	* python/py-objfile.c: Use C++ exception handling.
	* python/py-linetable.c: Use C++ exception handling.
	* python/py-lazy-string.c: Use C++ exception handling.
	* python/py-infthread.c: Use C++ exception handling.
	* python/py-inferior.c: Use C++ exception handling.
	* python/py-gdb-readline.c: Use C++ exception handling.
	* python/py-framefilter.c: Use C++ exception handling.
	* python/py-frame.c: Use C++ exception handling.
	* python/py-finishbreakpoint.c: Use C++ exception handling.
	* python/py-cmd.c: Use C++ exception handling.
	* python/py-breakpoint.c: Use C++ exception handling.
	* python/py-arch.c: Use C++ exception handling.
	* printcmd.c: Use C++ exception handling.
	* ppc-linux-tdep.c: Use C++ exception handling.
	* parse.c: Use C++ exception handling.
	* p-valprint.c: Use C++ exception handling.
	* objc-lang.c: Use C++ exception handling.
	* mi/mi-main.c: Use C++ exception handling.
	* mi/mi-interp.c: Use C++ exception handling.
	* mi/mi-cmd-stack.c: Use C++ exception handling.
	* mi/mi-cmd-break.c: Use C++ exception handling.
	* main.c: Use C++ exception handling.
	* linux-thread-db.c: Use C++ exception handling.
	* linux-tdep.c: Use C++ exception handling.
	* linux-nat.c: Use C++ exception handling.
	* linux-fork.c: Use C++ exception handling.
	* linespec.c: Use C++ exception handling.
	* language.c: Use C++ exception handling.
	* jit.c: Use C++ exception handling.
	* infrun.c: Use C++ exception handling.
	* infcmd.c: Use C++ exception handling.
	* infcall.c: Use C++ exception handling.
	* inf-loop.c: Use C++ exception handling.
	* i386-tdep.c: Use C++ exception handling.
	* i386-linux-tdep.c: Use C++ exception handling.
	* guile/scm-value.c: Use C++ exception handling.
	* guile/scm-type.c: Use C++ exception handling.
	* guile/scm-symtab.c: Use C++ exception handling.
	* guile/scm-symbol.c: Use C++ exception handling.
	* guile/scm-pretty-print.c: Use C++ exception handling.
	* guile/scm-ports.c: Use C++ exception handling.
	* guile/scm-param.c: Use C++ exception handling.
	* guile/scm-math.c: Use C++ exception handling.
	* guile/scm-lazy-string.c: Use C++ exception handling.
	* guile/scm-frame.c: Use C++ exception handling.
	* guile/scm-disasm.c: Use C++ exception handling.
	* guile/scm-cmd.c: Use C++ exception handling.
	* guile/scm-breakpoint.c: Use C++ exception handling.
	* guile/scm-block.c: Use C++ exception handling.
	* guile/guile-internal.h: Use C++ exception handling.
	* gnu-v3-abi.c: Use C++ exception handling.
	* gdbtypes.c: Use C++ exception handling.
	* frame.c: Use C++ exception handling.
	* frame-unwind.c: Use C++ exception handling.
	* fbsd-tdep.c: Use C++ exception handling.
	* f-valprint.c: Use C++ exception handling.
	* exec.c: Use C++ exception handling.
	* event-top.c: Use C++ exception handling.
	* event-loop.c: Use C++ exception handling.
	* eval.c: Use C++ exception handling.
	* dwarf2read.c: Use C++ exception handling.
	* dwarf2loc.c: Use C++ exception handling.
	* dwarf2-frame.c: Use C++ exception handling.
	* dwarf2-frame-tailcall.c: Use C++ exception handling.
	* dwarf-index-write.c: Use C++ exception handling.
	* dwarf-index-cache.c: Use C++ exception handling.
	* dtrace-probe.c: Use C++ exception handling.
	* disasm-selftests.c: Use C++ exception handling.
	* darwin-nat.c: Use C++ exception handling.
	* cp-valprint.c: Use C++ exception handling.
	* cp-support.c: Use C++ exception handling.
	* cp-abi.c: Use C++ exception handling.
	* corelow.c: Use C++ exception handling.
	* completer.c: Use C++ exception handling.
	* compile/compile-object-run.c: Use C++ exception handling.
	* compile/compile-object-load.c: Use C++ exception handling.
	* compile/compile-cplus-symbols.c: Use C++ exception handling.
	* compile/compile-c-symbols.c: Use C++ exception handling.
	* common/selftest.c: Use C++ exception handling.
	* common/new-op.c: Use C++ exception handling.
	* cli/cli-script.c: Use C++ exception handling.
	* cli/cli-interp.c: Use C++ exception handling.
	* cli/cli-cmds.c: Use C++ exception handling.
	* c-varobj.c: Use C++ exception handling.
	* btrace.c: Use C++ exception handling.
	* breakpoint.c: Use C++ exception handling.
	* break-catch-throw.c: Use C++ exception handling.
	* arch-utils.c: Use C++ exception handling.
	* amd64-tdep.c: Use C++ exception handling.
	* ada-valprint.c: Use C++ exception handling.
	* ada-typeprint.c: Use C++ exception handling.
	* ada-lang.c: Use C++ exception handling.
	* aarch64-tdep.c: Use C++ exception handling.

gdb/gdbserver/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

	* server.c: Use C++ exception handling.
	* linux-low.c: Use C++ exception handling.
	* gdbreplay.c: Use C++ exception handling.
2019-04-08 09:05:39 -06:00
Keith Seitz cc1defb1dc Allow really large fortran array bounds: TYPE_LENGTH to ULONGEST
This series is revisit of Siddhesh Poyarekar's patch from back in
2012. The last status on the patch is in the following gdb-patches
thread:

  https://sourceware.org/ml/gdb-patches/2012-08/msg00562.html

It appears that Tom approved the patch, but Jan had some issues
with a compiler error that made the test fail on -m32 test runs.
He wrote up a hand-tweaked .S file to deal with it. Siddesh said
he would update tests. Then nothing.

Siddesh and Jan have both moved on since.

The patch originally required a large precursor patch to work.
I have whittled this down to/rewritten the bare minimum, and this
first patch is the result, changing the type of TYPE_LENGTH
to ULONGEST from unsigned int.

The majority of the changes involve changing printf format
strings to use %s and pulongest instead of %d.

gdb/ChangeLog:

	* ada-lang.c (ada_template_to_fixed_record_type_1): Use
	%s/pulongest for TYPE_LENGTH instead of %d in format
	strings.
	* ada-typerint.c (ada_print_type): Likewise.
	* amd64-windows-tdep.c (amd64_windows_store_arg_in_reg): Likewise.
	* compile/compile-c-support.c (generate_register_struct): Likewise.
	* gdbtypes.c (recursive_dump_type): Likewise.
	* gdbtypes.h (struct type) <length>: Change type to ULONGEST.
	* m2-typeprint.c (m2_array):  Use %s/pulongest for TYPE_LENGTH
	instead of %d in format strings.
	* riscv-tdep.c (riscv_type_alignment): Cast second argument
	to std::min to ULONGEST.
	* symmisc.c (print_symbol): Use %s/pulongest for TYPE_LENGTH
	instead of %d in format strings.
	* tracepoint.c (info_scope_command): Likewise.
	* typeprint.c (print_offset_data::update)
	(print_offset_data::finish): Likewise.
	* xtensa-tdep.c (xtensa_store_return_value)
	(xtensa_push_dummy_call): Likewise.
2019-03-29 10:15:38 -07:00
Tom Tromey 582942f456 More block constification
I noticed that there are still many places referring to non-const
blocks.  This constifies all the remaining ones that I found that
could be constified.

In a few spots, this search found unused variables or fields.  I
removed these.  I've also removed some unnecessary casts to
"struct block *".

gdb/ChangeLog
2019-03-24  Tom Tromey  <tom@tromey.com>

	* c-exp.y (typebase): Remove casts.
	* gdbtypes.c (lookup_unsigned_typename, )
	(lookup_signed_typename): Remove cast.
	* eval.c (parse_to_comma_and_eval): Remove cast.
	* parse.c (write_dollar_variable): Remove cast.
	* block.h (struct block) <superblock>: Now const.
	* symfile-debug.c (debug_qf_map_matching_symbols): Update.
	* psymtab.c (psym_map_matching_symbols): Make "block" const.
	(map_block): Make "block" const.
	* symfile.h (struct quick_symbol_functions)
	<map_matching_symbols>: Constify block argument to "callback".
	* symtab.c (basic_lookup_transparent_type_quick): Make "block"
	const.
	(find_pc_sect_compunit_symtab): Make "b" const.
	(find_symbol_at_address): Likewise.
	(search_symbols): Likewise.
	* dwarf2read.c (dw2_lookup_symbol): Make "block" const.
	(dw2_debug_names_lookup_symbol): Likewise.
	(dw2_map_matching_symbols): Update.
	* p-valprint.c (pascal_val_print): Remove "block".
	* ada-lang.c (ada_add_global_exceptions): Make "b" const.
	(aux_add_nonlocal_symbols): Make "block" const.
	(resolve_subexp): Remove cast.
	* linespec.c (iterate_over_all_matching_symtabs): Make "block"
	const.
	(iterate_over_file_blocks): Likewise.
	* f-exp.y (%union) <bval>: Remove.
	* coffread.c (patch_opaque_types): Make "b" const.
	* spu-tdep.c (spu_catch_start): Make "block" const.
	* c-valprint.c (print_unpacked_pointer): Remove "block".
	* symmisc.c (dump_symtab_1): Make "b" const.
	(block_depth): Make "block" const.
	* d-exp.y (%union) <bval>: Remove.
	* cp-support.h (cp_lookup_rtti_type): Update.
	* cp-support.c (cp_lookup_rtti_type): Make "block" const.
	* psymtab.c (psym_lookup_symbol): Make "block" const.
	(maintenance_check_psymtabs): Make "b" const.
	* python/py-framefilter.c (extract_sym): Make "sym_block" const.
	(enumerate_locals, enumerate_args): Update.
	* python/py-symtab.c (stpy_global_block): Make "block" const.
	(stpy_static_block): Likewise.
	* inline-frame.c (block_starting_point_at): Make "new_block"
	const.
	* block.c (find_block_in_blockvector): Make return type const.
	(blockvector_for_pc_sect): Make "b" const.
	(find_block_in_blockvector): Make "b" const.
2019-03-24 23:32:08 -06:00
Tom Tromey 9bb9b2f9d6 Use scoped_restore_current_language in two places
I found a couple of spots that manually saved and restored the current
language.  This patch changes them to use
scoped_restore_current_language.

Tested by the buildbot.

gdb/ChangeLog
2019-03-23  Tom Tromey  <tom@tromey.com>

	* linespec.c (get_current_search_block): Use
	scoped_restore_current_language.
	* symmisc.c (dump_symtab): Use scoped_restore_current_language.
2019-03-23 10:18:15 -06:00
Tom Tromey 25629dfdb4 C++-ify bcache
This somewhat C++-ifies bcache.  It replaces bcache_xmalloc and
bcache_xfree with constructors; changes some functions into methods;
and changes various structures to include a bcache directly (as
opposed to a pointer to a bcache).

Tested by the buildbot.

gdb/ChangeLog
2019-03-07  Tom Tromey  <tom@tromey.com>

	* symmisc.c (print_symbol_bcache_statistics): Update.
	(print_objfile_statistics): Update.
	* symfile.c (allocate_symtab): Update.
	* stabsread.c: Don't include bcache.h.
	* psymtab.h (struct psymbol_bcache): Don't declare.
	(class psymtab_storage) <psymbol_cache>: Now a bcache.
	(psymbol_bcache_init, psymbol_bcache_free)
	(psymbol_bcache_get_bcache): Don't declare.
	* psymtab.c (struct psymbol_bcache): Remove.
	(psymtab_storage::psymtab_storage): Update.
	(psymtab_storage::~psymtab_storage): Update.
	(psymbol_bcache_init, psymbol_bcache_free)
	(psymbol_bcache_get_bcache, psymbol_bcache_full): Remove.
	(add_psymbol_to_bcache): Update.
	(allocate_psymtab): Update.
	* objfiles.h (struct objfile_per_bfd_storage) <filename_cache,
	macro_cache>: No longer pointers.
	* objfiles.c (get_objfile_bfd_data): Don't call bcache_xmalloc.
	(free_objfile_per_bfd_storage): Don't call bcache_xfree.
	* macrotab.c (macro_bcache): Update.
	* macroexp.c: Don't include bcache.h.
	* gdbtypes.c (check_types_worklist): Update.
	(types_deeply_equal): Remove TRY/CATCH.  Update.
	* elfread.c (elf_symtab_read): Update.
	* dwarf2read.c: Don't include bcache.h.
	* buildsym.c (buildsym_compunit::get_macro_table): Update.
	* bcache.h (bcache, bcache_full, bcache_xffree, bcache_xmalloc)
	(print_bcache_statistics, bcache_memory_used): Don't declare.
	(struct bcache): Move from bcache.c.  Add constructor, destructor,
	methods.  Rename all data members.
	* bcache.c (struct bcache): Move to bcache.h.
	(bcache::expand_hash_table): Rename from expand_hash_table.
	(bcache): Remove.
	(bcache::insert): Rename from bcache_full.
	(bcache::compare): Rename from bcache_compare.
	(bcache_xmalloc): Remove.
	(bcache::~bcache): Rename from bcache_xfree.
	(bcache::print_statistics): Rename from print_bcache_statistics.
	(bcache::memory_used): Rename from bcache_memory_used.
2019-03-07 10:48:02 -07:00
Tom Tromey 7932255de5 Make minimal symbol range adapter a method on objfile
This removes class objfile_msymbols in favor of a method on the
objfile.

2019-01-16  Tom Tromey  <tom@tromey.com>

	* objfiles.h (struct minimal_symbol_iterator): Rename.  Move
	earlier.
	(struct objfile) <msymbols_range>: Move from top level.
	<msymbols>: New method.
	(class objfile_msymbols): Remove.
	* symtab.c (default_collect_symbol_completion_matches_break_on):
	Update.
	* symmisc.c (dump_msymbols): Update.
	* stabsread.c (scan_file_globals): Update.
	* objc-lang.c (info_selectors_command, info_classes_command)
	(find_methods): Update.
	* minsyms.c (find_solib_trampoline_target): Update.
	* hppa-tdep.c (hppa_lookup_stub_minimal_symbol): Update.
	* coffread.c (coff_symfile_read): Update.
	* ada-lang.c (ada_lookup_simple_minsym)
	(ada_collect_symbol_completion_matches): Update.
2019-01-17 15:43:37 -07:00
Tom Tromey b669c95337 Add compunits range adapter to objfile
This removes the objfile_compunits range adapter in favor of using a
method on objfile.

2019-01-15  Tom Tromey  <tom@tromey.com>

	* symtab.c (lookup_objfile_from_block)
	(lookup_symbol_in_objfile_symtabs)
	(basic_lookup_transparent_type_1, find_pc_sect_compunit_symtab)
	(find_line_symtab, info_sources_command)
	(default_collect_symbol_completion_matches_break_on)
	(make_source_files_completion_list): Update.
	* symmisc.c (print_objfile_statistics, dump_objfile)
	(maintenance_print_symbols, maintenance_info_symtabs)
	(maintenance_check_symtabs, maintenance_info_line_tables):
	Update.
	* source.c (select_source_symtab)
	(forget_cached_source_info_for_objfile): Update.
	* objfiles.h (class objfile_compunits): Remove.
	(struct objfile) <compunits_range>: New typedef.
	(compunits): New method.
	* objfiles.c (objfile_relocate1): Update.
	* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update.
	* maint.c (count_symtabs_and_blocks): Update.
	* linespec.c (iterate_over_all_matching_symtabs): Update.
	* cp-support.c (add_symbol_overload_list_qualified): Update.
	* coffread.c (coff_symtab_read): Update.
	* ada-lang.c (add_nonlocal_symbols)
	(ada_collect_symbol_completion_matches)
	(ada_add_global_exceptions): Update.
2019-01-17 15:42:05 -07:00
Tom Tromey 2030c07971 Change all_objfiles adapter to be a method on program_space
This changes the all_objfiles range adapter to be a method on the
program space, and fixes up all the users.

gdb/ChangeLog
2019-01-17  Tom Tromey  <tom@tromey.com>

	* progspace.h (program_space) <objfiles_range>: New typedef.
	<objfiles>: New method.
	<objfiles_head>: Rename from objfiles.
	(object_files): Update.
	* guile/scm-progspace.c (gdbscm_progspace_objfiles): Update.
	* guile/scm-pretty-print.c
	(ppscm_find_pretty_printer_from_objfiles): Update.
	* guile/scm-objfile.c (gdbscm_objfiles): Update.
	* python/py-xmethods.c (gdbpy_get_matching_xmethod_workers):
	Update.
	* python/py-progspace.c (pspy_get_objfiles): Update.
	* python/py-prettyprint.c (find_pretty_printer_from_objfiles):
	Update.
	* python/py-objfile.c (objfpy_lookup_objfile_by_name)
	(objfpy_lookup_objfile_by_build_id): Update.
	* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update.
	* windows-tdep.c (windows_iterate_over_objfiles_in_search_order):
	Update.
	* symtab.c (iterate_over_symtabs, matching_obj_sections)
	(expand_symtab_containing_pc, lookup_objfile_from_block)
	(lookup_static_symbol, basic_lookup_transparent_type)
	(find_pc_sect_compunit_symtab, find_symbol_at_address)
	(find_line_symtab, info_sources_command)
	(default_collect_symbol_completion_matches_break_on)
	(make_source_files_completion_list, find_main_name): Update.
	* symmisc.c (print_symbol_bcache_statistics)
	(print_objfile_statistics, maintenance_print_symbols)
	(maintenance_print_msymbols, maintenance_print_objfiles)
	(maintenance_info_symtabs, maintenance_check_symtabs)
	(maintenance_expand_symtabs, maintenance_info_line_tables):
	Update.
	* symfile.c (remove_symbol_file_command, overlay_invalidate_all)
	(find_pc_overlay, find_pc_mapped_section, list_overlays_command)
	(map_overlay_command, unmap_overlay_command)
	(simple_overlay_update, expand_symtabs_matching)
	(map_symbol_filenames): Update.
	* symfile-debug.c (set_debug_symfile): Update.
	* spu-tdep.c (spu_overlay_update, spu_objfile_from_frame):
	Update.
	* source.c (select_source_symtab, forget_cached_source_info):
	Update.
	* solib.c (solib_read_symbols): Update.
	* solib-spu.c (append_ocl_sos): Update.
	* psymtab.c (maintenance_print_psymbols)
	(maintenance_info_psymtabs, maintenance_check_psymtabs): Update.
	* probe.c (parse_probes_in_pspace, find_probe_by_pc): Update.
	* printcmd.c (info_symbol_command): Update.
	* ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created):
	Update.
	* objfiles.h (class all_objfiles): Remove.
	* objfiles.c (have_partial_symbols, have_full_symbols)
	(have_minimal_symbols, qsort_cmp, update_section_map)
	(shared_objfile_contains_address_p)
	(default_iterate_over_objfiles_in_search_order): Update.
	* objc-lang.c (info_selectors_command, info_classes_command)
	(find_methods): Update.
	* minsyms.c (find_solib_trampoline_target): Update.
	* maint.c (maintenance_info_sections)
	(maintenance_translate_address, count_symtabs_and_blocks):
	Update.
	* main.c (captured_main_1): Update.
	* linux-thread-db.c (try_thread_db_load_from_pdir)
	(has_libpthread): Update.
	* linespec.c (iterate_over_all_matching_symtabs)
	(search_minsyms_for_name): Update.
	* jit.c (jit_find_objf_with_entry_addr): Update.
	* hppa-tdep.c (find_unwind_entry)
	(hppa_lookup_stub_minimal_symbol): Update.
	* gcore.c (gcore_create_callback, objfile_find_memory_regions):
	Update.
	* elfread.c (elf_gnu_ifunc_resolve_by_cache)
	(elf_gnu_ifunc_resolve_by_got): Update.
	* dwarf2-frame.c (dwarf2_frame_find_fde): Update.
	* dwarf-index-write.c (save_gdb_index_command): Update.
	* cp-support.c (add_symbol_overload_list_qualified): Update.
	* breakpoint.c (create_overlay_event_breakpoint)
	(create_longjmp_master_breakpoint)
	(create_std_terminate_master_breakpoint)
	(create_exception_master_breakpoint): Update.
	* blockframe.c (find_pc_partial_function): Update.
	* ada-lang.c (ada_lookup_simple_minsym, add_nonlocal_symbols)
	(ada_collect_symbol_completion_matches)
	(ada_add_global_exceptions): Update.
2019-01-17 15:34:37 -07:00
Keith Seitz b026f59345 gdb/23712: Use new multidictionary API
This patch builds on the previous by enabling the `new' multidictionary
API.  A lot of the hunks are simply textual replacements of "dict_"
with "mdict_" and similar transformations.

A word of warning, even with the use of multidictionaries, the code
still does not satisfactorily fix the reported problems with gdb/23712
(or gdb/23010). We still have additional changes to make before that
happens.

gdb/ChangeLog:

	PR gdb/23712
	PR symtab/23010
	* dictionary.h (struct dictionary): Replace declaration with
	multidictionary.
	(dict_create_hashed, dict_create_hashed_expandable)
	(dict_create_linear, dict_create_linear_expandable)
	(dict_free, dict_add_symbol, dict_add_pending, dict_empty)
	(dict_iterator_first, dict_iterator_next, dict_iter_match_first)
	(dict_iter_match_next, dict_size): Rename to "mdict_" versions
	taking multidictionary argument.
	[ALL_DICT_SYMBOLS]: Update for multidictionary.
	* block.h (struct block) <dict>: Change to multidictionary
	and rename `multidict'.
	* block.c, buildsym.c, jit.c, mdebugread.c, objfiles.c,
	symmisc.c: Update all dictionary references to multidictionary.
2019-01-10 13:57:08 -08:00
Tom Tromey d320c2b5e1 Introduce class psymtab_storage
This introduces a new psymtab_storage class, which holds all
psymbol-related objects that are independent of the objfile.  (This
latter contraint explains why psymbol_map was not moved; though this
could still be done with some work.)

This patch does not yet change where psymtab allocation is done --
that comes later.  This just wraps everything in a single object to
make further transformations simpler.

Note that a shared_ptr is used to link from the objfile to the
psymtab_storage object.  The end goal here is to allow a given symbol
reader to simply attach to the psymtab_storage object to the BFD, then
reuse it in later invocations; shared_ptr makes this simple to reason
about.

gdb/ChangeLog
2019-01-10  Tom Tromey  <tom@tromey.com>

	* symmisc.c (print_symbol_bcache_statistics): Update.
	(print_objfile_statistics): Update.
	* symfile.c (reread_symbols): Update.
	* psymtab.h (class psymtab_storage): New.
	* psymtab.c (psymtab_storage): New constructor.
	(~psymtab_storage): New destructor.
	(require_partial_symbols): Update.
	(ALL_OBJFILE_PSYMTABS_REQUIRED): Rewrite.
	(find_pc_sect_psymtab, find_pc_sect_psymbol)
	(match_partial_symbol, lookup_partial_symbol, dump_psymtab)
	(psym_dump, recursively_search_psymtabs, psym_has_symbols)
	(psym_find_compunit_symtab_by_address, sort_pst_symbols)
	(start_psymtab_common, end_psymtab_common)
	(add_psymbol_to_bcache, add_psymbol_to_list, init_psymbol_list)
	(allocate_psymtab): Update.
	(psymtab_storage::discard_psymtab): Rename from discard_psymtab.
	Update.
	(dump_psymtab_addrmap, maintenance_print_psymbols)
	(maintenance_check_psymtabs): Update.
	(class objfile_psymtabs): Move to objfiles.h.
	* psympriv.h (discard_psymtab): Now inline.
	(psymtab_discarder::psymtab_discarder): Update.
	(psymtab_discarder::~psymtab_discarder): Update.
	(ALL_OBJFILE_PSYMTABS): Rewrite.
	* objfiles.h (struct objfile) <psymtabs, psymtabs_addrmap,
	free_psymtabs, psymbol_cache, global_psymbols, static_psymbols>:
	Remove fields.
	<partial_symtabs>: New field.
	(class objfile_psymtabs): Move from psymtab.h.  Update.
	* objfiles.c (objfile::objfile): Initialize partial_symtabs, not
	psymbol_cache.
	(objfile::~objfile): Don't destroy psymbol_cache.
	* mdebugread.c (parse_partial_symbols): Update.
	* dwarf2read.c (create_addrmap_from_index)
	(create_addrmap_from_aranges, dw2_find_pc_sect_compunit_symtab)
	(process_psymtab_comp_unit_reader, dwarf2_build_psymtabs_hard)
	(add_partial_subprogram, dwarf2_ranges_read): Update.
	* dwarf-index-write.c (write_address_map)
	(write_one_signatured_type, recursively_write_psymbols)
	(class debug_names, class debug_names, write_psymtabs_to_index):
	Update.
2019-01-10 07:08:12 -07:00
Tom Tromey d5da8b3c0d Remove ALL_OBJFILE_FILETABS
This removes ALL_OBJFILE_FILETABS, replacing its uses with ranged for
loops.

gdb/ChangeLog
2019-01-09  Tom Tromey  <tom@tromey.com>

	* symmisc.c (print_objfile_statistics, dump_objfile)
	(maintenance_print_symbols): Use compunit_filetabs.
	* source.c (forget_cached_source_info_for_objfile): Use
	compunit_filetabs.
	* objfiles.h (ALL_OBJFILE_FILETABS): Remove.
	(ALL_FILETABS): Use compunit_filetabs.
	* objfiles.c (objfile_relocate1): Use compunit_filetabs.
	* coffread.c (coff_symtab_read): Use compunit_filetabs.
2019-01-09 18:28:15 -07:00
Tom Tromey 5accd1a07e Remove ALL_COMPUNIT_FILETABS
This removes ALL_COMPUNIT_FILETABS, replacing its uses with ranged for
loops.

Because this is still used in the ALL_OBJFILE_FILETABS macro, in some
places a declaration had to be removed or renamed to avoid shadowing.

gdb/ChangeLog
2019-01-09  Tom Tromey  <tom@tromey.com>

	* symtab.h (ALL_COMPUNIT_FILETABS): Remove.
	(compunit_filetabs): New.
	* symtab.c (iterate_over_some_symtabs, find_pc_sect_line): Use
	compunit_filetabs.
	(info_sources_command, make_source_files_completion_list): Remove
	declaration.
	* symmisc.c (print_objfile_statistics, dump_objfile)
	(maintenance_print_symbols): Remove declaration.
	(maintenance_info_symtabs): Use compunit_filetabs.
	(maintenance_info_line_tables): Likewise.
	* source.c (select_source_symtab): Change local variable name.
	(forget_cached_source_info_for_objfile): Remove declaration.
	* objfiles.h (ALL_OBJFILE_FILETABS): Use compunit_filetabs.
	* objfiles.c (objfile_relocate1): Remove declaration.
	* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Remove
	declaration.
	* maint.c (count_symtabs_and_blocks): Use compunit_filetabs.
	* coffread.c (coff_symtab_read): Remove declaration.
	* buildsym.c (buildsym_compunit::end_symtab_with_blockvector): Use
	compunit_filetabs.
2019-01-09 18:28:15 -07:00
Tom Tromey 592553c469 Remove ALL_OBJFILE_COMPUNITS
This removes ALL_OBJFILE_COMPUNITS, replacing its uses with ranged for
loops.  Because ALL_COMPUNITS is also updated, in some places a
declaration must be deleted to avoid shadowing.

gdb/ChangeLog
2019-01-09  Tom Tromey  <tom@tromey.com>

	* source.c (select_source_symtab)
	(forget_cached_source_info_for_objfile): Remove declaration.
	* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Remove
	declaration.
	* maint.c (count_symtabs_and_blocks): Remove declaration.
	* cp-support.c (add_symbol_overload_list_qualified): Remove
	declaration.
	* coffread.c (coff_symtab_read): Remove declaration.
	* symtab.c (lookup_symbol_in_objfile_symtabs)
	(basic_lookup_transparent_type_1): Use objfile_compunits.
	(lookup_objfile_from_block, find_pc_sect_compunit_symtab)
	(info_sources_command, search_symbols)
	(default_collect_symbol_completion_matches_break_on)
	(make_source_files_completion_list): Remove declaration.
	* ada-lang.c (add_nonlocal_symbols): Use objfile_compunits.
	(ada_collect_symbol_completion_matches)
	(ada_add_global_exceptions): Remove declaration.
	* linespec.c (iterate_over_all_matching_symtabs): Use
	objfile_compunits.
	* objfiles.h (ALL_OBJFILE_COMPUNITS): Remove.
	(class objfile_compunits): New.
	(ALL_COMPUNITS): Use objfile_compunits.
	* symmisc.c (print_objfile_statistics, maintenance_info_symtabs)
	(maintenance_check_symtabs, maintenance_info_line_tables): Use
	objfile_compunits.
	* objfiles.c (objfile_relocate1): Use objfile_compunits.
2019-01-09 18:28:15 -07:00
Tom Tromey 5325b9bf1e Remove ALL_MSYMBOLS and ALL_OBJFILE_MSYMBOLS
This removes the ALL_MSYMBOLS and ALL_OBJFILE_MSYMBOLS macros,
replacing their uses with ranged for loops.

In a couple of spots, a new declaration was needed in order to work
around shadowing; these are just temporary and are removed in a
subsequent patch.

gdb/ChangeLog
2019-01-09  Tom Tromey  <tom@tromey.com>

	* symtab.c (search_symbols)
	(default_collect_symbol_completion_matches_break_on): Use
	objfile_msymbols.
	* ada-lang.c (ada_lookup_simple_minsym)
	(ada_collect_symbol_completion_matches): Use objfile_msymbols.
	* minsyms.c (find_solib_trampoline_target): Use objfile_msymbols.
	* hppa-tdep.c (hppa_lookup_stub_minimal_symbol): Use
	objfile_msymbols.
	* coffread.c (coff_symfile_read): Use objfile_msymbols.
	* symmisc.c (dump_msymbols): Use objfile_msymbols.
	* objc-lang.c (find_methods): Use objfile_msymbols.
	(info_selectors_command, info_classes_command): Likewise.
	* stabsread.c (scan_file_globals): Use objfile_msymbols.
	* objfiles.h (class objfile_msymbols): New.
	(ALL_OBJFILE_MSYMBOLS): Remove.
	(ALL_MSYMBOLS): Remove.
2019-01-09 18:28:15 -07:00
Tom Tromey aed57c5371 Remove most uses of ALL_OBJFILES
This removes most uses of ALL_OBJFILES, replacing them with ranged for
loops.  The remaining uses are all in macros, and will be removed in
subsequent patches.

gdb/ChangeLog
2019-01-09  Tom Tromey  <tom@tromey.com>

	* symtab.c (iterate_over_symtabs, matching_obj_sections)
	(expand_symtab_containing_pc, lookup_static_symbol)
	(basic_lookup_transparent_type, find_pc_sect_compunit_symtab)
	(find_symbol_at_address, find_line_symtab, find_main_name): Use
	all_objfiles.
	* probe.c (find_probe_by_pc, collect_probes): Use all_objfiles.
	* breakpoint.c (create_overlay_event_breakpoint)
	(create_longjmp_master_breakpoint)
	(create_std_terminate_master_breakpoint)
	(create_exception_master_breakpoint): Use all_objfiles.
	* linux-thread-db.c (try_thread_db_load_from_pdir)
	(has_libpthread): Use all_objfiles.
	* ada-lang.c (add_nonlocal_symbols): Use all_objfiles.
	* linespec.c (iterate_over_all_matching_symtabs)
	(search_minsyms_for_name): Use all_objfiles.
	* maint.c (maintenance_info_sections): Use all_objfiles.
	* main.c (captured_main_1): Use all_objfiles.
	* spu-tdep.c (spu_objfile_from_frame): Use all_objfiles.
	* guile/scm-objfile.c (gdbscm_objfiles): Use all_objfiles.
	* guile/scm-pretty-print.c
	(ppscm_find_pretty_printer_from_objfiles): Use all_objfiles.
	* solib-spu.c (append_ocl_sos): Use all_objfiles.
	* symmisc.c (maintenance_print_symbols): Use all_objfiles.
	(maintenance_print_msymbols): Use all_objfiles.
	* source.c (select_source_symtab): Use all_objfiles.
	* jit.c (jit_find_objf_with_entry_addr): Use all_objfiles.
	* symfile.c (remove_symbol_file_command)
	(expand_symtabs_matching, map_symbol_filenames): Use
	all_objfiles.
	* ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created): Use
	all_objfiles.
	* dwarf2-frame.c (dwarf2_frame_find_fde): Use all_objfiles.
	* objc-lang.c (find_methods): Use all_objfiles.
	* objfiles.c (have_partial_symbols, have_full_symbols)
	(have_minimal_symbols, qsort_cmp)
	(default_iterate_over_objfiles_in_search_order): Use
	all_objfiles.
	* hppa-tdep.c (find_unwind_entry): Use all_objfiles.
	* psymtab.c (maintenance_print_psymbols): Use all_objfiles.
	(maintenance_check_psymtabs): Use all_objfiles.
	(ALL_PSYMTABS): Remove.
	* compile/compile-object-run.c (do_module_cleanup): Use
	all_objfiles.
	* blockframe.c (find_pc_partial_function): Use all_objfiles.
	* cp-support.c (add_symbol_overload_list_qualified): Use
	all_objfiles.
	* windows-tdep.c (windows_iterate_over_objfiles_in_search_order):
	Use all_objfiles.
	* dwarf-index-write.c (save_gdb_index_command): Use all_objfiles.
	* python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): Use
	all_objfiles.
	* python/py-objfile.c (objfpy_lookup_objfile_by_name)
	(objfpy_lookup_objfile_by_build_id): Use all_objfiles.
	* python/py-prettyprint.c (find_pretty_printer_from_objfiles):
	Uses all_objfiles.
	* solib.c (solib_read_symbols): Use all_objfiles
2019-01-09 18:28:14 -07:00
Tom Tromey 99d89cdea6 Remove ALL_PSPACE_OBJFILES
This removes the ALL_PSPACE_OBJFILES macro in favor of ranged for
loops.

gdb/ChangeLog
2019-01-09  Tom Tromey  <tom@tromey.com>

	* probe.c (parse_probes_in_pspace): Use all_objfiles.
	* guile/scm-progspace.c (gdbscm_progspace_objfiles): Use
	all_objfiles.
	* objfiles.h (ALL_PSPACE_OBJFILES): Remove.
	* symmisc.c (print_symbol_bcache_statistics)
	(print_objfile_statistics, maintenance_print_objfiles)
	(maintenance_info_symtabs, maintenance_check_symtabs)
	(maintenance_expand_symtabs, maintenance_info_line_tables): Use
	all_objfiles.
	* source.c (forget_cached_source_info): Use all_objfiles.
	* symfile-debug.c (set_debug_symfile): Use all_objfiles.
	* elfread.c (elf_gnu_ifunc_resolve_by_cache)
	(elf_gnu_ifunc_resolve_by_got): Use all_objfiles.
	* objfiles.c (update_section_map): Use all_objfiles.
	(shared_objfile_contains_address_p): Likewise.
	* psymtab.c (maintenance_info_psymtabs): Use all_objfiles.
	* python/py-progspace.c (pspy_get_objfiles): Use all_objfiles.
2019-01-09 18:28:14 -07:00
Tom Tromey 48c5e7e239 Use upper case for more metasyntactic variables in gdb
I noticed a few places where a Usage line in gdb did not use upper
case for metasyntactic variables.  This patch fixes all the instances
I found.

Tested on x86-64 Fedora 28.

gdb/ChangeLog
2019-01-04  Tom Tromey  <tom@tromey.com>

	* compile/compile.c (_initialize_compile): Use upper case for
	metasyntactic variables.
	* symmisc.c (_initialize_symmisc): Use upper case for
	metasyntactic variables.
	* psymtab.c (_initialize_psymtab): Use upper case for
	metasyntactic variables.
	* demangle.c (demangle_command): Use upper case for metasyntactic
	variables.
	(_initialize_demangler): Likewise.
	* ax-gdb.c (_initialize_ax_gdb): Use upper case for metasyntactic
	variables.
2019-01-04 11:08:02 -07:00
Joel Brobecker 42a4f53d2b Update copyright year range in all GDB files.
This commit applies all changes made after running the gdb/copyright.py
script.

Note that one file was flagged by the script, due to an invalid
copyright header
(gdb/unittests/basic_string_view/element_access/char/empty.cc).
As the file was copied from GCC's libstdc++-v3 testsuite, this commit
leaves this file untouched for the time being; a patch to fix the header
was sent to gcc-patches first.

gdb/ChangeLog:

	Update copyright year range in all GDB files.
2019-01-01 10:01:51 +04:00
Tom Tromey e86ca25fd6 Remove TYPE_TAG_NAME
TYPE_TAG_NAME has been an occasional source of confusion and bugs.  It
seems to me that it is only useful for C and C++ -- but even there,
not so much, because at least with DWARF there doesn't seem to be any
way to wind up with a type where the name and the tag name are both
non-NULL and different.

So, this patch removes TYPE_TAG_NAME entirely.  This should save a
little memory, but more importantly, it simplifies this part of gdb.

A few minor test suite adjustments were needed.  In some situations
the new code does not yield identical output to the old code.

gdb/ChangeLog
2018-06-01  Tom Tromey  <tom@tromey.com>

	* valops.c (enum_constant_from_type, value_namespace_elt)
	(value_maybe_namespace_elt): Update.
	* valarith.c (find_size_for_pointer_math): Update.
	* target-descriptions.c (make_gdb_type): Update.
	* symmisc.c (print_symbol): Update.
	* stabsread.c (define_symbol, read_type)
	(complain_about_struct_wipeout, add_undefined_type)
	(cleanup_undefined_types_1): Update.
	* rust-lang.c (rust_tuple_type_p, rust_slice_type_p)
	(rust_range_type_p, val_print_struct, rust_print_struct_def)
	(rust_internal_print_type, rust_composite_type)
	(rust_evaluate_funcall, rust_evaluate_subexp)
	(rust_inclusive_range_type_p): Update.
	* python/py-type.c (typy_get_tag): Update.
	* p-typeprint.c (pascal_type_print_base): Update.
	* mdebugread.c (parse_symbol, parse_type): Update.
	* m2-typeprint.c (m2_long_set, m2_record_fields, m2_enum):
	Update.
	* guile/scm-type.c (gdbscm_type_tag): Update.
	* go-lang.c (sixg_string_p): Update.
	* gnu-v3-abi.c (build_gdb_vtable_type, build_std_type_info_type):
	Update.
	* gdbtypes.h (struct main_type) <tag_name>: Remove.
	(TYPE_TAG_NAME): Remove.
	* gdbtypes.c (type_name_no_tag): Simplify.
	(check_typedef, check_types_equal, recursive_dump_type)
	(copy_type_recursive, arch_composite_type): Update.
	* f-typeprint.c (f_type_print_base): Update.  Print "Type" prefix
	in summary mode when needed.
	* eval.c (evaluate_funcall): Update.
	* dwarf2read.c (fixup_go_packaging, read_structure_type)
	(process_structure_scope, read_enumeration_type)
	(read_namespace_type, read_module_type, determine_prefix): Update.
	* cp-support.c (inspect_type): Update.
	* coffread.c (process_coff_symbol, decode_base_type): Update.
	* c-varobj.c (c_is_path_expr_parent): Update.
	* c-typeprint.c (c_type_print_base_struct_union): Update.
	(c_type_print_base_1): Update.  Print struct/class/union/enum in
	summary when using C language.
	* ax-gdb.c (gen_struct_ref, gen_namespace_elt)
	(gen_maybe_namespace_elt): Update.
	* ada-lang.c (ada_type_name): Simplify.
	(empty_record, ada_template_to_fixed_record_type_1)
	(template_to_static_fixed_type)
	(to_record_with_fixed_variant_part, ada_check_typedef): Update.

gdb/testsuite/ChangeLog
2018-06-01  Tom Tromey  <tom@tromey.com>

	* gdb.xml/tdesc-regs.exp (load_description): Update expected
	results.
	* gdb.dwarf2/method-ptr.exp: Set language to C++.
	* gdb.dwarf2/member-ptr-forwardref.exp: Set language to C++.
	* gdb.cp/typeid.exp (do_typeid_tests): Update type_re.
	* gdb.base/maint.exp (maint_pass_if): Update.
2018-06-01 10:19:55 -06:00
Pedro Alves f50776aad5 For PPC64/ELFv1: Introduce mst_data_gnu_ifunc
Running the new tests added later in the series on PPC64 (ELFv1)
revealed that the current ifunc support needs a bit of a design rework
to work properly on PPC64/ELFv1, as most of the new tests fail.  The
ifunc support only kind of works today if the ifunc symbol and the
resolver have the same name, as is currently tested by the
gdb.base/gnu-ifunc.exp testcase, which is unlike how ifuncs are
written nowadays.

The crux of the problem is that ifunc symbols are really function
descriptors, not text symbols:

   44: 0000000000020060    104 FUNC    GLOBAL DEFAULT       18 gnu_ifunc_resolver
   54: 0000000000020060    104 GNU_IFUNC GLOBAL DEFAULT     18 gnu_ifunc

But, currently GDB only knows about ifunc symbols that are text
symbols.  GDB's support happens to work in practice for PPC64 when the
ifunc and resolver are one and only, like in the current
gdb.base/gnu-ifunc.exp testcase:

   15: 0000000000020060    104 GNU_IFUNC GLOBAL DEFAULT       18 gnu_ifunc

because in that case, the synthetic ".gnu_ifunc" entry point text
symbol that bfd creates from the actual GNU ifunc "gnu_ifunc" function
(descriptor) symbol ends up with the the "is a gnu ifunc" flag set /
copied over:

  (gdb) maint print msymbols
  ...
  [ 8] i 0x9c4 .gnu_ifunc section .text                <<< mst_text_gnu_ifunc
  ...
  [29] D 0x20060 gnu_ifunc section .opd  crtstuff.c    <<< mst_data

But, if the resolver gets a distinct symbol/name from the ifunc
symbol, then we end up with this:

  (gdb) maint print msymbols
  [ 8] T 0x9e4 .gnu_ifunc_resolver section .text               <<< mst_text
  ...
  [29] D 0x20060 gnu_ifunc section .opd  crtstuff.c            <<< mst_data
  [30] D 0x20060 gnu_ifunc_resolver section .opd  crtstuff.c   <<< mst_data

I have a follow up bfd patch that turns that into:

   (gdb) maint print msymbols
+  [ 8] i 0x9e4 .gnu_ifunc section .text               <<< mst_text_gnu_ifunc
   [ 8] T 0x9e4 .gnu_ifunc_resolver section .text      <<< mst_text
   ...
   [29] D 0x20060 gnu_ifunc section .opd  crtstuff.c
   [30] D 0x20060 gnu_ifunc_resolver section .opd  crtstuff.c

but that won't help everything.  We still need this patch.

Specifically, when we do a symbol lookup by name, like e.g., to call a
function (see c-exp.y hunk), e.g., "p gnu_ifunc()", then we need to
know that the found "gnu_ifunc" minimal symbol is an ifunc in order to
do some special processing.  But, on PPC, that lookup by name finds
the function descriptor symbol, which presently is just a mst_data
symbol, while at present, we look for mst_text_gnu_ifunc symbols to
decide whether to do special GNU ifunc processing.  In most of those
places, we could try to resolve the function descriptor with
gdbarch_convert_from_func_ptr_addr, and then lookup the minimal symbol
at the resolved PC, see if that finds a minimal symbol of type
mst_text_gnu_ifunc.  If so, then we could assume that the original
mst_dadta / function descriptor "gnu_ifunc" symbol was an ifunc.  I
tried it, and it mostly works, even if it's not the most efficient.

However, there's one case that can't work with such a design -- it's
that of the user calling the ifunc resolver directly to debug it, like
"p gnu_ifunc_resolver(0)", expecting that to return the function
pointer of the final function (which is exercised by the new tests
added later).  In this case, with the not-fully-working solution, we'd
resolve the function descriptor, find that there's an
mst_text_gnu_ifunc symbol for the resolved address, and proceed
calling the function as if we tried to call "gnu_ifunc", the
user-visible GNU ifunc symbol, instead of the resolver.  I.e., it'd be
impossible to call the resolver directly as a normal function.

Introducing mst_data_gnu_ifunc eliminates the need for several
gdbarch_convert_from_func_ptr_addr calls, and, fixes the "call
resolver directly" use case mentioned above too.  It's the cleanest
approach I could think of.

In sum, we make GNU ifunc function descriptor symbols get a new
"mst_data_gnu_ifunc" minimal symbol type instead of the bare mst_data
type.  So when symbol lookup by name finds such a minimal symbol, we
know we found an ifunc symbol, without resolving the entry/text
symbol.  If the user calls the the resolver symbol instead, like "p
gnu_ifunc_resolver(0)", then we'll find the regular mst_data symbol
for "gnu_ifunc_resolver", and we'll call the resolver function as just
another regular function.

With this, most of the GNU ifunc tests added by a later patch pass on
PPC64 too.  The following bfd patch fixes the remaining issues.

gdb/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

	* breakpoint.c (set_breakpoint_location_function): Handle
	mst_data_gnu_ifunc.
	* c-exp.y (variable production): Handle mst_data_gnu_ifunc.
	* elfread.c (elf_symtab_read): Give data symbols with
	BSF_GNU_INDIRECT_FUNCTION set mst_data_gnu_ifunc type.
	(elf_rel_plt_read): Update comment.
	* linespec.c (convert_linespec_to_sals): Handle
	mst_data_gnu_ifunc.
	(minsym_found): Handle mst_data_gnu_ifunc.
	* minsyms.c (msymbol_is_function, minimal_symbol_reader::record)
	(find_solib_trampoline_target): Handle mst_data_gnu_ifunc.
	* parse.c (find_minsym_type_and_address): Handle
	mst_data_gnu_ifunc.
	* symmisc.c (dump_msymbols): Handle mst_data_gnu_ifunc.
	* symtab.c (find_gnu_ifunc): Handle mst_data_gnu_ifunc.
	* symtab.h (minimal_symbol_type) <mst_text_gnu_ifunc>: Update
	comment.
	<mst_data_gnu_ifunc>: New enumerator.
2018-04-26 13:09:16 +01:00
Joel Brobecker e2882c8578 Update copyright year range in all GDB files
gdb/ChangeLog:

        Update copyright year range in all GDB files
2018-01-02 07:38:06 +04:00
Pedro Alves b5ec771e60 Introduce lookup_name_info and generalize Ada's FULL/WILD name matching
Summary:
 - This is preparation for supporting wild name matching on C++ too.
 - This is also preparation for TAB-completion fixes.
 - Makes symbol name matching (think strcmp_iw) be based on a per-language method.
 - Merges completion and non-completion name comparison (think
   language_ops::la_get_symbol_name_cmp generalized).
 - Avoid re-hashing lookup name multiple times
 - Centralizes preparing a name for lookup (Ada name encoding / C++ Demangling),
   both completion and non-completion.
 - Fixes Ada latent bug with verbatim name matches in expressions
 - Makes ada-lang.c use common|symtab.c completion code a bit more.

Ada's wild matching basically means that

 "(gdb) break foo"

will find all methods named "foo" in all packages.  Translating to
C++, it's roughly the same as saying that "break klass::method" sets
breakpoints on all "klass::method" methods of all classes, no matter
the namespace.  A following patch will teach GDB about fullname vs
wild matching for C++ too.  This patch is preparatory work to get
there.

Another idea here is to do symbol name matching based on the symbol
language's algorithm.  I.e., avoid dependency on current language set.

This allows for example doing

  (gdb) b foo::bar< int > (<tab>

and having gdb name match the C++ symbols correctly even if the
current language is C or Assembly (or Rust, or Ada, or ...), which can
easily happen if you step into an Assembly/C runtime library frame.

By encapsulating all the information related to a lookup name in a
class, we can also cache hash computation for a given language in the
lookup name object, to avoid recomputing it over and over.

Similarly, because we don't really know upfront which languages the
lookup name will be matched against, for each language we store the
lookup name transformed into a search name.  E.g., for C++, that means
demangling the name.  But for Ada, it means encoding the name.  This
actually forces us to centralize all the different lookup name
encoding in a central place, resulting in clearer code, IMO.  See
e.g., the new ada_lookup_name_info class.

The lookup name -> symbol search name computation is also done only
once per language.

The old language->la_get_symbol_name_cmp / symbol_name_cmp_ftype are
generalized to work with both completion, and normal symbol look up.

At some point early on, I had separate completion vs non-completion
language vector entry points, but a single method ends up being better
IMO for simplifying things -- the more we merge the completion /
non-completion name lookup code paths, the less changes for bugs
causing completion vs normal lookup finding different symbols.

The ada-lex.l change is necessary because when doing

  (gdb) p <UpperCase>

then the name that is passed to write_ write_var_or_type ->
ada_lookup_symbol_list misses the "<>", i.e., it's just "UpperCase",
and we end up doing a wild match against "UpperCase" lowercased by
ada_lookup_name_info's constructor.  I.e., "uppercase" wouldn't ever
match "UpperCase", and the symbol lookup fails.

This wouldn't cause any regression in the testsuite, but I added a new
test that would pass before the patch and fail after, if it weren't
for that fix.

This is latent bug that happens to go unnoticed because that
particular path was inconsistent with the rest of Ada symbol lookup by
not lowercasing the lookup name.

Ada's symbol_completion_add is deleted, replaced by using common
code's completion_list_add_name.  To make the latter work for Ada, we
needed to add a new output parameter, because Ada wants to return back
a custom completion candidates that are not the symbol name.

With this patch, minimal symbol demangled name hashing is made
consistent with regular symbol hashing.  I.e., it now goes via the
language vector's search_name_hash method too, as I had suggested in a
previous patch.

dw2_expand_symtabs_matching / .gdb_index symbol names were a
challenge.  The problem is that we have no way to telling what is the
language of each symbol name found in the index, until we expand the
corresponding full symbol, which is off course what we're trying to
avoid.  Language information is simply not considered in the index
format...  Since the symbol name hashing and comparison routines are
per-language, we now have a problem.  The patch sorts this out by
matching each name against all languages.  This is inneficient, and
indeed slows down completion several times.  E.g., with:

 $ cat script.cmd
 set pagination off
 set $count = 0
 while $count < 400
   complete b string_prin
   printf "count = %d\n", $count
   set $count = $count + 1
 end

 $ time gdb --batch -q ./gdb-with-index -ex "source script-string_printf.cmd"

I get, before patch (-O2, x86-64):

 real    0m1.773s
 user    0m1.737s
 sys     0m0.040s

While after patch (-O2, x86-64):

 real    0m9.843s
 user    0m9.482s
 sys     0m0.034s

However, the following patch will optimize this, and will actually
make this use case faster compared to the "before patch" above:

 real    0m1.321s
 user    0m1.285s
 sys     0m0.039s

gdb/ChangeLog:
2017-11-08   Pedro Alves  <palves@redhat.com>

	* ada-lang.c (ada_encode): Rename to ..
	(ada_encode_1): ... this.  Add throw_errors parameter and handle
	it.
	(ada_encode): Reimplement.
	(match_name): Delete, folded into full_name.
	(resolve_subexp): No longer pass the encoded name to
	ada_lookup_symbol_list.
	(should_use_wild_match): Delete.
	(name_match_type_from_name): New.
	(ada_lookup_simple_minsym): Use lookup_name_info and the
	language's symbol_name_matcher_ftype.
	(add_symbols_from_enclosing_procs, ada_add_local_symbols)
	(ada_add_block_renamings): Adjust to use lookup_name_info.
	(ada_lookup_name): New.
	(add_nonlocal_symbols, ada_add_all_symbols)
	(ada_lookup_symbol_list_worker, ada_lookup_symbol_list)
	(ada_iterate_over_symbols): Adjust to use lookup_name_info.
	(ada_name_for_lookup): Delete.
	(ada_lookup_encoded_symbol): Construct a verbatim name.
	(wild_match): Reverse sense of return type.  Use bool.
	(full_match): Reverse sense of return type.  Inline bits of old
	match_name here.
	(ada_add_block_symbols): Adjust to use lookup_name_info.
	(symbol_completion_match): Delete, folded into...
	(ada_lookup_name_info::matches): ... .this new method.
	(symbol_completion_add): Delete.
	(ada_collect_symbol_completion_matches): Add name_match_type
	parameter.  Adjust to use lookup_name_info and
	completion_list_add_name.
	(get_var_value, ada_add_global_exceptions): Adjust to use
	lookup_name_info.
	(ada_get_symbol_name_cmp): Delete.
	(do_wild_match, do_full_match): New functions.
	(ada_lookup_name_info::ada_lookup_name_info): New method.
	(ada_symbol_name_matches, ada_get_symbol_name_matcher): New
	functions.
	(ada_language_defn): Install ada_get_symbol_name_matcher.
	* ada-lex.l (processId): If name starts with '<', copy it
	verbatim.
	* block.c (block_iter_match_step, block_iter_match_first)
	(block_iter_match_next, block_lookup_symbol)
	(block_lookup_symbol_primary, block_find_symbol): Adjust to use
	lookup_name_info.
	* block.h (block_iter_match_first, block_iter_match_next)
	(ALL_BLOCK_SYMBOLS_WITH_NAME): Adjust to use lookup_name_info.
	* c-lang.c (c_language_defn, cplus_language_defn)
	(asm_language_defn, minimal_language_defn): Adjust comments to
	refer to la_get_symbol_name_matcher.
	* completer.c (complete_files_symbols)
	(collect_explicit_location_matches, symbol_completer): Pass a
	symbol_name_match_type down.
	* completer.h (class completion_match, completion_match_result):
	New classes.
	(completion_tracker::reset_completion_match_result): New method.
	(completion_tracker::m_completion_match_result): New field.
	* cp-support.c (make_symbol_overload_list_block): Adjust to use
	lookup_name_info.
	(cp_fq_symbol_name_matches, cp_get_symbol_name_matcher): New
	functions.
	* cp-support.h (cp_get_symbol_name_matcher): New declaration.
	* d-lang.c: Adjust comments to refer to
	la_get_symbol_name_matcher.
	* dictionary.c (dict_vector) <iter_match_first, iter_match_next>:
	Adjust to use lookup_name_info.
	(dict_iter_match_first, dict_iter_match_next)
	(iter_match_first_hashed, iter_match_next_hashed)
	(iter_match_first_linear, iter_match_next_linear): Adjust to work
	with a lookup_name_info.
	* dictionary.h (dict_iter_match_first, dict_iter_match_next):
	Likewise.
	* dwarf2read.c (dw2_lookup_symbol): Adjust to use lookup_name_info.
	(dw2_map_matching_symbols): Adjust to use symbol_name_match_type.
	(gdb_index_symbol_name_matcher): New class.
	(dw2_expand_symtabs_matching) Adjust to use lookup_name_info and
	gdb_index_symbol_name_matcher.  Accept a NULL symbol_matcher.
	* f-lang.c (f_collect_symbol_completion_matches): Adjust to work
	with a symbol_name_match_type.
	(f_language_defn): Adjust comments to refer to
	la_get_symbol_name_matcher.
	* go-lang.c (go_language_defn): Adjust comments to refer to
	la_get_symbol_name_matcher.
	* language.c (default_symbol_name_matcher)
	(language_get_symbol_name_matcher): New functions.
	(unknown_language_defn, auto_language_defn): Adjust comments to
	refer to la_get_symbol_name_matcher.
	* language.h (symbol_name_cmp_ftype): Delete.
	(language_defn) <la_collect_symbol_completion_matches>: Add match
	type parameter.
	<la_get_symbol_name_cmp>: Delete field.
	<la_get_symbol_name_matcher>: New field.
	<la_iterate_over_symbols>: Adjust to use lookup_name_info.
	(default_symbol_name_matcher, language_get_symbol_name_matcher):
	Declare.
	* linespec.c (iterate_over_all_matching_symtabs)
	(iterate_over_file_blocks): Adjust to use lookup_name_info.
	(find_methods): Add language parameter, and use lookup_name_info
	and the language's symbol_name_matcher_ftype.
	(linespec_complete_function): Adjust.
	(lookup_prefix_sym): Use lookup_name_info.
	(add_all_symbol_names_from_pspace): Adjust.
	(find_superclass_methods): Add language parameter and pass it
	down.
	(find_method): Pass symbol language down.
	(find_linespec_symbols): Don't demangle or Ada encode here.
	(search_minsyms_for_name): Add lookup_name_info parameter.
	(add_matching_symbols_to_info): Add name_match_type parameter.
	Use lookup_name_info.
	* m2-lang.c (m2_language_defn): Adjust comments to refer to
	la_get_symbol_name_matcher.
	* minsyms.c: Include <algorithm>.
	(add_minsym_to_demangled_hash_table): Remove table parameter and
	add objfile parameter.  Use search_name_hash, and add language to
	demangled languages vector.
	(struct found_minimal_symbols): New struct.
	(lookup_minimal_symbol_mangled, lookup_minimal_symbol_demangled):
	New functions.
	(lookup_minimal_symbol): Adjust to use them.  Don't canonicalize
	input names here.  Use lookup_name_info instead.  Lookup up
	demangled names once for each language in the demangled names
	vector.
	(iterate_over_minimal_symbols): Use lookup_name_info.  Lookup up
	demangled names once for each language in the demangled names
	vector.
	(build_minimal_symbol_hash_tables): Adjust.
	* minsyms.h (iterate_over_minimal_symbols): Adjust to pass down a
	lookup_name_info.
	* objc-lang.c (objc_language_defn): Adjust comment to refer to
	la_get_symbol_name_matcher.
	* objfiles.h: Include <vector>.
	(objfile_per_bfd_storage) <demangled_hash_languages>: New field.
	* opencl-lang.c (opencl_language_defn): Adjust comment to refer to
	la_get_symbol_name_matcher.
	* p-lang.c (pascal_language_defn): Adjust comment to refer to
	la_get_symbol_name_matcher.
	* psymtab.c (psym_lookup_symbol): Use lookup_name_info.
	(match_partial_symbol): Use symbol_name_match_type,
	lookup_name_info and psymbol_name_matches.
	(lookup_partial_symbol): Use lookup_name_info.
	(map_block): Use symbol_name_match_type and lookup_name_info.
	(psym_map_matching_symbols): Use symbol_name_match_type.
	(psymbol_name_matches): New.
	(recursively_search_psymtabs): Use lookup_name_info and
	psymbol_name_matches.  Rename 'kind' parameter to 'domain'.
	(psym_expand_symtabs_matching): Use lookup_name_info.  Rename
	'kind' parameter to 'domain'.
	* rust-lang.c (rust_language_defn): Adjust comment to refer to
	la_get_symbol_name_matcher.
	* symfile-debug.c (debug_qf_map_matching_symbols)
	(debug_qf_map_matching_symbols): Use symbol_name_match_type.
	(debug_qf_expand_symtabs_matching): Use lookup_name_info.
	* symfile.c (expand_symtabs_matching): Use lookup_name_info.
	* symfile.h (quick_symbol_functions) <map_matching_symbols>:
	Adjust to use symbol_name_match_type.
	<expand_symtabs_matching>: Adjust to use lookup_name_info.
	(expand_symtabs_matching): Adjust to use lookup_name_info.
	* symmisc.c (maintenance_expand_symtabs): Use
	lookup_name_info::match_any ().
	* symtab.c (symbol_matches_search_name): New.
	(eq_symbol_entry): Adjust to use lookup_name_info and the
	language's matcher.
	(demangle_for_lookup_info::demangle_for_lookup_info): New.
	(lookup_name_info::match_any): New.
	(iterate_over_symbols, search_symbols): Use lookup_name_info.
	(compare_symbol_name): Add language, lookup_name_info and
	completion_match_result parameters, and use them.
	(completion_list_add_name): Make extern.  Add language and
	lookup_name_info parameters.  Use them.
	(completion_list_add_symbol, completion_list_add_msymbol)
	(completion_list_objc_symbol): Add lookup_name_info parameters and
	adjust.  Pass down language.
	(completion_list_add_fields): Add lookup_name_info parameters and
	adjust.  Pass down language.
	(add_symtab_completions): Add lookup_name_info parameters and
	adjust.
	(default_collect_symbol_completion_matches_break_on): Add
	name_match_type parameter, and use it.  Use lookup_name_info.
	(default_collect_symbol_completion_matches)
	(collect_symbol_completion_matches): Add name_match_type
	parameter, and pass it down.
	(collect_symbol_completion_matches_type): Adjust.
	(collect_file_symbol_completion_matches): Add name_match_type
	parameter, and use lookup_name_info.
	* symtab.h: Include <string> and "common/gdb_optional.h".
	(enum class symbol_name_match_type): New.
	(class ada_lookup_name_info): New.
	(struct demangle_for_lookup_info): New.
	(class lookup_name_info): New.
	(symbol_name_matcher_ftype): New.
	(SYMBOL_MATCHES_SEARCH_NAME): Use symbol_matches_search_name.
	(symbol_matches_search_name): Declare.
	(MSYMBOL_MATCHES_SEARCH_NAME): Delete.
	(default_collect_symbol_completion_matches)
	(collect_symbol_completion_matches)
	(collect_file_symbol_completion_matches): Add name_match_type
	parameter.
	(iterate_over_symbols): Use lookup_name_info.
	(completion_list_add_name): Declare.
	* utils.c (enum class strncmp_iw_mode): Moved to utils.h.
	(strncmp_iw_with_mode): Now extern.
	* utils.h (enum class strncmp_iw_mode): Moved from utils.c.
	(strncmp_iw_with_mode): Declare.

gdb/testsuite/ChangeLog:
2017-11-08   Pedro Alves  <palves@redhat.com>

	* gdb.ada/complete.exp (p <Exported_Capitalized>): New test.
	(p Exported_Capitalized): New test.
	(p exported_capitalized): New test.
2017-11-08 16:02:24 +00:00
Pedro Alves bf46927112 Eliminate catch_errors
If you want to use catch_errors with a function with parameters, then
currently you have to manually write a "capture" struct wrapping the
arguments and marshall/unmarshall that.

https://sourceware.org/ml/gdb-patches/2017-09/msg00834.html proposed
adjusting catch_errors to use gdb::function_view, which would allow
passing lambdas with automatic captures.  However, it seems like using
TRY/CATCH directly instead ends up producing clearer and easier to
debug code.  This is what this commit does.

Note that removing catch_errors exposes further cleanup opportunities
around no longer having to follow catch_errors callback type, and also
removes a few cleanups.

I didn't do anything to save/restore current_uiout because I think
that should be the responsibility of the code that changes
current_uiout in the first place.

(Another approach could be to make catch_errors a variadic template
like:

  template<typename Function, typename... Args>
  int catch_errors (const char *errstring, return_mask mask,
		    Function &&func, Args... args);

and then with:

  extern void function_with_args (int, int);
  extern void function_with_no_args ();

calls to the above functions would be wrapped like this:

  catch_errors ("some error happened", RETURN_MASK_ERROR,
                function_with_args, arg1, arg2);

  catch_errors ("some error happened", RETURN_MASK_ERROR,
                function_with_no_args);

but I'm thinking that that doesn't improve much if at all either.)

gdb/ChangeLog
2017-10-10  Pedro Alves  <palves@redhat.com>
	    Tom Tromey  <tom@tromey.com>

	* breakpoint.c (breakpoint_cond_eval): Change return type to bool
	and reverse logic.
	(WP_DELETED, WP_VALUE_CHANGED, WP_VALUE_NOT_CHANGED, WP_IGNORE):
	No longer macros.  Instead ...
	(enum wp_check_result): They're now values of this new
	enumeration.
	(watchpoint_check): Change return type to wp_check_result and
	parameter type to bpstat.
	(bpstat_check_watchpoint): Use TRY/CATCH instead of catch_errors.
	(bpstat_check_breakpoint_conditions): Use TRY/CATCH instead of
	catch_errors.  Reverse logic of watchpoint_check call.
	(breakpoint_re_set_one): Now returns void and takes a breakpoint
	pointer as parameter.
	(breakpoint_re_set): Use TRY/CATCH instead of catch_errors.
	* common/common-exceptions.c (throw_exception_sjlj): Update
	comments to avoid mentioning catch_errors.
	* exceptions.c (catch_errors): Delete.
	* exceptions.h: Update comments to avoid mentioning catch_errors.
	(catch_errors_ftype, catch_errors): Delete.
	* infrun.c (normal_stop): Use TRY/CATCH instead of catch_errors.
	(hook_stop_stub): Delete.
	(restore_selected_frame): Change return type to void, and
	parameter type to const frame_id &.
	(restore_infcall_control_state): Use TRY/CATCH instead of
	catch_errors.
	* main.c (captured_command_loop): Return void and remove
	parameter.  Remove references to catch_errors.
	(captured_main): Use TRY/CATCH instead of catch_errors.
	* objc-lang.c (objc_submethod_helper_data)
	(find_objc_msgcall_submethod_helper): Delete.
	(find_objc_msgcall_submethod): Use TRY/CATCH instead of
	catch_errors.
	* record-full.c (record_full_message): Return void.
	(record_full_message_args, record_full_message_wrapper): Delete.
	(record_full_message_wrapper_safe): Return bool and use TRY/CATCH
	instead of catch_errors.
	* solib-aix.c (solib_aix_open_symbol_file_object): Change
	parameter type to int.
	* solib-darwin.c (open_symbol_file_object): Ditto.
	* solib-dsbt.c (open_symbol_file_object): Ditto.
	* solib-frv.c (open_symbol_file_object): Ditto.
	* solib-svr4.c (open_symbol_file_object): Ditto.
	* solib-target.c (solib_target_open_symbol_file_object): Ditto.
	* solib.c (update_solib_list): Use TRY/CATCH instead of
	catch_errors.
	* solist.h (struct target_so_ops) <open_symbol_file_object>:
	Change type.
	* symmisc.c (struct print_symbol_args): Remove.
	(dump_symtab_1): Use TRY/CATCH instead of catch_errors.
	(print_symbol): Change type.
	* windows-nat.c (handle_load_dll, handle_unload_dll): Return void
	and remove parameters.
	(catch_errors): New.
	(get_windows_debug_event): Adjust.

gdb/testsuite/ChangeLog:
2017-10-10  Pedro Alves  <palves@redhat.com>

	* lib/selftest-support.exp (selftest_setup): Update for
	captured_command_loop's prototype change.
2017-10-10 16:45:50 +01:00
Tom Tromey e99c83e741 Constify some commands in symmisc.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* symmisc.c (maintenance_print_symbols)
	(maintenance_print_msymbols, maintenance_print_objfiles)
	(maintenance_info_symtabs, maintenance_check_symtabs)
	(maintenance_expand_symtabs, maintenance_info_line_tables):
	Constify.
2017-09-27 08:44:36 -06:00
John Baldwin 481695ed5f Remove unnecessary function prototypes.
These prototypes were required when compiling GDB as C but are not
required for C++.

gdb/ChangeLog:

	* aarch64-linux-nat.c: Remove _initialize_aarch64_linux_nat
	prototype.
	* aarch64-linux-tdep.c: Remove _initialize_aarch64_linux_tdep
	prototype.
	* aarch64-newlib-tdep.c: Remove _initialize_aarch64_newlib_tdep
	prototype.
	* aarch64-tdep.c: Remove _initialize_aarch64_tdep prototype.
	* ada-exp.y: Remove _initialize_ada_exp prototype.
	* ada-lang.c: Remove _initialize_ada_language prototype.
	* ada-tasks.c: Remove _initialize_tasks prototype.
	* addrmap.c: Remove _initialize_addrmap prototype.
	* agent.c: Remove _initialize_agent prototype.
	* aix-thread.c: Remove _initialize_aix_thread prototype.
	* alpha-bsd-nat.c: Remove _initialize_alphabsd_nat prototype.
	* alpha-linux-nat.c: Remove _initialize_alpha_linux_nat prototype.
	* alpha-linux-tdep.c: Remove _initialize_alpha_linux_tdep
	prototype.
	* alpha-nbsd-tdep.c: Remove _initialize_alphanbsd_tdep prototype.
	* alpha-obsd-tdep.c: Remove _initialize_alphaobsd_tdep prototype.
	* alpha-tdep.c: Remove _initialize_alpha_tdep prototype.
	* amd64-darwin-tdep.c: Remove _initialize_amd64_darwin_tdep
	prototype.
	* amd64-dicos-tdep.c: Remove _initialize_amd64_dicos_tdep
	prototype.
	* amd64-fbsd-nat.c: Remove _initialize_amd64fbsd_nat prototype.
	* amd64-fbsd-tdep.c: Remove _initialize_amd64fbsd_tdep prototype.
	* amd64-linux-nat.c: Remove _initialize_amd64_linux_nat prototype.
	* amd64-linux-tdep.c: Remove _initialize_amd64_linux_tdep
	prototype.
	* amd64-nbsd-nat.c: Remove _initialize_amd64nbsd_nat prototype.
	* amd64-nbsd-tdep.c: Remove _initialize_amd64nbsd_tdep prototype.
	* amd64-obsd-nat.c: Remove _initialize_amd64obsd_nat prototype.
	* amd64-obsd-tdep.c: Remove _initialize_amd64obsd_tdep prototype.
	* amd64-sol2-tdep.c: Remove _initialize_amd64_sol2_tdep prototype.
	* amd64-tdep.c: Remove _initialize_amd64_tdep prototype.
	* amd64-windows-nat.c: Remove _initialize_amd64_windows_nat
	prototype.
	* amd64-windows-tdep.c: Remove _initialize_amd64_windows_tdep
	prototype.
	* annotate.c: Remove _initialize_annotate prototype.
	* arc-newlib-tdep.c: Remove _initialize_arc_newlib_tdep prototype.
	* arc-tdep.c: Remove _initialize_arc_tdep prototype.
	* arch-utils.c: Remove _initialize_gdbarch_utils prototype.
	* arm-linux-nat.c: Remove _initialize_arm_linux_nat prototype.
	* arm-linux-tdep.c: Remove _initialize_arm_linux_tdep prototype.
	* arm-nbsd-tdep.c: Remove _initialize_arm_netbsd_tdep prototype.
	* arm-obsd-tdep.c: Remove _initialize_armobsd_tdep prototype.
	* arm-symbian-tdep.c: Remove _initialize_arm_symbian_tdep
	prototype.
	* arm-tdep.c: Remove _initialize_arm_tdep prototype.
	* arm-wince-tdep.c: Remove _initialize_arm_wince_tdep prototype.
	* auto-load.c: Remove _initialize_auto_load prototype.
	* auxv.c: Remove _initialize_auxv prototype.
	* avr-tdep.c: Remove _initialize_avr_tdep prototype.
	* ax-gdb.c: Remove _initialize_ax_gdb prototype.
	* bfin-linux-tdep.c: Remove _initialize_bfin_linux_tdep prototype.
	* bfin-tdep.c: Remove _initialize_bfin_tdep prototype.
	* break-catch-sig.c: Remove _initialize_break_catch_sig prototype.
	* break-catch-syscall.c: Remove _initialize_break_catch_syscall
	prototype.
	* break-catch-throw.c: Remove _initialize_break_catch_throw
	prototype.
	* breakpoint.c: Remove _initialize_breakpoint prototype.
	* bsd-uthread.c: Remove _initialize_bsd_uthread prototype.
	* btrace.c: Remove _initialize_btrace prototype.
	* charset.c: Remove _initialize_charset prototype.
	* cli/cli-cmds.c: Remove _initialize_cli_cmds prototype.
	* cli/cli-dump.c: Remove _initialize_cli_dump prototype.
	* cli/cli-interp.c: Remove _initialize_cli_interp prototype.
	* cli/cli-logging.c: Remove _initialize_cli_logging prototype.
	* cli/cli-script.c: Remove _initialize_cli_script prototype.
	* coff-pe-read.c: Remove _initialize_coff_pe_read prototype.
	* coffread.c: Remove _initialize_coffread prototype.
	* compile/compile.c: Remove _initialize_compile prototype.
	* complaints.c: Remove _initialize_complaints prototype.
	* completer.c: Remove _initialize_completer prototype.
	* copying.awk: Remove _initialize_copying prototype.
	* copying.c: Regenerate.
	* core-regset.c: Remove _initialize_core_regset prototype.
	* corefile.c: Remove _initialize_core prototype.
	* corelow.c: Remove _initialize_corelow prototype.
	* cp-abi.c: Remove _initialize_cp_abi prototype.
	* cp-namespace.c: Remove _initialize_cp_namespace prototype.
	* cp-support.c: Remove _initialize_cp_support prototype.
	* cp-valprint.c: Remove _initialize_cp_valprint prototype.
	* cris-linux-tdep.c: Remove _initialize_cris_linux_tdep prototype.
	* cris-tdep.c: Remove _initialize_cris_tdep prototype.
	* ctf.c: Remove _initialize_ctf prototype.
	* d-lang.c: Remove _initialize_d_language prototype.
	* darwin-nat-info.c: Remove _initialize_darwin_info_commands
	prototype.
	* darwin-nat.c: Remove _initialize_darwin_inferior prototype.
	* dbxread.c: Remove _initialize_dbxread prototype.
	* dcache.c: Remove _initialize_dcache prototype.
	* demangle.c: Remove _initialize_demangler prototype.
	* disasm-selftests.c: Remove _initialize_disasm_selftests
	prototype.
	* disasm.c: Remove _initialize_disasm prototype.
	* dtrace-probe.c: Remove _initialize_dtrace_probe prototype.
	* dummy-frame.c: Remove _initialize_dummy_frame prototype.
	* dwarf2-frame-tailcall.c: Remove _initialize_tailcall_frame
	prototype.
	* dwarf2-frame.c: Remove _initialize_dwarf2_frame prototype.
	* dwarf2expr.c: Remove _initialize_dwarf2expr prototype.
	* dwarf2loc.c: Remove _initialize_dwarf2loc prototype.
	* dwarf2read.c: Remove _initialize_dwarf2_read prototype.
	* elfread.c: Remove _initialize_elfread prototype.
	* exec.c: Remove _initialize_exec prototype.
	* extension.c: Remove _initialize_extension prototype.
	* f-lang.c: Remove _initialize_f_language prototype.
	* f-valprint.c: Remove _initialize_f_valprint prototype.
	* fbsd-nat.c: Remove _initialize_fbsd_nat prototype.
	* fbsd-tdep.c: Remove _initialize_fbsd_tdep prototype.
	* filesystem.c: Remove _initialize_filesystem prototype.
	* findcmd.c: Remove _initialize_mem_search prototype.
	* fork-child.c: Remove _initialize_fork_child prototype.
	* frame-base.c: Remove _initialize_frame_base prototype.
	* frame-unwind.c: Remove _initialize_frame_unwind prototype.
	* frame.c: Remove _initialize_frame prototype.
	* frv-linux-tdep.c: Remove _initialize_frv_linux_tdep prototype.
	* frv-tdep.c: Remove _initialize_frv_tdep prototype.
	* ft32-tdep.c: Remove _initialize_ft32_tdep prototype.
	* gcore.c: Remove _initialize_gcore prototype.
	* gdb_bfd.c: Remove _initialize_gdb_bfd prototype.
	* gdbarch.c: Regenerate.
	* gdbarch.sh: Remove _initialize_gdbarch prototype.
	* gdbtypes.c: Remove _initialize_gdbtypes prototype.
	* gnu-nat.c: Remove _initialize_gnu_nat prototype.
	* gnu-v2-abi.c: Remove _initialize_gnu_v2_abi prototype.
	* gnu-v3-abi.c: Remove _initialize_gnu_v3_abi prototype.
	* go-lang.c: Remove _initialize_go_language prototype.
	* go32-nat.c: Remove _initialize_go32_nat prototype.
	* guile/guile.c: Remove _initialize_guile prototype.
	* h8300-tdep.c: Remove _initialize_h8300_tdep prototype.
	* hppa-linux-nat.c: Remove _initialize_hppa_linux_nat prototype.
	* hppa-linux-tdep.c: Remove _initialize_hppa_linux_tdep prototype.
	* hppa-nbsd-nat.c: Remove _initialize_hppanbsd_nat prototype.
	* hppa-nbsd-tdep.c: Remove _initialize_hppanbsd_tdep prototype.
	* hppa-obsd-nat.c: Remove _initialize_hppaobsd_nat prototype.
	* hppa-obsd-tdep.c: Remove _initialize_hppaobsd_tdep prototype.
	* hppa-tdep.c: Remove _initialize_hppa_tdep prototype.
	* i386-bsd-nat.c: Remove _initialize_i386bsd_nat prototype.
	* i386-cygwin-tdep.c: Remove _initialize_i386_cygwin_tdep
	prototype.
	* i386-darwin-tdep.c: Remove _initialize_i386_darwin_tdep
	prototype.
	* i386-dicos-tdep.c: Remove _initialize_i386_dicos_tdep prototype.
	* i386-fbsd-nat.c: Remove _initialize_i386fbsd_nat prototype.
	* i386-fbsd-tdep.c: Remove _initialize_i386fbsd_tdep prototype.
	* i386-gnu-nat.c: Remove _initialize_i386gnu_nat prototype.
	* i386-gnu-tdep.c: Remove _initialize_i386gnu_tdep prototype.
	* i386-linux-nat.c: Remove _initialize_i386_linux_nat prototype.
	* i386-linux-tdep.c: Remove _initialize_i386_linux_tdep prototype.
	* i386-nbsd-nat.c: Remove _initialize_i386nbsd_nat prototype.
	* i386-nbsd-tdep.c: Remove _initialize_i386nbsd_tdep prototype.
	* i386-nto-tdep.c: Remove _initialize_i386nto_tdep prototype.
	* i386-obsd-nat.c: Remove _initialize_i386obsd_nat prototype.
	* i386-obsd-tdep.c: Remove _initialize_i386obsd_tdep prototype.
	* i386-sol2-nat.c: Remove _initialize_amd64_sol2_nat prototype.
	* i386-sol2-tdep.c: Remove _initialize_amd64_sol2_tdep prototype.
	* i386-tdep.c: Remove _initialize_i386_tdep prototype.
	* i386-windows-nat.c: Remove _initialize_i386_windows_nat
	prototype.
	* ia64-libunwind-tdep.c: Remove _initialize_libunwind_frame
	prototype.
	* ia64-linux-nat.c: Remove _initialize_ia64_linux_nat prototype.
	* ia64-linux-tdep.c: Remove _initialize_ia64_linux_tdep prototype.
	* ia64-tdep.c: Remove _initialize_ia64_tdep prototype.
	* ia64-vms-tdep.c: Remove _initialize_ia64_vms_tdep prototype.
	* infcall.c: Remove _initialize_infcall prototype.
	* infcmd.c: Remove _initialize_infcmd prototype.
	* inferior.c: Remove _initialize_inferiors prototype.
	* inflow.c: Remove _initialize_inflow prototype.
	* infrun.c: Remove _initialize_infrun prototype.
	* interps.c: Remove _initialize_interpreter prototype.
	* iq2000-tdep.c: Remove _initialize_iq2000_tdep prototype.
	* jit.c: Remove _initialize_jit prototype.
	* language.c: Remove _initialize_language prototype.
	* linux-fork.c: Remove _initialize_linux_fork prototype.
	* linux-nat.c: Remove _initialize_linux_nat prototype.
	* linux-tdep.c: Remove _initialize_linux_tdep prototype.
	* linux-thread-db.c: Remove _initialize_thread_db prototype.
	* lm32-tdep.c: Remove _initialize_lm32_tdep prototype.
	* m2-lang.c: Remove _initialize_m2_language prototype.
	* m32c-tdep.c: Remove _initialize_m32c_tdep prototype.
	* m32r-linux-nat.c: Remove _initialize_m32r_linux_nat prototype.
	* m32r-linux-tdep.c: Remove _initialize_m32r_linux_tdep prototype.
	* m32r-tdep.c: Remove _initialize_m32r_tdep prototype.
	* m68hc11-tdep.c: Remove _initialize_m68hc11_tdep prototype.
	* m68k-bsd-nat.c: Remove _initialize_m68kbsd_nat prototype.
	* m68k-bsd-tdep.c: Remove _initialize_m68kbsd_tdep prototype.
	* m68k-linux-nat.c: Remove _initialize_m68k_linux_tdep prototype.
	* m68k-linux-tdep.c: Remove _initialize_m68k_linux_tdep prototype.
	* m68k-tdep.c: Remove _initialize_m68k_tdep prototype.
	* m88k-bsd-nat.c: Remove _initialize_m68kbsd_nat prototype.
	* m88k-tdep.c: Remove _initialize_m68kbsd_tdep prototype.
	* machoread.c: Remove _initialize_machoread prototype.
	* macrocmd.c: Remove _initialize_macrocmd prototype.
	* macroscope.c: Remove _initialize_macroscope prototype.
	* maint.c: Remove _initialize_maint_cmds prototype.
	* mdebugread.c: Remove _initialize_mdebugread prototype.
	* memattr.c: Remove _initialize_mem prototype.
	* mep-tdep.c: Remove _initialize_mep_tdep prototype.
	* mi/mi-cmd-env.c: Remove _initialize_mi_cmd_env prototype.
	* mi/mi-cmds.c: Remove _initialize_mi_cmds prototype.
	* mi/mi-interp.c: Remove _initialize_mi_interp prototype.
	* mi/mi-main.c: Remove _initialize_mi_main prototype.
	* microblaze-linux-tdep.c: Remove
	_initialize_microblaze_linux_tdep prototype.
	* microblaze-tdep.c: Remove _initialize_microblaze_tdep prototype.
	* mips-fbsd-nat.c: Remove _initialize_mips_fbsd_nat prototype.
	* mips-fbsd-tdep.c: Remove _initialize_mips_fbsd_tdep prototype.
	* mips-linux-nat.c: Remove _initialize_mips_linux_nat prototype.
	* mips-linux-tdep.c: Remove _initialize_mips_linux_tdep prototype.
	* mips-nbsd-nat.c: Remove _initialize_mipsnbsd_nat prototype.
	* mips-nbsd-tdep.c: Remove _initialize_mipsnbsd_tdep prototype.
	* mips-sde-tdep.c: Remove _initialize_mips_sde_tdep prototype.
	* mips-tdep.c: Remove _initialize_mips_tdep prototype.
	* mips64-obsd-nat.c: Remove _initialize_mips64obsd_nat prototype.
	* mips64-obsd-tdep.c: Remove _initialize_mips64obsd_tdep
	prototype.
	* mipsread.c: Remove _initialize_mipsread prototype.
	* mn10300-linux-tdep.c: Remove _initialize_mn10300_linux_tdep
	prototype.
	* mn10300-tdep.c: Remove _initialize_mn10300_tdep prototype.
	* moxie-tdep.c: Remove _initialize_moxie_tdep prototype.
	* msp430-tdep.c: Remove _initialize_msp430_tdep prototype.
	* mt-tdep.c: Remove _initialize_mt_tdep prototype.
	* nds32-tdep.c: Remove _initialize_nds32_tdep prototype.
	* nios2-linux-tdep.c: Remove _initialize_nios2_linux_tdep
	prototype.
	* nios2-tdep.c: Remove _initialize_nios2_tdep prototype.
	* nto-procfs.c: Remove _initialize_procfs prototype.
	* nto-tdep.c: Remove _initialize_nto_tdep prototype.
	* objc-lang.c: Remove _initialize_objc_language prototype.
	* objfiles.c: Remove _initialize_objfiles prototype.
	* observer.c: Remove observer_test_first_notification_function,
	observer_test_second_notification_function,
	observer_test_third_notification_function, and
	_initialize_observer prototypes.
	* opencl-lang.c: Remove _initialize_opencl_language prototypes.
	* osabi.c: Remove _initialize_gdb_osabi prototype.
	* osdata.c: Remove _initialize_osdata prototype.
	* p-valprint.c: Remove _initialize_pascal_valprint prototype.
	* parse.c: Remove _initialize_parse prototype.
	* ppc-fbsd-nat.c: Remove _initialize_ppcfbsd_nat prototype.
	* ppc-fbsd-tdep.c: Remove _initialize_ppcfbsd_tdep prototype.
	* ppc-linux-nat.c: Remove _initialize_ppc_linux_nat prototype.
	* ppc-linux-tdep.c: Remove _initialize_ppc_linux_tdep prototype.
	* ppc-nbsd-nat.c: Remove _initialize_ppcnbsd_nat prototype.
	* ppc-nbsd-tdep.c: Remove _initialize_ppcnbsd_tdep prototype.
	* ppc-obsd-nat.c: Remove _initialize_ppcobsd_nat prototype.
	* ppc-obsd-tdep.c: Remove _initialize_ppcobsd_tdep prototype.
	* printcmd.c: Remove _initialize_printcmd prototype.
	* probe.c: Remove _initialize_probe prototype.
	* proc-api.c: Remove _initialize_proc_api prototype.
	* proc-events.c: Remove _initialize_proc_events prototype.
	* proc-service.c: Remove _initialize_proc_service prototype.
	* procfs.c: Remove _initialize_procfs prototype.
	* psymtab.c: Remove _initialize_psymtab prototype.
	* python/python.c: Remove _initialize_python prototype.
	* ravenscar-thread.c: Remove _initialize_ravenscar prototype.
	* record-btrace.c: Remove _initialize_record_btrace prototype.
	* record-full.c: Remove _initialize_record_full prototype.
	* record.c: Remove _initialize_record prototype.
	* regcache.c: Remove _initialize_regcache prototype.
	* reggroups.c: Remove _initialize_reggroup prototype.
	* remote-notif.c: Remove _initialize_notif prototype.
	* remote-sim.c: Remove _initialize_remote_sim prototype.
	* remote.c: Remove _initialize_remote prototype.
	* reverse.c: Remove _initialize_reverse prototype.
	* rl78-tdep.c: Remove _initialize_rl78_tdep prototype.
	* rs6000-aix-tdep.c: Remove _initialize_rs6000_aix_tdep prototype.
	* rs6000-lynx178-tdep.c: Remove _initialize_rs6000_lynx178_tdep
	prototype.
	* rs6000-nat.c: Remove _initialize_rs6000_nat prototype.
	* rs6000-tdep.c: Remove _initialize_rs6000_tdep prototype.
	* rust-exp.y: Remove _initialize_rust_exp prototype.
	* rx-tdep.c: Remove _initialize_rx_tdep prototype.
	* s390-linux-nat.c: Remove _initialize_s390_nat prototype.
	* s390-linux-tdep.c: Remove _initialize_s390_tdep prototype.
	* score-tdep.c: Remove _initialize_score_tdep prototype.
	* selftest-arch.c: Remove _initialize_selftests_foreach_arch
	prototype.
	* ser-go32.c: Remove _initialize_ser_dos prototype.
	* ser-mingw.c: Remove _initialize_ser_windows prototype.
	* ser-pipe.c: Remove _initialize_ser_pipe prototype.
	* ser-tcp.c: Remove _initialize_ser_tcp prototype.
	* ser-unix.c: Remove _initialize_ser_hardwire prototype.
	* serial.c: Remove _initialize_serial prototype.
	* sh-linux-tdep.c: Remove _initialize_sh_linux_tdep prototype.
	* sh-nbsd-nat.c: Remove _initialize_shnbsd_nat prototype.
	* sh-nbsd-tdep.c: Remove _initialize_shnbsd_tdep prototype.
	* sh-tdep.c: Remove _initialize_sh_tdep prototype.
	* skip.c: Remove _initialize_step_skip prototype.
	* sol-thread.c: Remove _initialize_sol_thread prototype.
	* solib-aix.c: Remove _initialize_solib_aix prototype.
	* solib-darwin.c: Remove _initialize_darwin_solib prototype.
	* solib-dsbt.c: Remove _initialize_dsbt_solib prototype.
	* solib-frv.c: Remove _initialize_frv_solib prototype.
	* solib-spu.c: Remove _initialize_spu_solib prototype.
	* solib-svr4.c: Remove _initialize_svr4_solib prototype.
	* solib-target.c: Remove _initialize_solib_target prototype.
	* solib.c: Remove _initialize_solib prototype.
	* source.c: Remove _initialize_source prototype.
	* sparc-linux-nat.c: Remove _initialize_sparc_linux_nat prototype.
	* sparc-linux-tdep.c: Remove _initialize_sparc_linux_tdep
	prototype.
	* sparc-nat.c: Remove _initialize_sparc_nat prototype.
	* sparc-nbsd-nat.c: Remove _initialize_sparcnbsd_nat prototype.
	* sparc-nbsd-tdep.c: Remove _initialize_sparcnbsd_tdep prototype.
	* sparc-obsd-tdep.c: Remove _initialize_sparc32obsd_tdep
	prototype.
	* sparc-sol2-nat.c: Remove _initialize_sparc_sol2_nat prototype.
	* sparc-sol2-tdep.c: Remove _initialize_sparc_sol2_tdep prototype.
	* sparc-tdep.c: Remove _initialize_sparc_tdep prototype.
	* sparc64-fbsd-nat.c: Remove _initialize_sparc64fbsd_nat
	prototype.
	* sparc64-fbsd-tdep.c: Remove _initialize_sparc64fbsd_tdep
	prototype.
	* sparc64-linux-nat.c: Remove _initialize_sparc64_linux_nat
	prototype.
	* sparc64-linux-tdep.c: Remove _initialize_sparc64_linux_tdep
	prototype.
	* sparc64-nat.c: Remove _initialize_sparc64_nat prototype.
	* sparc64-nbsd-nat.c: Remove _initialize_sparc64nbsd_nat
	prototype.
	* sparc64-nbsd-tdep.c: Remove _initialize_sparc64nbsd_tdep
	prototype.
	* sparc64-obsd-nat.c: Remove _initialize_sparc64obsd_nat
	prototype.
	* sparc64-obsd-tdep.c: Remove _initialize_sparc64obsd_tdep
	prototype.
	* sparc64-sol2-tdep.c: Remove _initialize_sparc64_sol2_tdep
	prototype.
	* spu-linux-nat.c: Remove _initialize_spu_nat prototype.
	* spu-multiarch.c: Remove _initialize_spu_multiarch prototype.
	* spu-tdep.c: Remove _initialize_spu_tdep prototype.
	* stabsread.c: Remove _initialize_stabsread prototype.
	* stack.c: Remove _initialize_stack prototype.
	* stap-probe.c: Remove _initialize_stap_probe prototype.
	* std-regs.c: Remove _initialize_frame_reg prototype.
	* symfile-debug.c: Remove _initialize_symfile_debug prototype.
	* symfile-mem.c: Remove _initialize_symfile_mem prototype.
	* symfile.c: Remove _initialize_symfile prototype.
	* symmisc.c: Remove _initialize_symmisc prototype.
	* symtab.c: Remove _initialize_symtab prototype.
	* target-dcache.c: Remove _initialize_target_dcache prototype.
	* target-descriptions.c: Remove _initialize_target_descriptions
	prototype.
	* thread.c: Remove _initialize_thread prototype.
	* tic6x-linux-tdep.c: Remove _initialize_tic6x_linux_tdep
	prototype.
	* tic6x-tdep.c: Remove _initialize_tic6x_tdep prototype.
	* tilegx-linux-nat.c: Remove _initialize_tile_linux_nat prototype.
	* tilegx-linux-tdep.c: Remove _initialize_tilegx_linux_tdep
	prototype.
	* tilegx-tdep.c: Remove _initialize_tilegx_tdep prototype.
	* tracefile-tfile.c: Remove _initialize_tracefile_tfile prototype.
	* tracefile.c: Remove _initialize_tracefile prototype.
	* tracepoint.c: Remove _initialize_tracepoint prototype.
	* tui/tui-hooks.c: Remove _initialize_tui_hooks prototype.
	* tui/tui-interp.c: Remove _initialize_tui_interp prototype.
	* tui/tui-layout.c: Remove _initialize_tui_layout prototype.
	* tui/tui-regs.c: Remove _initialize_tui_regs prototype.
	* tui/tui-stack.c: Remove _initialize_tui_stack prototype.
	* tui/tui-win.c: Remove _initialize_tui_win prototype.
	* tui/tui.c: Remove _initialize_tui prototype.
	* typeprint.c: Remove _initialize_typeprint prototype.
	* user-regs.c: Remove _initialize_user_regs prototype.
	* utils.c: Remove _initialize_utils prototype.
	* v850-tdep.c: Remove _initialize_v850_tdep prototype.
	* valarith.c: Remove _initialize_valarith prototype.
	* valops.c: Remove _initialize_valops prototype.
	* valprint.c: Remove _initialize_valprint prototype.
	* value.c: Remove _initialize_values prototype.
	* varobj.c: Remove _initialize_varobj prototype.
	* vax-bsd-nat.c: Remove _initialize_vaxbsd_nat prototype.
	* vax-nbsd-tdep.c: Remove _initialize_vaxnbsd_tdep prototype.
	* vax-tdep.c: Remove _initialize_vax_tdep prototype.
	* windows-nat.c: Remove _initialize_windows_nat,
	_initialize_check_for_gdb_ini, and _initialize_loadable
	prototypes.
	* windows-tdep.c: Remove _initialize_windows_tdep prototype.
	* xcoffread.c: Remove _initialize_xcoffread prototype.
	* xml-support.c: Remove _initialize_xml_support prototype.
	* xstormy16-tdep.c: Remove _initialize_xstormy16_tdep prototype.
	* xtensa-linux-nat.c: Remove _initialize_xtensa_linux_nat
	prototype.
	* xtensa-linux-tdep.c: Remove _initialize_xtensa_linux_tdep
	prototype.
	* xtensa-tdep.c: Remove _initialize_xtensa_tdep prototype.
2017-09-09 11:02:37 -07:00
Tom Tromey ee0c32930c Use gdb::unique_xmalloc_ptr when calling tilde_expand
This patch changes most sites calling tilde_expand to use
gdb::unique_xmalloc_ptr, rather than a cleanup.  It also changes
scan_expression_with_cleanup to return a unique pointer, because the
patch was already touching code in that area.

Regression tested on the buildbot.

ChangeLog
2017-08-05  Tom Tromey  <tom@tromey.com>

	* compile/compile-object-load.c (compile_object_load): Use
	gdb::unique_xmalloc_ptr.
	* cli/cli-dump.c (scan_filename): Rename from
	scan_filename_with_cleanup.  Change return type.
	(scan_expression): Rename from scan_expression_with_cleanup.
	Change return type.
	(dump_memory_to_file, dump_value_to_file, restore_command):
	Use gdb::unique_xmalloc_ptr.  Update.
	* cli/cli-cmds.c (find_and_open_script): Use
	gdb::unique_xmalloc_ptr.
	* tracefile-tfile.c (tfile_open): Use gdb::unique_xmalloc_ptr.
	* symmisc.c (maintenance_print_symbols)
	(maintenance_print_msymbols): Use gdb::unique_xmalloc_ptr.
	* symfile.c (symfile_bfd_open, generic_load)
	(add_symbol_file_command, remove_symbol_file_command): Use
	gdb::unique_xmalloc_ptr.
	* source.c (openp): Use gdb::unique_xmalloc_ptr.
	* psymtab.c (maintenance_print_psymbols): Use
	gdb::unique_xmalloc_ptr.
	* corelow.c (core_open): Use gdb::unique_xmalloc_ptr.
	* breakpoint.c (save_breakpoints): Use gdb::unique_xmalloc_ptr.
	* solib.c (solib_map_sections): Use gdb::unique_xmalloc_ptr.
	(reload_shared_libraries_1): Likewise.
2017-08-05 15:52:49 -06:00
Tom Tromey 773a1edcd1 Introduce gdb_argv, a class wrapper for buildargv
This introduces gdb_argv, a class wrapping an "argv" pointer; that is,
a pointer to a NULL-terminated array of char*, where both the array
and each non-NULL element in the array are xmalloc'd.

This patch then changes most users of gdb_buildargv to use gdb_argv
instead.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* utils.h (struct gdb_argv_deleter): New.
	(gdb_argv): New class.
	* utils.c (gdb_argv::reset): New method.
	* tracepoint.c (delete_trace_variable_command): Use gdb_argv.
	* tracefile.c (tsave_command): Use gdb_argv.
	* top.c (new_ui_command): Use gdb_argv.
	* symmisc.c (maintenance_print_symbols)
	(maintenance_print_msymbols, maintenance_expand_symtabs): Use gdb_argv.
	* symfile.c (symbol_file_command, generic_load)
	(remove_symbol_file_command): Use gdb_argv.
	* stack.c (backtrace_command): Use gdb_argv.
	* source.c (add_path, show_substitute_path_command)
	(unset_substitute_path_command, set_substitute_path_command):
	Use gdb_argv.
	* skip.c (skip_command): Use gdb_argv.  Use gdb_buildargv.
	* ser-mingw.c (pipe_windows_open): Use gdb_argv.
	* remote.c (extended_remote_run, remote_put_command)
	(remote_get_command, remote_delete_command): Use gdb_argv.
	* remote-sim.c (gdbsim_load, gdbsim_create_inferior)
	(gdbsim_open): Use gdb_argv.
	* python/py-cmd.c (gdbpy_string_to_argv): Use gdb_argv.
	* psymtab.c (maintenance_print_psymbols): Use gdb_argv.
	* procfs.c (procfs_info_proc): Use gdb_argv.
	* interps.c (interpreter_exec_cmd): Use gdb_argv.
	* infrun.c (handle_command): Use gdb_argv.
	* inferior.c (add_inferior_command, clone_inferior_command):
	Use gdb_argv.
	* guile/scm-string.c (gdbscm_string_to_argv): Use gdb_argv.
	* exec.c (exec_file_command): Use gdb_argv.
	* cli/cli-cmds.c (alias_command): Use gdb_argv.
	* compile/compile.c (build_argc_argv): Use gdb_argv.
2017-08-03 07:59:08 -06:00
Pedro Alves 14bc53a814 Use gdb::function_view in iterate_over_symtabs & co
I wanted to pass a lambda to iterate_over_symtabs (see following
patch), so I converted it to function_view, and then the rest is
cascaded from that.

This gets rid of a bunch of single-use callback functions and
corresponding manually managed callback capture types
(add_partial_datum, search_symbols_data, etc.) in favor of letting the
compiler generate them for us by using lambdas with a capture.  In a
couple cases, it was more natural to convert the existing function
callbacks to function objects (i.e., operator(), e.g.,
decode_compound_collector).

gdb/ChangeLog:
2017-02-23  Pedro Alves  <palves@redhat.com>

	* ada-lang.c: Include "common/function-view.h".
	(ada_iterate_over_symbols): Adjust to use function_view as
	callback type.
	(struct add_partial_datum, ada_complete_symbol_matcher): Delete.
	(ada_make_symbol_completion_list): Use a lambda.
	(ada_exc_search_name_matches): Delete.
	(name_matches_regex): New.
	(ada_add_global_exceptions): Use a lambda and name_matches_regex.
	* compile/compile-c-support.c: Include "common/function-view.h".
	(print_one_macro): Change prototype to accept a ui_file pointer.
	(write_macro_definitions): Use a lambda.
	* dwarf2read.c: Include "common/function-view.h".
	(dw2_map_expand_apply, dw2_map_symtabs_matching_filename)
	(dw2_expand_symtabs_matching): Adjust to use function_view as
	callback type.
	* language.h: Include "common/function-view.h".
	(struct language_defn) <la_iterate_over_symbols>: Adjust to use
	function_view as callback type.
	(LA_ITERATE_OVER_SYMBOLS): Remove DATA parameter.
	* linespec.c: Include "common/function-view.h".
	(collect_info::add_symbol): New method.
	(struct symbol_and_data_callback, iterate_inline_only, struct
	symbol_matcher_data, iterate_name_matcher): Delete.
	(iterate_over_all_matching_symtabs): Adjust to use function_view
	as callback type and lambdas.
	(iterate_over_file_blocks): Adjust to use function_view as
	callback type.
	(decode_compound_collector): Now a class with private fields.
	(decode_compound_collector::release_symbols): New method.
	(collect_one_symbol): Rename to...
	(decode_compound_collector::operator()): ... this and adjust.
	(lookup_prefix_sym): decode_compound_collector construction bits
	move to decode_compound_collector ctor.  Pass the
	decode_compound_collector object directly as callback.  Remove
	cleanups and use decode_compound_collector::release_symbols
	instead.
	(symtab_collector): Now a class with private fields.
	(symtab_collector::release_symtabs): New method.
	(add_symtabs_to_list): Rename to...
	(symtab_collector::operator()): ... this and adjust.
	(collect_symtabs_from_filename): symtab_collector construction
	bits move to symtab_collector ctor.  Pass the symtab_collector
	object directly as callback.  Remove cleanups and use
	symtab_collector::release_symtabs instead.
	(collect_symbols): Delete.
	(add_matching_symbols_to_info): Use lambdas.
	* macrocmd.c (print_macro_callback): Delete.
	(info_macro_command): Use a lambda.
	(info_macros_command): Pass print_macro_definition as callable
	directly.
	(print_one_macro): Remove 'ignore' parameter.
	(macro_list_command): Adjust.
	* macrotab.c (macro_for_each_data::fn): Now a function_view.
	(macro_for_each_data::user_data): Delete field.
	(foreach_macro): Adjust to call the function_view.
	(macro_for_each): Adjust to use function_view as callback type.
	(foreach_macro_in_scope): Adjust to call the function_view.
	(macro_for_each_in_scope): Adjust to use function_view as callback
	type.
	* macrotab.h: Include "common/function-view.h".
	(macro_callback_fn): Declare a prototype instead of a pointer.
	Remove "user_data" parameter.
	(macro_for_each, macro_for_each_in_scope): Adjust to use
	function_view as callback type.
	* psymtab.c (partial_map_expand_apply)
	(psym_map_symtabs_matching_filename, recursively_search_psymtabs):
	Adjust to use function_view as callback type and to return bool.
	(psym_expand_symtabs_matching): Adjust to use function_view as
	callback types.
	* symfile-debug.c (debug_qf_map_symtabs_matching_filename): Adjust
	to use function_view as callback type and to return bool.
	(debug_qf_expand_symtabs_matching): Adjust to use function_view as
	callback types.
	* symfile.c (expand_symtabs_matching): Adjust to use function_view
	as callback types.
	* symfile.h: Include "common/function-view.h".
	(expand_symtabs_file_matcher_ftype)
	(expand_symtabs_symbol_matcher_ftype)
	(expand_symtabs_exp_notify_ftype): Remove "data" parameter and
	return bool.
	(quick_symbol_functions::map_symtabs_matching_filename)
	(quick_symbol_functions::expand_symtabs_matching): Adjust to use
	function_view as callback type and return bool.
	(expand_symtabs_matching): Adjust to use function_view as callback
	type.
	(maintenance_expand_name_matcher)
	(maintenance_expand_file_matcher): Delete.
	(maintenance_expand_symtabs): Use lambdas.
	* symtab.c (iterate_over_some_symtabs): Adjust to use
	function_view as callback types and return bool.
	(iterate_over_symtabs): Likewise.  Use unique_xmalloc_ptr instead
	of a cleanup.
	(lookup_symtab_callback): Delete.
	(lookup_symtab): Use a lambda.
	(iterate_over_symbols): Adjust to use function_view as callback
	type.
	(struct search_symbols_data, search_symbols_file_matches)
	(search_symbols_name_matches): Delete.
	(search_symbols): Use a pair of lambdas.
	(struct add_name_data, add_macro_name, symbol_completion_matcher)
	(symtab_expansion_callback): Delete.
	(default_make_symbol_completion_list_break_on_1): Use lambdas.
	* symtab.h: Include "common/function-view.h".
	(iterate_over_some_symtabs): Adjust to use function_view as
	callback type and return bool.
	(iterate_over_symtabs): Adjust to use function_view as callback
	type.
	(symbol_found_callback_ftype): Remove 'data' parameter and return
	bool.
	(iterate_over_symbols): Adjust to use function_view as callback
	type.
2017-02-23 16:16:06 +00:00
Sergio Durigan Junior 99e8a4f9f8 PR gdb/21164: maint print {symbols,msymbols,psymbols} without args crash
This is a fix for PR gdb/21164.  The problem started to happen after:

 commit 34c41c681f
 Author:     Doug Evans <xdje42@gmail.com>
 AuthorDate: Mon Dec 19 08:33:46 2016 -0800

    New syntax for mt print symbols,msymbols,psymbols.

This change introduced new syntax for the mentioned commands, and
improved the parsing of arguments by using 'gdb_buildargv'.  However,
it is necessary to check if the argv being built is not NULL, which
can happen if the user doesn't provide any arguments to these
commands.

gdb/ChangeLog:
2017-02-15  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR gdb/21164
	* psymtab.c (maintenance_print_psymbols): Verify if 'argv' is not
	NULL before using it.
	* symmisc.c (maintenance_print_symbols): Likewise.
	(maintenance_print_msymbols): Likewise.

gdb/testsuite/ChangeLog:

gdb/ChangeLog:
2017-02-15  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR gdb/21164
	* gdb.base/maint.exp: Add testcases for when the commands do
	not have arguments.
2017-02-15 19:54:10 -05:00
Pedro Alves d7e747318f Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond.  It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.

- mem_fileopen -> string_file

mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack.  This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)

string_file's internal buffer is a std::string, thus the "string" in
the name.  This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.

- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone

The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer.  This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside.  With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.

Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.

With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.

- New ui_file::printf, ui_file::puts, etc. methods

These simplify / clarify client code.  I considered splitting
client-code changes, like these, e.g.:

  -  stb = mem_fileopen ();
  -  fprintf_unfiltered (stb, "%s%s%s",
  -		      _("The valid values are:\n"),
  -		      regdesc,
  -		      _("The default is \"std\"."));
  +  string_file stb;
  +  stb.printf ("%s%s%s",
  +	      _("The valid values are:\n"),
  +	      regdesc,
  +	      _("The default is \"std\"."));

In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc..  I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".

- gdb_fopen replaced with stack-based objects

This avoids the need for cleanups or unique_ptr's.  I.e., this:

      struct ui_file *file = gdb_fopen (filename, "w");
      if (filename == NULL)
 	perror_with_name (filename);
      cleanups = make_cleanup_ui_file_delete (file);
      // use file.
      do_cleanups (cleanups);

is replaced with this:

      stdio_file file;
      if (!file.open (filename, "w"))
 	perror_with_name (filename);
      // use file.

- odd contorsions in null_file_write / null_file_fputs around when to
  call to_fputs / to_write eliminated.

- Global null_stream object

A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.

- TUI's tui_sfileopen eliminated.  TUI's ui_file much simplified

The TUI's ui_file was serving a dual purpose.  It supported being used
as string buffer, and supported being backed by a stdio FILE.  The
string buffer part is gone, replaced by using of string_file.  The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.

gdb/ChangeLog:
2017-02-02  Pedro Alves  <palves@redhat.com>

	* ada-lang.c (type_as_string): Use string_file.
	* ada-valprint.c (ada_print_floating): Use string_file.
	* ada-varobj.c (ada_varobj_scalar_image)
	(ada_varobj_get_value_image): Use string_file.
	* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
	* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
	* breakpoint.c (update_inserted_breakpoint_locations)
	(insert_breakpoint_locations, reattach_breakpoints)
	(print_breakpoint_location, print_one_detail_ranged_breakpoint)
	(print_it_watchpoint): Use string_file.
	(save_breakpoints): Use stdio_file.
	* c-exp.y (oper): Use string_file.
	* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
	tee_file.
	(pop_output_files): Use delete.
	(handle_redirections): Use stdio_file and tee_file.
	* cli/cli-setshow.c (do_show_command): Use string_file.
	* compile/compile-c-support.c (c_compute_program): Use
	string_file.
	* compile/compile-c-symbols.c (generate_vla_size): Take a
	'string_file &' instead of a 'ui_file *'.
	(generate_c_for_for_one_variable): Take a 'string_file &' instead
	of a 'ui_file *'.  Use string_file.
	(generate_c_for_variable_locations): Take a 'string_file &'
	instead of a 'ui_file *'.
	* compile/compile-internal.h (generate_c_for_for_one_variable):
	Take a 'string_file &' instead of a 'ui_file *'.
	* compile/compile-loc2c.c (push, pushf, unary, binary)
	(print_label, pushf_register_address, pushf_register)
	(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
	'ui_file *'.  Adjust.
	* compile/compile.c (compile_to_object): Use string_file.
	* compile/compile.h (compile_dwarf_expr_to_c)
	(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
	'ui_file *'.
	* cp-support.c (inspect_type): Use string_file and obstack_copy0.
	(replace_typedefs_qualified_name): Use string_file and
	obstack_copy0.
	* disasm.c (gdb_pretty_print_insn): Use string_file.
	(gdb_disassembly): Adjust reference the null_stream global.
	(do_ui_file_delete): Delete.
	(gdb_insn_length): Use null_stream.
	* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
	* dwarf2loc.c (dwarf2_compile_property_to_c)
	(locexpr_generate_c_location, loclist_generate_c_location): Take a
	'string_file &' instead of a 'ui_file *'.
	* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
	* dwarf2read.c (do_ui_file_peek_last): Delete.
	(dwarf2_compute_name): Use string_file.
	* event-top.c (gdb_setup_readline): Use stdio_file.
	* gdbarch.sh (verify_gdbarch): Use string_file.
	* gdbtypes.c (safe_parse_type): Use null_stream.
	* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
	string_file.
	* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
	'string_file *' instead of a 'ui_file *'.
	(gdbscm_arch_disassemble): Use string_file.
	* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
	* guile/scm-ports.c (class ioscm_file_port): Now a class that
	inherits from ui_file.
	(ioscm_file_port_delete, ioscm_file_port_rewind)
	(ioscm_file_port_put): Delete.
	(ioscm_file_port_write): Rename to ...
	(ioscm_file_port::write): ... this.  Remove file_port_magic
	checks.
	(ioscm_file_port_new): Delete.
	(ioscm_with_output_to_port_worker): Use ioscm_file_port and
	ui_file_up.
	* guile/scm-type.c (tyscm_type_name): Use string_file.
	* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
	Use string_file.
	* infcmd.c (print_return_value_1): Use string_file.
	* infrun.c (print_target_wait_results): Use string_file.
	* language.c (add_language): Use string_file.
	* location.c (explicit_to_string_internal): Use string_file.
	* main.c (captured_main_1): Use null_file.
	* maint.c (maintenance_print_architecture): Use stdio_file.
	* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
	* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
	event_channel>: Change type to mi_console_file pointer.
	* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
	(mi_console_file_delete): Delete.
	(struct mi_console_file): Delete.
	(mi_console_file_magic): Delete.
	(mi_console_file_new): Delete.
	(mi_console_file::mi_console_file): New.
	(mi_console_file_delete): Delete.
	(mi_console_file_fputs): Delete.
	(mi_console_file::write): New.
	(mi_console_raw_packet): Delete.
	(mi_console_file::flush): New.
	(mi_console_file_flush): Delete.
	(mi_console_set_raw): Rename to ...
	(mi_console_file::set_raw): ... this.
	* mi/mi-console.h (class mi_console_file): New class.
	(mi_console_file_new, mi_console_set_raw): Delete.
	* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
	(mi_set_logging): Use delete and tee_file.  Adjust.
	* mi/mi-main.c (output_register): Use string_file.
	(mi_cmd_data_evaluate_expression): Use string_file.
	(mi_cmd_data_read_memory): Use string_file.
	(mi_cmd_execute, print_variable_or_computed): Use string_file.
	* mi/mi-out.c (mi_ui_out::main_stream): New.
	(mi_ui_out::rewind): Use main_stream and
	string_file.
	(mi_ui_out::put): Use main_stream and string_file.
	(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
	Allocate a 'string_file' instead.
	(mi_out_new): Don't allocate a mem_fileopen stream here.
	* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
	(mi_ui_out::main_stream): Declare method.
	* printcmd.c (eval_command): Use string_file.
	* psymtab.c (maintenance_print_psymbols): Use stdio_file.
	* python/py-arch.c (archpy_disassemble): Use string_file.
	* python/py-breakpoint.c (bppy_get_commands): Use string_file.
	* python/py-frame.c (frapy_str): Use string_file.
	* python/py-framefilter.c (py_print_type, py_print_single_arg):
	Use string_file.
	* python/py-type.c (typy_str): Use string_file.
	* python/py-unwind.c (unwind_infopy_str): Use string_file.
	* python/py-value.c (valpy_str): Use string_file.
	* record-btrace.c (btrace_insn_history): Use string_file.
	* regcache.c (regcache_print): Use stdio_file.
	* reggroups.c (maintenance_print_reggroups): Use stdio_file.
	* remote.c (escape_buffer): Use string_file.
	* rust-lang.c (rust_get_disr_info): Use string_file.
	* serial.c (serial_open_ops_1): Use stdio_file.
	(do_serial_close): Use delete.
	* stack.c (print_frame_arg): Use string_file.
	(print_frame_args): Remove local mem_fileopen stream, not used.
	(print_frame): Use string_file.
	* symmisc.c (maintenance_print_symbols): Use stdio_file.
	* symtab.h (struct symbol_computed_ops) <generate_c_location>:
	Take a 'string_file *' instead of a 'ui_file *'.
	* top.c (new_ui): Use stdio_file and stderr_file.
	(free_ui): Use delete.
	(execute_command_to_string): Use string_file.
	(quit_confirm): Use string_file.
	* tracepoint.c (collection_list::append_exp): Use string_file.
	* tui/tui-disasm.c (tui_disassemble): Use string_file.
	* tui/tui-file.c: Don't include "ui-file.h".
	(enum streamtype, struct tui_stream): Delete.
	(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
	(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
	(tui_file::tui_file): New method.
	(tui_file_fputs): Delete.
	(tui_file_get_strbuf): Delete.
	(tui_file::puts): New method.
	(tui_file_adjust_strbuf): Delete.
	(tui_file_flush): Delete.
	(tui_file::flush): New method.
	* tui/tui-file.h: Tweak intro comment.
	Include ui-file.h.
	(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
	(tui_file_adjust_strbuf): Delete declarations.
	(class tui_file): New class.
	* tui/tui-io.c (tui_initialize_io): Use tui_file.
	* tui/tui-regs.c (tui_restore_gdbout): Use delete.
	(tui_register_format): Use string_stream.
	* tui/tui-stack.c (tui_make_status_line): Use string_file.
	(tui_get_function_from_frame): Use string_file.
	* typeprint.c (type_to_string): Use string_file.
	* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
	(null_stream): New global.
	(ui_file_delete): Delete.
	(ui_file::ui_file): New.
	(null_file_isatty): Delete.
	(ui_file::~ui_file): New.
	(null_file_rewind): Delete.
	(ui_file::printf): New.
	(null_file_put): Delete.
	(null_file_flush): Delete.
	(ui_file::putstr): New.
	(null_file_write): Delete.
	(ui_file::putstrn): New.
	(null_file_read): Delete.
	(ui_file::putc): New.
	(null_file_fputs): Delete.
	(null_file_write_async_safe): Delete.
	(ui_file::vprintf): New.
	(null_file_delete): Delete.
	(null_file::write): New.
	(null_file_fseek): Delete.
	(null_file::puts): New.
	(ui_file_data): Delete.
	(null_file::write_async_safe): New.
	(gdb_flush, ui_file_isatty): Adjust.
	(ui_file_put, ui_file_rewind): Delete.
	(ui_file_write): Adjust.
	(ui_file_write_for_put): Delete.
	(ui_file_write_async_safe, ui_file_read): Adjust.
	(ui_file_fseek): Delete.
	(fputs_unfiltered): Adjust.
	(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
	(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
	(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
	(set_ui_file_data): Delete.
	(string_file::~string_file, string_file::write)
	(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
	(do_ui_file_as_string, ui_file_as_string): Delete.
	(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
	(struct mem_file): Delete.
	(mem_file_new): Delete.
	(stdio_file::stdio_file): New.
	(mem_file_delete): Delete.
	(stdio_file::stdio_file): New.
	(mem_fileopen): Delete.
	(stdio_file::~stdio_file): New.
	(mem_file_rewind): Delete.
	(stdio_file::set_stream): New.
	(mem_file_put): Delete.
	(stdio_file::open): New.
	(mem_file_write): Delete.
	(stdio_file_magic, struct stdio_file): Delete.
	(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
	(stdio_file::flush): New.
	(stdio_file_read): Rename to ...
	(stdio_file::read): ... this.  Adjust.
	(stdio_file_write): Rename to ...
	(stdio_file::write): ... this.  Adjust.
	(stdio_file_write_async_safe): Rename to ...
	(stdio_file::write_async_safe) ... this.  Adjust.
	(stdio_file_fputs): Rename to ...
	(stdio_file::puts) ... this.  Adjust.
	(stdio_file_isatty): Delete.
	(stdio_file_fseek): Delete.
	(stdio_file::isatty): New.
	(stderr_file_write): Rename to ...
	(stderr_file::write) ... this.  Adjust.
	(stderr_file_fputs): Rename to ...
	(stderr_file::puts) ... this.  Adjust.
	(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
	(stderr_file::stderr_file): New.
	(tee_file_magic): Delete.
	(struct tee_file): Delete.
	(tee_file::tee_file): New.
	(tee_file_new): Delete.
	(tee_file::~tee_file): New.
	(tee_file_delete): Delete.
	(tee_file_flush): Rename to ...
	(tee_file::flush): ... this.  Adjust.
	(tee_file_write): Rename to ...
	(tee_file::write): ... this.  Adjust.
	(tee_file::write_async_safe): New.
	(tee_file_fputs): Rename to ...
	(tee_file::puts): ... this.  Adjust.
	(tee_file_isatty): Rename to ...
	(tee_file::isatty): ... this.  Adjust.
	* ui-file.h (struct obstack, struct ui_file): Don't
	forward-declare.
	(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
	(ui_file_write_ftype)
	(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
	(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
	(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
	(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
	(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
	(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
	(set_ui_file_fseek): Delete.
	(ui_file_data, ui_file_delete, ui_file_rewind)
	(struct ui_file): New.
	(ui_file_up): New.
	(class null_file): New.
	(null_stream): Declare.
	(ui_file_write_for_put, ui_file_put): Delete.
	(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
	Delete.
	(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
	(gdb_fopen, tee_file_new): Delete.
	(struct string_file): New.
	(struct stdio_file): New.
	(stdio_file_up): New.
	(struct stderr_file): New.
	(class tee_file): New.
	* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
	of a 'ui_file *'.  Adjust.
	* ui-out.h (class ui_out) <field_stream>: Likewise.
	* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
	(null_stream): Delete.
	(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
	Adjust.
	* utils.h (struct ui_file): Delete forward declaration..
	(make_cleanup_ui_file_delete, null_stream): Delete declarations.
	(error_stream): Take a 'string_file &' instead of a
	'ui_file *'.
	* varobj.c (varobj_value_get_print_value): Use string_file.
	* xtensa-tdep.c (xtensa_verify_config): Use string_file.
	* gdbarch.c: Regenerate.
2017-02-02 11:11:47 +00:00
Joel Brobecker 61baf725ec update copyright year range in GDB files
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.

gdb/ChangeLog:

        Update copyright year range in all GDB files.
2017-01-01 10:52:34 +04:00
Doug Evans 34c41c681f New syntax for mt print symbols,msymbols,psymbols.
gdb/ChangeLog:

	* NEWS: Document new syntax for "mt print symbols", "mt print psymbols"
	and "mt print msymbols" commands.
	* psymtab.c (DEV_TTY): Delete.
	(dump_psymtab_addrmap): Don't dump if psymtabs_addrmap is NULL.
	(maintenance_print_psymbols): Rewrite for new syntax:
	mt print psymbols [-objfile objfile] [-pc address] [outfile]
	mt print psymbols [-objfile objfile] [-source source] [outfile]
	(_initialize_psymtab): Update help text.
	* symmisc.c (maintenance_print_symbols): Rewrite for new syntax:
	mt print symbols [-pc address] [outfile]
	mt print symbols [-objfile objfile] [-source source] [outfile]
	(maintenance_print_msymbols): Rewrite for new syntax:
	mt print msymbols [-objfile objfile] [outfile]
	Only print symbols for the current progspace.
	(_initialize_symmisc): Update help text.

gdb/doc/ChangeLog:

	* gdb.texinfo (Symbols): Update docs for symbol printing maintenance
	commands.

gdb/testsuite/ChangeLog:

	* gdb.base/maint.exp: Update tests for maint print symbols, psymbols
	and msymbols.
2016-12-22 15:37:22 -08:00
Pedro Alves 1736a7bd96 gdb: Remove support for obsolete OSABIs and a.out
gdb/ChangeLog:
2016-12-09  Pedro Alves  <palves@redhat.com>

	* Makefile.in (ALL_TARGET_OBS): Remove vax-obsd-tdep.o.
	* alpha-fbsd-tdep.c (_initialize_alphafbsd_tdep): Adjust.
	* alpha-nbsd-tdep.c: Move comment to _initialize_alphanbsd_tdep.
	(alphanbsd_core_osabi_sniffer): Delete.
	(_initialize_alphanbsd_tdep): No longer handle a.out.
	* alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Adjust.
	* amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Adjust.
	* amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Adjust.
	* amd64-obsd-tdep.c (amd64obsd_supply_regset)
	(amd64obsd_combined_regset)
	(amd64obsd_iterate_over_regset_sections, amd64obsd_core_init_abi):
	Delete.
	(_initialize_amd64obsd_tdep): Don't handle a.out.
	* arm-nbsd-nat.c (struct md_core, fetch_core_registers)
	(arm_netbsd_core_fns): Delete.
	(_initialize_arm_netbsd_nat): Don't register arm_netbsd_core_fns.
	* arm-nbsd-tdep.c (arm_netbsd_aout_init_abi)
	(arm_netbsd_aout_osabi_sniffer): Delete.
	(_initialize_arm_netbsd_tdep): Don't handle a.out.
	* arm-obsd-tdep.c (armobsd_core_osabi_sniffer): Delete.
	(_initialize_armobsd_tdep): Don't handle a.out.
	* arm-tdep.c (arm_gdbarch_init): Remove bfd_target_aout_flavour
	case.
	* breakpoint.c (disable_breakpoints_in_unloaded_shlib): Remove
	SunOS a.out handling.
	* configure.tgt (vax-*-netbsd* | vax-*-knetbsd*-gnu): Remove
	vax-obsd-tdep.o from gdb_target_objs.
	(vax-*-openbsd*): Likewise.
	(*-*-freebsd*): Adjust default gdb_osabi.
	(*-*-openbsd*): Likewise.
	* dbxread.c (block_address_function_relative): Delete.
	(dbx_symfile_read): Remove reference to
	block_address_function_relative.
	(dbx_symfile_read): Don't call read_dbx_dynamic_symtab.
	(read_dbx_dynamic_symtab): Delete.
	(process_one_symbol): Remove references to
	block_address_function_relative.
	* defs.h (GDB_OSABI_FREEBSD_AOUT, GDB_OSABI_NETBSD_AOUT): Remove.
	(GDB_OSABI_FREEBSD_ELF): Rename to ...
	(GDB_OSABI_FREEBSD): ... this.
	(GDB_OSABI_NETBSD_ELF): Rename to ...
	(GDB_OSABI_NETBSD): ... this.
	(GDB_OSABI_OPENBSD_ELF): Rename to ...
	(GDB_OSABI_OPENBSD): ... this.
	(GDB_OSABI_HPUX_ELF, GDB_OSABI_HPUX_SOM): Remove.
	* fbsd-tdep.c: Adjust comment.
	* hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Adjust.
	* hppa-obsd-tdep.c (GDB_OSABI_NETBSD_CORE): Delete.
	(hppaobsd_core_osabi_sniffer): Delete.
	(_initialize_hppabsd_tdep): Don't handle a.out.
	* hppa-tdep.c (hppa_stub_frame_unwind_cache): Don't handle
	GDB_OSABI_HPUX_SOM.
	(hppa_gdbarch_init): Likewise.
	* i386-bsd-tdep.c (i386bsd_aout_osabi_sniffer)
	(i386bsd_core_osabi_sniffer, _initialize_i386bsd_tdep): Delete.
	* i386-fbsd-tdep.c (i386fbsdaout_init_abi): Delete.  Merge bits
	with ...
	(i386fbsd_init_abi): ... this.
	(_initialize_i386fbsd_tdep): Don't handle a.out.
	* i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Adjust.
	* i386-obsd-tdep.c (i386obsd_aout_supply_regset)
	(i386obsd_aout_gregset)
	(i386obsd_aout_iterate_over_regset_sections): Delete.
	(i386obsd_init_abi): Merge with i386obsd_elf_init_abi.
	(i386obsd_aout_init_abi): Delete.
	(_initialize_i386obsd_tdep): Don't handle a.out.
	* m68k-bsd-tdep.c (m68kobsd_sigtramp_cache_init)
	(m68kobsd_sigtramp): Delete.
	(m68kbsd_init_abi): Merge with ...
	(m68kbsd_elf_init_abi): ... this, and delete it.
	(m68kbsd_aout_init_abi): Delete.
	(m68kbsd_aout_osabi_sniffer, m68kbsd_core_osabi_sniffer): Delete.
	(_initialize_m68kbsd_tdep): Don't handle a.out.
	* mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Adjust.
	* mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Adjust.
	* osabi.c (gdb_osabi_names): Remove "a.out" entries.  Drop "ELF"
	suffixes.  Remove "HP-UX" entries.
	(generic_elf_osabi_sniff_abi_tag_sections): Adjust.
	(generic_elf_osabi_sniffer): No longer handle GDB_OSABI_HPUX_ELF.
	Adjust.
	(_initialize_ppcfbsd_tdep): Adjust.
	* ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Adjust.
	* ppc-obsd-tdep.c (GDB_OSABI_NETBSD_CORE)
	(ppcobsd_core_osabi_sniffer): Delete.
	(_initialize_ppcobsd_tdep): Don't handle a.out.
	* rs6000-tdep.c (rs6000_gdbarch_init): Adjust.
	* sh-nbsd-tdep.c (GDB_OSABI_NETBSD_CORE)
	(shnbsd_core_osabi_sniffer): Delete.
	(_initialize_shnbsd_tdep): Don't handle a.out.
	* solib.c (clear_solib): Don't handle SunOS/a.out.
	* sparc-nbsd-tdep.c (sparc32nbsd_init_abi): Make extern.
	(sparc32nbsd_aout_init_abi): Delete.
	(sparc32nbsd_elf_init_abi): Merged into sparc32nbsd_init_abi.
	(sparcnbsd_aout_osabi_sniffer): Delete.
	(GDB_OSABI_NETBSD_CORE, sparcnbsd_core_osabi_sniffer): Delete.
	(_initialize_sparcnbsd_tdep): No longer handle a.out.
	* sparc-obsd-tdep.c (sparc32obsd_init_abi)
	(_initialize_sparc32obsd_tdep): Adjust.
	* sparc-tdep.h (sparc32nbsd_elf_init_abi): Rename to ...
	(sparc32nbsd_init_abi): ... this.
	* sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Adjust.
	* sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Adjust.
	* sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Adjust.
	* stabsread.c: Update comment.
	* symmisc.c (print_objfile_statistics): Don't mention "a.out" in
	output.
	* vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Adjust.
	* vax-obsd-tdep.c: Delete file.
2016-12-09 16:08:49 +00:00
Trevor Saunders 870f88f755 remove trivialy unused variables
gdb/ChangeLog:

2016-05-07  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* aarch64-linux-tdep.c (aarch64_linux_sigframe_init): Remove unused
	variables.
	* aarch64-tdep.c (aarch64_skip_prologue): Likewise.
	(aarch64_scan_prologue): Likewise.
	(aarch64_prologue_prev_register): Likewise.
	(aarch64_dwarf2_prev_register): Likewise.
	(pass_in_v): Likewise.
	(aarch64_push_dummy_call): Likewise.
	(aarch64_breakpoint_from_pc): Likewise.
	(aarch64_return_in_memory): Likewise.
	(aarch64_return_value): Likewise.
	(aarch64_displaced_step_b_cond): Likewise.
	(aarch64_displaced_step_cb): Likewise.
	(aarch64_displaced_step_tb): Likewise.
	(aarch64_gdbarch_init): Likewise.
	(aarch64_process_record): Likewise.
	* alpha-mdebug-tdep.c (alpha_mdebug_init_abi): Likewise.
	* alpha-tdep.c (_initialize_alpha_tdep): Likewise.
	* amd64-dicos-tdep.c (amd64_dicos_init_abi): Likewise.
	* amd64-linux-tdep.c (amd64_dtrace_parse_probe_argument): Likewise.
	* amd64-tdep.c (fixup_riprel): Likewise.
	* amd64-windows-tdep.c (amd64_windows_frame_decode_epilogue): Likewise.
	(amd64_windows_frame_decode_insns): Likewise.
	(amd64_windows_frame_cache): Likewise.
	(amd64_windows_frame_prev_register): Likewise.
	(amd64_windows_frame_this_id): Likewise.
	(amd64_windows_init_abi): Likewise.
	* arm-linux-tdep.c (arm_linux_get_syscall_number): Likewise.
	(arm_linux_get_next_pcs_syscall_next_pc): Likewise.
	* arm-symbian-tdep.c (arm_symbian_init_abi): Likewise.
	* arm-tdep.c (arm_make_epilogue_frame_cache): Likewise.
	(arm_epilogue_frame_prev_register): Likewise.
	(arm_record_vdata_transfer_insn): Likewise.
	(arm_record_exreg_ld_st_insn): Likewise.
	* auto-load.c (execute_script_contents): Likewise.
	(print_scripts): Likewise.
	* avr-tdep.c (avr_frame_prev_register): Likewise.
	(avr_push_dummy_call): Likewise.
	* bfin-linux-tdep.c (bfin_linux_sigframe_init): Likewise.
	* bfin-tdep.c (bfin_gdbarch_init): Likewise.
	* blockframe.c (find_pc_partial_function_gnu_ifunc): Likewise.
	* break-catch-throw.c (fetch_probe_arguments): Likewise.
	* breakpoint.c (breakpoint_xfer_memory): Likewise.
	(breakpoint_init_inferior): Likewise.
	(breakpoint_inserted_here_p): Likewise.
	(software_breakpoint_inserted_here_p): Likewise.
	(hardware_breakpoint_inserted_here_p): Likewise.
	(bpstat_what): Likewise.
	(break_range_command): Likewise.
	(save_breakpoints): Likewise.
	* coffread.c (coff_symfile_read): Likewise.
	* cris-tdep.c (cris_push_dummy_call): Likewise.
	(cris_scan_prologue): Likewise.
	(cris_register_size): Likewise.
	(_initialize_cris_tdep): Likewise.
	* d-exp.y: Likewise.
	* dbxread.c (dbx_read_symtab): Likewise.
	(process_one_symbol): Likewise.
	(coffstab_build_psymtabs): Likewise.
	(elfstab_build_psymtabs): Likewise.
	* dicos-tdep.c (dicos_init_abi): Likewise.
	* disasm.c (do_mixed_source_and_assembly): Likewise.
	(gdb_disassembly): Likewise.
	* dtrace-probe.c (dtrace_process_dof): Likewise.
	* dwarf2read.c (error_check_comp_unit_head): Likewise.
	(build_type_psymtabs_1): Likewise.
	(skip_one_die): Likewise.
	(process_imported_unit_die): Likewise.
	(dwarf2_physname): Likewise.
	(read_file_scope): Likewise.
	(setup_type_unit_groups): Likewise.
	(create_dwo_cu_reader): Likewise.
	(create_dwo_cu): Likewise.
	(create_dwo_unit_in_dwp_v1): Likewise.
	(create_dwo_unit_in_dwp_v2): Likewise.
	(lookup_dwo_unit_in_dwp): Likewise.
	(free_dwo_file): Likewise.
	(check_producer): Likewise.
	(dwarf2_add_typedef): Likewise.
	(dwarf2_add_member_fn): Likewise.
	(read_unsigned_leb128): Likewise.
	(read_signed_leb128): Likewise.
	(dwarf2_const_value): Likewise.
	(follow_die_sig_1): Likewise.
	(dwarf_decode_macro_bytes): Likewise.
	* extension.c (restore_active_ext_lang): Likewise.
	* frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise.
	* ft32-tdep.c (ft32_analyze_prologue): Likewise.
	* gdbtypes.c (lookup_typename): Likewise.
	(resolve_dynamic_range): Likewise.
	(check_typedef): Likewise.
	* h8300-tdep.c (h8300_is_argument_spill): Likewise.
	(h8300_gdbarch_init): Likewise.
	* hppa-tdep.c (hppa32_push_dummy_call): Likewise.
	(hppa_frame_this_id): Likewise.
	(_initialize_hppa_tdep): Likewise.
	* hppanbsd-tdep.c (hppanbsd_sigtramp_cache_init): Likewise.
	* hppaobsd-tdep.c (hppaobsd_supply_fpregset): Likewise.
	* i386-dicos-tdep.c (i386_dicos_init_abi): Likewise.
	* i386-tdep.c (i386_bnd_type): Likewise.
	(i386_gdbarch_init): Likewise.
	(i386_mpx_bd_base): Likewise.
	* i386nbsd-tdep.c (i386nbsd_sigtramp_cache_init): Likewise.
	* i386obsd-tdep.c (i386obsd_elf_init_abi): Likewise.
	* ia64-tdep.c (examine_prologue): Likewise.
	(ia64_frame_cache): Likewise.
	(ia64_push_dummy_call): Likewise.
	* infcmd.c (finish_command_fsm_async_reply_reason): Likewise.
	(default_print_one_register_info): Likewise.
	* infrun.c (infrun_thread_ptid_changed): Likewise.
	(thread_still_needs_step_over): Likewise.
	(stop_all_threads): Likewise.
	(restart_threads): Likewise.
	(keep_going_stepped_thread): Likewise.
	* iq2000-tdep.c (iq2000_scan_prologue): Likewise.
	* language.c (language_init_primitive_type_symbols): Likewise.
	* linespec.c (add_sal_to_sals): Likewise.
	* linux-nat.c (status_callback): Likewise.
	(kill_unfollowed_fork_children): Likewise.
	(linux_nat_kill): Likewise.
	* linux-tdep.c (linux_fill_prpsinfo): Likewise.
	* linux-thread-db.c (thread_db_notice_clone): Likewise.
	(record_thread): Likewise.
	* location.c (string_to_event_location_basic): Likewise.
	* m32c-tdep.c (m32c_prev_register): Likewise.
	* m32r-linux-tdep.c (m32r_linux_init_abi): Likewise.
	* m32r-tdep.c (decode_prologue): Likewise.
	* m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise.
	* machoread.c (macho_symtab_read): Likewise.
	(macho_symfile_read): Likewise.
	(macho_symfile_offsets): Likewise.
	* maint.c (set_per_command_cmd): Likewise.
	* mi/mi-cmd-stack.c (mi_cmd_stack_list_locals): Likewise.
	(mi_cmd_stack_list_variables): Likewise.
	* mi/mi-main.c (mi_cmd_exec_run): Likewise.
	(output_register): Likewise.
	(mi_cmd_execute): Likewise.
	(mi_cmd_trace_define_variable): Likewise.
	(print_variable_or_computed): Likewise.
	* minsyms.c (prim_record_minimal_symbol_full): Likewise.
	* mn10300-tdep.c (mn10300_frame_prev_register): Likewise.
	* msp430-tdep.c (msp430_pseudo_register_write): Likewise.
	* mt-tdep.c (mt_registers_info): Likewise.
	* nios2-tdep.c (nios2_analyze_prologue): Likewise.
	(nios2_push_dummy_call): Likewise.
	(nios2_frame_unwind_cache): Likewise.
	(nios2_stub_frame_cache): Likewise.
	(nios2_stub_frame_sniffer): Likewise.
	(nios2_gdbarch_init): Likewise.
	* ppc-ravenscar-thread.c: Likewise.
	* ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise.
	* python/py-evts.c (add_new_registry): Likewise.
	* python/py-finishbreakpoint.c (bpfinishpy_init): Likewise.
	(bpfinishpy_detect_out_scope_cb): Likewise.
	* python/py-framefilter.c (py_print_value): Likewise.
	* python/py-inferior.c (infpy_write_memory): Likewise.
	* python/py-infevents.c (create_inferior_call_event_object): Likewise.
	* python/py-infthread.c (thpy_get_ptid): Likewise.
	* python/py-linetable.c (ltpy_get_pcs_for_line): Likewise.
	(ltpy_get_all_source_lines): Likewise.
	(ltpy_is_valid): Likewise.
	(ltpy_iternext): Likewise.
	* python/py-symtab.c (symtab_and_line_to_sal_object): Likewise.
	* python/py-unwind.c (pyuw_object_attribute_to_pointer): Likewise.
	(unwind_infopy_str): Likewise.
	* python/py-varobj.c (py_varobj_get_iterator): Likewise.
	* ravenscar-thread.c (ravenscar_inferior_created): Likewise.
	* rs6000-aix-tdep.c (rs6000_push_dummy_call): Likewise.
	* rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call): Likewise.
	* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Likewise.
	* s390-linux-tdep.c (s390_supply_tdb_regset): Likewise.
	(s390_frame_prev_register): Likewise.
	(s390_dwarf2_frame_init_reg): Likewise.
	(s390_record_vr): Likewise.
	(s390_process_record): Likewise.
	* score-tdep.c (score_push_dummy_call): Likewise.
	(score3_analyze_prologue): Likewise.
	* sh-tdep.c (sh_extract_return_value_nofpu): Likewise.
	* sh64-tdep.c (sh64_analyze_prologue): Likewise.
	(sh64_push_dummy_call): Likewise.
	(sh64_extract_return_value): Likewise.
	(sh64_do_fp_register): Likewise.
	* solib-aix.c (solib_aix_get_section_offsets): Likewise.
	* solib-darwin.c (darwin_read_exec_load_addr_from_dyld): Likewise.
	(darwin_solib_read_all_image_info_addr): Likewise.
	* solib-dsbt.c (enable_break): Likewise.
	* solib-frv.c (enable_break2): Likewise.
	(frv_fdpic_find_canonical_descriptor): Likewise.
	* solib-svr4.c (svr4_handle_solib_event): Likewise.
	* sparc-tdep.c (sparc_skip_stack_check): Likewise.
	* sparc64-linux-tdep.c (sparc64_linux_get_longjmp_target): Likewise.
	* sparcobsd-tdep.c (sparc32obsd_init_abi): Likewise.
	* spu-tdep.c (info_spu_dma_cmdlist): Likewise.
	* stack.c (read_frame_local): Likewise.
	* symfile.c (symbol_file_add_separate): Likewise.
	(remove_symbol_file_command): Likewise.
	* symmisc.c (maintenance_print_one_line_table): Likewise.
	* symtab.c (symbol_cache_flush): Likewise.
	(basic_lookup_transparent_type): Likewise.
	(sort_search_symbols_remove_dups): Likewise.
	* target.c (target_memory_map): Likewise.
	(target_detach): Likewise.
	(target_resume): Likewise.
	(acquire_fileio_fd): Likewise.
	(target_store_registers): Likewise.
	* thread.c (print_thread_info_1): Likewise.
	* tic6x-tdep.c (tic6x_analyze_prologue): Likewise.
	* tilegx-linux-tdep.c (tilegx_linux_sigframe_init): Likewise.
	* tilegx-tdep.c (tilegx_push_dummy_call): Likewise.
	(tilegx_analyze_prologue): Likewise.
	(tilegx_stack_frame_destroyed_p): Likewise.
	(tilegx_frame_cache): Likewise.
	* tracefile.c (trace_save): Likewise.
	* tracepoint.c (encode_actions_and_make_cleanup): Likewise.
	(start_tracing): Likewise.
	(print_one_static_tracepoint_marker): Likewise.
	* tui/tui.c (tui_enable): Likewise.
	* valops.c (value_struct_elt_bitpos): Likewise.
	(find_overload_match): Likewise.
	(find_oload_champ): Likewise.
	* value.c (value_contents_copy_raw): Likewise.
	* windows-tdep.c (windows_get_tlb_type): Likewise.
	* x86-linux-nat.c (x86_linux_enable_btrace): Likewise.
	* xcoffread.c (record_minimal_symbol): Likewise.
	(scan_xcoff_symtab): Likewise.
	* xtensa-tdep.c (execute_code): Likewise.
	(xtensa_gdbarch_init): Likewise.
	(_initialize_xtensa_tdep): Likewise.
2016-05-07 20:12:53 -04:00