Commit Graph

412 Commits

Author SHA1 Message Date
Rainer Orth bb6e55f3ee Remove obsolete gdbarch_static_transform_name
gdbarch_static_transform_name is completely Solaris-specific or rather
specific to the Studio compilers.  Studio cc has deprecated Stabs support
in the 12.4 release back in 2015, GCC has defaulted to DWARF-2 on Solaris
7+ since 2004 and Stabs themselves are pretty much obsolete, so the whole
code can go.

Tested on sparcv9-sun-solaris2.11 and x86_64-pc-linux-gnu with
--enable-targets=all.

	* sol2-tdep.c (sol2_static_transform_name): Remove.
	(sol2_init_abi): Don't register it.
	* gdbarch.sh (static_transform_name): Remove.
	* gdbarch.c, gdbarch.h: Regenerate.

	* dbxread.c (read_dbx_symtab) <'S'>: Remove call to
	gdbarch_static_transform_name.
	* mdebugread.c (parse_partial_symbols) <'S'>: Likewise.
	* stabsread.c (define_symbol) <'X'>: Remove.
	(define_symbol) <'S'>: Remove gdbarch_static_transform_name
	handling.
	<'V'>: Likewise.
	* xcoffread.c (scan_xcoff_symtab): Remove gdbarch.
	<'S'>: Remove call to gdbarch_static_transform_name.
2020-06-25 17:56:12 +02:00
Simon Marchi b6cdac4b80 gdb: remove FIELD_TYPE macro
Remove the `FIELD_TYPE` macro, changing all the call sites to use
`field::type` directly.

gdb/ChangeLog:

	* gdbtypes.h (FIELD_TYPE): Remove.  Change all call sites
	to use field::type instead.

Change-Id: I7673fedaa276e485189c87991a9043495da22ef5
2020-06-08 15:26:06 -04:00
Simon Marchi 5d14b6e5d6 gdb: add field::type / field::set_type
Add the `type` and `set_type` methods on `struct field`, in order to
remoremove the `FIELD_TYPE` macro.  In this patch, the `FIELD_TYPE`
macro is changed to use `field::type`, so all the call sites that are
useused to set the field's type are changed to use `field::set_type`.
The next patch will remove `FIELD_TYPE` completely.

Note that because of the name clash between the existing field named
`type` and the new method, I renamed the field `m_type`.  It is not
private per-se, because we can't make `struct field` a non-POD yet, but
it should be considered private anyway (not accessed outside `struct
field`).

gdb/ChangeLog:

	* gdbtypes.h (struct field) <type, set_type>: New methods.
	Rename `type` field to...
	<m_type>: ... this.  Change references throughout to use type or
	set_type methods.
	(FIELD_TYPE): Use field::type.  Change call sites that modify
	the field's type to use field::set_type instead.

Change-Id: Ie21f866e3b7f8a51ea49b722d07d272a724459a0
2020-06-08 15:26:04 -04:00
Simon Marchi ceacbf6edf gdb: remove TYPE_FIELD macro
Replace all uses of it by type::field.

Note that since type::field returns a reference to the field, some spots
are used to assign the whole field structure.  See ctfread.c, function
attach_fields_to_type, for example.  This is the same as was happening
with the macro, so I don't think it's a problem, but if anybody sees a
really nicer way to do this, now could be a good time to implement it.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_FIELD): Remove.  Replace all uses with
	type::field.
2020-05-23 17:39:54 -04:00
Simon Marchi 80fc5e77f0 gdb: remove TYPE_FIELDS macro
Remove all uses of the `TYPE_FIELDS` macro.  Replace them with either:

1) type::fields, to obtain a pointer to the fields array (same as
   TYPE_FIELDS yields)
2) type::field, a new convenience method that obtains a reference to one
   of the type's field by index.  It is meant to replace

     TYPE_FIELDS (type)[idx]

   with

     type->field (idx)

gdb/ChangeLog:

	* gdbtypes.h (struct type) <field>: New method.
	(TYPE_FIELDS): Remove, replace all uses with either type::fields
	or type::field.

Change-Id: I49fba10114417deb502060c6156aa5f7fc62462f
2020-05-22 16:55:17 -04:00
Simon Marchi 3cabb6b069 gdb: add type::fields / type::set_fields
Add the `fields` and `set_fields` methods on `struct type`, in order to
remove the `TYPE_FIELDS` macro.  In this patch, the `TYPE_FIELDS` macro
is changed to the `type::fields`, so all the call sites that use it to
set the fields array are changed to use `type::set_fields`.  The next
patch will remove `TYPE_FIELDS` entirely.

gdb/ChangeLog:

	* gdbtypes.h (struct type) <fields, set_fields>: New methods.
	(TYPE_FIELDS): Use type::fields.  Change all call sites that
	modify the propery to use type::set_fields instead.

Change-Id: I05174ce68f2ce3fccdf5d8b469ff141f14886b33
2020-05-22 16:55:16 -04:00
Simon Marchi 1f704f761b gdb: remove TYPE_NFIELDS macro
Remove `TYPE_NFIELDS`, changing all the call sites to use
`type::num_fields` directly.  This is quite a big diff, but this was
mostly done using sed and coccinelle.  A few call sites were done by
hand.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_NFIELDS): Remove.  Change all cal sites to use
	type::num_fields instead.

Change-Id: Ib73be4c36f9e770e0f729bac3b5257d7cb2f9591
2020-05-22 16:55:15 -04:00
Simon Marchi 5e33d5f4e1 gdb: add type::num_fields / type::set_num_fields
Add the `num_fields` and `set_num_fields` methods on `struct type`, in
order to remove the `TYPE_NFIELDS` macro.  In this patch, the
`TYPE_NFIELDS` macro is changed to use `type::num_fields`, so all the
call sites that are used to set the number of fields are changed to use
`type::set_num_fields`.  The next patch will remove `TYPE_NFIELDS`
completely.

I think that in the future, we should consider making the interface of
`struct type` better.  For example, right now it's possible for the
number of fields property and the actual number of fields set to be out
of sync.  However, I want to keep the existing behavior in this patch,
just translate from macros to methods.

gdb/ChangeLog:

	* gdbtypes.h (struct type) <num_fields, set_num_fields>: New
	methods.
	(TYPE_NFIELDS): Use type::num_fields.  Change all call sites
	that modify the number of fields to use type::set_num_fields
	instead.

Change-Id: I5ad9de5be4097feaf942d111077434bf91d13dc5
2020-05-22 16:55:14 -04:00
Simon Marchi 7d93a1e0b6 gdb: remove TYPE_NAME macro
Remove `TYPE_NAME`, changing all the call sites to use `type::name`
directly.  This is quite a big diff, but this was mostly done using sed
and coccinelle.  A few call sites were done by hand.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_NAME): Remove.  Change all cal sites to use
	type::name instead.
