Commit Graph

95 Commits

Author SHA1 Message Date
Keith Seitz 9cdfd9a26e Change compile_instance/compile_c_instance into classes
This patch changes structs compile_instance and compile_c_instance into
classes.

Because of the nature of the change, there are a number of unavoidably
mechanical changes buried in here, such as turning variable access of the
POD struct into method calls, removing the struct keyword, and changing
access of the plugin from "c_plugin->operation()" to
"plugin ().operation ()".

There is one "non-trivial" change associated with this patch, though.
The type cache and symbol error maps have been moved into the base class,
believing these facilities would be used other language implementations.
[They are indeed re-used by C++.]

gdb/ChangeLog:

        * compile/compile-c-support.c (c_get_compile_context): Use `new'
        instead of `new_compile_instance'.
        * compile/compile-c-symbols.c (compile_instance::insert_symbol_error):
        Update description.
        If the symbol error map is not initialized, create it.
        (generate_c_for_for_one_symbol): Do not check/initialize
        the symbol error map.
        * compile/compile-c-types.c (compile_c_instance): Make a class.
        Update all callers.
        (compile_instance::compile_instance): Initialize the type cache.
        (get_cached_type): New function.
        (insert_type): Update description.
        (compile_c_instance::m_default_cflags): Define.
        (convert_type): Update description.  Use get_cached_type.
        (delete_instance): Moved to destructor.
        (new_compile_instance): Moved to constructor.
        * compile/compile-c.h (compile_c_instance): Make class inheriting
        from compile_instance.
        <base>: Remove field.
        <type_map, symbol_err_map>: Move to base class.
        <c_plugin>: Rename to `m_plugin' and remove pointer type.
        * compile/compile-internal.h (compile_instance): Make class.
        <type_map_t, symbol_err_map_t>: Define.
        <fe>: Rename to `m_gcc_fe'.
        <scope, block, gcc_target_options>: Add `m_' prefix.
        <m_type_map, m_symbol_err_map>: New fields, moved from
        compile_c_instance.
        <destroy>: Remove.
        (convert_type, new_compile_instance): Remove.
        * compile/compile.c (cleanup_compile_instance): Remove.
        (compile_to_object): Use unique_ptr to eliminate cleanups.
        (compile_instance::set_print_callback, compile_instance::version)
        (compile_instance::set_verbose)
        (compile_instance::set_driver_filename)
        (compile_instance::set_triplet_regexp)
        (compile_instance::set_arguments)
        (compile_instance::set_source_file)
        (compile_instance::compile): Define.
2018-08-10 11:14:25 -07:00
Keith Seitz 18cdc6d8f8 Add a C++ wrapper for GCC C plug-in
This patch introduces a new class which wraps the GCC C compile plug-in.
It is a little unfortunate that this all happened in between the time that
GCC moved to C++ and GDB moved to C++, leaving us with an ABI promise to
support a C-like interface.  The hope is to isolate GDB from some of this
should it change in the future.

Broadly, what this does is replace calls like:

  C_CTX (context)->c_ops->operation (C_CTX (context), ...);

with calls that now look like:

  context->c_plugin->operation (...);

This API will be further refined in following patches when struct
compile_instance/compile_c_instance are changed into classes.

gdb/ChangeLog:
        * Makefile.in (HFILES_NO_SRCDIR): Add compile/gcc-c-plugin.h.
        * compile/compile-c-types.c: Define GCC_METHODN macros and include
        gcc-c-fe.def to define C plugin.
        (delete_instance): Delete `c_plugin'.
        (new_compile_instance): Initialize `c_plugin'.
        * compile/compile-c.h: Include gcc_c_plugin.h.
        (struct compile_c_instance) <c_plugin>: New member.
        * gcc-c-plugin.h: New file.
        Update all callers with API change.
2018-08-10 11:14:25 -07:00
Keith Seitz b7dc48b4a8 Move C-related declarations to compile-c.h
This patch simply moves a bunch of C language-related declarations from
the various compile header files into a new C-specific header, compile-c.h.

gdb/ChangeLog:
        * Makefile.in (SUBDIR_GCC_COMPILE_SRCS): Move header files ...
        (HFILES_NO_SRCDIR): ... to here.
        Add compile-internal.h and compile-c.h.
        * compile/compile-c-support.c: Include compile-c.h.
        * compile/compile-c-symbols.c: Include compile-c.h.
        (generate_c_for_variable_locations): Update comment.
        * compile/compile-c-types.c: Include compile-c.h.
        * compile/compile-c.h: New file -- moved C language declarations
        from other files here.
        * compile/compile-internal.h: Do not include hashtab.h or
        common/enum-flags.h.
        (gcc_qualifiers_flags, struct compile_c_instance, C_CTX)
        (gcc_convert_symbol, gcc_symbol_address)
        (generate_c_for_variable_locations, c_get_mode_for_size)
        (c_get_range_decl_name): Definitions moved to compile-c.h.
        * compile/compile-loc2c.c: Include compile-c.h.
2018-08-10 11:14:25 -07:00
Keith Seitz 6f36b6d29f Rename symbol_substitution_name
This patch simply adds a "c_" prefix to symbol_substitution_name to clarify
that this is a C language-related function.

gdb/ChangeLog:
        * compile/compile-c-symbols.c (symbol_substitution_name): Rename to ...
        (c_symbol_substitution_name): ... this.
        Update all callers.
2018-08-10 11:14:25 -07:00
Keith Seitz bd923e5108 Return unique_xmalloc_ptr for generate_c_for_variable_locations
This patch eliminates two cleanups in compile/ by changing
generate_c_for_variable_locations so that it returns a unique_ptr.

gdb/ChangeLog:
        * compile/compile-c-support.c (c_compute_program): Use
        unique_xmalloc_ptr to eliminate cleanup.
        * compile/compile-c-symbols.c (generate_c_for_variable_locations):
        Return a unique_xmalloc_ptr and eliminate cleanup.
        * compile/compile-internal.h (generate_c_for_variable_locations):
        Return unique_xmalloc_ptr and update description.
2018-08-10 11:14:25 -07:00
Tom Tromey 8d49165d83 Simple unused variable removals
This patch holds all the straightforward unused variable deletions.

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

	* guile/scm-value.c (gdbscm_value_call): Remove unused variables.
	* guile/scm-math.c (vlscm_unop_gdbthrow, vlscm_binop_gdbthrow)
	(vlscm_convert_typed_value_from_scheme): Remove unused variable.
	* buildsym-legacy.c (get_macro_table): Remove unused variable.
	* stack.c (frame_apply_level_command): Remove unused variable.
	* tic6x-tdep.c (tic6x_push_dummy_call): Remove unused variable.
	* sparc64-tdep.c (adi_examine_command): Remove unused variable.
	* rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call): Remove
	unused variable.
	* nios2-tdep.c (nios2_push_dummy_call): Remove unused variable.
	* mep-tdep.c (mep_push_dummy_call): Remove unused variable.
	* ada-lang.c (ada_lookup_symbol_list_worker): Remove unused
	variable.
	* amd64-tdep.c (amd64_supply_xsave): Remove unused variable.
	* arm-tdep.c (arm_record_data_proc_misc_ld_str): Remove unused
	variable.
	* breakpoint.c (check_no_tracepoint_commands, update_watchpoint):
	Remove unused variable.
	* cli/cli-script.c (recurse_read_control_structure): Remove unused
	variable.
	* common/tdesc.c (print_xml_feature::visit): Remove unused
	variable.
	* compile/compile-object-load.c (store_regs): Remove unused
	variables.
	* complaints.c (clear_complaints): Remove unused variable.
	* corelow.c (core_target_open): Remove unused variable.
	* fbsd-tdep.c (fbsd_core_info_proc_status): Remove unused
	variable.
	* guile/scm-frame.c (gdbscm_frame_read_var): Remove unused
	variable.
	* guile/scm-symtab.c (stscm_print_sal_smob): Remove unused
	variable.
	* guile/scm-type.c (gdbscm_field_baseclass_p): Remove unused
	variable.
	* guile/scm-utils.c (gdbscm_parse_function_args): Remove unused
	variable.
	* hppa-tdep.c (hppa_stub_frame_unwind_cache): Remove unused
	variable.
	* ia64-tdep.c (examine_prologue): Remove unused variable.
	* infcall.c (run_inferior_call): Remove unused variable.
	* inferior.c (exit_inferior): Remove unused variable.
	* infrun.c (infrun_thread_ptid_changed): Remove unused variable.
	* linespec.c (decode_line_2): Remove unused variable.
	* linux-nat.c (super_close): Remove.
	* linux-tdep.c (linux_info_proc): Remove unused variable.
	* mi/mi-main.c (mi_execute_command): Remove unused variable.
	* microblaze-linux-tdep.c (microblaze_linux_sigtramp_cache):
	Remove unused variable.
	* parse.c (find_minsym_type_and_address): Remove unused variable.
	* printcmd.c (info_symbol_command, printf_floating): Remove unused
	variable.
	* python/py-breakpoint.c (bppy_set_commands): Remove unused
	variable.
	* python/py-unwind.c (unwind_infopy_dealloc): Remove unused
	variables.
	* record-btrace.c (record_btrace_target::store_registers): Remove
	unused variable.
	(cmd_show_record_btrace_cpu): Remove unused variable.
	* riscv-tdep.c (riscv_register_reggroup_p)
	(riscv_push_dummy_call, riscv_return_value): Remove unused
	variable.
	* rust-exp.y (literal): Remove unused variable.
	* rust-lang.c (rust_evaluate_subexp) <OP_RUST_ARARAY>: Remove
	unused variable.
	<STRUCTOP_ANONYMOUS>: Likewise.
	* s390-linux-tdep.c (s390_linux_init_abi_31)
	(s390_linux_init_abi_64): Remove unused variable.
	* ser-ming2.c (ser_windows_read_prim, pipe_select_thread)
	(file_select_thread, net_windows_open, _initialize_ser_windows):
	Remove unused variables.
	* symtab.c (find_pc_sect_line): Remove unused variable.
	* target-memory.c (compute_garbled_blocks): Remove unused
	variable.
	(target_write_memory_blocks): Remove unused variable.
	* target.c (target_stack::unpush): Remove unused variables.
	* tracepoint.c (start_tracing, all_tracepoint_actions)
	(merge_uploaded_trace_state_variables)
	(print_one_static_tracepoint_marker): Remove unused variable.
	* unittests/basic_string_view/element_access/char/1.cc (test01):
	Remove unused variable.
	* windows-nat.c (windows_continue, windows_add_all_dlls)
	(do_initial_windows_stuff, windows_nat_target::create_inferior):
	Remove unused variables.
2018-07-22 13:20:01 -06:00
Pedro Alves 00431a78b2 Use thread_info and inferior pointers more throughout
This is more preparation bits for multi-target support.

In a multi-target scenario, we need to address the case of different
processes/threads running on different targets that happen to have the
same PID/PTID.  E.g., we can have both process 123 in target 1, and
process 123 in target 2, while they're in reality different processes
running on different machines.  Or maybe we've loaded multiple
instances of the same core file.  Etc.

To address this, in my WIP multi-target branch, threads and processes
are uniquely identified by the (process_stratum target_ops *, ptid_t)
and (process_stratum target_ops *, pid) tuples respectively.  I.e.,
each process_stratum instance has its own thread/process number space.

As you can imagine, that requires passing around target_ops * pointers
in a number of functions where we're currently passing only a ptid_t
or an int.  E.g., when we look up a thread_info object by ptid_t in
find_thread_ptid, the ptid_t alone isn't sufficient.

In many cases though, we already have the thread_info or inferior
pointer handy, but we "lose" it somewhere along the call stack, only
to look it up again by ptid_t/pid.  Since thread_info or inferior
objects know their parent target, if we pass around thread_info or
inferior pointers when possible, we avoid having to add extra
target_ops parameters to many functions, and also, we eliminate a
number of by ptid_t/int lookups.

So that's what this patch does.  In a bit more detail:

- Changes a number of functions and methods to take a thread_info or
  inferior pointer instead of a ptid_t or int parameter.

- Changes a number of structure fields from ptid_t/int to inferior or
  thread_info pointers.

- Uses the inferior_thread() function whenever possible instead of
  inferior_ptid.

- Uses thread_info pointers directly when possible instead of the
  is_running/is_stopped etc. routines that require a lookup.

- A number of functions are eliminated along the way, such as:

  int valid_gdb_inferior_id (int num);
  int pid_to_gdb_inferior_id (int pid);
  int gdb_inferior_id_to_pid (int num);
  int in_inferior_list (int pid);

- A few structures and places hold a thread_info pointer across
  inferior execution, so now they take a strong reference to the
  (refcounted) thread_info object to avoid the thread_info pointer
  getting stale.  This is done in enable_thread_stack_temporaries and
  in the infcall.c code.

- Related, there's a spot in infcall.c where using a RAII object to
  handle the refcount would be handy, so a gdb::ref_ptr specialization
  for thread_info is added (thread_info_ref, in gdbthread.h), along
  with a gdb_ref_ptr policy that works for all refcounted_object types
  (in common/refcounted-object.h).

gdb/ChangeLog:
2018-06-21  Pedro Alves  <palves@redhat.com>

	* ada-lang.h (ada_get_task_number): Take a thread_info pointer
	instead of a ptid_t.  All callers adjusted.
	* ada-tasks.c (ada_get_task_number): Likewise.  All callers
	adjusted.
	(print_ada_task_info, display_current_task_id, task_command_1):
	Adjust.
	* breakpoint.c (watchpoint_in_thread_scope): Adjust to use
	inferior_thread.
	(breakpoint_kind): Adjust.
	(remove_breakpoints_pid): Rename to ...
	(remove_breakpoints_inf): ... this.  Adjust to take an inferior
	pointer.  All callers adjusted.
	(bpstat_clear_actions): Use inferior_thread.
	(get_bpstat_thread): New.
	(bpstat_do_actions): Use it.
	(bpstat_check_breakpoint_conditions, bpstat_stop_status): Adjust
	to take a thread_info pointer.  All callers adjusted.
	(set_longjmp_breakpoint_for_call_dummy, set_momentary_breakpoint)
	(breakpoint_re_set_thread): Use inferior_thread.
	* breakpoint.h (struct inferior): Forward declare.
	(bpstat_stop_status): Update.
	(remove_breakpoints_pid): Delete.
	(remove_breakpoints_inf): New.
	* bsd-uthread.c (bsd_uthread_target::wait)
	(bsd_uthread_target::update_thread_list): Use find_thread_ptid.
	* btrace.c (btrace_add_pc, btrace_enable, btrace_fetch)
	(maint_btrace_packet_history_cmd)
	(maint_btrace_clear_packet_history_cmd): Adjust.
	(maint_btrace_clear_cmd, maint_info_btrace_cmd): Adjust to use
	inferior_thread.
	* cli/cli-interp.c: Include "inferior.h".
	* common/refcounted-object.h (struct
	refcounted_object_ref_policy): New.
	* compile/compile-object-load.c: Include gdbthread.h.
	(store_regs): Use inferior_thread.
	* corelow.c (core_target::close): Use current_inferior.
	(core_target_open): Adjust to use first_thread_of_inferior and use
	the current inferior.
	* ctf.c (ctf_target::close): Adjust to use current_inferior.
	* dummy-frame.c (dummy_frame_id) <ptid>: Delete, replaced by ...
	<thread>: ... this new field.  All references adjusted.
	(dummy_frame_pop, dummy_frame_discard, register_dummy_frame_dtor):
	Take a thread_info pointer instead of a ptid_t.
	* dummy-frame.h (dummy_frame_push, dummy_frame_pop)
	(dummy_frame_discard, register_dummy_frame_dtor): Take a
	thread_info pointer instead of a ptid_t.
	* elfread.c: Include "inferior.h".
	(elf_gnu_ifunc_resolver_stop, elf_gnu_ifunc_resolver_return_stop):
	Use inferior_thread.
	* eval.c (evaluate_subexp): Likewise.
	* frame.c (frame_pop, has_stack_frames, find_frame_sal): Use
	inferior_thread.
	* gdb_proc_service.h (struct thread_info): Forward declare.
	(struct ps_prochandle) <ptid>: Delete, replaced by ...
	<thread>: ... this new field.  All references adjusted.
	* gdbarch.h, gdbarch.c: Regenerate.
	* gdbarch.sh (get_syscall_number): Replace 'ptid' parameter with a
	'thread' parameter.  All implementations and callers adjusted.
	* gdbthread.h (thread_info) <set_running>: New method.
	(delete_thread, delete_thread_silent): Take a thread_info pointer
	instead of a ptid.
	(global_thread_id_to_ptid, ptid_to_global_thread_id): Delete.
	(first_thread_of_process): Delete, replaced by ...
	(first_thread_of_inferior): ... this new function.  All callers
	adjusted.
	(any_live_thread_of_process): Delete, replaced by ...
	(any_live_thread_of_inferior): ... this new function.  All callers
	adjusted.
	(switch_to_thread, switch_to_no_thread): Declare.
	(is_executing): Delete.
	(enable_thread_stack_temporaries): Update comment.
	<enable_thread_stack_temporaries>: Take a thread_info pointer
	instead of a ptid_t.  Incref the thread.
	<~enable_thread_stack_temporaries>: Decref the thread.
	<m_ptid>: Delete
	<m_thr>: New.
	(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
	(get_last_thread_stack_temporary)
	(value_in_thread_stack_temporaries, can_access_registers_thread):
	Take a thread_info pointer instead of a ptid_t.  All callers
	adjusted.
	* infcall.c (get_call_return_value): Use inferior_thread.
	(run_inferior_call): Work with thread pointers instead of ptid_t.
	(call_function_by_hand_dummy): Work with thread pointers instead
	of ptid_t.  Use thread_info_ref.
	* infcmd.c (proceed_thread_callback): Access thread's state
	directly.
	(ensure_valid_thread, ensure_not_running): Use inferior_thread,
	access thread's state directly.
	(continue_command): Use inferior_thread.
	(info_program_command): Use find_thread_ptid and access thread
	state directly.
	(proceed_after_attach_callback): Use thread state directly.
	(notice_new_inferior): Take a thread_info pointer instead of a
	ptid_t.  All callers adjusted.
	(exit_inferior): Take an inferior pointer instead of a pid.  All
	callers adjusted.
	(exit_inferior_silent): New.
	(detach_inferior): Delete.
	(valid_gdb_inferior_id, pid_to_gdb_inferior_id)
	(gdb_inferior_id_to_pid, in_inferior_list): Delete.
	(detach_inferior_command, kill_inferior_command): Use
	find_inferior_id instead of valid_gdb_inferior_id and
	gdb_inferior_id_to_pid.
	(inferior_command): Use inferior and thread pointers.
	* inferior.h (struct thread_info): Forward declare.
	(notice_new_inferior): Take a thread_info pointer instead of a
	ptid_t.  All callers adjusted.
	(detach_inferior): Delete declaration.
	(exit_inferior, exit_inferior_silent): Take an inferior pointer
	instead of a pid.  All callers adjusted.
	(gdb_inferior_id_to_pid, pid_to_gdb_inferior_id, in_inferior_list)
	(valid_gdb_inferior_id): Delete.
	* infrun.c (follow_fork_inferior, proceed_after_vfork_done)
	(handle_vfork_child_exec_or_exit, follow_exec): Adjust.
	(struct displaced_step_inferior_state) <pid>: Delete, replaced by
	...
	<inf>: ... this new field.
	<step_ptid>: Delete, replaced by ...
	<step_thread>: ... this new field.
	(get_displaced_stepping_state): Take an inferior pointer instead
	of a pid.  All callers adjusted.
	(displaced_step_in_progress_any_inferior): Adjust.
	(displaced_step_in_progress_thread): Take a thread pointer instead
	of a ptid_t.  All callers adjusted.
	(displaced_step_in_progress, add_displaced_stepping_state): Take
	an inferior pointer instead of a pid.  All callers adjusted.
	(get_displaced_step_closure_by_addr): Adjust.
	(remove_displaced_stepping_state): Take an inferior pointer
	instead of a pid.  All callers adjusted.
	(displaced_step_prepare_throw, displaced_step_prepare)
	(displaced_step_fixup): Take a thread pointer instead of a ptid_t.
	All callers adjusted.
	(start_step_over): Adjust.
	(infrun_thread_ptid_changed): Remove bit updating ptids in the
	displaced step queue.
	(do_target_resume): Adjust.
	(fetch_inferior_event): Use inferior_thread.
	(context_switch, get_inferior_stop_soon): Take an
	execution_control_state pointer instead of a ptid_t.  All callers
	adjusted.
	(switch_to_thread_cleanup): Delete.
	(stop_all_threads): Use scoped_restore_current_thread.
	* inline-frame.c: Include "gdbthread.h".
	(inline_state) <inline_state>: Take a thread pointer instead of a
	ptid_t.  All callers adjusted.
	<ptid>: Delete, replaced by ...
	<thread>: ... this new field.
	(find_inline_frame_state): Take a thread pointer instead of a
	ptid_t.  All callers adjusted.
	(skip_inline_frames, step_into_inline_frame)
	(inline_skipped_frames, inline_skipped_symbol): Take a thread
	pointer instead of a ptid_t.  All callers adjusted.
	* inline-frame.h (skip_inline_frames, step_into_inline_frame)
	(inline_skipped_frames, inline_skipped_symbol): Likewise.
	* linux-fork.c (delete_checkpoint_command): Adjust to use thread
	pointers directly.
	* linux-nat.c (get_detach_signal): Likewise.
	* linux-thread-db.c (thread_from_lwp): New 'stopped' parameter.
	(thread_db_notice_clone): Adjust.
	(thread_db_find_new_threads_silently)
	(thread_db_find_new_threads_2, thread_db_find_new_threads_1): Take
	a thread pointer instead of a ptid_t.  All callers adjusted.
	* mi/mi-cmd-var.c: Include "inferior.h".
	(mi_cmd_var_update_iter): Update to use thread pointers.
	* mi/mi-interp.c (mi_new_thread): Update to use the thread's
	inferior directly.
	(mi_output_running_pid, mi_inferior_count): Delete, bits factored
	out to ...
	(mi_output_running): ... this new function.
	(mi_on_resume_1): Adjust to use it.
	(mi_user_selected_context_changed): Adjust to use inferior_thread.
	* mi/mi-main.c (proceed_thread): Adjust to use thread pointers
	directly.
	(interrupt_thread_callback): : Adjust to use thread and inferior
	pointers.
	* proc-service.c: Include "gdbthread.h".
	(ps_pglobal_lookup): Adjust to use the thread's inferior directly.
	* progspace-and-thread.c: Include "inferior.h".
	* progspace.c: Include "inferior.h".
	* python/py-exitedevent.c (create_exited_event_object): Adjust to
	hold a reference to an inferior_object.
	* python/py-finishbreakpoint.c (bpfinishpy_init): Adjust to use
	inferior_thread.
	* python/py-inferior.c (struct inferior_object): Give the type a
	tag name instead of a typedef.
	(python_on_normal_stop): No need to check if the current thread is
	listed.
	(inferior_to_inferior_object): Change return type to
	inferior_object.  All callers adjusted.
	(find_thread_object): Delete, bits factored out to ...
	(thread_to_thread_object): ... this new function.
	* python/py-infthread.c (create_thread_object): Use
	inferior_to_inferior_object.
	(thpy_is_stopped): Use thread pointer directly.
	(gdbpy_selected_thread): Use inferior_thread.
	* python/py-record-btrace.c (btpy_list_object) <ptid>: Delete
	field, replaced with ...
	<thread>: ... this new field.  All users adjusted.
	(btpy_insn_or_gap_new): Drop const.
	(btpy_list_new): Take a thread pointer instead of a ptid_t.  All
	callers adjusted.
	* python/py-record.c: Include "gdbthread.h".
	(recpy_insn_new, recpy_func_new): Take a thread pointer instead of
	a ptid_t.  All callers adjusted.
	(gdbpy_current_recording): Use inferior_thread.
	* python/py-record.h (recpy_record_object) <ptid>: Delete
	field, replaced with ...
	<thread>: ... this new field.  All users adjusted.
	(recpy_element_object) <ptid>: Delete
	field, replaced with ...
	<thread>: ... this new field.  All users adjusted.
	(recpy_insn_new, recpy_func_new): Take a thread pointer instead of
	a ptid_t.  All callers adjusted.
	* python/py-threadevent.c: Include "gdbthread.h".
	(get_event_thread): Use thread_to_thread_object.
	* python/python-internal.h (struct inferior_object): Forward
	declare.
	(find_thread_object, find_inferior_object): Delete declarations.
	(thread_to_thread_object, inferior_to_inferior_object): New
	declarations.
	* record-btrace.c: Include "inferior.h".
	(require_btrace_thread): Use inferior_thread.
	(record_btrace_frame_sniffer)
	(record_btrace_tailcall_frame_sniffer): Use inferior_thread.
	(get_thread_current_frame): Use scoped_restore_current_thread and
	switch_to_thread.
	(get_thread_current_frame): Use thread pointer directly.
	(record_btrace_replay_at_breakpoint): Use thread's inferior
	pointer directly.
	* record-full.c: Include "inferior.h".
	* regcache.c: Include "gdbthread.h".
	(get_thread_arch_regcache): Use the inferior's address space
	directly.
	(get_thread_regcache, registers_changed_thread): New.
	* regcache.h (get_thread_regcache(thread_info *thread)): New
	overload.
	(registers_changed_thread): New.
	(remote_target) <remote_detach_1>: Swap order of parameters.
	(remote_add_thread): <remote_add_thread>: Return the new thread.
	(get_remote_thread_info(ptid_t)): New overload.
	(remote_target::remote_notice_new_inferior): Use thread pointers
	directly.
	(remote_target::process_initial_stop_replies): Use
	thread_info::set_running.
	(remote_target::remote_detach_1, remote_target::detach)
	(extended_remote_target::detach): Adjust.
	* stack.c (frame_show_address): Use inferior_thread.
	* target-debug.h (target_debug_print_thread_info_pp): New.
	* target-delegates.c: Regenerate.
	* target.c (default_thread_address_space): Delete.
	(memory_xfer_partial_1): Use current_inferior.
	(target_detach): Use current_inferior.
	(target_thread_address_space): Delete.
	(generic_mourn_inferior): Use current_inferior.
	* target.h (struct target_ops) <thread_address_space>: Delete.
	(target_thread_address_space): Delete.
	* thread.c (init_thread_list): Use ALL_THREADS_SAFE.  Use thread
	pointers directly.
	(delete_thread_1, delete_thread, delete_thread_silent): Take a
	thread pointer instead of a ptid_t.  Adjust all callers.
	(ptid_to_global_thread_id, global_thread_id_to_ptid): Delete.
	(first_thread_of_process): Delete, replaced by ...
	(first_thread_of_inferior): ... this new function.  All callers
	adjusted.
	(any_thread_of_process): Rename to ...
	(any_thread_of_inferior): ... this, and take an inferior pointer.
	(any_live_thread_of_process): Rename to ...
	(any_live_thread_of_inferior): ... this, and take an inferior
	pointer.
	(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
	(value_in_thread_stack_temporaries)
	(get_last_thread_stack_temporary): Take a thread pointer instead
	of a ptid_t.  Adjust all callers.
	(thread_info::set_running): New.
	(validate_registers_access): Use inferior_thread.
	(can_access_registers_ptid): Rename to ...
	(can_access_registers_thread): ... this, and take a thread
	pointer.
	(print_thread_info_1): Adjust to compare thread pointers instead
	of ptids.
	(switch_to_no_thread, switch_to_thread): Make extern.
	(scoped_restore_current_thread::~scoped_restore_current_thread):
	Use m_thread pointer directly.
	(scoped_restore_current_thread::scoped_restore_current_thread):
	Use inferior_thread.
	(thread_command): Use thread pointer directly.
	(thread_num_make_value_helper): Use inferior_thread.
	* top.c (execute_command): Use inferior_thread.
	* tui/tui-interp.c: Include "inferior.h".
	* varobj.c (varobj_create): Use inferior_thread.
	(value_of_root_1): Use find_thread_global_id instead of
	global_thread_id_to_ptid.
2018-06-21 17:09:31 +01:00
Tom Tromey 12973681f5 Use counted_command_line everywhere
Currently command lines are reference counted using shared_ptr only
when attached to breakpoints.  This patch changes gdb to use
shared_ptr in commands as well.  This allows for the removal of
copy_command_lines.

Note that the change to execute_user_command explicitly makes a new
reference to the command line.  This will be used in a later patch.

This simplifies struct command_line based on the observation that a
given command can have at most two child bodies: an "if" can have both
"then" and "else" parts.  Perhaps the names I've chosen for the
replacements here are not very good -- your input requested.

ChangeLog
2018-05-04  Tom Tromey  <tom@tromey.com>

	* tracepoint.c (all_tracepoint_actions): Rename from
	all_tracepoint_actions_and_cleanup.  Change return type.
	(actions_command, encode_actions_1, encode_actions)
	(trace_dump_actions, tdump_command): Update.
	* remote.c (remote_download_command_source): Update.
	* python/python.c (gdbpy_eval_from_control_command)
	(python_command, python_interactive_command): Update.
	* mi/mi-cmd-break.c (mi_cmd_break_commands): Update.
	* guile/guile.c (guile_command)
	(gdbscm_eval_from_control_command, guile_command): Update.
	* compile/compile.c (compile_code_command)
	(compile_print_command, compile_to_object): Update.
	* cli/cli-script.h (struct command_lines_deleter): New.
	(counted_command_line): New typedef.
	(struct command_line): Add constructor, destructor.
	<body_list>: Remove.
	<body_list_0, body_list_1>: New members.
	(command_line_up): Remove typedef.
	(read_command_lines, read_command_lines_1, get_command_line):
	Update.
	(copy_command_lines): Don't declare.
	* cli/cli-script.c (build_command_line): Use "new".
	(get_command_line): Return counted_command_line.
	(print_command_lines, execute_user_command)
	(execute_control_command_1, while_command, if_command): Update.
	(realloc_body_list): Remove.
	(process_next_line, recurse_read_control_structure): Update.
	(read_command_lines, read_command_lines_1): Return counted_command_line.
	(free_command_lines): Use "delete".
	(copy_command_lines): Remove.
	(define_command, document_command, show_user_1): Update.
	* cli/cli-decode.h (struct cmd_list_element) <user_commands>: Now
	a counted_command_line.
	* breakpoint.h (counted_command_line): Remove typedef.
	(breakpoint_set_commands): Update.
	* breakpoint.c (check_no_tracepoint_commands)
	(validate_commands_for_breakpoint): Update.
	(breakpoint_set_commands): Change commands to be a
	counted_command_line.
	(commands_command_1, update_dprintf_command_list)
	(create_tracepoint_from_upload): Update.
2018-05-04 15:58:06 -06:00
Alexandre Oliva 476d250ee8 Add libcc1 v1 compatibility to C compile feature
This patch adds v1 compatibiltiy to the C compile feature.  The only change
in v1 concerns the handling of integer types, which permits GDB to specify
the built-in name for the type.

As far as I know, the C frontend is still on v0, so this patch is purely
precautionary. [By default C++ compile uses the equivalent of the C
frontend's int_type and float_type (aka the "v1" versions).]

gdb/ChangeLog:

	* compile/compile-c-types.c (convert_int, convert_float):
	Update for C FE v1.
2018-04-27 12:36:19 -07:00
Sergio Durigan Junior b4987c956d Create new common/pathstuff.[ch]
This commit moves the path manipulation routines found on utils.c to a
new common/pathstuff.c, and updates the Makefile.in's accordingly.
The routines moved are "gdb_realpath", "gdb_realpath_keepfile" and
"gdb_abspath".

This will be needed because gdbserver will have to call "gdb_abspath"
on my next patch, which implements a way to expand the path of the
inferior provided by the user in order to allow specifying just the
binary name when starting gdbserver, like:

  $ gdbserver :1234 a.out

With the recent addition of the startup-with-shell feature on
gdbserver, this scenario doesn't work anymore if the user doesn't have
the current directory listed in the PATH variable.

I had to do a minor adjustment on "gdb_abspath" because we don't have
access to "tilde_expand" on gdbserver, so now the function is using
"gdb_tilde_expand" instead.  Otherwise, the code is the same.

Regression tested on the BuildBot, without regressions.

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

	* Makefile.in (COMMON_SFILES): Add "common/pathstuff.c".
	(HFILES_NO_SRCDIR): Add "common/pathstuff.h".
	* auto-load.c: Include "common/pathstuff.h".
	* common/common-def.h (current_directory): Move here.
	* common/gdb_tilde_expand.c (gdb_tilde_expand_up): New
	function.
	* common/gdb_tilde_expand.h (gdb_tilde_expand_up): New
	prototype.
	* common/pathstuff.c: New file.
	* common/pathstuff.h: New file.
	* compile/compile.c: Include "common/pathstuff.h".
	* defs.h (current_directory): Move to "common/common-defs.h".
	* dwarf2read.c: Include "common/pathstuff.h".
	* exec.c: Likewise.
	* guile/scm-safe-call.c: Likewise.
	* linux-thread-db.c: Likewise.
	* main.c: Likewise.
	* nto-tdep.c: Likewise.
	* objfiles.c: Likewise.
	* source.c: Likewise.
	* symtab.c: Likewise.
	* utils.c: Include "common/pathstuff.h".
	(gdb_realpath): Move to "common/pathstuff.c".
	(gdb_realpath_keepfile): Likewise.
	(gdb_abspath): Likewise.
	* utils.h (gdb_realpath): Move to "common/pathstuff.h".
	(gdb_realpath_keepfile): Likewise.
	(gdb_abspath): Likewise.

gdb/gdbserver/ChangeLog:
2018-02-28  Sergio Durigan Junior  <sergiodj@redhat.com>

	* Makefile.in (SFILES): Add "$(srcdir)/common/pathstuff.c".
	(OBJS): Add "pathstuff.o".
	* server.c (current_directory): New global variable.
	(captured_main): Initialize "current_directory".
2018-02-28 11:34:39 -05:00
Phil Muldoon e05cac70d8 Update get_args documentation
This patch adds argument compilation documentation, expanding on the
already existing comments, giving a more thorough explanation of
the source of the arguments used in the final argument string.

gdb/ChangeLog:

	* compile/compile.c (get_args): Add additional comments
	explaining function.
2018-02-27 12:53:41 -08:00
Tom Tromey f6c2623eb8 Return unique_xmalloc_ptr from macro scope functions
This changes the macro scope functions (sal_macro_scope,
user_macro_scope, and default_macro_scope) to return a
unique_xmalloc_ptr, then fixes up the users.  This allowed for the
removal of several cleanups.

2018-02-08  Tom Tromey  <tom@tromey.com>

	* symtab.c (default_collect_symbol_completion_matches_break_on):
	Use unique_xmalloc_ptr.
	* macroscope.h: (sal_macro_scope, user_macro_scope)
	(default_macro_scope): Return unique_xmalloc_ptr.
	* macroscope.c (sal_macro_scope, user_macro_scope)
	(default_macro_scope): Return unique_xmalloc_ptr.
	* macroexp.h (macro_expand, macro_expand_once): Return
	unique_xmalloc_ptr.
	* macroexp.c (macro_expand, macro_expand_once): Return
	unique_xmalloc_ptr.
	* macrocmd.c (macro_expand_command, macro_expand_once_command)
	(info_macro_command, info_macros_command): Use
	unique_xmalloc_ptr.
	* compile/compile-c-support.c (write_macro_definitions): Use
	unique_xmalloc_ptr.
	* c-exp.y (c_parse): Use unique_xmalloc_ptr.
2018-02-08 11:46:55 -07:00
Sergio Durigan Junior 7d937cad0a Fix warning on gdb/compile/compile.c (C++-ify "triplet_rx")
This fixes a GCC warning that happens when compiling
gdb/compile/compile.c on some GCC versions (e.g., "gcc (GCC) 7.2.1
20180104 (Red Hat 7.2.1-6)"):

../../gdb/compile/compile.c: In function 'void eval_compile_command(command_line*, const char*, compile_i_scope_types, void*)':
../../gdb/compile/compile.c:548:19: warning: 'triplet_rx' may be used uninitialized in this function [-Wmaybe-uninitialized]
     error_message = compiler->fe->ops->set_arguments_v0 (compiler->fe, triplet_rx,
     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         argc, argv);
         ~~~~~~~~~~~
../../gdb/compile/compile.c:466:9: note: 'triplet_rx' was declared here
   char *triplet_rx;
         ^~~~~~~~~~

It's a simple patch that converts "triplet_rx" from "char *" to
"std::string", thus guaranteeing that it will be always initialized.

I've regtested this patch and did not find any regressions.  OK to
apply on both master and 8.1 (after creating a bug for it)?

gdb/ChangeLog:
2018-01-17  Sergio Durigan Junior  <sergiodj@redhat.com>

	* compile/compile.c (compile_to_object): Convert "triplet_rx"
	to "std::string".
2018-01-17 18:05:42 -05:00
Pedro Alves de63c46b54 Fix regresssion(internal-error) printing subprogram argument (PR gdb/22670)
At <https://sourceware.org/ml/gdb-patches/2017-12/msg00298.html>, Joel
wrote:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider the following code which first declares a tagged type (the
equivalent of a class in Ada), and then a procedure which takes a
pointer (access) to this type's 'Class.

    package Pck is
       type Top_T is tagged record
          N : Integer := 1;
       end record;
       procedure Inspect (Obj: access Top_T'Class);
    end Pck;

Putting a breakpoint in that procedure and then running to it triggers
an internal error:

    (gdb) break inspect
    (gdb) continue
    Breakpoint 1, pck.inspect (obj=0x63e010
    /[...]/gdb/stack.c:621: internal-error: void print_frame_args(symbol*, frame_info*, int, ui_file*): Assertion `nsym != NULL' failed.