2020-05-16 12:36:05 -04:00
Simon Marchi d0e39ea27c gdb: add type::name / type::set_name
Add the `name` and `set_name` methods on `struct type`, in order to
remove the `TYPE_NAME` macro.  In this patch, the `TYPE_NAME` macro is
changed to use `type::name`, so all the call sites that are used to set
the type name are changed to use `type::set_name`.  The next patch will
remove `TYPE_NAME` completely.

gdb/ChangeLog:

	* gdbtypes.h (struct type) <name, set_name>: New methods.
	(TYPE_CODE): Use type::name.  Change all call sites used to set
	the name to use type::set_name instead.
2020-05-16 12:36:05 -04:00
Tom Tromey 8c14c3a373 Remove allocate_symbol et al
This removes allocate_symbol, allocate_template_symbol, and
initialize_objfile_symbol in favor of changing the default values for
symbol members, and updating the one per-arch caller.

gdb/ChangeLog
2020-05-15  Tom Tromey  <tom@tromey.com>

	* language.c (language_alloc_type_symbol): Set
	SYMBOL_SECTION.
	* symtab.c (initialize_objfile_symbol): Remove.
	(allocate_symbol): Remove.
	(allocate_template_symbol): Remove.
	* dwarf2/read.c (fixup_go_packaging): Use "new".
	(new_symbol): Use "new".
	(read_variable): Don't call initialize_objfile_symbol.  Use
	"new".
	(read_func_scope): Use "new".
	* xcoffread.c (process_xcoff_symbol): Don't call
	initialize_objfile_symbol.
	(SYMBOL_DUP): Remove.
	* coffread.c (process_coff_symbol, coff_read_enum_type): Use
	"new".
	* symtab.h (allocate_symbol, initialize_objfile_symbol)
	(allocate_template_symbol): Don't declare.
	(struct symbol): Add copy constructor.  Change defaults.
	* jit.c (finalize_symtab): Use "new".
	* ctfread.c (ctf_add_enum_member_cb, new_symbol, ctf_add_var_cb):
	Use "new".
	* stabsread.c (patch_block_stabs, define_symbol, read_enum_type)
	(common_block_end): Use "new".
	* mdebugread.c (parse_symbol): Use "new".
	(new_symbol): Likewise.
2020-05-15 16:11:34 -06:00
Simon Marchi 7813437494 gdb: remove TYPE_CODE macro
Remove TYPE_CODE, changing all the call sites to use type::code
directly.  This is quite a big diff, but this was mostly done using sed
and coccinelle.  A few call sites were done by hand.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_CODE): Remove.  Change all call sites to use
	type::code instead.
2020-05-14 13:46:38 -04:00
Simon Marchi 67607e24d0 gdb: add type::code / type::set_code
Add the code and set_code methods on code, in order to remove the
TYPE_CODE macro.  In this patch, the TYPE_CODE macro is changed to use
type::code, so all the call sites that are used to set the type code are
changed to use type::set_code.  The next patch will remove TYPE_CODE
completely.

gdb/ChangeLog:

	* gdbtypes.h (struct type) <code, set_code>: New methods.
	(TYPE_CODE): Use type::code.  Change all call sites used to set
	the code to use type::set_code instead.
2020-05-14 13:45:40 -04:00
Tom Tromey 596dc4adff Speed up psymbol reading by removing a copy
I noticed that cp_canonicalize_string and friends copy a
unique_xmalloc_ptr to a std::string.  However, this copy isn't
genuinely needed anywhere, and it serves to slow down DWARF psymbol
reading.

This patch removes the copy and updates the callers to adapt.

This speeds up the reader from 1.906 seconds (mean of 10 runs, of gdb
on a copy of itself) to 1.888 seconds (mean of 10 runs, on the same
copy as the first trial).

gdb/ChangeLog
2020-05-08  Tom Tromey  <tom@tromey.com>

	* symtab.h (class demangle_result_storage) <set_malloc_ptr>: New
	overload.
	<swap_string, m_string>: Remove.
	* symtab.c (demangle_for_lookup, completion_list_add_symbol):
	Update.
	* stabsread.c (define_symbol, read_type): Update.
	* linespec.c (find_linespec_symbols): Update.
	* gnu-v3-abi.c (gnuv3_get_typeid): Update.
	* dwarf2/read.c (dwarf2_canonicalize_name): Update.
	* dbxread.c (read_dbx_symtab): Update.
	* cp-support.h (cp_canonicalize_string_full)
	(cp_canonicalize_string, cp_canonicalize_string_no_typedefs):
	Return unique_xmalloc_ptr.
	* cp-support.c (inspect_type): Update.
	(cp_canonicalize_string_full): Return unique_xmalloc_ptr.
	(cp_canonicalize_string_no_typedefs, cp_canonicalize_string):
	Likewise.
	* c-typeprint.c (print_name_maybe_canonical): Update.
	* break-catch-throw.c (check_status_exception_catchpoint):
	Update.
2020-05-08 14:14:06 -06:00
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 Tromey 5b930b4538 Change how complex types are created
This patch changes how complex types are created.  init_complex_type
and arch_complex_type are unified, and complex types are reused, by
attaching them to the underlying scalar type.

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

	* stabsread.c (rs6000_builtin_type, read_sun_floating_type)
	(read_range_type): Update.
	* mdebugread.c (basic_type): Update.
	* go-lang.c (build_go_types): Use init_complex_type.
	* gdbtypes.h (struct main_type) <complex_type>: New member.
	(init_complex_type): Update.
	(arch_complex_type): Don't declare.
	* gdbtypes.c (init_complex_type): Remove "objfile" parameter.
	Make name if none given.  Use alloc_type_copy.  Look for cached
	complex type.
	(arch_complex_type): Remove.
	(gdbtypes_post_init): Use init_complex_type.
	* f-lang.c (build_fortran_types): Use init_complex_type.
	* dwarf2/read.c (read_base_type): Update.
	* d-lang.c (build_d_types): Use init_complex_type.
	* ctfread.c (read_base_type): Update.
2020-04-01 14:09:52 -06: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
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 4d4eaa3005 Make symbol_set_names a member function
This also renames it to make it clearer that this is not a cheap
function (to compute_and_set_names).  Also renames name to m_name
to make the implementation of the renamed function more readable.

Most of the places that access sym->m_name directly were also changed
to call linkage_name () instead, to make it clearer which name they
are accessing.

gdb/ChangeLog:

2019-12-26  Christian Biesinger  <cbiesinger@google.com>

	* ada-lang.c (ada_decode_symbol): Update.
	* buildsym.c (add_symbol_to_list): Update.
	* coffread.c (process_coff_symbol): Update.
	* ctfread.c (ctf_add_enum_member_cb): Update.
	(new_symbol): Update.
	(ctf_add_var_cb): Update.
	* dwarf2read.c (fixup_go_packaging): Update.
	(dwarf2_compute_name): Update.
	(new_symbol): Update.
	* jit.c (finalize_symtab): Update.
	* language.c (language_alloc_type_symbol): Update.
	* mdebugread.c (new_symbol): Update.
	* minsyms.c (minimal_symbol_reader::record_full): Update.
	(minimal_symbol_reader::install): Update.
	* psymtab.c (print_partial_symbols): Update.
	(psymbol_hash): Update.
	(psymbol_compare): Update.
	(add_psymbol_to_bcache): Update.
	(maintenance_check_psymtabs): Update.
	* stabsread.c (define_symbol): Update.
	* symtab.c (symbol_set_names): Rename to...
	(general_symbol_info::compute_and_set_names): ...this.
	(general_symbol_info::natural_name): Update.
	(general_symbol_info::search_name): Update.
	(fixup_section): Update.
	* symtab.h (struct general_symbol_info) <name>: Rename to...
	<m_name>: ...this.
	<compute_and_set_names>: Rename from...
	(symbol_set_names): ...this.
	(SYMBOL_SET_NAMES): Remove.
	(struct symbol) <ctor>: Update.

Change-Id: I8da1f10cab4e0b89f19d5750fa4e6e2ac8d2b24f
2019-12-27 01:41:35 -03:00
Christian Biesinger d3ecddab5f Use a member function to set a symbol's language
This removes symbol_set_language and SYMBOL_SET_LANGUAGE in favor of
a new function general_symbol_info::set_language. symbol and minimal_symbol
already inherit from that struct so this works naturally.

gdb/ChangeLog:

2019-12-15  Christian Biesinger  <cbiesinger@google.com>

	* ada-exp.y (write_ambiguous_var): Update.
	* coffread.c (process_coff_symbol): Update.
	* ctfread.c (ctf_add_enum_member_cb): Update.
	(new_symbol): Update.
	* dwarf2read.c (fixup_go_packaging): Update.
	(new_symbol): Update.
	* language.c (language_alloc_type_symbol): Update.
	* mdebugread.c (new_symbol): Update.
	* minsyms.c (minimal_symbol_reader::record_full): Update.
	* psymtab.c (add_psymbol_to_bcache): Update.
	* stabsread.c (define_symbol): Update.
	(read_enum_type): Update.
	* symtab.c (symbol_set_language): Make this a member function...
	(general_symbol_info::set_language): ... here.
	* symtab.h (struct general_symbol_info) <set_language>: New function.
	(SYMBOL_SET_LANGUAGE): Remove.
	(symbol_set_language): Remove.

Change-Id: Ideafb6c384004b9adef793a1192735c501da41d5
2019-12-16 00:44:58 -06:00
Christian Biesinger c1b5c1ebc9 Use an accessor function for general_symbol_info::language
Also renames the member variable to m_language to make code easier to read
when more functions become member functions.

I was originally hoping to eventually make m_language private (after a few
more patches), but unfortunately then it no longer counts as a POD type,
which means gdbsupport/poison.h won't let us use memset to initialize
this type, which psymtabs rely on to clear padding bytes so that bcache
can work properly.

gdb/ChangeLog:

2019-12-15  Christian Biesinger  <cbiesinger@google.com>

	* ada-lang.c (ada_add_block_symbols): Update.
	(ada_collect_symbol_completion_matches): Update.
	* ax-gdb.c (gen_expr): Update.
	* block.c (block_lookup_symbol): Update.
	(block_lookup_symbol_primary): Update.
	(block_find_symbol): Update.
	* cp-namespace.c (cp_lookup_symbol_imports_or_template): Update.
	* dbxread.c (process_one_symbol): Update.
	* dictionary.c (insert_symbol_hashed): Update.
	(collate_pending_symbols_by_language): Update.
	(mdict_add_symbol): Update.
	* dwarf-index-write.c (write_psymbols): Update.
	* dwarf2read.c (fixup_go_packaging): Update.
	* findvar.c (read_var_value): Update.
	* ft32-tdep.c (ft32_skip_prologue): Update.
	* go-lang.c (go_symbol_package_name): Update.
	* language.h (scoped_switch_to_sym_language_if_auto::
	scoped_switch_to_sym_language_if_auto): Update.
	* linespec.c (find_method): Update.
	(find_label_symbols_in_block): Update.
	* mdebugread.c (parse_symbol): Update.
	* mi/mi-cmd-stack.c (list_arg_or_local): Update.
	* minsyms.c (add_minsym_to_demangled_hash_table): Update.
	(minimal_symbol_reader::install): Update.
	* moxie-tdep.c (moxie_skip_prologue): Update.
	* parse.c (parse_exp_in_context): Update.
	* psymtab.c (psymbol_name_matches): Update.
	(match_partial_symbol): Update.
	(lookup_partial_symbol): Update.
	(psymbol_hash): Update.
	(psymbol_compare): Update.
	* python/py-framefilter.c (extract_sym): Update.
	(py_print_single_arg): Update.
	* stabsread.c (define_symbol): Update.
	* stack.c (print_frame_arg): Update.
	(find_frame_funname): Update.
	(info_frame_command_core): Update.
	* symfile.c (set_initial_language): Update.
	* symtab.c (symbol_set_demangled_name): Update.
	(symbol_get_demangled_name): Update.
	(symbol_set_language): Update.
	(symbol_find_demangled_name): Update.
	(symbol_set_names): Update.
	(general_symbol_info::natural_name): Update.
	(general_symbol_info::demangled_name): Update.
	(general_symbol_info::search_name): Update.
	(symbol_matches_search_name): Update.
	(eq_symbol_entry): Update.
	(iterate_over_symbols): Update.
	(completion_list_add_symbol): Update.
	(completion_list_add_msymbol): Update.
	(completion_list_add_fields): Update.
	* symtab.h (struct general_symbol_info) <language>: New function.
	<language>: Rename to...
	<m_language>: ...this.
	(SYMBOL_LANGUAGE): Remove.
	(MSYMBOL_LANGUAGE): Remove.
	(struct symbol) <ctor>: Update.
	* xstormy16-tdep.c (xstormy16_skip_prologue): Update.

Change-Id: I6464d477457e61639c63ddf8b145e407a35c235a
2019-12-16 00:44:36 -06:00
Christian Biesinger 4cbd39b289 Replace hash function from bcache with fast_hash
This function is not just slower than xxhash, it is slower than
even libiberty's iterative_hash, so there does not seem to be
a reason for it to exist.

------------------------------------------------------------
Benchmark                     Time           CPU Iterations
------------------------------------------------------------
BM_xxh3                      11 ns         11 ns   66127192
BM_xxh32                     19 ns         19 ns   36792609
BM_xxh64                     16 ns         16 ns   42941328
BM_city32                    26 ns         26 ns   27028370
BM_city64                    17 ns         17 ns   40472793
BM_iterative_hash            77 ns         77 ns    9088854
BM_bcache_hash              125 ns        125 ns    5599232