What's special about this subprogram is that it takes an access to
what we call a 'Class type, and for implementation reasons, the
compiler adds an extra argument named "objL". If you are curious why,
it allows the compiler for perform dynamic accessibility checks that
are mandated by the language.

If we look at the location where we get the internal error (in
stack.c), we find that we are looping over the symbol of each
parameter, and for each parameter, we do:

    /* We have to look up the symbol because arguments can have
       two entries (one a parameter, one a local) and the one we
       want is the local, which lookup_symbol will find for us.
    [...]
        nsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
                              b, VAR_DOMAIN, NULL).symbol;
        gdb_assert (nsym != NULL);

The lookup_symbol goes through the lookup structure, which means the
symbol's linkage name ("objL") gets transformed into a
lookup_name_info object (in block_lookup_symbol), before it gets fed
to the block symbol dictionary iterators.  This, in turn, triggers the
symbol matching by comparing the "lookup" name which, for Ada, means
among other things, lowercasing the given name to "objl".  It is this
transformation that causes the lookup find no matches, and therefore
trip this assertion.

Going back to the "offending" call to lookup_symbol in stack.c, what
we are trying to do, here, is do a lookup by linkage name.  So, I
think what we mean to be doing is a completely literal symbol lookup,
so maybe not even strcmp_iw, but actually just plain strcmp???

In the past, in practice, you could get that effect by doing a lookup
using the C language. But that doesn't work, because we still end up
somehow using Ada's lookup_name routine which transforms "objL".

So, ideally, as I hinted before, I think what we need is a way to
perform a literal lookup so that searches by linkage names like the
above can be performed.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This commit fixes the problem by implementing something similar to
Joel's literal idea, but with some important differences.

I considered adding a symbol_name_match_type::LINKAGE and supporting
searching by linkage name for any language, but the problem with that
is that the dictionaries only work with SYMBOL_SEARCH_NAME, because
that's what is used for hashing.  We'd need separate dictionaries for
hashed linkage names.

So with the current symbol tables infrastructure, it's not literal
linkage names that we want to pass down, but instead literal _search_
names (SYMBOL_SEARCH_NAME, etc.).

However, psymbols have no overload/function parameter info in C++, so
a straight strcmp doesn't work properly for C++ name matching.

So what we do is be a little less aggressive then and add a new
symbol_name_match_type::SEARCH_SYMBOL instead that takes as input a
non-user-input search symbol, and then we skip any decoding/demangling
steps and make:

 - Ada treat that as a verbatim match,
 - other languages treat it as symbol_name_match_type::FULL.

This also fixes the new '"maint check-psymtabs" for Ada' testcase for
me (gdb.ada/maint_with_ada.exp).  I've not removed the kfail yet
because Joel still sees that testcase failing with this patch.
That'll be fixed in follow up patches.

gdb/ChangeLog:
2018-01-05  Pedro Alves  <palves@redhat.com>

	PR gdb/22670
	* ada-lang.c (literal_symbol_name_matcher): New function.
	(ada_get_symbol_name_matcher): Use it for
	symbol_name_match_type::SEARCH_NAME.
	* block.c (block_lookup_symbol): New parameter 'match_type'.  Pass
	it down instead of assuming symbol_name_match_type::FULL.
	* block.h (block_lookup_symbol): New parameter 'match_type'.
	* c-valprint.c (print_unpacked_pointer): Use
	lookup_symbol_search_name instead of lookup_symbol.
	* compile/compile-object-load.c (get_out_value_type): Pass down
	symbol_name_match_type::SEARCH_NAME.
	* cp-namespace.c (cp_basic_lookup_symbol): Pass down
	symbol_name_match_type::FULL.
	* cp-support.c (cp_get_symbol_name_matcher): Handle
	symbol_name_match_type::SEARCH_NAME.
	* infrun.c (insert_exception_resume_breakpoint): Use
	lookup_symbol_search_name.
	* p-valprint.c (pascal_val_print): Use lookup_symbol_search_name.
	* psymtab.c (maintenance_check_psymtabs): Use
	symbol_name_match_type::SEARCH_NAME and SYMBOL_SEARCH_NAME.
	* stack.c (print_frame_args): Use lookup_symbol_search_name and
	SYMBOL_SEARCH_NAME.
	* symtab.c (lookup_local_symbol): Don't demangle the lookup name
	if symbol_name_match_type::SEARCH_NAME.
	(lookup_symbol_in_language): Pass down
	symbol_name_match_type::FULL.
	(lookup_symbol_search_name): New.
	(lookup_language_this): Pass down
	symbol_name_match_type::SEARCH_NAME.
	(lookup_symbol_aux, lookup_local_symbol): New parameter
	'match_type'.  Pass it down.
	* symtab.h (symbol_name_match_type::SEARCH_NAME): New enumerator.
	(lookup_symbol_search_name): New declaration.
	(lookup_symbol_in_block): New 'match_type' parameter.

gdb/testsuite/ChangeLog:
2018-01-05  Joel Brobecker  <brobecker@adacore.com>

	PR gdb/22670
	* gdb.ada/access_tagged_param.exp: New file.
	* gdb.ada/access_tagged_param/foo.adb: New file.
2018-01-05 16:07:00 +00:00
Joel Brobecker e2882c8578 Update copyright year range in all GDB files
gdb/ChangeLog:

        Update copyright year range in all GDB files
2018-01-02 07:38:06 +04:00
Simon Marchi 798a7429f9 Remove some unused variables
This patch removes some unused variables, found with -Wunused.  I have
not removed everything reported by -Wunused, because some expressions
such as

  struct type *arg_type = check_typedef (value_type);

in bfin-tdep.c could have an unexpected but important side-effect.  I
removed others that I considered more low-risk, such as:

  struct gdbarch *gdbarch = get_objfile_arch (objfile);

I tested building with Python 2/Python 3/no Python, with/without expat,
with/without libipt and with/without babeltrace.

gdb/ChangeLog:

	* ada-lang.c (ada_collect_symbol_completion_matches): Remove
	unused variables.
	(ada_is_redundant_range_encoding): Likewise.
	* ada-varobj.c (ada_varobj_get_value_of_array_variable):
	Likewise.
	* alpha-tdep.c (alpha_software_single_step): Likewise.
	* arm-tdep.c (_initialize_arm_tdep): Likewise.
	* auto-load.c (info_auto_load_cmd): Likewise.
	* break-catch-syscall.c (insert_catch_syscall): Likewise.
	(remove_catch_syscall): Likewise.
	* breakpoint.c (condition_completer): Likewise.
	(clear_command): Likewise.
	(update_breakpoint_locations): Likewise.
	* btrace.c (btrace_disable): Likewise.
	(btrace_teardown): Likewise.
	(btrace_maint_update_pt_packets): Likewise.
	(maint_btrace_clear_cmd): Likewise.
	* cli/cli-decode.c (lookup_cmd_1): Likewise.
	(lookup_cmd_composition): Likewise.
	* cli/cli-dump.c (scan_filename): Likewise.
	(restore_command): Likewise.
	* compile/compile-loc2c.c (compute_stack_depth): Likewise.
	* compile/compile-object-load.c (compile_object_load): Likewise.
	* compile/compile-object-run.c (compile_object_run): Likewise.
	* compile/compile.c (compile_to_object): Likewise.
	* completer.c (filename_completer): Likewise.
	(complete_files_symbols): Likewise.
	(complete_expression): Likewise.
	* corelow.c (core_open): Likewise.
	* ctf.c (ctf_start): Likewise.
	(ctf_write_status): Likewise.
	(ctf_write_uploaded_tsv): Likewise.
	(ctf_write_definition_end): Likewise.
	(ctf_open_dir): Likewise.
	(ctf_xfer_partial): Likewise.
	(ctf_trace_find): Likewise.
	* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
	Likewise.
	* dwarf2loc.c (allocate_piece_closure): Likewise.
	(indirect_pieced_value): Likewise.
	(dwarf2_evaluate_loc_desc_full): Likewise.
	* dwarf2read.c (dw2_expand_marked_cus): Likewise.
	(dw2_expand_symtabs_matching): Likewise.
	(dw2_map_symbol_filenames): Likewise.
	(read_and_check_comp_unit_head): Likewise.
	(read_cutu_die_from_dwo): Likewise.
	(lookup_dwo_unit): Likewise.
	(read_comp_units_from_section): Likewise.
	(dwarf2_compute_name): Likewise.
	(handle_DW_AT_stmt_list): Likewise.
	(create_cus_hash_table): Likewise.
	(create_dwp_v2_section): Likewise.
	(dwarf2_rnglists_process): Likewise.
	(dwarf2_ranges_process): Likewise.
	(dwarf2_record_block_ranges): Likewise.
	(is_vtable_name): Likewise.
	(read_formatted_entries): Likewise.
	(skip_form_bytes): Likewise.
	* elfread.c (elf_symtab_read): Likewise.
	* exec.c (exec_file_command): Likewise.
	* f-valprint.c (f_val_print): Likewise.
	(info_common_command_for_block): Likewise.
	* guile/guile.c (initialize_scheme_side): Likewise.
	* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise.
	* guile/scm-cmd.c (cmdscm_completer): Likewise.
	(gdbscm_register_command_x): Likewise.
	* guile/scm-frame.c (gdbscm_frame_read_var): Likewise.
	* guile/scm-param.c (gdbscm_parameter_value): Likewise.
	* guile/scm-ports.c (file_port_magic): Likewise.
	* guile/scm-pretty-print.c (ppscm_search_pp_list): Likewise.
	(ppscm_pretty_print_one_value): Likewise.
	(ppscm_print_children): Likewise.
	* guile/scm-string.c (gdbscm_string_to_argv): Likewise.
	* guile/scm-symtab.c (gdbscm_sal_symtab): Likewise.
	* guile/scm-type.c (gdbscm_type_next_field_x): Likewise.
	* guile/scm-utils.c (gdbscm_parse_function_args): Likewise.
	* i386-tdep.c (i386_register_reggroup_p): Likewise.
	* infcmd.c (run_command_1): Likewise.
	(until_next_fsm_clean_up): Likewise.
	* linespec.c (linespec_complete): Likewise.
	(find_label_symbols): Likewise.
	* m2-valprint.c (m2_val_print): Likewise.
	* memattr.c (require_user_regions): Likewise.
	(lookup_mem_region): Likewise.
	(disable_mem_command): Likewise.
	(mem_delete): Likewise.
	* mep-tdep.c (mep_register_name): Likewise.
	(mep_analyze_prologue): Likewise.
	* mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries): Likewise.
	* mi/mi-interp.c (mi_on_sync_execution_done): Likewise.
	* mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise.
	* microblaze-linux-tdep.c (microblaze_linux_init_abi): Likewise.
	* minidebug.c (lzma_open): Likewise.
	* minsyms.c (lookup_minimal_symbol): Likewise.
	* mips-linux-tdep.c (mips64_fill_fpregset): Likewise.
	* mips-tdep.c (mips_stub_frame_sniffer): Likewise.
	(mips_o64_return_value): Likewise.
	(mips_single_step_through_delay): Likewise.
	(_initialize_mips_tdep): Likewise.
	* nios2-tdep.c (nios2_push_dummy_call): Likewise.
	(nios2_software_single_step): Likewise.
	* parse.c (find_minsym_type_and_address): Likewise.
	* psymtab.c (psym_relocate): Likewise.
	* python/py-breakpoint.c (bppy_get_commands): Likewise.
	(gdbpy_breakpoint_modified): Likewise.
	* python/py-infevents.c (create_inferior_call_event_object):
	Likewise.
	* python/py-record-btrace.c (btpy_list_item): Likewise.
	* python/py-type.c (typy_str): Likewise.
	* python/py-value.c (valpy_call): Likewise.
	* python/python.c (do_start_initialization): Likewise.
	* record-btrace.c (record_btrace_insn_history_range): Likewise.
	(record_btrace_call_history_range): Likewise.
	(record_btrace_record_method): Likewise.
	(record_btrace_xfer_partial): Likewise.
	(btrace_get_frame_function): Likewise.
	* record-full.c (record_full_open): Likewise.
	* record.c (get_context_size): Likewise.
	* registry.h (DEFINE_REGISTRY): Likewise.
	* remote-fileio.c (remote_fileio_request): Likewise.
	* remote.c (remote_update_thread_list): Likewise.
	(remote_check_symbols): Likewise.
	(remote_commit_resume): Likewise.
	(remote_interrupt): Likewise.
	(remote_insert_breakpoint): Likewise.
	(compare_sections_command): Likewise.
	* rust-exp.y (super_name): Likewise.
	(lex_string): Likewise.
	(convert_ast_to_type): Likewise.
	(convert_ast_to_expression): Likewise.
	* rust-lang.c (rust_print_struct_def): Likewise.
	(rust_print_type): Likewise.
	(rust_evaluate_subexp): Likewise.
	* rx-tdep.c (rx_register_type): Likewise.
	* ser-event.c (serial_event_clear): Likewise.
	* serial.c (serial_open): Likewise.
	* spu-tdep.c (spu_overlay_new_objfile): Likewise.
	* symfile.c (section_is_overlay): Likewise.
	(overlay_unmapped_address): Likewise.
	(overlay_mapped_address): Likewise.
	(simple_overlay_update_1): Likewise.
	(simple_overlay_update): Likewise.
	* symtab.c (symbol_find_demangled_name): Likewise.
	(search_symbols): Likewise.
	* target-descriptions.c (tdesc_predefined_type): Likewise.
	* target.c (target_commit_resume): Likewise.
	* thread.c (print_selected_thread_frame): Likewise.
	* top.c (new_ui_command): Likewise.
	(gdb_readline_no_editing): Likewise.
	* tracefile-tfile.c (tfile_open): Likewise.
	* tracepoint.c (create_tsv_from_upload): Likewise.
	* utils.c (quit): Likewise.
	(defaulted_query): Likewise.
	* valarith.c (value_concat): Likewise.
	* xml-syscall.c (xml_list_syscalls_by_group): Likewise.
	* xml-tdesc.c (target_fetch_description_xml): Likewise.
	* xtensa-tdep.c (xtensa_pseudo_register_read): Likewise.
	(xtensa_pseudo_register_write): Likewise.

gdb/gdbserver/ChangeLog:

	* regcache.c (registers_to_string): Remove unused variable.
2017-12-05 16:05:50 -05:00
Tom Tromey eb4c3f4aaa Constify add_setshow_*
This constifies the add_setshow_* family of functions, and then fixes
up the fallout.  The bulk of this patch was written by script.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* ada-lang.c (catch_ada_exception_command): Constify.
	(catch_assert_command): Constify.
	* break-catch-throw.c (catch_catch_command, catch_throw_command)
	(catch_rethrow_command): Constify.
	(catch_exception_command_1): Constify.
	* breakpoint.h (add_catch_command): Constify.
	* break-catch-syscall.c (catch_syscall_command_1): Constify.
	(catch_syscall_split_args): Constify.
	* break-catch-sig.c (catch_signal_command): Constify.
	(catch_signal_split_args): Constify.
	* cli/cli-decode.h (struct cmd_list_element) <function>: Use
	cmd_const_sfunc_ftype.
	* cli/cli-decode.c (add_setshow_cmd_full): Constify.
	(add_setshow_enum_cmd, add_setshow_auto_boolean_cmd)
	(add_setshow_boolean_cmd, add_setshow_filename_cmd)
	(add_setshow_string_cmd, struct cmd_list_element)
	(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
	(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
	(add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd):
	Constify.
	(set_cmd_sfunc): Constify.
	(empty_sfunc): Constify.
	* command.h (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd)
	(add_setshow_boolean_cmd, add_setshow_filename_cmd)
	(add_setshow_string_cmd, add_setshow_string_noescape_cmd)
	(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
	(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
	(add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd):
	Constify.
	(set_cmd_sfunc): Constify.
	(cmd_sfunc_ftype): Remove.
	* compile/compile.c (set_compile_args): Constify.
	* infrun.c (set_disable_randomization): Constify.
	* infcmd.c (set_args_command, set_cwd_command): Constify.
	* breakpoint.c (set_condition_evaluation_mode): Constify.
	(add_catch_command): Constify.
	(catch_fork_command_1, catch_exec_command_1)
	(catch_load_command_1, catch_unload_command_1): Constify.
	(catch_load_or_unload): Constify.
	* guile/scm-param.c (pascm_set_func): Constify.
	(add_setshow_generic): Constify.
	* python/py-param.c (get_set_value): Constify.
	* top.h (set_verbose): Constify.
	* tui/tui-win.c (tui_set_var_cmd): Constify.
	* mi/mi-main.c (set_mi_async_command): Constify.
	* cli/cli-logging.c (set_logging_overwrite)
	(set_logging_redirect): Constify.
	* value.c (set_max_value_size): Constify.
	* valprint.c (set_input_radix, set_output_radix): Constify.
	* utils.c (set_width_command, set_height_command): Constify.
	* typeprint.c (set_print_type_methods, set_print_type_typedefs): Constify.
	* tracepoint.c (set_disconnected_tracing)
	(set_circular_trace_buffer, set_trace_buffer_size)
	(set_trace_user, set_trace_notes, set_trace_stop_notes): Constify.
	* top.c (set_history_size_command, set_verbose, set_editing)
	(set_gdb_datadir, set_history_filename): Constify.
	* target.c (set_targetdebug, maint_set_target_async_command)
	(maint_set_target_non_stop_command, set_target_permissions)
	(set_write_memory_permission): Constify.
	(open_target): Constify.
	* target-descriptions.c (set_tdesc_filename_cmd): Constify.
	* target-dcache.c (set_stack_cache, set_code_cache): Constify.
	* symtab.c (set_symbol_cache_size_handler): Constify.
	* symfile.c (set_ext_lang_command): Constify.
	* symfile-debug.c (set_debug_symfile): Constify.
	* source.c (set_directories_command): Constify.
	* solib.c (reload_shared_libraries, gdb_sysroot_changed): Constify.
	* serial.c (set_parity): Constify.
	* rs6000-tdep.c (powerpc_set_soft_float, powerpc_set_vector_abi): Constify.
	* remote.c (set_remote_exec_file, set_remotebreak)
	(set_remote_protocol_Z_packet_cmd, set_range_stepping): Constify.
	* record.c (set_record_insn_history_size)
	(set_record_call_history_size): Constify.
	* record-full.c (set_record_full_insn_max_num): Constify.
	* proc-api.c (set_procfs_trace_cmd, set_procfs_file_cmd): Constify.
	* osabi.c (set_osabi): Constify.
	* mips-tdep.c (set_mips64_transfers_32bit_regs)
	(reinit_frame_cache_sfunc, mips_abi_update): Constify.
	* maint.c (maintenance_set_profile_cmd): Constify.
	* linux-thread-db.c (set_libthread_db_search_path): Constify.
	* language.c (set_language_command, set_range_command)
	(set_case_command): Constify.
	* infrun.c (set_non_stop, set_observer_mode)
	(set_stop_on_solib_events, set_schedlock_func)
	(set_exec_direction_func): Constify.
	* infcmd.c (set_inferior_tty_command): Constify.
	* disasm.c (set_disassembler_options_sfunc): Constify.
	* demangle.c (set_demangling_command): Constify.
	* dcache.c (set_dcache_size, set_dcache_line_size): Constify.
	* cris-tdep.c (set_cris_version, set_cris_mode)
	(set_cris_dwarf2_cfi): Constify.
	* corefile.c (set_gnutarget_command): Constify.
	* charset.c (set_host_charset_sfunc, set_target_charset_sfunc)
	(set_target_wide_charset_sfunc): Constify.
	* breakpoint.c (update_dprintf_commands): Constify.
	* auto-load.c (set_auto_load_dir, set_auto_load_safe_path): Constify.
	* arm-tdep.c (set_fp_model_sfunc, arm_set_abi)
	(set_disassembly_style_sfunc): Constify.
	* arch-utils.c (set_endian, set_architecture): Constify.
	* alpha-tdep.c (reinit_frame_cache_sfunc): Constify.
	* agent.c (set_can_use_agent): Constify.
2017-11-07 13:59:09 -07:00
Tom Tromey ed2b3126d1 Remove make_cleanup_free_objfile
This replaces make_cleanup_free_objfile with std::unique_ptr.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

	* objfiles.c (do_free_objfile_cleanup): Remove.
	* compile/compile-object-load.c (compile_object_load): Update.
	* objfiles.h (make_cleanup_free_objfile): Remove.
2017-11-04 10:27:18 -06:00
Tom Tromey c6bcad5ffc Use std::vector in compile-loc2c.c
This changes compile-loc2c.c to use std::vector, removing some
cleanups.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

	* compile/compile-loc2c.c (compute_stack_depth_worker): Change
	type of "info".
	(compute_stack_depth): Likewise.
	(do_compile_dwarf_expr_to_c): Use std::vector.
2017-11-04 10:27:15 -06:00
Tom Tromey 20dcd8cae7 Remove cleanups from link_callbacks_einfo
This removes a cleanup from link_callbacks_einfo by using std::string.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

	* compile/compile-object-load.c (link_callbacks_einfo): Use
	std::string.
2017-11-04 10:27:15 -06:00
Tom Tromey 9e86da0760 Change objfile to use new/delete
This changes objfiles to use new and delete rather than xmalloc and
free.  Simon noticed that it uses a non-POD and so shouldn't be
allocated with XCNEW; and I wanted to be able to use another non-POD as
a member; this patch is the result.

Regression tested by the buildbot.

2017-10-13  Tom Tromey  <tom@tromey.com>

	* compile/compile-object-run.c (do_module_cleanup): Use delete.
	* solib.c (update_solib_list, reload_shared_libraries_1): Use
	delete.
	* symfile.c (symbol_file_add_with_addrs): Use new.
	(symbol_file_add_separate): Update comment.
	(syms_from_objfile_1, remove_symbol_file_command): Use delete.
	* jit.c (jit_object_close_impl): Use new.
	(jit_unregister_code): Use delete.
	* objfiles.c (objfile::objfile): Rename from allocate_objfile.
	(~objfile): Rename from free_objfile.
	(free_objfile_separate_debug, do_free_objfile_cleanup)
	(free_all_objfiles, objfile_purge_solibs): Use delete.
	* objfiles.h (struct objfile): Add constructor and destructor.
	Use DISABLE_COPY_AND_ASSIGN.  Add initializers to data members.
	(allocate_objfile, free_objfile): Don't declare.
	(struct objstats): Add initializers.
2017-10-13 07:18:29 -06:00
Tom Tromey 981a3fb359 Constify add_prefix_cmd
This changes add_prefix_cmd to accept a const-taking function as an
argument; then fixes up all the callers.

In a couple of spots I had to add a non-const overload of a function,
because the function is passed to two different command-adding
"constructors".  These overloads are temporary; once constification is
complete they can be removed.

This patch also fixes a typo I happened to notice while constifying.

Note that this touches a couple of files (gnu-nat.c and go32-nat.c)
that I can't build.  So, while I made a best-effort there, I am not
certain they will still compile.

Tested by rebuilding.

gdb/ChangeLog
2017-10-11  Tom Tromey  <tom@tromey.com>

	* gdbthread.h (thread_command): Constify.
	* inferior.h (detach_command): Constify.
	* top.h (set_history, show_history): Constify.
	* arm-tdep.c (set_arm_command, show_arm_command): Constify.
	* serial.c (serial_set_cmd, serial_show_cmd): Constify.
	* bsd-kvm.c (bsd_kvm_cmd): Constify.
	* printcmd.c (set_command): Constify.
	(non_const_set_command): New function.
	* dcache.c (set_dcache_command, show_dcache_command): Constify.
	* breakpoint.c (enable_command, disable_command, delete_command)
	(catch_command, tcatch_command, set_breakpoint_cmd)
	(show_breakpoint_cmd): Constify.
	* macrocmd.c (macro_command): Constify.
	* infcmd.c (unset_command, kill_command, detach_command)
	(info_proc_cmd): Constify.
	* i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify.
	* auto-load.c (show_auto_load_cmd, set_auto_load_cmd)
	(info_auto_load_cmd): Constify.
	* target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd)
	(unset_tdesc_cmd): Constify.
	* ada-lang.c (set_ada_command, show_ada_command)
	(maint_set_ada_cmd, maint_show_ada_cmd): Constify.
	* guile/guile.c (set_guile_command, show_guile_command)
	(info_guile_command): Constify.
	* tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd):
	Constify.
	* skip.c (skip_command): Constify.
	* compile/compile.c (_initialize_compile): Constify.
	* dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify.
	* btrace.c (maint_btrace_cmd, maint_btrace_set_cmd)
	(maint_btrace_show_cmd, maint_btrace_pt_set_cmd)
	(maint_btrace_pt_show_cmd): Constify.
	* remote.c (set_remote_cmd, show_remote_cmd, remote_command):
	Constify.
	* python/python.c (user_show_python, user_set_python): Constify.
	* mips-tdep.c (set_mips_command, show_mips_command)
	(set_mipsfpu_command): Constify.
	* record-btrace.c (cmd_record_btrace_start)
	(cmd_set_record_btrace, cmd_show_record_btrace)
	(cmd_set_record_btrace_bts, cmd_show_record_btrace_bts)
	(cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): Constify.
	* rs6000-tdep.c (set_powerpc_command, show_powerpc_command):
	Constify.
	* symfile.c (overlay_command): Constify.
	* spu-tdep.c (set_spu_command, show_spu_command): Constify.
	* cli/cli-logging.c (set_logging_command, show_logging_command):
	Constify.
	* cli/cli-dump.c (dump_command, append_command)
	(srec_dump_command, ihex_dump_command, verilog_dump_command)
	(tekhex_dump_command, binary_dump_command)
	(binary_append_command): Constify.
	* cli/cli-decode.c (struct cmd_list_element): Change type of
	"fun".
	* cli/cli-cmds.c (info_command, show_command, set_debug)
	(show_debug): Constify.
	(show_command): Add non-const overload.
	* top.c (set_history, show_history): Constify.
	* sh-tdep.c (set_sh_command, show_sh_command): Constify.
	* command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype.
	* target.c (target_command): Constify.
	* sparc64-tdep.c (info_adi_command): Constify.
	* record-full.c (cmd_record_full_start): Constify.
	(set_record_full_command): Constify.  Fix typo.
	(show_record_full_command): Constify.
	* thread.c (thread_command, thread_apply_command): Constify.
	* memattr.c (dummy_cmd): Constify.
	* value.c (function_command): Constify.
	* frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify.
	* probe.c (info_probes_command): Constify.
	* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify.
	* gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd)
	(show_thread_cmd, set_thread_default_cmd)
	(show_thread_default_cmd): Constify.
	(check_empty): Constify.
	* tracepoint.c (tfind_command): Constify.
	* cp-support.c (maint_cplus_command): Constify.
	* windows-tdep.c (info_w32_command): Constify.
	* record.c (cmd_record_start, set_record_command)
	(show_record_command, info_record_command, cmd_record_goto):
	Constify.
	* ravenscar-thread.c (set_ravenscar_command)
	(show_ravenscar_command): Constify.
	* utils.c (set_internal_problem_cmd, show_internal_problem_cmd):
	Constify.
	(add_internal_problem_command): Remove casts.
	* arc-tdep.c (maintenance_print_arc_command): Constify.
	* valprint.c (set_print, show_print, set_print_raw)
	(show_print_raw): Constify.
	* maint.c (maintenance_command, maintenance_info_command)
	(maintenance_print_command, maintenance_set_cmd)
	(maintenance_show_cmd, set_per_command_cmd)
	(show_per_command_cmd, maintenance_check_command): Constify.
	* language.c (set_check, show_check): Constify.
	* typeprint.c (show_print_type, set_print_type): Constify.
	* go32-nat.c (go32_info_dos_command): Constify.
2017-10-11 16:21:02 -06:00
Tom Tromey 6663cf9161 Constify some commands in compile.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* compile/compile.c (check_raw_argument, compile_file_command)
	(compile_code_command, compile_print_command): Constify.
2017-09-27 08:44:59 -06:00
Pedro Alves 26a67918a5 Sync libiberty/ & include/ with GCC
Note this brings in the interface files for libcc1/G++ as well, which
we will be needing in GDB soon anyway.  That commit renamed a method
in the C interface and that required a small update to GDB's compile/
code, which I've included that in this patch to keep the tree
building.

include/ChangeLog:
2017-09-15  Pedro Alves  <palves@redhat.com>

	* ansidecl.h (DISABLE_COPY_AND_ASSIGN): New macro.

	2017-09-12  Jiong Wang  <jiong.wang@arm.com>

	* dwarf2.def (DW_CFA_AARCH64_negate_ra_state): New DW_CFA_DUP.
	* dwarf2.h (DW_CFA_DUP): New define.

	2017-08-21  Richard Biener  <rguenther@suse.de>

	* simple-object.h (simple_object_copy_lto_debug_sections): New
	function.

	2017-05-18  Martin Liska  <mliska@suse.cz>

	* ansidecl.h: Define CONSTEXPR macro.

	2017-05-24  Nathan Sidwell  <nathan@acm.org>

	* libiberty.h (ASTRDUP): Adjust cast to avoid warning.

	2017-01-30  Alexandre Oliva <aoliva@redhat.com>

	Introduce C++ support in libcc1.
	* gcc-c-fe.def (int_type_v0): Rename from...
	(int_type): ... this.  Introduce new version.
	(float_type_v0): Rename from...
	(float_type): ... this.  Introduce new version.
	(char_type): New.
	* gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1.
	(gcc_type_array): Move...
	* gcc-interface.h: ... here.
	* gcc-cp-fe.def: New.
	* gcc-cp-interface.h: New.

	2016-04-29  Oleg Endo  <olegendo@gcc.gnu.org>

	* longlong.h (umul_ppmm): Remove SHMEDIA checks.
	(__umulsidi3, count_leading_zeros): Remove SHMEDIA implementations.

	2017-09-15  Yao Qi  <yao.qi@linaro.org>
	    Pedro Alves  <palves@redhat.com>

	* ansidecl.h (DISABLE_COPY_AND_ASSIGN): New macro.

	2017-09-12  Jiong Wang  <jiong.wang@arm.com>

	* dwarf2.def (DW_CFA_AARCH64_negate_ra_state): New DW_CFA_DUP.
	* dwarf2.h (DW_CFA_DUP): New define.

	2017-08-21  Richard Biener  <rguenther@suse.de>

	* simple-object.h (simple_object_copy_lto_debug_sections): New
	function.

	2017-05-18  Martin Liska  <mliska@suse.cz>

	* ansidecl.h: Define CONSTEXPR macro.

	2017-05-24  Nathan Sidwell  <nathan@acm.org>

	* libiberty.h (ASTRDUP): Adjust cast to avoid warning.

	2017-01-30  Alexandre Oliva <aoliva@redhat.com>

	Introduce C++ support in libcc1.
	* gcc-c-fe.def (int_type_v0): Rename from...
	(int_type): ... this.  Introduce new version.
	(float_type_v0): Rename from...
	(float_type): ... this.  Introduce new version.
	(char_type): New.
	* gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1.
	(gcc_type_array): Move...
	* gcc-interface.h: ... here.
	* gcc-cp-fe.def: New.
	* gcc-cp-interface.h: New.

	2016-04-29  Oleg Endo  <olegendo@gcc.gnu.org>

	* longlong.h (umul_ppmm): Remove SHMEDIA checks.
	(__umulsidi3, count_leading_zeros): Remove SHMEDIA implementations.

libiberty/ChangeLog:
2017-09-15  Nathan Sidwell  <nathan@acm.org>

	PR demangler/82195
	* cp-demangle.c (d_name): Add 'toplevel' parm.  Pass to	...
	(d_local_name): ... here.  Parse trailing function args on nested
	local_name.
	(d_encoding, d_special_name, d_class_enum_type): Adjust d_name calls.
	* testsuite/demangle-expected: Add tests.

2017-09-15  Richard Biener  <rguenther@suse.de>

	PR lto/81968
	* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
	Iterate marking dependent sections necessary.

2017-09-15  Nathan Sidwell  <nathan@acm.org>

	* cp-demangle.c (is_fnqual_component_type): Reimplement using
	FNQUAL_COMPONENT_CASE.
	(d_encoding): Hold bare_function_type in local var.
	(d_local_name): Build name in both cases and build result once.
	Collapse switch-if to single conditional.
	(d_local_name):

	* testsuite/demangle-expected: Realign blank lines with tests.

2017-09-12  Jiong Wang  <jiong.wang@arm.com>

	* dwarfnames.c (DW_CFA_DUP): New define.

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

	* compile/compile-c-types.c (convert_enum, convert_int)
	(convert_float): Adjust to refer to int_type_v0 and float_type_v0.
2017-09-15 17:40:33 +01:00
Tom Tromey f1735a53a6 Rename _const functions to use overloading instead
This renames a few functions -- skip_spaces_const,
skip_to_space_const, get_number_const, extract_arg_const -- to drop
the "_const" suffix and instead rely on overloading.

This makes future const fixes simpler by reducing the number of lines
that must be changed.  I think it is also not any less clear, as all
these functions have the same interface as their non-const versions by
design.  Furthermore there's an example of using an overload in-tree
already, namely check_for_argument.

This patch was largely created using some perl one-liners; then a few
fixes were applied by hand.

ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* common/common-utils.h (skip_to_space): Remove macro, redeclare
	as function.
	(skip_to_space): Rename from skip_to_space_const.
	* common/common-utils.c (skip_to_space): New function.
	(skip_to_space): Rename from skip_to_space_const.
	* cli/cli-utils.h (get_number): Rename from get_number_const.
	(extract_arg): Rename from extract_arg_const.
	* cli/cli-utils.c (get_number): Rename from get_number_const.
	(extract_arg): Rename from extract_arg_const.
	(number_or_range_parser::get_number): Use ::get_number.
	* aarch64-linux-tdep.c, ada-lang.c, arm-linux-tdep.c, ax-gdb.c,
	break-catch-throw.c, breakpoint.c, cli/cli-cmds.c, cli/cli-dump.c,
	cli/cli-script.c, cli/cli-setshow.c, compile/compile.c,
	completer.c, demangle.c, disasm.c, findcmd.c, linespec.c,
	linux-tdep.c, linux-thread-db.c, location.c, mi/mi-parse.c,
	minsyms.c, nat/linux-procfs.c, printcmd.c, probe.c,
	python/py-breakpoint.c, record.c, rust-exp.y, serial.c, stack.c,
	stap-probe.c, tid-parse.c, tracepoint.c: Update all callers.
2017-09-11 15:46:12 -06:00
John Baldwin 481695ed5f Remove unnecessary function prototypes.
These prototypes were required when compiling GDB as C but are not
required for C++.

gdb/ChangeLog:

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

Currently, you can end misled by GDB over output like this:

  (gdb) p var
  $1 = -1
  (gdb) p /x var
  $2 = 0xffffffff

until you realize that GDB is assuming that the variable is an "int",
because:

  (gdb) ptype var
  type = <data variable, no debug info>

You may try to fix it by casting, but that doesn't really help:

  (gdb) p /x (unsigned long long) var
  $3 = 0xffffffffffffffff            # incorrect
         ^^

That's incorrect output, because the variable was defined like this:

  uint64_t var = 0x7fffffffffffffff;
                   ^^

What happened is that with the cast, GDB did an int -> 'unsigned long
long' conversion instead of reinterpreting the variable as the cast-to
type.  To get at the variable properly you have to reinterpret the
variable's address manually instead, with either:

  (gdb) p /x *(unsigned long long *) &var
  $4 = 0x7fffffffffffffff
  (gdb) p /x {unsigned long long} &var
  $5 = 0x7fffffffffffffff

After this commit GDB does it for you.  This is what you'll get
instead:

  (gdb) p var
  'var' has unknown type; cast it to its declared type
  (gdb) p /x (unsigned long long) var
  $1 = 0x7fffffffffffffff

As in the functions patch, the "compile" machinery doesn't currently
have the cast-to type handy, so it continues assuming no-debug
variables have int type, though now at least it warns.

The change to gdb.cp/m-static.exp deserves an explanation:

 - gdb_test "print 'gnu_obj_1::method()::sintvar'" "\\$\[0-9\]+ = 4" \
 + gdb_test "print (int) 'gnu_obj_1::method()::sintvar'" "\\$\[0-9\]+ = 4" \

That's printing the "sintvar" function local static of the
"gnu_obj_1::method()" method.

The problem with that test is that that "'S::method()::static_var'"
syntax doesn't really work in C++ as you'd expect.  The way to make it
work correctly currently is to quote the method part, not the whole
expression, like:

  (gdb) print 'gnu_obj_1::method()'::sintvar

If you wrap the whole expression in quotes, like in m-static.exp, what
really happens is that the parser considers the whole string as a
symbol name, but there's no debug symbol with that name.  However,
local statics have linkage and are given a mangled name that demangles
to the same string as the full expression, so that's what GDB prints.
After this commit, and without the cast, the print in m-static.exp
would error out saying that the variable has unknown type:

  (gdb) p 'gnu_obj_1::method()::sintvar'
  'gnu_obj_1::method()::sintvar' has unknown type; cast it to its declared type

TBC, if currently (even before this series) you try to print any
function local static variable of type other than int, you'll get
bogus results.  You can see that with m-static.cc as is, even.
Printing the "svar" local, which is a boolean (1 byte) still prints as
"int" (4 bytes):

  (gdb) p 'gnu_obj_1::method()::svar'
  $1 = 1
  (gdb) ptype 'gnu_obj_1::method()::svar'
  type = <data variable, no debug info>

This probably prints some random bogus value on big endian machines.

If 'svar' was of some aggregate type (etc.) we'd still print it as
int, so the problem would have been more obvious...  After this
commit, you'll get instead:

  (gdb) p 'gnu_obj_1::method()::svar'
  'gnu_obj_1::method()::svar' has unknown type; cast it to its declared type

... so at least GDB is no longer misleading.  Making GDB find the real
local static debug symbol is the subject of the following patches.  In
the end, it'll all "Just Work".

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

	* ax-gdb.c: Include "typeprint.h".
	(gen_expr_for_cast): New function.
	(gen_expr) <OP_CAST, OP_CAST_TYPE>: Use it.
	<OP_VAR_VALUE, OP_MSYM_VAR_VALUE>: Error out if the variable's
	type is unknown.
	* dwarf2read.c (new_symbol_full): Fallback to int instead of
	nodebug_data_symbol.
	* eval.c: Include "typeprint.h".
	(evaluate_subexp_standard) <OP_VAR_VALUE, OP_VAR_MSYM_VALUE>:
	Error out if symbol has unknown type.
	<UNOP_CAST, UNOP_CAST_TYPE>: Common bits factored out to
	evaluate_subexp_for_cast.
	(evaluate_subexp_for_address, evaluate_subexp_for_sizeof): Handle
	OP_VAR_MSYM_VALUE.
	(evaluate_subexp_for_cast): New function.
	* gdbtypes.c (init_nodebug_var_type): New function.
	(objfile_type): Use it to initialize types of variables with no
	debug info.
	* typeprint.c (error_unknown_type): New.
	* typeprint.h (error_unknown_type): New declaration.
	* compile/compile-c-types.c (convert_type_basic): Handle
	TYPE_CODE_ERROR; warn and fallback to int for variables with
	unknown type.

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

	* gdb.asm/asm-source.exp: Add casts to int.
	* gdb.base/nodebug.c (dataglobal8, dataglobal32_1, dataglobal32_2)
	(dataglobal64_1, dataglobal64_2): New globals.
	* gdb.base/nodebug.exp: Test different expressions involving the
	new globals, with print, whatis and ptype.  Add casts to int.
	* gdb.base/solib-display.exp: Add casts to int.
	* gdb.compile/compile-ifunc.exp: Expect warning.  Add cast to int.
	* gdb.cp/m-static.exp: Add cast to int.
	* gdb.dwarf2/dw2-skip-prologue.exp: Add cast to int.
	* gdb.threads/tls-nodebug.exp: Check that gdb errors out printing
	tls variable with no debug info without a cast.  Test with a cast
	to int too.
	* gdb.trace/entry-values.exp: Add casts.
2017-09-04 20:21:15 +01:00
Pedro Alves 7022349d5c Stop assuming no-debug-info functions return int
The fact that GDB defaults to assuming that functions return int, when
it has no debug info for the function has been a recurring source of
user confusion.  Recently this came up on the errno pretty printer
discussions.  Shortly after, it came up again on IRC, with someone
wondering why does getenv() in GDB return a negative int:

  (gdb) p getenv("PATH")
  $1 = -6185

This question (with s/getenv/random-other-C-runtime-function) is a FAQ
on IRC.

The reason for the above is:

 (gdb) p getenv
 $2 = {<text variable, no debug info>} 0x7ffff7751d80 <getenv>
 (gdb) ptype getenv
 type = int ()

... which means that GDB truncated the 64-bit pointer that is actually
returned from getent to 32-bit, and then sign-extended it:

 (gdb) p /x -6185
 $6 = 0xffffe7d7

The workaround is to cast the function to the right type, like:

 (gdb) p ((char *(*) (const char *)) getenv) ("PATH")
 $3 = 0x7fffffffe7d7 "/usr/local/bin:/"...

IMO, we should do better than this.

I see the "assume-int" issue the same way I see printing bogus values
for optimized-out variables instead of "<optimized out>" -- I'd much
rather that the debugger tells me "I don't know" and tells me how to
fix it than showing me bogus misleading results, making me go around
tilting at windmills.

If GDB prints a signed integer when you're expecting a pointer or
aggregate, you at least have some sense that something is off, but
consider the case of the function actually returning a 64-bit integer.
For example, compile this without debug info:

 unsigned long long
 function ()
 {
   return 0x7fffffffffffffff;
 }

Currently, with pristine GDB, you get:

 (gdb) p function ()
 $1 = -1                      # incorrect
 (gdb) p /x function ()
 $2 = 0xffffffff              # incorrect

maybe after spending a few hours debugging you suspect something is
wrong with that -1, and do:

 (gdb) ptype function
 type = int ()

and maybe, just maybe, you realize that the function actually returns
unsigned long long.  And you try to fix it with:

(gdb) p /x (unsigned long long) function ()
 $3 = 0xffffffffffffffff      # incorrect

... which still produces the wrong result, because GDB simply applied
int to unsigned long long conversion.  Meaning, it sign-extended the
integer that it extracted from the return of the function, to 64-bits.

and then maybe, after asking around on IRC, you realize you have to
cast the function to a pointer of the right type, and call that.  It
won't be easy, but after a few missteps, you'll get to it:

.....  (gdb) p /x ((unsigned long long(*) ()) function) ()
 $666 = 0x7fffffffffffffff             # finally! :-)


So to improve on the user experience, this patch does the following
(interrelated) things:

 - makes no-debug-info functions no longer default to "int" as return
   type.  Instead, they're left with NULL/"<unknown return type>"
   return type.

    (gdb) ptype getenv
    type = <unknown return type> ()

 - makes calling a function with unknown return type an error.

    (gdb) p getenv ("PATH")
    'getenv' has unknown return type; cast the call to its declared return type

 - and then to make it easier to call the function, makes it possible
   to _only_ cast the return of the function to the right type,
   instead of having to cast the function to a function pointer:

    (gdb) p (char *) getenv ("PATH")                      # now Just Works
    $3 = 0x7fffffffe7d7 "/usr/local/bin:/"...

    (gdb) p ((char *(*) (const char *)) getenv) ("PATH")  # continues working
    $4 = 0x7fffffffe7d7 "/usr/local/bin:/"...

   I.e., it makes GDB default the function's return type to the type
   of the cast, and the function's parameters to the type of the
   arguments passed down.

After this patch, here's what you'll get for the "unsigned long long"
example above:

 (gdb) p function ()
 'function' has unknown return type; cast the call to its declared return type
 (gdb) p /x (unsigned long long) function ()
 $4 = 0x7fffffffffffffff     # correct!

Note that while with "print" GDB shows the name of the function that
has the problem:

  (gdb) p getenv ("PATH")
  'getenv' has unknown return type; cast the call to its declared return type

which can by handy in more complicated expressions, "ptype" does not:

  (gdb) ptype getenv ("PATH")
  function has unknown return type; cast the call to its declared return type

This will be fixed in the next patch.

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

	* ada-lang.c (ada_evaluate_subexp) <TYPE_CODE_FUNC>: Don't handle
	TYPE_GNU_IFUNC specially here.  Throw error if return type is
	unknown.
	* ada-typeprint.c (print_func_type): Handle functions with unknown
	return type.
	* c-typeprint.c (c_type_print_base): Handle functions and methods
	with unknown return type.
	* compile/compile-c-symbols.c (convert_symbol_bmsym)
	<mst_text_gnu_ifunc>: Use nodebug_text_gnu_ifunc_symbol.
	* compile/compile-c-types.c: Include "objfiles.h".
	(convert_func): For functions with unknown return type, warn and
	default to int.
	* compile/compile-object-run.c (compile_object_run): Adjust call
	to call_function_by_hand_dummy.
	* elfread.c (elf_gnu_ifunc_resolve_addr): Adjust call to
	call_function_by_hand.
	* eval.c (evaluate_subexp_standard): Adjust calls to
	call_function_by_hand.  Handle functions and methods with unknown
	return type.  Pass expect_type to call_function_by_hand.
	* f-typeprint.c (f_type_print_base): Handle functions with unknown
	return type.
	* gcore.c (call_target_sbrk): Adjust call to
	call_function_by_hand.
	* gdbtypes.c (objfile_type): Leave nodebug text symbol with NULL
	return type instead of int.  Make nodebug_text_gnu_ifunc_symbol be
	an integer address type instead of nodebug.
	* guile/scm-value.c (gdbscm_value_call): Adjust call to
	call_function_by_hand.
	* infcall.c (error_call_unknown_return_type): New function.
	(call_function_by_hand): New "default_return_type" parameter.
	Pass it down.
	(call_function_by_hand_dummy): New "default_return_type"
	parameter.  Use it instead of defaulting to int.  If there's no
	default and the return type is unknown, throw an error.  If
	there's a default return type, and the called function has no
	debug info, then assume the function is prototyped.
	* infcall.h (call_function_by_hand, call_function_by_hand_dummy):
	New "default_return_type" parameter.
	(error_call_unknown_return_type): New declaration.
	* linux-fork.c (call_lseek): Cast return type of lseek.
	(inferior_call_waitpid, checkpoint_command): Adjust calls to
	call_function_by_hand.
	* linux-tdep.c (linux_infcall_mmap, linux_infcall_munmap): Adjust
	calls to call_function_by_hand.
	* m2-typeprint.c (m2_procedure): Handle functions with unknown
	return type.
	* objc-lang.c (lookup_objc_class, lookup_child_selector)
	(value_nsstring, print_object_command): Adjust calls to
	call_function_by_hand.
	* p-typeprint.c (pascal_type_print_varspec_prefix): Handle
	functions with unknown return type.
	(pascal_type_print_func_varspec_suffix): New function.
	(pascal_type_print_varspec_suffix) <TYPE_CODE_FUNC,
	TYPE_CODE_METHOD>: Use it.
	* python/py-value.c (valpy_call): Adjust call to
	call_function_by_hand.
	* rust-lang.c (rust_evaluate_funcall): Adjust call to
	call_function_by_hand.
	* valarith.c (value_x_binop, value_x_unop): Adjust calls to
	call_function_by_hand.
	* valops.c (value_allocate_space_in_inferior): Adjust call to
	call_function_by_hand.
	* typeprint.c (type_print_unknown_return_type): New function.
	* typeprint.h (type_print_unknown_return_type): New declaration.

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

	* gdb.base/break-main-file-remove-fail.exp (test_remove_bp): Cast
	return type of munmap in infcall.
	* gdb.base/break-probes.exp: Cast return type of foo in infcall.
	* gdb.base/checkpoint.exp: Simplify using for loop.  Cast return
	type of ftell in infcall.
	* gdb.base/dprintf-detach.exp (dprintf_detach_test): Cast return
	type of getpid in infcall.
	* gdb.base/infcall-exec.exp: Cast return type of execlp in
	infcall.
	* gdb.base/info-os.exp: Cast return type of getpid in infcall.
	Bail on failure to extract the pid.
	* gdb.base/nodebug.c: #include <stdint.h>.
	(multf, multf_noproto, mult, mult_noproto, add8, add8_noproto):
	New functions.
	* gdb.base/nodebug.exp (test_call_promotion): New procedure.
	Change expected output of print/whatis/ptype with functions with
	no debug info.  Test all supported languages.  Call
	test_call_promotion.
	* gdb.compile/compile.exp: Adjust expected output to expect
	warning.
	* gdb.threads/siginfo-threads.exp: Likewise.
2017-09-04 20:21:13 +01:00
Tom Tromey 8f84fb0ee8 Use std::string and unique_xmalloc_ptr in compile/ code
Change various things in the compile/ code to use std::string or
unique_xmalloc_ptr as appropriate.  This allows the removal of some
cleanups.

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

	* compile/compile.c (compile_register_name_mangled): Return
	std::string.
	* compile/compile-loc2c.c (pushf_register_address): Update.
	(pushf_register): Update.
	* compile/compile-c-types.c (convert_array): Update.
	* compile/compile-c-symbols.c (generate_vla_size): Update.
	(error_symbol_once): Use a gdb::unique_xmalloc_ptr.
	(symbol_substitution_name): Return a gdb::unique_xmalloc_ptr.
	(convert_one_symbol): Update.
	(generate_c_for_for_one_variable): Update.
	* compile/compile-c-support.c (c_get_range_decl_name): Return a
	std::string.
	(generate_register_struct): Update.
	* compile/compile-internal.h (c_get_range_decl_name): Return a
	std::string.
	(compile_register_name_mangled): Return std::string.
2017-09-03 13:03:10 -06:00
Jan Kratochvil 6e41ddec97 compile: Add 'set compile-gcc'
As discussed in
	How to use compile & execute function in GDB
	https://sourceware.org/ml/gdb/2015-04/msg00026.html

GDB currently searches for compilers on /usr/bin/ARCH-OS-gcc and
chooses a match from there.  However, it is not currently possible for
the user to override which compiler to use.  This is what this patch
implements.

It is also a sync between GCC's and GDB's interfaces.

gdb/ChangeLog
2017-08-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* NEWS (Changes since GDB 7.9): Add set compile-gcc and show
	compile-gcc.
	* compile/compile.c (compile_gcc, show_compile_gcc): New.
	(compile_to_object): Implement compile_gcc.
	(_initialize_compile): Install "set compile-gcc".  Initialize
	compile_gcc.

gdb/doc/ChangeLog
2017-08-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.texinfo (Compiling and Injecting Code): Add to subsection
	"Compiler search for the compile command" descriptions of set
	compile-gcc and show compile-gcc.

include/ChangeLog
2017-08-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gcc-interface.h (enum gcc_base_api_version): Update comment for
	GCC_FE_VERSION_1.
	(struct gcc_base_vtable): Rename set_arguments to set_arguments_v0.
	Add set_arguments, set_triplet_regexp and set_driver_filename.
2017-08-23 11:16:35 -04:00
Jan Kratochvil e68c32d53e compile: set debug compile: Display GCC driver filename
As discussed in
	How to use compile & execute function in GDB
	https://sourceware.org/ml/gdb/2015-04/msg00026.html

GDB currently searches for compilers on /usr/bin/ARCH-OS-gcc and
chooses a match from there.  However, it is not currently possible for
the user to display which compiler was selected.  Up until now, GDB's
compiler interface was not up-to-date with GCC's one, which means that
it wasn't possible to obtain this information.  This patch implements
the mechanisms necessary for that.

gdb/ChangeLog
2017-08-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* compile/compile.c (compile_to_object): Conditionally call
	set_verbose.  Conditionally call compile or compile_v0.

include/ChangeLog
2017-08-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gcc-interface.h (enum gcc_base_api_version): Add
	GCC_FE_VERSION_1.
	(struct gcc_base_vtable): Rename compile to compile_v0.  Update
	comment for compile.  New methods set_verbose and compile.
2017-08-23 11:15:03 -04:00
Tom Tromey e3e41d588a Change gdb_abspath to return a unique_xmalloc_ptr
This changes gdb_abspath to return a unique_xmalloc_ptr, and fixes up
the callers.  This allows the removal of a cleanup, and also puts
ownership rules into the API, where they belong.

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

	* compile/compile.c (compile_file_command): Use
	gdb::unique_xmalloc_ptr, std::string.
	* utils.c (gdb_abspath): Change return type.
	* source.c (openp): Update.
	* objfiles.c (allocate_objfile): Update.
	* main.c (set_gdb_data_directory): Update.
	* utils.h (gdb_abspath): Return a gdb::unique_xmalloc_ptr.
2017-08-22 09:30:10 -06:00
Tom Tromey ee0c32930c Use gdb::unique_xmalloc_ptr when calling tilde_expand
This patch changes most sites calling tilde_expand to use
gdb::unique_xmalloc_ptr, rather than a cleanup.  It also changes
scan_expression_with_cleanup to return a unique pointer, because the
patch was already touching code in that area.

Regression tested on the buildbot.

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

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

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

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

	* utils.h (struct gdb_argv_deleter): New.
	(gdb_argv): New class.
	* utils.c (gdb_argv::reset): New method.
	* tracepoint.c (delete_trace_variable_command): Use gdb_argv.
	* tracefile.c (tsave_command): Use gdb_argv.
	* top.c (new_ui_command): Use gdb_argv.
	* symmisc.c (maintenance_print_symbols)
	(maintenance_print_msymbols, maintenance_expand_symtabs): Use gdb_argv.
	* symfile.c (symbol_file_command, generic_load)
	(remove_symbol_file_command): Use gdb_argv.
	* stack.c (backtrace_command): Use gdb_argv.
	* source.c (add_path, show_substitute_path_command)
	(unset_substitute_path_command, set_substitute_path_command):
	Use gdb_argv.
	* skip.c (skip_command): Use gdb_argv.  Use gdb_buildargv.
	* ser-mingw.c (pipe_windows_open): Use gdb_argv.
	* remote.c (extended_remote_run, remote_put_command)
	(remote_get_command, remote_delete_command): Use gdb_argv.
	* remote-sim.c (gdbsim_load, gdbsim_create_inferior)
	(gdbsim_open): Use gdb_argv.
	* python/py-cmd.c (gdbpy_string_to_argv): Use gdb_argv.
	* psymtab.c (maintenance_print_psymbols): Use gdb_argv.
	* procfs.c (procfs_info_proc): Use gdb_argv.
	* interps.c (interpreter_exec_cmd): Use gdb_argv.
	* infrun.c (handle_command): Use gdb_argv.
	* inferior.c (add_inferior_command, clone_inferior_command):
	Use gdb_argv.
	* guile/scm-string.c (gdbscm_string_to_argv): Use gdb_argv.
	* exec.c (exec_file_command): Use gdb_argv.
	* cli/cli-cmds.c (alias_command): Use gdb_argv.
	* compile/compile.c (build_argc_argv): Use gdb_argv.
2017-08-03 07:59:08 -06:00
Tom Tromey b80cf83844 Remove an unlink cleanup
compile/compile.c had its own cleanup to unlink a file.  This patch
replaces this cleanup with gdb::unlinker.

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

	* compile/compile.c (cleanup_unlink_file): Remove.
	(compile_to_object): Use gdb::unlinker.
	(eval_compile_command): Likewise.
2017-08-03 07:58:57 -06:00
Tom Tromey d419f42dd3 Introduce and use gdb_file_up
This introduces gdb_file_up, a unique pointer holding a FILE*, and
then changes some code in gdb to use it.  In particular
gdb_fopen_cloexec now returns a gdb_file_up.  This allow removing some
cleanups.

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

	* xml-support.c (xml_fetch_content_from_file): Update.
	* ui-file.c (stdio_file::open): Update.
	* tracefile-tfile.c (tfile_start): Update.
	* remote.c (remote_file_put, remote_file_get): Update.
	* nat/linux-procfs.c (linux_proc_get_int)
	(linux_proc_pid_get_state, linux_proc_tid_get_name): Update.
	* nat/linux-osdata.c (linux_common_core_of_thread): Update.
	(command_from_pid, commandline_from_pid, linux_xfer_osdata_cpus)
	(print_sockets, linux_xfer_osdata_shm, linux_xfer_osdata_sem)
	(linux_xfer_osdata_msg, linux_xfer_osdata_modules): Update.
	* nat/linux-btrace.c (linux_determine_kernel_start): Update.
	* linux-nat.c (linux_proc_pending_signals): Update.
	* dwarf2read.c (write_psymtabs_to_index): Use gdb_file_up.
	(file_closer): Remove.
	* compile/compile.c (compile_to_object): Update.
	* common/filestuff.h (struct gdb_file_deleter): New.
	(gdb_file_up): New typedef.
	(gdb_fopen_cloexec): Change return type.
	* common/filestuff.c (gdb_fopen_cloexec): Return gdb_file_up.
	* cli/cli-dump.c (fopen_with_cleanup): Remove.
	(dump_binary_file, restore_binary_file): Update.
	* auto-load.c (auto_load_objfile_script_1): Update.
2017-08-03 07:58:52 -06:00
Simon Marchi 266934d1ad compile-loc2c: Fix uninitialized variable error
Compiling with clang gives this warning/error:

  /home/emaisin/src/binutils-gdb/gdb/compile/compile-loc2c.c:731:6: error: variable 'uoffset' is uninitialized when used here [-Werror,-Wuninitialized]
              uoffset += dwarf2_per_cu_text_offset (per_cu);
              ^~~~~~~
  /home/emaisin/src/binutils-gdb/gdb/compile/compile-loc2c.c:669:23: note: initialize the variable 'uoffset' to silence this warning
        uint64_t uoffset, reg;
                        ^
                         = 0

I am really not sure if what this patch does is good, but it is my best
guess.  DW_OP_addr means that there's an constant address provided by
the DWARF bytecode that should be pushed on the stack.  That address is
considered skipped by the "op_ptr += addr_size", but it is never read.
uoffset is indeed read just after, without having been assigned first.

So I think the intent is to read the address, it was just omitted.

gdb/ChangeLog:

	* compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Read
	address when op is DW_OP_addr.
2017-07-09 20:25:46 +02:00
Pedro Alves d269dfc64f Add STRINGIFY to gdb/common/preprocessor.h
We have several copies of this common idiom under gdb/ currently.
This commit moves them / factors them out to gdb/common/preprocessor.h.

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

	* common/agent.h: Include "common/preprocessor.h".
	(STRINGIZE_1, STRINGIZE): Delete.
	(IPA_SYM): Use STRINGIFY instead.
	* common/preprocessor.h (STRINGIFY_1, STRINGIFY): New.
	* compile/compile-c-support.c: Include "common/preprocessor.h".
	(STR, STRINGIFY): Delete.
	* ia64-libunwind-tdep.c: Include "common/preprocessor.h".
	(STRINGIFY2, STRINGIFY): Delete.
2017-06-22 10:59:42 +01:00
Tom Tromey 711799d513 Use std::vector in compile-loc2c.c
This changes compile-loc2c.c to use std::vector in place of a VEC,
allowing the removal of a cleanup.

gdb/ChangeLog
2017-04-12  Tom Tromey  <tom@tromey.com>

	* compile/compile-loc2c.c (compute_stack_depth_worker): Change
	type of "to_do".  Update.
	(compute_stack_depth): Use std::vector.
2017-04-12 11:16:19 -06:00
Tom Tromey 0e8621a0be Introduce gdb_dlhandle_up
This introduces gdb_dlhandle_up, a unique_ptr that can close a
dlopen'd library.  All the functions working with dlopen handles are
updated to use this new type.

I did not try to build this on Windows.

gdb/ChangeLog
2017-04-12  Tom Tromey  <tom@tromey.com>

	* jit.c (struct jit_reader): Declare separately.  Add constructor
	and destructor.  Change type of "handle".
	(loaded_jit_reader): Define separately.
	(jit_reader_load): Update.  New "new".
	(jit_reader_unload_command): Use "delete".
	* gdb-dlfcn.h (struct dlclose_deleter): New.
	(gdb_dlhandle_up): New typedef.
	(gdb_dlopen, gdb_dlsym): Update types.
	(gdb_dlclose): Remove.
	* gdb-dlfcn.c (gdb_dlopen): Return a gdb_dlhandle_up.
	(gdb_dlsym): Change type of "handle".
	(make_cleanup_dlclose): Remove.
	(dlclose_deleter::operator()): Rename from gdb_dlclose.
	* compile/compile-c-support.c (load_libcc): Update.
2017-04-12 11:16:17 -06:00
Tom Tromey 93921405a4 Introduce command_line_up
This introduces command_line_up, a unique_ptr for command_line
objects, and changes many places to use it.  This removes a number of
cleanups.

Command lines are funny in that sometimes they are reference counted.
Once there is more C++-ification of some of the users, perhaps all of
these can be changed to use shared_ptr instead.

gdb/ChangeLog
2017-04-12  Tom Tromey  <tom@tromey.com>

	* tracepoint.c (actions_command): Update.
	* python/python.c (python_command, python_interactive_command):
	Update.
	* mi/mi-cmd-break.c (mi_cmd_break_commands): Update.
	* guile/guile.c (guile_command): Update.
	* defs.h (read_command_lines, read_command_lines_1): Return
	command_line_up.
	(command_lines_deleter): New struct.
	(command_line_up): New typedef.
	* compile/compile.c (compile_code_command)
	(compile_print_command): Update.
	* cli/cli-script.h (get_command_line, copy_command_lines): Return
	command_line_up.
	(make_cleanup_free_command_lines): Remove.
	* cli/cli-script.c (get_command_line, read_command_lines_1)
	(copy_command_lines): Return command_line_up.
	(while_command, if_command, read_command_lines, define_command)
	(document_command): Update.
	(do_free_command_lines_cleanup, make_cleanup_free_command_lines):
	Remove.
	* breakpoint.h (breakpoint_set_commands): Change type of
	"commands".
	* breakpoint.c (breakpoint_set_commands): Change type of
	"commands".  Update.
	(do_map_commands_command, update_dprintf_command_list)
	(create_tracepoint_from_upload): Update.
2017-04-12 11:16:17 -06:00
Artemiy Volkov aa0061181a Convert lvalue reference type check to general reference type check
In almost all contexts (except for overload resolution rules and expression
semantics), lvalue and rvalue references are equivalent. That means that in all
but these cases we can replace a TYPE_CODE_REF check to a TYPE_IS_REFERENCE
check and, for switch statements, add a case label for a rvalue reference type
next to a case label for an lvalue reference type. This patch does exactly
that.

gdb/ChangeLog

	PR gdb/14441
	* aarch64-tdep.c (aarch64_type_align)
	(aarch64_extract_return_value, aarch64_store_return_value): Change
	lvalue reference type checks to general reference type checks.
	* amd64-tdep.c (amd64_classify): Likewise.
	* amd64-windows-tdep.c (amd64_windows_passed_by_integer_register):
	Likewise.
	* arm-tdep.c (arm_type_align, arm_extract_return_value)
	(arm_store_return_value): Likewise.
	* ax-gdb.c (gen_fetch, gen_cast): Likewise.
	* c-typeprint.c (c_print_type): Likewise.
	* c-varobj.c (adjust_value_for_child_access, c_value_of_variable)
	(cplus_number_of_children, cplus_describe_child): Likewise.
	* compile/compile-c-symbols.c (generate_vla_size): Likewise.
	* completer.c (expression_completer): Likewise.
	* cp-support.c (make_symbol_overload_list_adl_namespace):
	Likewise.
	* darwin-nat-info.c (info_mach_region_command): Likewise.
	* dwarf2loc.c (entry_data_value_coerce_ref)
	(value_of_dwarf_reg_entry): Likewise.
	* eval.c (ptrmath_type_p, evaluate_subexp_standard)
	(evaluate_subexp_for_address, evaluate_subexp_for_sizeof):
	Likewise.
	* findvar.c (extract_typed_address, store_typed_address):
	Likewise.
	* gdbtypes.c (rank_one_type): Likewise.
	* hppa-tdep.c (hppa64_integral_or_pointer_p): Likewise.
	* infcall.c (value_arg_coerce): Likewise.
	* language.c (pointer_type): Likewise.
	* m32c-tdep.c (m32c_reg_arg_type, m32c_m16c_address_to_pointer):
	Likewise.
	* m88k-tdep.c (m88k_integral_or_pointer_p): Likewise.
	* mn10300-tdep.c (mn10300_type_align): Likewise.
	* msp430-tdep.c (msp430_push_dummy_call): Likewise.
	* ppc-sysv-tdep.c (do_ppc_sysv_return_value)
	(ppc64_sysv_abi_push_param, ppc64_sysv_abi_return_value):
	Likewise.
	* printcmd.c (print_formatted, x_command): Likewise.
	* python/py-type.c (typy_get_composite, typy_template_argument):
	Likewise.
	* python/py-value.c (valpy_referenced_value)
	(valpy_get_dynamic_type, value_has_field): Likewise.
	* s390-linux-tdep.c (s390_function_arg_integer): Likewise.
	* sparc-tdep.c (sparc_integral_or_pointer_p): Likewise.
	* sparc64-tdep.c (sparc64_integral_or_pointer_p): Likewise.
	* spu-tdep.c (spu_scalar_value_p): Likewise.
	* symtab.c (lookup_symbol_aux): Likewise.
	* typeprint.c (whatis_exp, print_type_scalar): Likewise.
	* valarith.c (binop_types_user_defined_p, unop_user_defined_p):
	Likewise.
	* valops.c (value_cast_pointers, value_cast)
	(value_reinterpret_cast, value_dynamic_cast, value_addr, typecmp)
	(value_struct_elt, value_struct_elt_bitpos)
	(value_find_oload_method_list, find_overload_match)
	(value_rtti_indirect_type): Likewise.
	* valprint.c (val_print_scalar_type_p, generic_val_print):
	Likewise.
	* value.c (value_actual_type, value_as_address, unpack_long)
	(pack_long, pack_unsigned_long, coerce_ref_if_computed)
	(coerce_ref): Likewise.
	* varobj.c (varobj_get_value_type): Likewise.
2017-03-20 13:47:54 -07:00
Pedro Alves 14bc53a814 Use gdb::function_view in iterate_over_symtabs & co
I wanted to pass a lambda to iterate_over_symtabs (see following
patch), so I converted it to function_view, and then the rest is
cascaded from that.

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

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

	* ada-lang.c: Include "common/function-view.h".
	(ada_iterate_over_symbols): Adjust to use function_view as
	callback type.
	(struct add_partial_datum, ada_complete_symbol_matcher): Delete.
	(ada_make_symbol_completion_list): Use a lambda.
	(ada_exc_search_name_matches): Delete.
	(name_matches_regex): New.
	(ada_add_global_exceptions): Use a lambda and name_matches_regex.
	* compile/compile-c-support.c: Include "common/function-view.h".
	(print_one_macro): Change prototype to accept a ui_file pointer.
	(write_macro_definitions): Use a lambda.
	* dwarf2read.c: Include "common/function-view.h".
	(dw2_map_expand_apply, dw2_map_symtabs_matching_filename)
	(dw2_expand_symtabs_matching): Adjust to use function_view as
	callback type.
	* language.h: Include "common/function-view.h".
	(struct language_defn) <la_iterate_over_symbols>: Adjust to use
	function_view as callback type.
	(LA_ITERATE_OVER_SYMBOLS): Remove DATA parameter.
	* linespec.c: Include "common/function-view.h".
	(collect_info::add_symbol): New method.
	(struct symbol_and_data_callback, iterate_inline_only, struct
	symbol_matcher_data, iterate_name_matcher): Delete.
	(iterate_over_all_matching_symtabs): Adjust to use function_view
	as callback type and lambdas.
	(iterate_over_file_blocks): Adjust to use function_view as
	callback type.
	(decode_compound_collector): Now a class with private fields.
	(decode_compound_collector::release_symbols): New method.
	(collect_one_symbol): Rename to...
	(decode_compound_collector::operator()): ... this and adjust.
	(lookup_prefix_sym): decode_compound_collector construction bits
	move to decode_compound_collector ctor.  Pass the
	decode_compound_collector object directly as callback.  Remove
	cleanups and use decode_compound_collector::release_symbols
	instead.
	(symtab_collector): Now a class with private fields.
	(symtab_collector::release_symtabs): New method.
	(add_symtabs_to_list): Rename to...
	(symtab_collector::operator()): ... this and adjust.
	(collect_symtabs_from_filename): symtab_collector construction
	bits move to symtab_collector ctor.  Pass the symtab_collector
	object directly as callback.  Remove cleanups and use
	symtab_collector::release_symtabs instead.
	(collect_symbols): Delete.
	(add_matching_symbols_to_info): Use lambdas.
	* macrocmd.c (print_macro_callback): Delete.
	(info_macro_command): Use a lambda.
	(info_macros_command): Pass print_macro_definition as callable
	directly.
	(print_one_macro): Remove 'ignore' parameter.
	(macro_list_command): Adjust.
	* macrotab.c (macro_for_each_data::fn): Now a function_view.
	(macro_for_each_data::user_data): Delete field.
	(foreach_macro): Adjust to call the function_view.
	(macro_for_each): Adjust to use function_view as callback type.
	(foreach_macro_in_scope): Adjust to call the function_view.
	(macro_for_each_in_scope): Adjust to use function_view as callback
	type.
	* macrotab.h: Include "common/function-view.h".
	(macro_callback_fn): Declare a prototype instead of a pointer.
	Remove "user_data" parameter.
	(macro_for_each, macro_for_each_in_scope): Adjust to use
	function_view as callback type.
	* psymtab.c (partial_map_expand_apply)
	(psym_map_symtabs_matching_filename, recursively_search_psymtabs):
	Adjust to use function_view as callback type and to return bool.
	(psym_expand_symtabs_matching): Adjust to use function_view as
	callback types.
	* symfile-debug.c (debug_qf_map_symtabs_matching_filename): Adjust
	to use function_view as callback type and to return bool.
	(debug_qf_expand_symtabs_matching): Adjust to use function_view as
	callback types.
	* symfile.c (expand_symtabs_matching): Adjust to use function_view
	as callback types.
	* symfile.h: Include "common/function-view.h".
	(expand_symtabs_file_matcher_ftype)
	(expand_symtabs_symbol_matcher_ftype)
	(expand_symtabs_exp_notify_ftype): Remove "data" parameter and
	return bool.
	(quick_symbol_functions::map_symtabs_matching_filename)
	(quick_symbol_functions::expand_symtabs_matching): Adjust to use
	function_view as callback type and return bool.
	(expand_symtabs_matching): Adjust to use function_view as callback
	type.
	(maintenance_expand_name_matcher)
	(maintenance_expand_file_matcher): Delete.
	(maintenance_expand_symtabs): Use lambdas.
	* symtab.c (iterate_over_some_symtabs): Adjust to use
	function_view as callback types and return bool.
	(iterate_over_symtabs): Likewise.  Use unique_xmalloc_ptr instead
	of a cleanup.
	(lookup_symtab_callback): Delete.
	(lookup_symtab): Use a lambda.
	(iterate_over_symbols): Adjust to use function_view as callback
	type.
	(struct search_symbols_data, search_symbols_file_matches)
	(search_symbols_name_matches): Delete.
	(search_symbols): Use a pair of lambdas.
	(struct add_name_data, add_macro_name, symbol_completion_matcher)
	(symtab_expansion_callback): Delete.
	(default_make_symbol_completion_list_break_on_1): Use lambdas.
	* symtab.h: Include "common/function-view.h".
	(iterate_over_some_symtabs): Adjust to use function_view as
	callback type and return bool.
	(iterate_over_symtabs): Adjust to use function_view as callback
	type.
	(symbol_found_callback_ftype): Remove 'data' parameter and return
	bool.
	(iterate_over_symbols): Adjust to use function_view as callback
	type.
2017-02-23 16:16:06 +00:00
Pedro Alves d7e747318f Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond.  It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.

- mem_fileopen -> string_file

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

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

- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone

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

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

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

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

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

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

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

- gdb_fopen replaced with stack-based objects

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

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

is replaced with this:

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

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

- Global null_stream object

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

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

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

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

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

If you look you will see a couple of spots using "release" where a use
of gdb_bfd_ref_ptr would be cleaner.  These will be fixed in the next
patch.

I think this patch fixes some latent bugs.  For example, it seems to
me that previously objfpy_add_separate_debug_file leaked a BFD.

I'm not 100% certain that the macho_symfile_read_all_oso change is
correct.  The existing code here is hard for me to follow.  One goal
of this sort of automated reference counting, though, is to make it
more difficult to make logic errors; so hopefully the code is clear
now.

2017-01-10  Tom Tromey  <tom@tromey.com>

	* windows-tdep.c (windows_xfer_shared_library): Update.
	* windows-nat.c (windows_make_so): Update.
	* utils.h (make_cleanup_bfd_unref): Remove.
	* utils.c (do_bfd_close_cleanup, make_cleanup_bfd_unref): Remove.
	* symfile.h (symfile_bfd_open)
	(find_separate_debug_file_in_section): Return gdb_bfd_ref_ptr.
	* symfile.c (read_symbols, symbol_file_add)
	(separate_debug_file_exists): Update.
	(symfile_bfd_open): Return gdb_bfd_ref_ptr.
	(generic_load, reread_symbols): Update.
	* symfile-mem.c (symbol_file_add_from_memory): Update.
	* spu-linux-nat.c (spu_bfd_open): Return gdb_bfd_ref_ptr.
	(spu_symbol_file_add_from_memory): Update.
	* solist.h (struct target_so_ops) <bfd_open>: Return
	gdb_bfd_ref_ptr.
	(solib_bfd_fopen, solib_bfd_open): Return gdb_bfd_ref_ptr.
	* solib.c (solib_bfd_fopen, solib_bfd_open): Return
	gdb_bfd_ref_ptr.
	(solib_map_sections, reload_shared_libraries_1): Update.
	* solib-svr4.c (enable_break): Update.
	* solib-spu.c (spu_bfd_fopen): Return gdb_bfd_ref_ptr.
	* solib-frv.c (enable_break2): Update.
	* solib-dsbt.c (enable_break): Update.
	* solib-darwin.c (gdb_bfd_mach_o_fat_extract): Return
	gdb_bfd_ref_ptr.
	(darwin_solib_get_all_image_info_addr_at_init): Update.
	(darwin_bfd_open): Return gdb_bfd_ref_ptr.
	* solib-aix.c (solib_aix_bfd_open): Return gdb_bfd_ref_ptr.
	* record-full.c (record_full_save): Update.
	* python/py-objfile.c (objfpy_add_separate_debug_file): Update.
	* procfs.c (insert_dbx_link_bpt_in_file): Update.
	* minidebug.c (find_separate_debug_file_in_section): Return
	gdb_bfd_ref_ptr.
	* machoread.c (macho_add_oso_symfile): Change abfd to
	gdb_bfd_ref_ptr.
	(macho_symfile_read_all_oso): Update.
	(macho_check_dsym): Return gdb_bfd_ref_ptr.
	(macho_symfile_read): Update.
	* jit.c (bfd_open_from_target_memory): Return gdb_bfd_ref_ptr.
	(jit_bfd_try_read_symtab): Update.
	* gdb_bfd.h (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr)
	(gdb_bfd_openw, gdb_bfd_openr_iovec)
	(gdb_bfd_openr_next_archived_file, gdb_bfd_fdopenr): Return
	gdb_bfd_ref_ptr.
	(gdb_bfd_ref_policy): New struct.
	(gdb_bfd_ref_ptr): New typedef.
	* gdb_bfd.c (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr)
	(gdb_bfd_openw, gdb_bfd_openr_iovec)
	(gdb_bfd_openr_next_archived_file, gdb_bfd_fdopenr): Return
	gdb_bfd_ref_ptr.
	* gcore.h (create_gcore_bfd): Return gdb_bfd_ref_ptr.
	* gcore.c (create_gcore_bfd): Return gdb_bfd_ref_ptr.
	(gcore_command): Update.
	* exec.c (exec_file_attach): Update.
	* elfread.c (elf_symfile_read): Update.
	* dwarf2read.c (dwarf2_get_dwz_file): Update.
	(try_open_dwop_file, open_dwo_file): Return gdb_bfd_ref_ptr.
	(open_and_init_dwo_file): Update.
	(open_dwp_file): Return gdb_bfd_ref_ptr.
	(open_and_init_dwp_file): Update.
	* corelow.c (core_open): Update.
	* compile/compile-object-load.c (compile_object_load): Update.
	* common/gdb_ref_ptr.h (ref_ptr::operator->): New operator.
	* coffread.c (coff_symfile_read): Update.
	* cli/cli-dump.c (bfd_openr_or_error, bfd_openw_or_error): Return
	gdb_bfd_ref_ptr.  Rename.
	(dump_bfd_file, restore_command): Update.
	* build-id.h (build_id_to_debug_bfd): Return gdb_bfd_ref_ptr.
	* build-id.c (build_id_to_debug_bfd): Return gdb_bfd_ref_ptr.
	(find_separate_debug_file_by_buildid): Update.
2017-01-10 19:14:10 -07:00
Tom Tromey fc4007c969 Remove make_cleanup_htab_delete
This removes make_cleanup_htab_delete in favor of destructors,
building on an earlier patch that added the htab_up typedef.

Testing revealed that more cleanup-removal work was needed in
dwarf2loc.c, so this version of the patch changes code there to use
unordered_set and vector, removing some more cleanups.

2017-01-10  Tom Tromey  <tom@tromey.com>

	* utils.h (make_cleanup_htab_delete): Don't declare.
	* utils.c (do_htab_delete_cleanup, make_cleanup_htab_delete):
	Remove.
	* linespec.c (decode_compound_collector): Add constructor,
	destructor.
	(lookup_prefix_sym): Remove cleanup.
	(symtab_collector): Add constructor, destructor.
	(collect_symtabs_from_filename): Remove cleanup.
	* disasm.c (do_mixed_source_and_assembly): Use htab_up.
	* compile/compile-c-symbols.c (generate_c_for_variable_locations):
	Use htab_up.
	* gnu-v3-abi.c (gnuv3_print_vtable): Use htab_up.
	* dwarf2read.c (dw2_expand_symtabs_matching)
	(dw2_map_symbol_filenames, dwarf_decode_macros)
	(write_psymtabs_to_index): Use htab_up.
	* dwarf2loc.c (func_verify_no_selftailcall)
	(call_site_find_chain_1, func_verify_no_selftailcall)
	(chain_candidate, call_site_find_chain_1): Use std::unordered_set,
	std::vector, gdb::unique_xmalloc_ptr.
	(call_sitep): Remove typedef.
	(dwarf2_locexpr_baton_eval): Remove unused variable.
2017-01-10 19:14:08 -07:00
Joel Brobecker 61baf725ec update copyright year range in GDB files
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.

gdb/ChangeLog:

        Update copyright year range in all GDB files.
2017-01-01 10:52:34 +04:00
Pedro Alves aaee65aea2 Use ui_file_as_string in gdb/compile/
Using ui_file_as_string would imply changing a few prototypes to pass
around source and object file names as std::string.  Instead of that,
wrap those two in a new class.  This ends up eliminating a small
wrinkle: get_new_file_names and compile_object_load have swapped
parameters.  The former takes "source, objfile", while the latter
takes "objfile, source".

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

	* c-lang.h (c_compute_program): Now returns std::string.
	* compile/compile-internal.h (class compile_file_names): New
	class.
	* compile/compile-object-load.c (compile_object_load): Replace
	object_file and source_file parameters with a compile_file_names
	parameter.  Adjust.
	* compile-object-load.h: Include "compile-internal.h".
	(compile_object_load): Replace object_file and source_file
	parameters with a compile_file_names parameter.
	* compile/compile-c-support.c (c_compute_program): Now returns a
	std::string.  Use ui_file_as_string.
	* compile/compile.c (get_new_file_names): Remove parameters and
	return a compile_file_names instead.
	(compile_to_object): Now returns a compile_file_names.  Use
	ui_file_as_string.
	(eval_compile_command): Use compile_file_names.
	* language.h (struct language_defn) <la_compute_program>: Now
	returns std::string.
2016-11-08 15:26:46 +00:00
Tom Tromey b7b633e9b1 Use RAII to save and restore scalars
This patch replaces many (but not all) uses of
make_cleanup_restore_integer with a simple RAII-based template class.
It also removes the similar restore_execution_direction cleanup in
favor of this new class.  Subsequent patches will replace other
similar cleanups with this class.

The class is typically instantiated using make_scoped_restore.  This
allows for template argument deduction.

2016-10-21  Tom Tromey  <tom@tromey.com>

	* common/scoped_restore.h: New file.
	* utils.h: Include scoped_restore.h.
	* top.c (execute_command_to_string): Use scoped_restore.
	* python/python.c (python_interactive_command): Use
	scoped_restore.
	(python_command, execute_gdb_command): Likewise.
	* printcmd.c (do_one_display): Use scoped_restore.
	* mi/mi-main.c (exec_continue): Use scoped_restore.
	* mi/mi-cmd-var.c (mi_cmd_var_assign): Use scoped_restore.
	* linux-fork.c (checkpoint_command): Use scoped_restore.
	* infrun.c (restore_execution_direction): Remove.
	(fetch_inferior_event): Use scoped_restore.
	* compile/compile.c (compile_file_command): Use
	scoped_restore.
	(compile_code_command, compile_print_command): Likewise.
	* cli/cli-script.c (execute_user_command): Use
	scoped_restore.
	(while_command, if_command, script_from_file): Likewise.
	* arm-tdep.c (arm_insert_single_step_breakpoint): Use
	scoped_restore.
2016-10-21 14:17:31 -06:00
Pedro Alves 325fac504a gdb: Use std::min and std::max throughout
Otherwise including <string> or some other C++ header is broken.
E.g.:

  In file included from /opt/gcc/include/c++/7.0.0/bits/char_traits.h:39:0,
		   from /opt/gcc/include/c++/7.0.0/string:40,
		   from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/infrun.c:68:
  /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
       min(const _Tp& __a, const _Tp& __b, _Compare __comp)
							  ^
  /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2
       max(const _Tp& __a, const _Tp& __b, _Compare __comp)
							  ^
  In file included from .../src/gdb/infrun.c:21:0:

To the best of my grepping abilities, I believe I adjusted all min/max
calls.

gdb/ChangeLog:
2016-09-16  Pedro Alves  <palves@redhat.com>

	* defs.h (min, max): Delete.
	* aarch64-tdep.c: Include <algorithm> and use std::min and
	std::max throughout.
	* aarch64-tdep.c: Likewise.
	* alpha-tdep.c: Likewise.
	* amd64-tdep.c: Likewise.
	* amd64-windows-tdep.c: Likewise.
	* arm-tdep.c: Likewise.
	* avr-tdep.c: Likewise.
	* breakpoint.c: Likewise.
	* btrace.c: Likewise.
	* ctf.c: Likewise.
	* disasm.c: Likewise.
	* doublest.c: Likewise.
	* dwarf2loc.c: Likewise.
	* dwarf2read.c: Likewise.
	* environ.c: Likewise.
	* exec.c: Likewise.
	* f-exp.y: Likewise.
	* findcmd.c: Likewise.
	* ft32-tdep.c: Likewise.
	* gcore.c: Likewise.
	* hppa-tdep.c: Likewise.
	* i386-darwin-tdep.c: Likewise.
	* i386-tdep.c: Likewise.
	* linux-thread-db.c: Likewise.
	* lm32-tdep.c: Likewise.
	* m32r-tdep.c: Likewise.
	* m88k-tdep.c: Likewise.
	* memrange.c: Likewise.
	* minidebug.c: Likewise.
	* mips-tdep.c: Likewise.
	* moxie-tdep.c: Likewise.
	* nds32-tdep.c: Likewise.
	* nios2-tdep.c: Likewise.
	* nto-procfs.c: Likewise.
	* parse.c: Likewise.
	* ppc-sysv-tdep.c: Likewise.
	* probe.c: Likewise.
	* record-btrace.c: Likewise.
	* remote.c: Likewise.
	* rs6000-tdep.c: Likewise.
	* rx-tdep.c: Likewise.
	* s390-linux-nat.c: Likewise.
	* s390-linux-tdep.c: Likewise.
	* ser-tcp.c: Likewise.
	* sh-tdep.c: Likewise.
	* sh64-tdep.c: Likewise.
	* source.c: Likewise.
	* sparc-tdep.c: Likewise.
	* symfile.c: Likewise.
	* target-memory.c: Likewise.
	* target.c: Likewise.
	* tic6x-tdep.c: Likewise.
	* tilegx-tdep.c: Likewise.
	* tracefile-tfile.c: Likewise.
	* tracepoint.c: Likewise.
	* valprint.c: Likewise.
	* value.c: Likewise.
	* xtensa-tdep.c: Likewise.
	* cli/cli-cmds.c: Likewise.
	* compile/compile-object-load.c: Likewise.
2016-09-16 19:55:17 +01:00