gdb/ChangeLog:

2019-12-03  Christian Biesinger  <cbiesinger@google.com>

	* bcache.c (hash): Remove.
	(hash_continue): Remove.
	* bcache.h (hash): Remove.
	(hash_continue): Remove.
	(struct bcache) <ctor>: Update.
	* psymtab.c (psymbol_hash): Update.
	* stabsread.c (hashname): Update.
	* utils.h (fast_hash): Add an argument for a start value,
	defaulting to zero.

Change-Id: I107f013eda5fdd3293326b5a206be43155dae0f8
2019-12-03 15:27:15 -06:00
Christian Biesinger 43678b0afe Replace SYMBOL_SET_LINKAGE_NAME with a member function
Easier to read, shorter, and will later make it possible to make the
name field private.

gdb/ChangeLog:

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

	* ada-exp.y (write_ambiguous_var): Replace SYMBOL_SET_LINKAGE_NAME
	with sym->set_linkage_name.
	* coffread.c (coff_read_enum_type): Likewise.
	* mdebugread.c (parse_symbol): Likewise.
	* stabsread.c (patch_block_stabs): Likewise.
	(define_symbol): Likewise.
	(read_enum_type): Likewise.
	(common_block_end): Likewise.
	* symtab.h (struct general_symbol_info) <set_linkage_name>: New
	function.
	(SYMBOL_SET_LINKAGE_NAME): Remove.
	* xcoffread.c (process_xcoff_symbol): Replace SYMBOL_SET_LINKAGE_NAME
	with sym->set_linkage_name.

Change-Id: I174a0542c014f1b035070068076308bb8ae79abb
2019-11-27 11:09:18 -06: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
Christian Biesinger 31edb80295 Change some arguments to gdb::string_view instead of name+len
Just some code cleanup. This change has a few benefits:
- Shorter argument list in the functions
- If the caller needs to calculate the string, they no longer
  need to explicitly call strlen
- It is easy to pass std::string to this (done in one place
  currently)

This also updates a couple of places that were passing 0/1 to
a bool parameter.

gdb/ChangeLog:

2019-10-29  Christian Biesinger  <cbiesinger@google.com>

	* coffread.c (record_minimal_symbol): Update.
	(process_coff_symbol): Update.
	* dbxread.c (read_dbx_symtab): Update.
	* dwarf2read.c (add_partial_symbol): Update.
	(fixup_go_packaging): Update.
	(load_partial_dies): Update.
	(new_symbol): Update.
	* elfread.c (record_minimal_symbol): Change signature to use
	gdb::string_view instead of name+len.
	(elf_symtab_read): Update.
	(elf_rel_plt_read): Update.
	* mdebugread.c (parse_partial_symbols): Update.
	(handle_psymbol_enumerators): Update.
	(new_symbol): Update.
	* minsyms.c (minimal_symbol_reader::record_full): Change signature
	to use gdb::string_view instead of name+len.
	* minsyms.h (class minimal_symbol_reader) <record_full>: Likewise.
	* psympriv.h (add_psymbol_to_list): Likewise.
	* psymtab.c (add_psymbol_to_bcache): Likewise.
	(add_psymbol_to_list): Likewise.
	* stabsread.c (define_symbol): Update.
	* symtab.c (symbol_set_names): Change signature to use gdb::string_view.
	* symtab.h (SYMBOL_SET_NAMES): Likewise.
	(symbol_set_names): Likewise.
	* xcoffread.c (scan_xcoff_symtab): Update.

Change-Id: I2675c6865e0368f9c755a1081088a53aa54dda4c
2019-10-29 14:19:59 -05:00
Tom de Vries 30baf67b65 [gdb] Fix more typos in comments (2)
Fix typos in comments.  NFC.

Tested on x86_64-linux.

gdb/ChangeLog:

2019-10-26  Tom de Vries  <tdevries@suse.de>

	* aarch64-linux-tdep.c: Fix typos in comments.
	* aarch64-tdep.c: Same.
	* ada-lang.c: Same.
	* amd64-nat.c: Same.
	* arc-tdep.c: Same.
	* arch/aarch64-insn.c: Same.
	* block.c: Same.
	* breakpoint.h: Same.
	* btrace.h: Same.
	* c-varobj.c: Same.
	* cli/cli-decode.c: Same.
	* cli/cli-script.c: Same.
	* cli/cli-utils.h: Same.
	* coff-pe-read.c: Same.
	* coffread.c: Same.
	* compile/compile-cplus-symbols.c: Same.
	* compile/compile-object-run.c: Same.
	* completer.c: Same.
	* corelow.c: Same.
	* cp-support.c: Same.
	* demangle.c: Same.
	* dwarf-index-write.c: Same.
	* dwarf2-frame.c: Same.
	* dwarf2-frame.h: Same.
	* eval.c: Same.
	* frame-base.h: Same.
	* frame.h: Same.
	* gdbcmd.h: Same.
	* gdbtypes.h: Same.
	* gnu-nat.c: Same.
	* guile/scm-objfile.c: Same.
	* i386-tdep.c: Same.
	* i386-tdep.h: Same.
	* infcall.c: Same.
	* infcall.h: Same.
	* linux-nat.c: Same.
	* m68k-tdep.c: Same.
	* macroexp.c: Same.
	* memattr.c: Same.
	* mi/mi-cmd-disas.c: Same.
	* mi/mi-getopt.h: Same.
	* mi/mi-main.c: Same.
	* minsyms.c: Same.
	* nat/aarch64-sve-linux-sigcontext.h: Same.
	* objfiles.h: Same.
	* ppc-linux-nat.c: Same.
	* ppc-linux-tdep.c: Same.
	* ppc-tdep.h: Same.
	* progspace.h: Same.
	* prologue-value.h: Same.
	* python/py-evtregistry.c: Same.
	* python/py-instruction.h: Same.
	* record-btrace.c: Same.
	* record-full.c: Same.
	* remote.c: Same.
	* rs6000-tdep.c: Same.
	* ser-tcp.c: Same.
	* sol-thread.c: Same.
	* sparc-sol2-tdep.c: Same.
	* sparc64-tdep.c: Same.
	* stabsread.c: Same.
	* symfile.c: Same.
	* symtab.h: Same.
	* target.c: Same.
	* tracepoint.c: Same.
	* tui/tui-data.h: Same.
	* tui/tui-io.c: Same.
	* tui/tui-win.c: Same.
	* tui/tui.c: Same.
	* unittests/rsp-low-selftests.c: Same.
	* user-regs.h: Same.
	* utils.c: Same.
	* utils.h: Same.
	* valarith.c: Same.
	* valops.c: Same.
	* valprint.c: Same.
	* valprint.h: Same.
	* value.c: Same.
	* value.h: Same.
	* varobj.c: Same.
	* x86-nat.h: Same.
	* xtensa-tdep.c: Same.

gdb/gdbserver/ChangeLog:

2019-10-26  Tom de Vries  <tdevries@suse.de>

	* linux-aarch64-low.c: Fix typos in comments.
	* linux-arm-low.c: Same.
	* linux-low.c: Same.
	* linux-ppc-low.c: Same.
	* proc-service.c: Same.
	* regcache.h: Same.
	* server.c: Same.
	* tracepoint.c: Same.
	* win32-low.c: Same.

gdb/stubs/ChangeLog:

2019-10-26  Tom de Vries  <tdevries@suse.de>

	* ia64vms-stub.c: Fix typos in comments.
	* m32r-stub.c: Same.
	* m68k-stub.c: Same.
	* sh-stub.c: Same.

gdb/testsuite/ChangeLog:

2019-10-26  Tom de Vries  <tdevries@suse.de>

	* gdb.base/bigcore.c: Fix typos in comments.
	* gdb.base/ctf-ptype.c: Same.
	* gdb.base/long_long.c: Same.
	* gdb.dwarf2/dw2-op-out-param.S: Same.
	* gdb.python/py-evthreads.c: Same.
	* gdb.reverse/i387-stack-reverse.c: Same.
	* gdb.trace/tfile.c: Same.
	* lib/compiler.c: Same.
	* lib/compiler.cc: Same.

Change-Id: I8573d84a577894270179ae30f46c48d806fc1beb
2019-10-26 09:55:32 +02:00
Tom de Vries 85102364b2 [gdb] Fix more typos in comments
Fix typos in comments.  NFC.

Tested on x86_64-linux.

gdb/ChangeLog:

2019-10-18  Tom de Vries  <tdevries@suse.de>

	* aarch64-tdep.c: Fix typos in comments.
	* ada-lang.c: Same.
	* ada-tasks.c: Same.
	* alpha-tdep.c: Same.
	* alpha-tdep.h: Same.
	* amd64-nat.c: Same.
	* amd64-windows-tdep.c: Same.
	* arc-tdep.c: Same.
	* arc-tdep.h: Same.
	* arch-utils.c: Same.
	* arm-nbsd-tdep.c: Same.
	* arm-tdep.c: Same.
	* ax-gdb.c: Same.
	* blockframe.c: Same.
	* btrace.c: Same.
	* c-varobj.c: Same.
	* coff-pe-read.c: Same.
	* coffread.c: Same.
	* cris-tdep.c: Same.
	* darwin-nat.c: Same.
	* dbxread.c: Same.
	* dcache.c: Same.
	* disasm.c: Same.
	* dtrace-probe.c: Same.
	* dwarf-index-write.c: Same.
	* dwarf2-frame-tailcall.c: Same.
	* dwarf2-frame.c: Same.
	* dwarf2read.c: Same.
	* eval.c: Same.
	* exceptions.c: Same.
	* fbsd-tdep.c: Same.
	* findvar.c: Same.
	* frame.c: Same.
	* frv-tdep.c: Same.
	* gnu-v3-abi.c: Same.
	* go32-nat.c: Same.
	* h8300-tdep.c: Same.
	* hppa-tdep.c: Same.
	* i386-linux-tdep.c: Same.
	* i386-tdep.c: Same.
	* ia64-libunwind-tdep.c: Same.
	* ia64-tdep.c: Same.
	* infcmd.c: Same.
	* infrun.c: Same.
	* linespec.c: Same.
	* linux-nat.c: Same.
	* linux-thread-db.c: Same.
	* machoread.c: Same.
	* mdebugread.c: Same.
	* mep-tdep.c: Same.
	* mn10300-tdep.c: Same.
	* namespace.c: Same.
	* objfiles.c: Same.
	* opencl-lang.c: Same.
	* or1k-tdep.c: Same.
	* osabi.c: Same.
	* ppc-linux-nat.c: Same.
	* ppc-linux-tdep.c: Same.
	* ppc-sysv-tdep.c: Same.
	* printcmd.c: Same.
	* procfs.c: Same.
	* record-btrace.c: Same.
	* record-full.c: Same.
	* remote-fileio.c: Same.
	* remote.c: Same.
	* rs6000-tdep.c: Same.
	* s12z-tdep.c: Same.
	* score-tdep.c: Same.
	* ser-base.c: Same.
	* ser-go32.c: Same.
	* skip.c: Same.
	* sol-thread.c: Same.
	* solib-svr4.c: Same.
	* solib.c: Same.
	* source.c: Same.
	* sparc-nat.c: Same.
	* sparc-sol2-tdep.c: Same.
	* sparc-tdep.c: Same.
	* sparc64-tdep.c: Same.
	* stabsread.c: Same.
	* stack.c: Same.
	* symfile.c: Same.
	* symtab.c: Same.
	* target-descriptions.c: Same.
	* target-float.c: Same.
	* thread.c: Same.
	* utils.c: Same.
	* valops.c: Same.
	* valprint.c: Same.
	* value.c: Same.
	* varobj.c: Same.
	* windows-nat.c: Same.
	* xcoffread.c: Same.
	* xstormy16-tdep.c: Same.
	* xtensa-tdep.c: Same.

Change-Id: I5175f1b107bfa4e1cdd4a3361ccb4739e53c75c4
2019-10-18 02:48:08 +02:00
Christian Biesinger bad5c02618 Move declaration of vtbl_ptr_name to the header.
There are conflicting comments about whether this was
introduced in GCC 2.4.5 or GCC 2.6 and I don't know
which one is correct...

gdb/ChangeLog:

2019-10-07  Christian Biesinger  <cbiesinger@google.com>

	* c-lang.h (vtbl_ptr_name): Declare.
	* cp-valprint.c (vtbl_ptr_name): Remove "extern" now that we get
	it from the header.
	* stabsread.c (define_symbol): Remove declaration of vtbl_ptr_name.
2019-10-07 17:30:22 -05:00
Tom Tromey 38583298e0 Change SYMBOL_VALUE_ADDRESS to be an rvalue
This changes SYMBOL_VALUE_ADDRESS to be an rvalue.  The symbol readers
generally assign using this, so this also introduces
SET_SYMBOL_VALUE_ADDRESS and updates the readers.  Making this change
is useful in a subsequent patch, which redefined SYMBOL_VALUE_ADDRESS.

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

	* coffread.c (process_coff_symbol): Update.
	* dwarf2read.c (var_decode_location, new_symbol): Update.
	* mdebugread.c (parse_symbol): Update.
	* objfiles.c (relocate_one_symbol): Update.
	* stabsread.c (define_symbol, fix_common_block)
	(scan_file_globals): Update.
	* symtab.h (SYMBOL_VALUE_ADDRESS): Expand to an rvalue.
	(SET_SYMBOL_VALUE_ADDRESS): New macro.
	* xcoffread.c (process_xcoff_symbol): Update.
2019-10-02 09:53:17 -06:00
Tom Tromey 0cf9feb996 Introduce obstack_strndup
This introduces obstack_strndup and changes gdb to use it.

Note that obstack_strndup works like savestring, and not exactly like
xstrndup.  The difference is that obstack_strndup uses the passed-in
length, while xstrndup uses strnlen to choose the length.

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

	* stabsread.c (patch_block_stabs, read_one_struct_field)
	(read_enum_type): Use obstack_strndup.
	* rust-exp.y (rust_parser::copy_name): Use obstack_strndup.
	* gdb_obstack.h (obstack_strndup): Use obstack_strndup.
	* dwarf2read.c (guess_full_die_structure_name)
	(anonymous_struct_prefix): Use obstack_strndup.
	* dbxread.c (cp_set_block_scope): Use obstack_strndup.
	* c-exp.y (yylex): Use obstack_strndup.
	* ada-exp.y (write_object_renaming, write_ambiguous_var)
	(write_var_or_type): Use obstack_strndup.
2019-08-06 20:08:48 -06:00
Tom Tromey efba19b06a Add obstack_strdup overload taking a std::string
This adds an obstack_strdup overload that takes a std::string, and
changes a few spots in gdb to use it.

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

	* symfile.c (reread_symbols): Use obstack_strdup.
	* stabsread.c (read_type): Use obstack_strdup.
	* gdb_obstack.h (obstack_strdup): New overload.
	* dwarf2read.c (dwarf2_compute_name, create_dwo_unit_in_dwp_v1)
	(create_dwo_unit_in_dwp_v2, build_error_marker_type)
	(dwarf2_canonicalize_name): Use obstack_strdup.
	* dbxread.c (read_dbx_symtab): Use obstack_strdup.
	* cp-support.c (inspect_type, replace_typedefs_qualified_name):
	Use obstack_strdup.
2019-08-06 20:08:48 -06:00
Tom Tromey 021887d88a Use obstack_strdup more
This changes gdb to use obstack_strdup when appropriate, rather than
the wordier obstack_copy0.

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

	* xcoffread.c (SYMNAME_ALLOC, process_xcoff_symbol): Use
	obstack_strdup.
	* typeprint.c (typedef_hash_table::find_global_typedef): Use
	obstack_strdup.
	* symfile.c (allocate_compunit_symtab): Use obstack_strdup.
	* stabsread.c (common_block_start): Use obstack_strdup.
	* objfiles.c (set_objfile_main_name, objfile): Use
	obstack_strdup.
	* namespace.c (add_using_directive): Use obstack_strdup.
	* mdebugread.c (parse_symbol, parse_type): Use obstack_strdup.
	* jit.c (finalize_symtab): Use obstack_strdup.
	* dwarf2read.c (fixup_go_packaging, dwarf2_physname)
	(guess_partial_die_structure_name, partial_die_info::fixup)
	(dwarf2_name): Use obstack_strdup.
	* coffread.c (coff_read_struct_type, coff_read_enum_type): Use
	obstack_strdup.
	* c-exp.y (scan_macro_expansion): Use obstack_strdup.
	* buildsym.c (buildsym_compunit::end_symtab_with_blockvector): Use
	obstack_strdup.
	* ada-lang.c (ada_decode_symbol): Use obstack_strdup.
2019-08-06 20:08:48 -06:00
Tom Tromey cafb34387d Remove unnecessary casts of NULL
I noticed some unnecessary casts of NULL.  This removes all the
unnecessary ones, leaving only ones where we must ensure that NULL has
pointer type for passing through varargs.

I removed a couple of useless casts of 0 that I noticed while writing
this.

Tested by rebuilding.

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

	* valops.c (value_cast, value_slice): Remove unnecessary cast.
	* breakpoint.c (stopin_command, stopat_command)
	(until_break_command, decode_location_default): Remove unnecessary
	cast.
	* utils.c (subset_compare): Remove unnecessary cast.
	* ada-lang.c (ada_update_initial_language): Remove unnecessary
	cast.
	* linespec.c (decode_line_with_last_displayed): Remove unnecessary
	cast.
	* infcmd.c (path_command): Remove unnecessary cast.
	* coffread.c (decode_type): Remove unnecessary cast.
	* xcoffread.c (read_xcoff_symtab): Remove unnecessary cast.
	* mipsread.c (mipscoff_symfile_read): Remove unnecessary cast.
	* tui/tui-stack.c (tui_show_locator_content)
	(tui_show_frame_info): Remove unnecessary cast.
	* tui/tui-win.c (tui_scroll_forward_command)
	(tui_scroll_backward_command, tui_set_focus, tui_set_win_height)
	(parse_scrolling_args): Remove unnecessary cast.
	* tui/tui-data.c (init_win_info, tui_del_window)
	(tui_free_window, tui_del_data_windows, tui_free_data_content)
	(free_content_elements): Remove unnecessary cast.
	* tui/tui-windata.c (tui_first_data_item_displayed): Remove
	unnecessary cast.
	* tui/tui-source.c (tui_set_source_content)
	(tui_vertical_source_scroll): Remove unnecessary cast.
	* tui/tui-layout.c (tui_default_win_height): Remove unnecessary
	cast.
	* tui/tui-io.c (tui_initialize_io): Remove unnecessary cast.
	* tui/tui-regs.c (tui_display_registers_from)
	(tui_display_register): Remove unnecessary cast.
	* tui/tui-wingeneral.c (tui_refresh_win, tui_delete_win)
	(tui_unhighlight_win, tui_highlight_win, tui_make_window)
	(make_visible): Remove unnecessary cast.
	* tui/tui-winsource.c (tui_erase_source_content)
	(tui_update_breakpoint_info, tui_set_exec_info_content): Remove
	unnecessary cast.
	* ax-gdb.c (agent_command_1): Remove unnecessary cast.
	* cli/cli-setshow.c (cmd_show_list): Remove unnecessary cast.
	* stabsread.c (read_type, read_array_type, read_range_type):
	Remove unnecessary cast.
	* mdebugread.c (mdebug_build_psymtabs): Remove unnecessary cast.
	(parse_symbol, parse_type, upgrade_type, parse_external)
	(parse_partial_symbols, psymtab_to_symtab_1, cross_ref): Remove
	unnecessary cast.
	* gdb_bfd.c (gdb_bfd_map_section): Remove unnecessary cast.
2019-06-16 09:59:03 -06:00
Tom Tromey d772d2abcc Convert stabsread.c to type-safe registry API
This changes stabsread.c to use the type-safe registry API.

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

	* stabsread.c (rs6000_builtin_type_data): Change type.
	(rs6000_builtin_type, _initialize_stabsread): Update.
2019-05-08 16:01:55 -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 61b3009970 Remove last cleanups from stabsread.c
This removes the last cleanups from stabsread.c.  Similar code in
dwarf2read.c was C++-ified, but considering that stabs are deprecated,
it seemed simpler to just change these allocations to use an obstack
and leave the data structures in place.

This patch renames field_info to stabs_field_info -- adding a
constructor here provoked a bug due to the resulting ODR violation.

2019-03-06  Tom Tromey  <tom@tromey.com>

	* stabsread.c (struct stabs_field_info): Rename from field_info.
	<list, fnlist>: Add initializers.
	<obstack>: New member.
	(read_member_functions, read_struct_fields, read_baseclasses):
	Allocate on obstack.  Don't use cleanups.
	(read_one_struct_field, read_member_functions, read_struct_fields)
	(read_baseclasses, read_tilde_fields, attach_fn_fields_to_type)
	(attach_fields_to_type, read_cpp_abbrev, read_member_functions)
	(read_struct_type): Update.
2019-03-06 16:04:31 -07:00
Tom Tromey d65d5705cd Remove the EXTERN define from stabsread.h
This removes the EXTERN define from stabsread.h.  This is the only
spot that still uses this approach, and it interfered with sorting the
includes in stabsread.c.

Tested by rebuilding.

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

	* stabsread.c (EXTERN): Do not define.
	(symnum, next_symbol_text_func, processing_gcc_compilation)
	(within_function, global_sym_chain, global_stabs)
	(previous_stab_code, this_object_header_files)
	(n_this_object_header_files)
	(n_allocated_this_object_header_files): Define.
	* stabsread.h (EXTERN): Never define.  Use "extern".
2019-01-22 16:00:05 -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 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
Simon Marchi 041be52673 gdb: Remove support for old mangling schemes
An upcoming sync with gcc's libiberty [1] will remove support for old
mangling schemes (GNU v2, Lucid, ARM, HP and EDG).  It will remove the
cplus_demangle_opname function, so we need to get rid of its usages in
GDB (it's a GNU v2 specific function).

I think the changes are mostly relatively obvious, some hacks that were
necessary to support overloaded operators with GNU v2 mangling are not
needed anymore.

The change in stabsread.c is perhaps less obvious.  I think we could get
rid of more code in that region that is specific to old mangling
schemes, but I chose to do only the minimal changes required to remove
the cplus_demangle_opname uses.  There is also a detailed comment just
above that explaining how GNU v2 and v3 mangled symbols are handled, I
decided to leave it as-is, since I wasn't sure which part to remove,
change or leave there.

[1] The commit "Remove support for demangling GCC 2.x era mangling
schemes.", specifically.

gdb/ChangeLog:

	* gdbtypes.c (check_stub_method_group): Remove handling of old
	mangling schemes.
	* linespec.c (find_methods): Likewise.
	* stabsread.c (read_member_functions): Likewise.
	* valops.c (search_struct_method): Likewise.
	(value_struct_elt_for_reference): Likewise.
	* NEWS: Mention this change.

gdb/testsuite/ChangeLog:

	* gdb.cp/demangle.exp (test_gnu_style_demangling): Rename to...
	(test_gnuv3_style_demangling): ... this.
	(test_lucid_style_demangling): Remove.
	(test_arm_style_demangling): Remove.
	(test_hp_style_demangling): Remove.
	(do_tests): Remove calls to the above.

gdb/doc/ChangeLog:

	* gdb.texinfo (Print Settings): Remove mention of specific
	demangle-style values, just refer to the in-process help.
2019-01-09 12:58:05 -05: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
Simon Marchi f6efe3f842 Introduce gdbarch_num_cooked_regs
The expression

  gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch)

is used quite often to find the number of cooked registers (raw + pseudo
registers).  This patch introduces gdbarch_num_cooked_regs, which does
the equivalent.  It substantially reduces required wrapping in some
places, so should improve readability.

There is a for loop in m68hc11_frame_unwind_cache that had iterated
until (the equivalent of) gdbarch_num_cooked_regs (gdbarch) - 1.  During
review, we concluded that this is most likely an off-by-one mistake, so
I replaced it with gdbarch_num_cooked_regs (gdbarch).

gdb/ChangeLog:

	* gdbarch.sh (gdbarch_num_cooked_regs): New.
	* gdbarch.h: Re-generate.
	* ax-gdb.c (gen_expr): Use gdbarch_num_cooked_regs.
	* dwarf2-frame.c (dwarf2_frame_cache): Likewise.
	* eval.c (evaluate_subexp_standard): Likewise.
	* findvar.c (value_of_register): Likewise.
	(value_of_register_lazy): Likewise.
	(address_from_register): Likewise.
	* frame.c (get_frame_register_bytes): Likewise.
	* gdbarch-selftests.c (register_to_value_test): Likewise.
	* h8300-tdep.c (h8300_register_type): Likewise.
	* i386-tdep.c (i386_dbx_reg_to_regnum): Likewise.
	(i386_svr4_reg_to_regnum): Likewise.
	* infcmd.c (default_print_registers_info): Likewise.
	(registers_info): Likewise.
	(print_vector_info): Likewise.
	(default_print_float_info): Likewise.
	* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise.
	* mdebugread.c (mdebug_reg_to_regnum): Likewise.
	* mi/mi-main.c (mi_cmd_data_list_register_names): Likewise.
	(mi_cmd_data_list_changed_registers): Likewise.
	(mi_cmd_data_list_register_values): Likewise.
	(mi_cmd_data_write_register_values): Likewise.
	(mi_cmd_trace_frame_collected): Likewise.
	* mips-tdep.c (print_gp_register_row): Likewise.
	(mips_print_registers_info): Likewise.
	* nds32-tdep.c (nds32_gdbarch_init): Likewise.
	* regcache.c (init_regcache_descr): Likewise.
	(register_size): Likewise.
	(register_dump::dump): Likewise.
	(cooked_read_test): Likewise.
	(cooked_write_test): Likewise.
	* rs6000-tdep.c (rs6000_register_sim_regno): Likewise.
	(rs6000_gdbarch_init): Likewise.
	* stabsread.c (stab_reg_to_regnum): Likewise.
	* stack.c (info_frame_command): Likewise.
	* target-descriptions.c (tdesc_register_name): Likewise.
	* trad-frame.c (trad_frame_alloc_saved_regs): Likewise.
	* tui/tui-regs.c (tui_show_register_group): Likewise.
	* user-regs.c (user_reg_map_name_to_regnum): Likewise.
	(user_reg_map_regnum_to_name): Likewise.
	(value_of_user_reg): Likewise.
	(maintenance_print_user_registers): Likewise.
	* xtensa-tdep.c (xtensa_find_register_by_name): Likewise.
	(xtensa_register_name): Likewise.
	(xtensa_register_type): Likewise.
	(xtensa_reg_to_regnum): Likewise.
	(xtensa_pseudo_register_read): Likewise.
	(xtensa_pseudo_register_write): Likewise.
2018-10-21 22:29:21 -04:00
Tom Tromey 80e649fcac Parameterize cp_scan_for_anonymous_namespaces
This changes cp_scan_for_anonymous_namespaces to use the
buildsym_compunit API, rather than the function-based API.

gdb/ChangeLog
2018-07-20  Tom Tromey  <tom@tromey.com>

	* stabsread.c (define_symbol): Update.
	* buildsym-legacy.h (get_buildsym_compunit): Declare.
	* dwarf2read.c (new_symbol): Update.
	* cp-support.h (cp_scan_for_anonymous_namespaces): Update.
	* cp-namespace.c: Include buildsym.h.
	(cp_scan_for_anonymous_namespaces): Add "compunit" parameter.
	* buildsym-legacy.c (get_buildsym_compunit): New function.
2018-07-20 09:42:53 -06:00
Tom Tromey 0baae8dbd3 Introduce buildsym-legacy.h
This introduces a new header, buildsym-legacy.h, and changes all the
symbol readers to use it.  The idea is to put the function-based
interface, that relies on the buildsym_compunit global, into a
separate header.  Then when a symbol reader is updated to use the new
interface, it can simply not include buildsym-legacy.h, so it's easy
to be sure that the new API is used everywhere.

gdb/ChangeLog
2018-07-20  Tom Tromey  <tom@tromey.com>

	* xcoffread.c: Include buildsym-legacy.h.
	* windows-nat.c: Include buildsym-legacy.h.
	* stabsread.c: Include buildsym-legacy.h.
	* mdebugread.c: Include buildsym-legacy.h.
	* buildsym-legacy.h: New file.
	* buildsym-legacy.c: New file, from buildsym.c.
	* go32-nat.c: Include buildsym-legacy.h.
	* dwarf2read.c: Include buildsym-legacy.h.
	* dbxread.c: Include buildsym-legacy.h.
	* cp-namespace.c: Include buildsym-legacy.h.
	* coffread.c: Include buildsym-legacy.h.
	* buildsym.h: Move some contents to buildsym-legacy.h.
	* buildsym.c: Include buildsym-legacy.h.  Move many functions to
	buildsym-legacy.c.
	* Makefile.in (HFILES_NO_SRCDIR): Add buildsym-legacy.h.
2018-07-20 09:42:53 -06:00
Tom Tromey e148f09d75 Move the symbol lists to buildsym_compunit
This moves the global symbol lists into buildsym_compunit, adds
accessors, and updates all the users.

gdb/ChangeLog
2018-07-20  Tom Tromey  <tom@tromey.com>

	* xcoffread.c (read_xcoff_symtab, process_xcoff_symbol): Update.
	* stabsread.c (patch_block_stabs, define_symbol, read_type)
	(read_enum_type, common_block_start, common_block_end)
	(cleanup_undefined_types_1, finish_global_stabs): Update.
	* mdebugread.c (psymtab_to_symtab_1): Update.
	* dwarf2read.c (fixup_go_packaging, read_func_scope)
	(read_lexical_block_scope, new_symbol): Update.
	* dbxread.c (process_one_symbol): Update.
	* coffread.c (coff_symtab_read, process_coff_symbol)
	(coff_read_enum_type): Update.
	* buildsym.h (file_symbols, global_symbols, local_symbols): Don't
	declare.
	(get_local_symbols, get_file_symbols, get_global_symbols): New
	functions.
	* buildsym.c (~buildsym_compunit): Clean up m_file_symbols and
	m_global_symbols.
	<m_file_symbols, m_local_symbols, m_global_symbols>: New members.
	(~scoped_free_pendings): Update.
	(finish_block, prepare_for_building, reset_symtab_globals)
	(end_symtab_get_static_block, end_symtab_with_blockvector)
	(augment_type_symtab, push_context): Update.
	(get_local_symbols, get_file_symbols, get_global_symbols): New
	functions.
	(buildsym_init): Update.
2018-07-20 09:42:46 -06:00
Tom Tromey 3c65e5b31c Move current_subfile to buildsym_compunit
This moves the global current_subfile into buildsym_compunit.

gdb/ChangeLog
2018-07-20  Tom Tromey  <tom@tromey.com>

	* xcoffread.c (process_linenos): Update.
	* stabsread.c (define_symbol, read_type, read_enum_type): Update.
	* mdebugread.c (psymtab_to_symtab_1): Update.
	* dwarf2read.c (setup_type_unit_groups)
	(lnp_state_machine::handle_set_file, dwarf_record_line_p)
	(lnp_state_machine::record_line, dwarf_decode_lines): Update.
	* dbxread.c (process_one_symbol): Update.
	* coffread.c (coff_symtab_read, enter_linenos)
	(process_coff_symbol): Update.
	* buildsym.h (current_subfile): Don't declare.
	(get_current_subfile): Declare.
	* buildsym.c (struct buildsym_compunit) <m_current_subfile>: New
	member.
	(start_subfile, free_buildsym_compunit, push_subfile)
	(prepare_for_building, start_symtab): Update.
	(get_current_subfile): New function.
2018-07-20 09:42:42 -06:00
Tom Tromey 77d6f1aa16 Move scan_file_globals declaration to stabsread.h
scan_file_globals is defined in stabsread.c, so move its declaration
to stabsread.h.

gdb/ChangeLog
2018-07-16  Tom Tromey  <tom@tromey.com>

	* stabsread.c (scan_file_globals): Update comment.
	* stabsread.h (scan_file_globals): Move from buildsym.h.
	* buildsym.h (scan_file_globals): Move to stabsread.h.
2018-07-16 08:55:19 -06:00
Tom Tromey 5985ac614d Move within_function to stabsread
The global within_function is only used by a few symbol readers.  This
patch moves the global out of buildsym and into stabsread, which
seemed like a better fit.  It also arranges for the existing readers
to clear the global at the appropriate time.

gdb/ChangeLog
2018-07-16  Tom Tromey  <tom@tromey.com>

	* stabsread.h (within_function): Move from buildsym.h.
	* stabsread.c (start_stabs): Clear within_function.
	* coffread.c (coff_start_symtab): Clear within_function.
	* buildsym.h (within_function): Move to stabsread.h.
	* buildsym.c (prepare_for_building): Update.
2018-07-16 08:55:18 -06:00
Tom Tromey 2150c3ef04 Move some code from buildsym to stabsread
A few things that currently reside in buildsym.c turn out to be
specific to the stabs reader.  This patch moves these from
buildsym.[ch] to stabsread.[ch].

gdb/ChangeLog
2018-07-16  Tom Tromey  <tom@tromey.com>

	* stabsread.h (HASHSIZE, hashname, symnum, next_symbol_text)
	(next_symbol_text_func): Move from buildsym.h.
	* stabsread.c (hashname): Move from buildsym.c.
	* buildsym.h (HASHSIZE, symnum, next_symbol_text)
	(next_symbol_text_func, hashname): Move to stabsread.h.
	* buildsym.c: Don't include bcache.h
	(hashname): Move to stasbread.c.
2018-07-16 08:55:17 -06:00