Commit Graph

129 Commits

Author SHA1 Message Date
Pedro Alves e3d60dfc00 GC inferior.c:init_inferior_list
Not used anywhere.  This was actually never used.  It came in because
I originally created inferior.c by copying thread.c, and doing
s/thread/inferior/g, and missed that nothing needs this.  :-)

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

	* inferior.c (init_inferior_list): Delete.
	* inferior.h (init_inferior_list): Delete.
2017-04-13 16:18:16 +01:00
Pedro Alves 7a1149643d -Wwrite-strings: Constify target_pid_to_str and target_thread_extra_thread_info
-Wwrite-strings flagged a missing cast for example here:

   static char *
   ravenscar_extra_thread_info (struct target_ops *self, struct thread_info *tp)
   {
     return "Ravenscar task";

Since callers are not supposed to free the string returned by these
methods, change the methods' signature to return const strings.

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

	* aix-thread.c (aix_thread_pid_to_str)
	(aix_thread_extra_thread_info): Constify.
	* bsd-kvm.c (bsd_kvm_pid_to_str): Constify.
	* bsd-uthread.c (bsd_uthread_extra_thread_info)
	(bsd_uthread_pid_to_str): Constify.
	* corelow.c (core_pid_to_str): Constify.
	* darwin-nat.c (darwin_pid_to_str): Constify.
	* fbsd-nat.c (fbsd_pid_to_str): Constify.
	* fbsd-tdep.c (fbsd_core_pid_to_str, gdbarch_core_pid_to_str):
	Constify.
	* gnu-nat.c (gnu_pid_to_str): Constify.
	* go32-nat.c (go32_pid_to_str): Constify.
	* i386-cygwin-tdep.c (i386_windows_core_pid_to_str): Constify.
	* inf-ptrace.c (inf_ptrace_pid_to_str): Constify.
	* inferior.c (inferior_pid_to_str): Constify.
	* linux-nat.c (linux_nat_pid_to_str): Constify.
	* linux-tdep.c (linux_core_pid_to_str): Constify.
	* linux-thread-db.c (thread_db_pid_to_str)
	(thread_db_extra_thread_info): Constify.
	* nto-tdep.c (nto_extra_thread_info): Constify.
	* nto-tdep.h (nto_extra_thread_info): Constify.
	* obsd-nat.c (obsd_pid_to_str): Constify.
	* procfs.c (procfs_pid_to_str): Constify.
	* ravenscar-thread.c (ravenscar_extra_thread_info)
	(ravenscar_pid_to_str): Constify.
	* remote-sim.c (gdbsim_pid_to_str): Constify.
	* remote.c (remote_threads_extra_info, remote_pid_to_str):
	Constify.
	* sol-thread.c (solaris_pid_to_str): Constify.
	* sol2-tdep.c (sol2_core_pid_to_str): Constify.
	* sol2-tdep.h (sol2_core_pid_to_str): Constify.
	* target.c (default_pid_to_str, target_pid_to_str)
	(normal_pid_to_str, default_pid_to_str): Constify.
	* target.h (target_ops::to_pid_to_str)
	(target_ops::to_extra_thread_info): Constify.
	(target_pid_to_str, normal_pid_to_str): Constify.
	* windows-nat.c (windows_pid_to_str): Constify.
	* gdbarch.sh (core_pid_to_str): Constify.
	* target-delegates.c: Regenerate.
	* gdbarch.h, gdbarch.c: Regenerate.
2017-04-05 19:21:34 +01: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
Simon Marchi 112e8700a6 Class-ify ui_out
This patch finalizes the C++ conversion of the ui-out subsystem, by
turning the ui_out and ui_out_impl structures into a single class
hierarchy.  ui_out functions are turned into virtual methods of that new
class, so as a result there are a lot of call sites to update.

In the previous version of the patchset, there were separate ui_out and
ui_out_impl classes, but it wasn't really useful and added boilerplate.
In this version there is simply an ui_out base class that is
extended for CLI, TUI and MI.

It's a bit hard to maintain a ChangeLog for such a big patch, I did my
best but I'm sure there are some missing or outdated info in there...

gdb/ChangeLog:

    * ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header,
    ui_out_table_body,  ui_out_field_int, ui_out_field_fmt_int,
    ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream,
    ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text,
    ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags,
    ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect):
    Remove, replace with a method in class ui_out.
    (table_begin_ftype): Remove, replace with pure virtual method in
    class ui_out.
    (table_body_ftype): Likewise.
    (table_end_ftype): Likewise.
    (table_header_ftype): Likewise.
    (ui_out_begin_ftype): Likewise.
    (ui_out_end_ftype): Likewise.
    (field_int_ftype): Likewise.
    (field_skip_ftype): Likewise.
    (field_string_ftype): Likewise.
    (field_fmt_ftype): Likewise.
    (spaces_ftype): Likewise.
    (text_ftype): Likewise.
    (message_ftype): Likewise.
    (wrap_hint_ftype): Likewise.
    (flush_ftype): Likewise.
    (redirect_ftype): Likewise.
    (data_destroy_ftype): Likewise.
    (struct ui_out_impl): Remove, replace with class ui_out.
    (ui_out_new): Remove.
    (class ui_out): New class.
    * ui-out.c (struct ui_out): Remove, replaced with class ui_out.
    (current_level): Remove, replace with ui_out method.
    (push_level): Likewise.
    (pop_level): Likewise.
    (uo_table_begin, uo_table_body, uo_table_end, uo_table_header,
    uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt,
    uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush,
    uo_redirect, uo_field_string): Remove.
    (ui_out_table_begin): Replace with ...
    (ui_out::table_begin): ... this.
    (ui_out_table_body): Replace with ...
    (ui_out::table_body): ... this.
    (ui_out_table_end): Replace with ...
    (ui_out::table_end): ... this.
    (ui_out_table_header): Replace with ...
    (ui_out::table_header): ... this.
    (ui_out_begin): Replace with ...
    (ui_out::begin): ... this.
    (ui_out_end): Replace with ...
    (ui_out::end): ... this.
    (ui_out_field_int): Replace with ...
    (ui_out::field_int): ... this.
    (ui_out_field_fmt_int): Replace with ...
    (ui_out::field_fmt_int): ... this.
    (ui_out_field_core_addr): Replace with ...
    (ui_out::field_core_addr): ... this.
    (ui_out_field_stream): Replace with ...
    (ui_out::field_stream): ... this.
    (ui_out_field_skip): Replace with ...
    (ui_out::field_skip): ... this.
    (ui_out_field_string): Replace with ...
    (ui_out::field_string): ... this.
    (ui_out_field_fmt): Replace with ...
    (ui_out::field_fmt): ... this.
    (ui_out_spaces): Replace with ...
    (ui_out::spaces): ... this.
    (ui_out_text): Replace with ...
    (ui_out::text): ... this.
    (ui_out_message): Replace with ...
    (ui_out::message): ... this.
    (ui_out_wrap_hint): Replace with ...
    (ui_out::wrap_hint): ... this.
    (ui_out_flush): Replace with ...
    (ui_out::flush): ... this.
    (ui_out_redirect): Replace with ...
    (ui_out::redirect): ... this.
    (ui_out_test_flags): Replace with ...
    (ui_out::test_flags): ... this.
    (ui_out_is_mi_like_p): Replace with ...
    (ui_out::is_mi_like_p): ... this.
    (verify_field): Replace with ...
    (ui_out::verify_field): ... this.
    (ui_out_query_field): Replace with ...
    (ui_out::query_table_field): ... this.
    (ui_out_data): Remove.
    (ui_out_new): Remove, replace with ...
    (ui_out::ui_out): ... this constructor.
    (do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end,
    do_cleanup_end, make_cleanup_ui_out_tuple_begin_end,
    make_cleanup_ui_out_list_begin_end): Update fallouts of struct
    ui_out -> class ui_out change.
    * cli-out.c (cli_out_data): Remove.
    (cli_uiout_dtor): Remove.
    (cli_table_begin): Replace with ...
    (cli_ui_out::do_table_begin): ... this new method.
    (cli_table_body): Replace with ...
    (cli_ui_out::do_table_body): ... this new method.
    (cli_table_end): Replace with ...
    (cli_ui_out::do_table_end): ... this new method.
    (cli_table_header): Replace with ...
    (cli_ui_out::do_table_header): ... this new method.
    (cli_begin): Replace with ...
    (cli_ui_out::do_begin): ... this new method.
    (cli_end): Replace with ...
    (cli_ui_out::do_end): ... this new method.
    (cli_field_int): Replace with ...
    (cli_ui_out::do_field_int): ... this new method.
    (cli_field_skip): Replace with ...
    (cli_ui_out::do_field_skip): ... this new method.
    (cli_field_string): Replace with ...
    (cli_ui_out::do_field_string): ... this new method.
    (cli_field_fmt): Replace with ...
    (cli_ui_out::do_field_fmt): ... this new method.
    (cli_spaces): Replace with ...
    (cli_ui_out::do_spaces): ... this new method.
    (cli_text): Replace with ...
    (cli_ui_out::do_text): ... this new method.
    (cli_message): Replace with ...
    (cli_ui_out::do_message): ... this new method.
    (cli_wrap_hint): Replace with ...
    (cli_ui_out::do_wrap_hint): ... this new method.
    (cli_flush): Replace with ...
    (cli_ui_out::do_flush): ... this new method.
    (cli_redirect): Replace with ...
    (cli_ui_out::do_redirect): ... this new method.
    (out_field_fmt): Replace with ...
    (cli_ui_out::out_field_fmt): ... this new method.
    (field_separator): Replace with ...
    (cli_ui_out::field_separator): ... this new method.
    (cli_out_set_stream): Replace with ...
    (cli_ui_out::set_stream): ... this new method.
    (cli_ui_out_impl): Remove.
    (cli_out_data_ctor): Remove.
    (cli_ui_out_impl::cli_ui_out_impl): New constructor.
    (cli_ui_out_impl::~cli_ui_out_impl): New destructor.
    (cli_out_new): Change return type to cli_ui_out *, instantiate a
    cli_ui_out.
    * cli-out.h (cli_ui_out_data): Remove, replace with class
    cli_ui_out.
    (class cli_ui_out): New class.
    (cli_ui_out_impl): Remove.
    (cli_out_data_ctor): Remove.
    (cli_out_new): Change return type to cli_ui_out*.
    (cli_out_set_stream): Remove.
    * cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type
    to cli_ui_out*.
    (cli_interpreter_resume): Adapt.
    (cli_interpreter_exec): Adapt.
    * mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove.
    (mi_ui_out_impl): Remove.
    (mi_table_begin): Replace with ...
    (mi_ui_out::do_table_begin): ... this.
    (mi_table_body): Replace with ...
    (mi_ui_out::do_table_body): ... this.
    (mi_table_end): Replace with ...
    (mi_ui_out::do_table_end): ... this.
    (mi_table_header): Replace with ...
    (mi_ui_out::do_table_header): ... this.
    (mi_begin): Replace with ...
    (mi_ui_out::do_begin): ... this.
    (mi_end): Replace with ...
    (mi_ui_out::do_end): ... this.
    (mi_field_int): Replace with ...
    (mi_ui_out::do_field_int): ... this.
    (mi_field_skip): Replace with ...
    (mi_ui_out::do_field_skip): ... this.
    (mi_field_string): Replace with ...
    (mi_ui_out::do_field_string): ... this.
    (mi_field_fmt): Replace with ...
    (mi_ui_out::do_field_fmt): ... this.
    (mi_spaces): Replace with ...
    (mi_ui_out::do_spaces): ... this.
    (mi_text): Replace with ...
    (mi_ui_out::do_text): ... this.
    (mi_message): Replace with ...
    (mi_ui_out::do_message): ... this.
    (mi_wrap_hint): Replace with ...
    (mi_ui_out::do_wrap_hint): ... this.
    (mi_flush): Replace with ...
    (mi_ui_out::do_flush): ... this.
    (mi_redirect): Replace with ...
    (mi_ui_out::do_redirect):
    (field_separator): Replace with ...
    (mi_ui_out::field_separator):
    (mi_open): Replace with ...
    (mi_ui_out::open): ... this.
    (mi_close): Replace with ...
    (mi_ui_out::close): ... this.
    (mi_out_rewind): Replace with ...
    (mi_ui_out::rewind): ... this.
    (mi_out_put): Replace with ...
    (mi_ui_out::put): ... this.
    (mi_version): Replace with ...
    (mi_ui_out::version): ... this.
    (mi_out_data_ctor): Replace with ...
    (mi_ui_out::mi_ui_out): ... this.
    (mi_out_data_dtor): Replace with ...
    (mi_ui_out::~mi_ui_out): ... this.
    (mi_out_new): Change return type to mi_ui_out*, instantiate
    an mi_ui_out object.
    (as_mi_ui_out): New function.
    (mi_version): Update fallouts of struct ui_out to class ui_out
    transition.
    (mi_out_put): Likewise.
    (mi_out_rewind): Likewise.
    * mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*.
    * tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl):
    Remove.
    (tui_field_int): Replace with ...
    (tui_ui_out::do_field_int): ... this.
    (tui_field_string): Replace with ...
    (tui_ui_out::do_field_string): ... this.
    (tui_field_fmt): Replace with ...
    (tui_ui_out::do_field_fmt): ... this.
    (tui_text): Replace with ...
    (tui_ui_out::do_text): ... this.
    (tui_out_new): Change return type to tui_ui_out*, instantiate
    tui_ui_out object.
    (tui_ui_out::tui_ui_out): New.
    * tui/tui-out.h: New file.
    * tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h.
    * tui/tui-io.c: Include tui/tui-out.h.
    (tui_old_uiout): Change type to cli_ui_out*.
    (tui_setup_io): Use dynamic_cast.
    * tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*.
    * tui/tui-interp.c (tui_resume): Adapt.
    * ada-lang.c (print_it_exception): Update fallouts of struct
    ui_out to class ui_out transition.
    (print_one_exception): Likewise.
    (print_mention_exception): Likewise.
    * ada-tasks.c (print_ada_task_info): Likewise.
    (info_task): Likewise.
    (task_command): Likewise.
    * auto-load.c (print_script): Likewise.
    (auto_load_info_scripts): Likewise.
    (info_auto_load_cmd): Likewise.
    * break-catch-sig.c (signal_catchpoint_print_one): Likewise.
    * break-catch-syscall.c (print_it_catch_syscall): Likewise.
    (print_one_catch_syscall): Likewise.
    * break-catch-throw.c (print_it_exception_catchpoint): Likewise.
    (print_one_exception_catchpoint): Likewise.
    (print_one_detail_exception_catchpoint): Likewise.
    (print_mention_exception_catchpoint): Likewise.
    * breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise.
    (print_solib_event): Likewise.
    (watchpoint_check): Likewise.
    (wrap_indent_at_field): Likewise.
    (print_breakpoint_location): Likewise.
    (output_thread_groups): Likewise.
    (print_one_breakpoint_location): Likewise.
    (breakpoint_1): Likewise.
    (default_collect_info): Likewise.
    (watchpoints_info): Likewise.
    (print_it_catch_fork): Likewise.
    (print_one_catch_fork): Likewise.
    (print_it_catch_vfork): Likewise.
    (print_one_catch_vfork): Likewise.
    (print_it_catch_solib): Likewise.
    (print_one_catch_solib): Likewise.
    (print_it_catch_exec): Likewise.
    (print_one_catch_exec): Likewise.
    (mention): Likewise.
    (print_it_ranged_breakpoint): Likewise.
    (print_one_ranged_breakpoint): Likewise.
    (print_one_detail_ranged_breakpoint): Likewise.
    (print_mention_ranged_breakpoint): Likewise.
    (print_it_watchpoint): Likewise.
    (print_mention_watchpoint): Likewise.
    (print_it_masked_watchpoint): Likewise.
    (print_one_detail_masked_watchpoint): Likewise.
    (print_mention_masked_watchpoint): Likewise.
    (bkpt_print_it): Likewise.
    (tracepoint_print_one_detail): Likewise.
    (tracepoint_print_mention): Likewise.
    (update_static_tracepoint): Likewise.
    (tracepoints_info): Likewise.
    (save_breakpoints): Likewise.
    * cli/cli-cmds.c (complete_command): Likewise.
    * cli/cli-logging.c (set_logging_redirect): Likewise.
    (pop_output_files): Likewise.
    (handle_redirections): Likewise.
    * cli/cli-script.c (print_command_lines): Likewise.
    * cli/cli-setshow.c (do_show_command): Likewise.
    (cmd_show_list): Likewise.
    * cp-abi.c (list_cp_abis): Likewise.
    (show_cp_abi_cmd): Likewise.
    * darwin-nat-info.c (darwin_debug_regions_recurse): Likewise.
    * disasm.c (gdb_pretty_print_insn): Likewise.
    (do_mixed_source_and_assembly_deprecated): Likewise.
    (do_mixed_source_and_assembly): Likewise.
    * gdb_bfd.c (print_one_bfd): Likewise.
    (maintenance_info_bfds): Likewise.
    * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise.
    * guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise.
    * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise.
    * i386-tdep.c (i386_mpx_print_bounds): Likewise.
    * infcmd.c (run_command_1): Likewise.
    (print_return_value_1): Likewise.
    * inferior.c (print_selected_inferior): Likewise.
    (print_inferior): Likewise.
    * infrun.c (print_end_stepping_range_reason): Likewise.
    (print_signal_exited_reason): Likewise.
    (print_exited_reason): Likewise.
    (print_signal_received_reason): Likewise.
    (print_no_history_reason): Likewise.
    * interps.c (interp_set): Likewise.
    * linespec.c (decode_line_full): Likewise.
    * linux-thread-db.c (info_auto_load_libthread_db): Likewise.
    * mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise.
    (mi_cmd_env_path): Likewise.
    (mi_cmd_env_dir): Likewise.
    (mi_cmd_inferior_tty_show): Likewise.
    * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise.
    (print_partial_file_name): Likewise.
    (mi_cmd_file_list_exec_source_files): Likewise.
    * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise.
    (mi_cmd_info_gdb_mi_command): Likewise.
    * mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise.
    (mi_cmd_stack_list_args): Likewise.
    (list_arg_or_local): Likewise.
    * mi/mi-cmd-var.c (print_varobj): Likewise.
    (mi_cmd_var_create): Likewise.
    (mi_cmd_var_delete): Likewise.
    (mi_cmd_var_set_format): Likewise.
    (mi_cmd_var_show_format): Likewise.
    (mi_cmd_var_info_num_children): Likewise.
    (mi_cmd_var_list_children): Likewise.
    (mi_cmd_var_info_type): Likewise.
    (mi_cmd_var_info_path_expression): Likewise.
    (mi_cmd_var_info_expression): Likewise.
    (mi_cmd_var_show_attributes): Likewise.
    (mi_cmd_var_evaluate_expression): Likewise.
    (mi_cmd_var_assign): Likewise.
    (varobj_update_one): Likewise.
    * mi/mi-interp.c (as_mi_interp): Likewise.
    (mi_on_normal_stop_1): Likewise.
    (mi_tsv_modified): Likewise.
    (mi_breakpoint_created): Likewise.
    (mi_breakpoint_modified): Likewise.
    (mi_solib_loaded): Likewise.
    (mi_solib_unloaded): Likewise.
    (mi_command_param_changed): Likewise.
    (mi_memory_changed): Likewise.
    (mi_user_selected_context_changed): Likewise.
    * mi/mi-main.c (print_one_inferior): Likewise.
    (output_cores): Likewise.
    (list_available_thread_groups): Likewise.
    (mi_cmd_data_list_register_names): Likewise.
    (mi_cmd_data_list_changed_registers): Likewise.
    (output_register): Likewise.
    (mi_cmd_data_evaluate_expression): Likewise.
    (mi_cmd_data_read_memory): Likewise.
    (mi_cmd_data_read_memory_bytes): Likewise.
    (mi_cmd_list_features): Likewise.
    (mi_cmd_list_target_features): Likewise.
    (mi_cmd_add_inferior): Likewise.
    (mi_execute_command): Likewise.
    (mi_load_progress): Likewise.
    (print_variable_or_computed): Likewise.
    (mi_cmd_trace_frame_collected): Likewise.
    * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise.
    * osdata.c (info_osdata_command): Likewise.
    * probe.c (gen_ui_out_table_header_info): Likewise.
    (print_ui_out_not_applicables): Likewise.
    (print_ui_out_info): Likewise.
    (info_probes_for_ops): Likewise.
    (enable_probes_command): Likewise.
    (disable_probes_command): Likewise.
    * progspace.c (print_program_space): Likewise.
    * python/py-breakpoint.c (bppy_get_commands): Likewise.
    * python/py-framefilter.c (py_print_type): Likewise.
    (py_print_value): Likewise.
    (py_print_single_arg): Likewise.
    (enumerate_args): Likewise.
    (enumerate_locals): Likewise.
    (py_print_args): Likewise.
    (py_print_frame): Likewise.
    * record-btrace.c (btrace_ui_out_decode_error): Likewise.
    (btrace_call_history_insn_range): Likewise.
    (btrace_call_history_src_line): Likewise.
    (btrace_call_history): Likewise.
    * remote.c (show_remote_cmd): Likewise.
    * skip.c (skip_info): Likewise.
    * solib.c (info_sharedlibrary_command): Likewise.
    * source.c (print_source_lines_base): Likewise.
    * spu-tdep.c (info_spu_event_command): Likewise.
    (info_spu_signal_command): Likewise.
    (info_spu_mailbox_list): Likewise.
    (info_spu_dma_cmdlist): Likewise.
    (info_spu_dma_command): Likewise.
    (info_spu_proxydma_command): Likewise.
    * stack.c (print_stack_frame): Likewise.
    (print_frame_arg): Likewise.
    (read_frame_arg): Likewise.
    (print_frame_args): Likewise.
    (print_frame_info): Likewise.
    (print_frame): Likewise.
    * symfile.c (load_progress): Likewise.
    (generic_load): Likewise.
    (print_transfer_performance): Likewise.
    * thread.c (do_captured_list_thread_ids): Likewise.
    (print_thread_info_1): Likewise.
    (restore_selected_frame): Likewise.
    (do_captured_thread_select): Likewise.
    (print_selected_thread_frame): Likewise.
    * top.c (execute_command_to_string): Likewise.
    * tracepoint.c (tvariables_info_1): Likewise.
    (trace_status_mi): Likewise.
    (tfind_1): Likewise.
    (print_one_static_tracepoint_marker): Likewise.
    (info_static_tracepoint_markers_command): Likewise.
    * utils.c (do_ui_out_redirect_pop): Likewise.
    (fputs_maybe_filtered): Likewise.
2016-12-22 16:19:42 -05:00
Thomas Schwinge 53488a6e19 Avoid PATH_MAX usage
On GNU/Hurd, there is no "#define PATH_MAX", so this failed to build.

	gdb/
	* inferior.c (print_selected_inferior): Avoid PATH_MAX usage.
2016-12-09 07:19:28 +01:00
Simon Marchi 5590c2bae0 Remove unnecessary inferior lookup in inferior_command
In the case where we switch to a non-running inferior, we do a
"find_inferior_id (num)", although we did the same call right before.

gdb/ChangeLog:

	* inferior.c (inferior_command): Remove duplicate
	find_inferior_id call.
2016-12-06 16:19:33 -05:00
Simon Marchi 7fb048a2ee Remove verbosity from ui_out_message and friends
That concept is never actually used, so it's just a burden.  Removing it
facilitates the refactoring in upcoming patches.

gdb/ChangeLog:

	* mi/mi-out.c (mi_message): Remove verbosity argument.
	* ada-tasks.c (print_ada_task_info, info_task, task_command):
	Update call.
	* auto-load.c (auto_load_info_scripts): Likewise.
	* breakpoint.c (breakpoint_1, watchpoints_info, tracepoints_info):
	Likewise.
	* cli-out.c (cli_message): Remove verbosity argument.
	* inferior.c (print_inferior): Update call.
	* linux-thread-db.c (info_auto_load_libthread_db): Likewise.
	* probe.c (info_probes_for_ops): Likewise.
	* skip.c (skip_info): Likewise.
	* solib.c (info_sharedlibrary_command): Likewise.
	* symfile.c (load_progress): Likewise.
	* thread.c (print_thread_info_1): Likewise.
	* ui-out.c (uo_message, ui_out_message): Remove verbosity argument.
	(ui_out_get_verblvl): Remove.
	* ui-out.h (ui_out_message): Remove verbosity argument.
	(ui_out_get_verblvl): Remove.
	(message_ftype): Remove verbosity argument.
2016-11-26 22:06:21 -05:00
Sandra Loosemore ecf45d2cc7 PR 20569, segv in follow_exec
The following testcases make GDB crash whenever an invalid sysroot is
provided, when GDB is unable to find a valid path to the symbol file:

 gdb.base/catch-syscall.exp
 gdb.base/execl-update-breakpoints.exp
 gdb.base/foll-exec-mode.exp
 gdb.base/foll-exec.exp
 gdb.base/foll-vfork.exp
 gdb.base/pie-execl.exp
 gdb.multi/bkpt-multi-exec.exp
 gdb.python/py-finish-breakpoint.exp
 gdb.threads/execl.exp
 gdb.threads/non-ldr-exc-1.exp
 gdb.threads/non-ldr-exc-2.exp
 gdb.threads/non-ldr-exc-3.exp
 gdb.threads/non-ldr-exc-4.exp
 gdb.threads/thread-execl.exp

The immediate cause of the segv is that follow_exec is passing a NULL
argument (the result of exec_file_find) to strlen.

However, the problem is deeper than that: follow_exec simply isn't
prepared for the case where sysroot translation fails to locate the
new executable.  Actually all callers of exec_file_find have bugs due
to confusion between host and target pathnames.  This commit attempts
to fix all that.

In terms of the testcases that were formerly segv'ing, GDB now prints
a warning but continues execution of the new program, so that the
tests now mostly FAIL instead.  You could argue the FAILs are due to a
legitimate problem with the test environment setting up the sysroot
translation incorrectly.

A new representative test is added which exercises the ne wwarning
code path even with native testing.

Tested on x86_64 Fedora 23, native and gdbserver.

gdb/ChangeLog:
2016-10-25  Sandra Loosemore  <sandra@codesourcery.com>
	    Luis Machado  <lgustavo@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	PR gdb/20569
	* exceptions.c (exception_print_same): Moved here from exec.c.
	* exceptions.h (exception_print_same): Declare.
	* exec.h: Include "symfile-add-flags.h".
	(try_open_exec_file): New declaration.
	* exec.c (exception_print_same): Moved to exceptions.c.
	(try_open_exec_file): New function.
	(exec_file_locate_attach): Rename exec_file and full_exec_path
	variables to avoid confusion between target and host pathnames.
	Move pathname processing logic to exec_file_find.  Do not return
	early if pathname lookup fails; Call try_open_exec_file.
	* infrun.c (follow_exec): Split and rename execd_pathname variable
	to avoid confusion between target and host pathnames.  Warn if
	pathname lookup fails.  Pass target pathname to
	target_follow_exec, not hostpathname.  Call try_open_exec_file.
	* main.c (symbol_file_add_main_adapter): New function.
	(captured_main_1): Use it.
	* solib-svr4.c (open_symbol_file_object): Adjust to pass
	symfile_add_flags to symbol_file_add_main.
	* solib.c (exec_file_find): Incorporate fallback logic for relative
	pathnames formerly in exec_file_locate_attach.
	* symfile.c (symbol_file_add_main, symbol_file_add_main_1):
	Replace 'from_tty' parameter with a symfile_add_file.
	(symbol_file_command): Adjust to pass symfile_add_flags to
	symbol_file_add_main.
	* symfile.h (symbol_file_add_main): Replace 'from_tty' parameter
	with a symfile_add_file.

gdb/testsuite/ChangeLog:
2016-10-25  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.base/exec-invalid-sysroot.exp: New file.
2016-10-26 16:47:46 +01:00
Pedro Alves ef4a339527 gdb: Free inferior->priv when inferior exits
(Where "exits" includes being killed or detached.)

Nothing is clearing inferior->priv currently.  This is a problem if we
change the inferior's process_stratum targets in a single debug
session.  This field is currently only used by darwin-nat.c, but a
follow up patch will make remote.c use it too.  Without the fix,
remote.c might end up mistaking the priv object allocated by
darwin-nat.c with its own.

(Found by inspection.)

gdb/ChangeLog:
2016-10-26  Pedro Alves  <palves@redhat.com>

	* inferior.c (exit_inferior_1): Free 'priv'.
2016-10-26 16:21:40 +01:00
Pedro Alves bfd282882d Convert tid_range_parser and get_number_or_range to classes
This converts tid_range_parser and get_number_or_range to be classes.
The various tid_range_parser_* and get_number_or_range_* functions
become methods on the respective classes.  Then it updates the users
to follow.

The rationale for the change is that this provides better
encapsulation.  For example, this forced me to think of a better
interface between tid_range_parser and get_number_or_range, since the
former peeked into the latter's internals a bit too much.  That ended
up resulting mostly in these two not-just-straight-1-1 changes:

  void
 -tid_range_parser_skip (struct tid_range_parser *parser)
 +tid_range_parser::skip_range ()
  {
 ...

 -  tid_range_parser_init (parser, parser->range_parser.end_ptr,
 -			 parser->default_inferior);
 +  m_range_parser.skip_range ();
 +  init (m_range_parser.string (), m_default_inferior);
  }

 and:

    /* If we successfully parsed a thread number or finished parsing a
       thread range, switch back to assuming the next TID is
       inferior-qualified.  */
 -  if (parser->range_parser.end_ptr == NULL
 -      || parser->range_parser.string == parser->range_parser.end_ptr)
 +  if (!m_range_parser.in_range ())
      {

For the same reason (encapsulation), this moves the enum
tid_range_state definition to within the tid_parser class's scope,
since that is private implementation detail.

While at it, switch to use "bool" for booleans.

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

	* tid-parse.h (tid_range_parser): New class.
	(enum tid_range_state): Move into tid_range_parser's scope.
	Remove TID_RANGE_ prefix from all values.
	(tid_range_parser_get_tid, tid_range_parser_get_tid_range)
	(tid_range_parser_star_range, tid_range_parser_finished)
	(tid_range_parser_skip, tid_range_parser_qualified): Don't
	declare.
	(tid_is_in_list): Update comment.
	* tid-parse.c (tid_range_parser::tid_range_parser): New.
	(init, finished, get_string, skip, tid_is_qualified)
	(get_tid_or_range, get_tid_range, get_tid, star_range): Rename;
	turn into methods.
	(tid_is_in_list): Adjust.
	* cli/cli-utils.h (number_or_range_parser): New class.
	(init_number_or_range, get_number_or_range)
	(number_range_setup_range): Don't declare.
	* cli/cli-utils.c
	(number_or_range_parser::number_or_range_parser): New.
	(init_number_or_range, get_number_or_range)
	(number_range_setup_range): Rename; turn into methods.
	(number_is_in_list): Adjust.
	* breakpoint.c (map_breakpoint_numbers): Adjust.  Use bool.
	(trace_pass_command, get_tracepoint_by_number): Adjust.
	* breakpoint.h (get_tracepoint_by_number): Adjust.
	* inferior.c (detach_inferior_command, kill_inferior_command)
	(remove_inferior_command): Adjust.
	* linespec.c (decode_line_2): Adjust.
	* memattr.c (mem_enable_command, mem_disable_command)
	(mem_delete_command): Adjust.
	* printcmd.c (map_display_numbers): Adjust.
	* reverse.c (delete_bookmark_command, bookmarks_info): Adjust.
	* thread.c (thread_apply_command): Adjust.
2016-10-13 01:54:07 +01:00
Antoine Tremblay 4034d0ff52 Emit inferior, thread and frame selection events to all UIs
With this patch, when an inferior, thread or frame is explicitly
selected by the user, notifications will appear on all CLI and MI UIs.
When a GDB console is integrated in a front-end, this allows the
front-end to follow a selection made by the user ont he CLI, and it
informs the user about selection changes made behind the scenes by the
front-end.

This patch addresses PR gdb/20487.

In order to communicate frame changes to the front-end, this patch adds
a new field to the =thread-selected event for the selected frame.  The
idea is that since inferior/thread/frame can be seen as a composition,
it makes sense to send them together in the same event.  The vision
would be to eventually send the inferior information as well, if we find
that it's needed, although the "=thread-selected" event would be
ill-named for that job.

Front-ends need to handle this new field if they want to follow the
frame selection changes that originate from the console.  The format of
the frame attribute is the same as what is found in the *stopped events.

Here's a detailed example for each command and the events they generate:

thread
------

1. CLI command:

     thread 1.3

   MI event:

     =thread-selected,id="3",frame={...}

2. MI command:

     -thread-select 3

   CLI event:

     [Switching to thread 1.3 ...]

3. MI command (CLI-in-MI):

     thread 1.3

   MI event/reply:

     &"thread 1.3\n"
     ~"#0  child_sub_function () ...
     =thread-selected,id="3",frame={level="0",...}
     ^done

frame
-----

1. CLI command:

     frame 1

   MI event:

     =thread-selected,id="3",frame={level="1",...}

2. MI command:

     -stack-select-frame 1

   CLI event:

     #1  0x00000000004007f0 in child_function...

3. MI command (CLI-in-MI):

     frame 1

   MI event/reply:

     &"frame 1\n"
     ~"#1  0x00000000004007f9 in ..."
     =thread-selected,id="3",frame={level="1"...}
     ^done

inferior
--------

Inferior selection events only go from the console to MI, since there's
no way to select the inferior in pure MI.

1. CLI command:

     inferior 2

   MI event:

     =thread-selected,id="3"

Note that if the user selects an inferior that is not started or exited,
the MI doesn't receive a notification.  Since there is no threads to
select, the =thread-selected event does not apply...

2. MI command (CLI-in-MI):

     inferior 2

   MI event/reply:

     &"inferior 2\n"
     ~"[Switching to inferior 2 ...]"
     =thread-selected,id="4",frame={level="0"...}
     ^done

Internal implementation detail: this patch makes it possible to suppress
notifications caused by a CLI command, like what is done in mi-interp.c.
This means that it's now possible to use the
add_com_suppress_notification function to register a command with some
event suppressed.  It is used to implement the select-frame command in
this patch.

The function command_notifies_uscc_observer was added to extract
the rather complicated logical expression from the if statement.  It is
also now clearer what that logic does: if the command used by the user
already notifies the user_selected_context_changed observer, there is
not need to notify it again.  It therefore protects again emitting the
event twice.

No regressions, tested on ubuntu 14.04 x86 with target boards unix and
native-extended-gdbserver.

gdb/ChangeLog:

YYYY-MM-DD  Antoine Tremblay  <antoine.tremblay@ericsson.com>
YYYY-MM-DD  Simon Marchi  <simon.marchi@ericsson.com>

	PR gdb/20487
	* NEWS: Mention new frame field of =thread-selected event.
	* cli/cli-decode.c (add_cmd): Initialize c->suppress_notification.
	(add_com_suppress_notification): New function definition.
	(cmd_func): Set and restore the suppress_notification flag.
	* cli/cli-deicode.h (struct cmd_list_element)
	<suppress_notification>: New field.
	* cli/cli-interp.c (cli_suppress_notification): New global variable.
	(cli_on_user_selected_context_changed): New function.
	(_initialize_cli_interp): Attach to user_selected_context_changed
	observer.
	* command.h (struct cli_suppress_notification): New structure.
	(cli_suppress_notification): New global variable declaration.
	(add_com_suppress_notification): New function declaration.
	* defs.h (enum user_selected_what_flag): New enum.
	(user_selected_what): New enum flag type.
	* frame.h (print_stack_frame_to_uiout): New function declaration.
	* gdbthread.h (print_selected_thread_frame): New function declaration.
	* inferior.c (print_selected_inferior): New function definition.
	(inferior_command): Remove printing of inferior/thread/frame switch
	notifications, notify user_selected_context_changed observer.
	* inferior.h (print_selected_inferior): New function declaration.
	* mi/mi-cmds.c (struct mi_cmd): Add user_selected_context
	suppression to stack-select-frame and thread-select commands.
	* mi/mi-interp.c (struct mi_suppress_notification)
	<user_selected_context>: Initialize.
	(mi_user_selected_context_changed): New function definition.
	(_initialize_mi_interp): Attach to user_selected_context_changed.
	* mi/mi-main.c (mi_cmd_thread_select): Print thread selection reply.
	(mi_execute_command): Handle notification suppression.  Notify
	user_selected_context_changed observer on thread change instead of printing
	event directly.  Don't send it if command already sends the notification.
	(command_notifies_uscc_observer): New function.
	(mi_cmd_execute): Don't handle notification suppression.
	* mi/mi-main.h (struct mi_suppress_notification)
	<user_selected_context>: New field.
	* stack.c (print_stack_frame_to_uiout): New function definition.
	(select_frame_command): Notify user_selected_context_changed
	observer.
	(frame_command): Call print_selected_thread_frame if there's no frame
	change or notify user_selected_context_changed observer if there is.
	(up_command): Notify user_selected_context_changed observer.
	(down_command): Likewise.
	(_initialize_stack): Suppress user_selected_context notification for
	command select-frame.
	* thread.c (thread_command): Notify
	user_selected_context_changed if the thread has changed, print
	thread info directly if it hasn't.
	(do_captured_thread_select): Do not print thread switch event.
	(print_selected_thread_frame): New function definition.
	* tui/tui-interp.c (tui_on_user_selected_context_changed):
	New function definition.
	(_initialize_tui_interp): Attach to user_selected_context_changed
	observer.

gdb/doc/ChangeLog:

	PR gdb/20487
	* gdb.texinfo (Context management): Update mention of frame
	change notifications.
	(gdb/mi Async Records): Document frame field in
	=thread-select event.
	* observer.texi (GDB Observers): New user_selected_context_changed
	observer.

gdb/testsuite/ChangeLog:

	PR gdb/20487
	* gdb.mi/mi-pthreads.exp (check_mi_thread_command_set): Adapt
	=thread-select-event check.
2016-10-03 16:54:58 -04:00
Simon Marchi eb2332d78d Fix remove-inferior error message
This error message should not contain the word symbol:

  (gdb) remove-inferiors 1
  Warning: Can not remove current symbol inferior 1.

gdb/ChangeLog:

	* inferior.c (remove_inferior_command): Fix error message.

gdb/testsuite/ChangeLog:

	* gdb.multi/remove-inferiors.exp (test_remove_inferiors): Fix
	expected error message.
2016-08-17 16:02:27 -04:00
Simon Marchi 9b19e39006 Remove stale comment
This comment seems outdated, since exiting an inferior does not remove
it.

gdb/ChangeLog:

	* inferior.c (exit_inferior_1): Remove comment.
2016-08-17 10:26:37 -04:00
Pedro Alves 43792cf0de Centralize thread ID printing
Add a new function to print a thread ID, in the style of paddress,
plongest, etc. and adjust all CLI-reachable paths to use it.

This gives us a single place to tweak to print inferior-qualified
thread IDs later:

 - [Switching to thread 1 (Thread 0x7ffff7fc2740 (LWP 8155))]
 + [Switching to thread 1.1 (Thread 0x7ffff7fc2740 (LWP 8155))]

etc., though for now, this has no user-visible change.

No regressions on x86_64 Fedora 20.

gdb/ChangeLog:
2016-01-13  Pedro Alves  <palves@redhat.com>

	* breakpoint.c (remove_threaded_breakpoints)
	(print_one_breakpoint_location): Use print_thread_id.
	* btrace.c (btrace_enable, btrace_disable, btrace_teardown)
	(btrace_fetch, btrace_clear): Use print_thread_id.
	* common/print-utils.c (CELLSIZE): Delete.
	(get_cell): Rename to ...
	(get_print_cell): ... this and made extern.  Adjust call callers.
	Adjust to use PRINT_CELL_SIZE.
	* common/print-utils.h (get_print_cell): Declare.
	(PRINT_CELL_SIZE): New.
	* gdbthread.h (print_thread_id): Declare.
	* infcmd.c (signal_command): Use print_thread_id.
	* inferior.c (print_inferior): Use print_thread_id.
	* infrun.c (handle_signal_stop)
	(insert_exception_resume_breakpoint)
	(insert_exception_resume_from_probe)
	(print_signal_received_reason): Use print_thread_id.
	* record-btrace.c (record_btrace_info)
	(record_btrace_resume_thread, record_btrace_cancel_resume)
	(record_btrace_step_thread, record_btrace_wait): Use
	print_thread_id.
	* thread.c (thread_apply_all_command): Use print_thread_id.
	(print_thread_id): New function.
	(thread_apply_command): Use print_thread_id.
	(thread_command, thread_find_command, do_captured_thread_select):
	Use print_thread_id.
2016-01-13 10:59:14 +00:00
Pedro Alves e3940304fe Add a new $_inferior convenience variable
Like $_thread, but holds the current inferior number.

gdb/ChangeLog:
2016-01-13  Pedro Alves  <palves@redhat.com>

	* NEWS: Mention $_inferior.
	* inferior.c (inferior_id_make_value): New.
	(inferior_funcs): New.
	(_initialize_inferior): Create $_inferior variable.

gdb/testsuite/ChangeLog:
2016-01-13  Pedro Alves  <palves@redhat.com>

	* gdb.base/default.exp: Expect $_inferior as well.
	* gdb.multi/base.exp: Test $_inferior.

gdb/doc/ChangeLog:
2016-01-13  Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (Inferiors and Programs): Document the $_inferior
	convenience variable.
	(Convenience Vars): Likewise.
2016-01-13 10:56:05 +00:00
Pedro Alves b05b120205 Reapply: List inferiors/threads/pspaces in ascending order
[This reapplies a change that was accidentally reverted with c0ecb95f3d.]

Before:
  (gdb) info threads
    Id   Target Id         Frame
    3    Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30
    2    Thread 0x7ffff7fc4700 (LWP 29034) 0x000000000040087b in child_function_2 (arg=0x0) at foo.c:60
  * 1    Thread 0x7ffff7fc5740 (LWP 29030) 0x0000003b37209237 in pthread_join (threadid=140737353893632, thread_return=0x0) at pthread_join.c:92

After:
  (gdb) info threads
    Id   Target Id         Frame
  * 1    Thread 0x7ffff7fc5740 (LWP 29030) 0x0000003b37209237 in pthread_join (threadid=140737353893632, thread_return=0x0) at pthread_join.c:92
    2    Thread 0x7ffff7fc4700 (LWP 29034) 0x000000000040087b in child_function_2 (arg=0x0) at foo.c:60
    3    Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30

gdb/doc/ChangeLog:
2015-11-24  Pedro Alves  <palves@redhat.com>

	PR 17539
	* gdb.texinfo (Inferiors and Programs): Adjust "maint info
	program-spaces" example to ascending order listing.
	(Threads): Adjust "info threads" example to ascending order
	listing.
	(Forks): Adjust "info inferiors" example to ascending order
	listing.

gdb/ChangeLog:
2015-11-24  Pedro Alves  <palves@redhat.com>

	PR 17539
	* inferior.c (add_inferior_silent): Append the new inferior to the
	end of the list.
	* progspace.c (add_program_space): Append the new pspace to the
	end of the list.
	* thread.c (new_thread): Append the new thread to the end of the
	list.

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

	PR 17539
	* gdb.base/foll-exec-mode.exp: Adjust to GDB listing inferiors and
	threads in ascending order.
	* gdb.base/foll-fork.exp: Likewise.
	* gdb.base/foll-vfork.exp: Likewise.
	* gdb.base/multi-forks.exp: Likewise.
	* gdb.mi/mi-nonstop.exp: Likewise.
	* gdb.mi/mi-nsintrall.exp: Likewise.
	* gdb.multi/base.exp: Likewise.
	* gdb.multi/multi-arch.exp: Likewise.
	* gdb.python/py-inferior.exp: Likewise.
	* gdb.threads/break-while-running.exp: Likewise.
	* gdb.threads/execl.exp: Likewise.
	* gdb.threads/gcore-thread.exp: Likewise.
	* gdb.threads/info-threads-cur-sal.exp: Likewise.
	* gdb.threads/kill.exp: Likewise.
	* gdb.threads/linux-dp.exp: Likewise.
	* gdb.threads/multiple-step-overs.exp: Likewise.
	* gdb.threads/next-bp-other-thread.exp: Likewise.
	* gdb.threads/step-bg-decr-pc-switch-thread.exp: Likewise.
	* gdb.threads/step-over-lands-on-breakpoint.exp: Likewise.
	* gdb.threads/step-over-trips-on-watchpoint.exp: Likewise.
	* gdb.threads/thread-find.exp: Likewise.
	* gdb.threads/tls.exp: Likewise.
	* lib/mi-support.exp (mi_reverse_list): Delete.
	(mi_check_thread_states): No longer reverse list.
2016-01-12 01:12:38 +00:00
Jan Kratochvil c0ecb95f3d testsuite: Fix false FAILs on too long base directory
I was getting

gu (print arg0)^M
= 0x7fffffffdafb
"/unsafebuild-x86_64-redhat-linux-gnu/gdb/testsuite.unix.-m64/outputs/gdb.guile/scm-value/scm-"...^M
(gdb) FAIL: gdb.guile/scm-value.exp: verify dereferenced value
python print (arg0)^M
0x7fffffffdafd
"/unsafebuild-x86_64-redhat-linux-gnu/gdb/testsuite.unix.-m64/outputs/gdb.python/py-value/py-v"...^M
(gdb) FAIL: gdb.python/py-value.exp: verify dereferenced value

and also:

(gdb) p argv[0]^M
$2 = 0x7fffffffd832 "/home/jkratoch/redhat/gdb-test-", 'x' <repeats 169
times>...^M
(gdb) FAIL: gdb.guile/scm-value.exp: argv[0] should be available on this
target

gdb/testsuite/ChangeLog
2016-01-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.guile/scm-value.exp (test_value_in_inferior): Set print elements
	and repeats to unlimited.
	* gdb.python/py-value.exp: Likewise.
	* lib/gdb.exp (gdb_has_argv0): Save and temporarily set print elements
	and repeats to unlimited.
2016-01-11 22:12:16 +01:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Don Breazeal 8020350c52 Target remote mode fork and exec event support
This patch implements support for fork and exec events with target remote
mode Linux targets.  For such targets with Linux kernels 2.5.46 and later,
this enables follow-fork-mode, detach-on-fork and fork and exec
catchpoints.

The changes required to implement this included:

 * Don't exit from gdbserver if there are still active inferiors.

 * Allow changing the active process in remote mode.

 * Enable fork and exec events in remote mode.

 * Print "Ending remote debugging" only when disconnecting.

 * Combine remote_kill and extended_remote_kill into a single function
   that can handle the multiple inferior case for target remote.  Also,
   the same thing for remote_mourn and extended_remote_mourn.

 * Enable process-style ptids in target remote.

 * Remove restriction on multiprocess mode in target remote.

gdb/gdbserver/ChangeLog:

	* server.c (process_serial_event): Don't exit from gdbserver
	in remote mode if there are still active inferiors.

gdb/ChangeLog:

	* inferior.c (number_of_live_inferiors): New function.
	(have_live_inferiors): Use number_of_live_inferiors in place
	of duplicate code.
	* inferior.h (number_of_live_inferiors): Declare new function.
	* remote.c (set_general_process): Remove restriction on target
	remote mode.
	(remote_query_supported): Likewise.
	(remote_detach_1): Exit in target remote mode only when there
	is just one live inferior left.
	(remote_disconnect): Unpush the target directly instead of
	calling remote_mourn.
	(remote_kill): Rewrite function to handle both target remote
	and extended-remote.  Call remote_kill_k.
	(remote_kill_k): New function.
	(extended_remote_kill): Delete function.
	(remote_mourn, extended_remote_mourn): Combine functions into
	one, remote_mourn, and enable extended functionality for target
	remote.
	(remote_pid_to_str): Enable "process" style ptid string for
	target remote.
	(remote_supports_multi_process): Remove restriction on target
	remote mode.
2015-12-14 11:18:05 -08:00
Pedro Alves 7e0aa6aa99 List inferiors/threads/pspaces in ascending order
Before:
  (gdb) info threads
    Id   Target Id         Frame
    3    Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30
    2    Thread 0x7ffff7fc4700 (LWP 29034) 0x000000000040087b in child_function_2 (arg=0x0) at foo.c:60
  * 1    Thread 0x7ffff7fc5740 (LWP 29030) 0x0000003b37209237 in pthread_join (threadid=140737353893632, thread_return=0x0) at pthread_join.c:92

After:
  (gdb) info threads
    Id   Target Id         Frame
  * 1    Thread 0x7ffff7fc5740 (LWP 29030) 0x0000003b37209237 in pthread_join (threadid=140737353893632, thread_return=0x0) at pthread_join.c:92
    2    Thread 0x7ffff7fc4700 (LWP 29034) 0x000000000040087b in child_function_2 (arg=0x0) at foo.c:60
    3    Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30

gdb/doc/ChangeLog:
2015-11-24  Pedro Alves  <palves@redhat.com>

	PR 17539
	* gdb.texinfo (Inferiors and Programs): Adjust "maint info
	program-spaces" example to ascending order listing.
	(Threads): Adjust "info threads" example to ascending order
	listing.
	(Forks): Adjust "info inferiors" example to ascending order
	listing.

gdb/ChangeLog:
2015-11-24  Pedro Alves  <palves@redhat.com>

	PR 17539
	* inferior.c (add_inferior_silent): Append the new inferior to the
	end of the list.
	* progspace.c (add_program_space): Append the new pspace to the
	end of the list.
	* thread.c (new_thread): Append the new thread to the end of the
	list.

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

	PR 17539
	* gdb.base/foll-exec-mode.exp: Adjust to GDB listing inferiors and
	threads in ascending order.
	* gdb.base/foll-fork.exp: Likewise.
	* gdb.base/foll-vfork.exp: Likewise.
	* gdb.base/multi-forks.exp: Likewise.
	* gdb.mi/mi-nonstop.exp: Likewise.
	* gdb.mi/mi-nsintrall.exp: Likewise.
	* gdb.multi/base.exp: Likewise.
	* gdb.multi/multi-arch.exp: Likewise.
	* gdb.python/py-inferior.exp: Likewise.
	* gdb.threads/break-while-running.exp: Likewise.
	* gdb.threads/execl.exp: Likewise.
	* gdb.threads/gcore-thread.exp: Likewise.
	* gdb.threads/info-threads-cur-sal.exp: Likewise.
	* gdb.threads/kill.exp: Likewise.
	* gdb.threads/linux-dp.exp: Likewise.
	* gdb.threads/multiple-step-overs.exp: Likewise.
	* gdb.threads/next-bp-other-thread.exp: Likewise.
	* gdb.threads/step-bg-decr-pc-switch-thread.exp: Likewise.
	* gdb.threads/step-over-lands-on-breakpoint.exp: Likewise.
	* gdb.threads/step-over-trips-on-watchpoint.exp: Likewise.
	* gdb.threads/thread-find.exp: Likewise.
	* gdb.threads/tls.exp: Likewise.
	* lib/mi-support.exp (mi_reverse_list): Delete.
	(mi_check_thread_states): No longer reverse list.
2015-11-24 18:36:31 +00:00
Simon Marchi 9a3c826307 Add some more casts (1/2)
Note: I needed to split this patch in two, otherwise it's too big for
the mailing list.

This patch adds explicit casts to situations where a void pointer is
assigned to a pointer to the "real" type.  Building in C++ mode requires
those assignments to use an explicit cast.  This includes, for example:

 - callback arguments (cleanups, comparison functions, ...)
 - data attached to some object (objfile, program space, etc) in the form
   of a void pointer
 - "user data" passed to some function

This patch comes from the commit "(mostly) auto-generated patch to insert
casts needed for C++", taken from Pedro's C++ branch.

Only files built on x86 with --enable-targets=all are modified, so the
native files for other arches will need to be dealt with separately.

I built-tested this with --enable-targets=all and reg-tested.  To my
surprise, a test case (selftest.exp) had to be adjusted.

Here's the ChangeLog entry.  Again, this was relatively quick to make
despite the length, thanks to David Malcom's script, although I don't
believe it's very useful information in that particular case...

gdb/ChangeLog:

	* aarch64-tdep.c (aarch64_make_prologue_cache): Add cast(s).
	(aarch64_make_stub_cache): Likewise.
	(value_of_aarch64_user_reg): Likewise.
	* ada-lang.c (ada_inferior_data_cleanup): Likewise.
	(get_ada_inferior_data): Likewise.
	(get_ada_pspace_data): Likewise.
	(ada_pspace_data_cleanup): Likewise.
	(ada_complete_symbol_matcher): Likewise.
	(ada_exc_search_name_matches): Likewise.
	* ada-tasks.c (get_ada_tasks_pspace_data): Likewise.
	(get_ada_tasks_inferior_data): Likewise.
	* addrmap.c (addrmap_mutable_foreach_worker): Likewise.
	(splay_obstack_alloc): Likewise.
	(splay_obstack_free): Likewise.
	* alpha-linux-tdep.c (alpha_linux_supply_gregset): Likewise.
	(alpha_linux_collect_gregset): Likewise.
	(alpha_linux_supply_fpregset): Likewise.
	(alpha_linux_collect_fpregset): Likewise.
	* alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise.
	* alpha-tdep.c (alpha_lds): Likewise.
	(alpha_sts): Likewise.
	(alpha_sigtramp_frame_unwind_cache): Likewise.
	(alpha_heuristic_frame_unwind_cache): Likewise.
	(alpha_supply_int_regs): Likewise.
	(alpha_fill_int_regs): Likewise.
	(alpha_supply_fp_regs): Likewise.
	(alpha_fill_fp_regs): Likewise.
	* alphanbsd-tdep.c (alphanbsd_supply_fpregset): Likewise.
	(alphanbsd_aout_supply_gregset): Likewise.
	(alphanbsd_supply_gregset): Likewise.
	* amd64-linux-tdep.c (amd64_linux_init_abi): Likewise.
	(amd64_x32_linux_init_abi): Likewise.
	* amd64-nat.c (amd64_supply_native_gregset): Likewise.
	(amd64_collect_native_gregset): Likewise.
	* amd64-tdep.c (amd64_frame_cache): Likewise.
	(amd64_sigtramp_frame_cache): Likewise.
	(amd64_epilogue_frame_cache): Likewise.
	(amd64_supply_fxsave): Likewise.
	(amd64_supply_xsave): Likewise.
	(amd64_collect_fxsave): Likewise.
	(amd64_collect_xsave): Likewise.
	* amd64-windows-tdep.c (amd64_windows_frame_cache): Likewise.
	* amd64obsd-tdep.c (amd64obsd_trapframe_cache): Likewise.
	* arm-linux-tdep.c (arm_linux_supply_gregset): Likewise.
	(arm_linux_collect_gregset): Likewise.
	(arm_linux_supply_nwfpe): Likewise.
	(arm_linux_collect_nwfpe): Likewise.
	(arm_linux_supply_vfp): Likewise.
	(arm_linux_collect_vfp): Likewise.
	* arm-tdep.c (arm_find_mapping_symbol): Likewise.
	(arm_prologue_unwind_stop_reason): Likewise.
	(arm_prologue_this_id): Likewise.
	(arm_prologue_prev_register): Likewise.
	(arm_exidx_data_free): Likewise.
	(arm_find_exidx_entry): Likewise.
	(arm_stub_this_id): Likewise.
	(arm_m_exception_this_id): Likewise.
	(arm_m_exception_prev_register): Likewise.
	(arm_normal_frame_base): Likewise.
	(gdb_print_insn_arm): Likewise.
	(arm_objfile_data_free): Likewise.
	(arm_record_special_symbol): Likewise.
	(value_of_arm_user_reg): Likewise.
	* armbsd-tdep.c (armbsd_supply_fpregset): Likewise.
	(armbsd_supply_gregset): Likewise.
	* auto-load.c (auto_load_pspace_data_cleanup): Likewise.
	(get_auto_load_pspace_data): Likewise.
	(hash_loaded_script_entry): Likewise.
	(eq_loaded_script_entry): Likewise.
	(clear_section_scripts): Likewise.
	(collect_matching_scripts): Likewise.
	* auxv.c (auxv_inferior_data_cleanup): Likewise.
	(get_auxv_inferior_data): Likewise.
	* avr-tdep.c (avr_frame_unwind_cache): Likewise.
	* ax-general.c (do_free_agent_expr_cleanup): Likewise.
	* bfd-target.c (target_bfd_xfer_partial): Likewise.
	(target_bfd_xclose): Likewise.
	(target_bfd_get_section_table): Likewise.
	* bfin-tdep.c (bfin_frame_cache): Likewise.
	* block.c (find_block_in_blockvector): Likewise.
	(call_site_for_pc): Likewise.
	(block_find_non_opaque_type_preferred): Likewise.
	* break-catch-sig.c (signal_catchpoint_insert_location): Likewise.
	(signal_catchpoint_remove_location): Likewise.
	(signal_catchpoint_breakpoint_hit): Likewise.
	(signal_catchpoint_print_one): Likewise.
	(signal_catchpoint_print_mention): Likewise.
	(signal_catchpoint_print_recreate): Likewise.
	* break-catch-syscall.c (get_catch_syscall_inferior_data): Likewise.
	* breakpoint.c (do_cleanup_counted_command_line): Likewise.
	(bp_location_compare_addrs): Likewise.
	(get_first_locp_gte_addr): Likewise.
	(check_tracepoint_command): Likewise.
	(do_map_commands_command): Likewise.
	(get_breakpoint_objfile_data): Likewise.
	(free_breakpoint_probes): Likewise.
	(do_captured_breakpoint_query): Likewise.
	(compare_breakpoints): Likewise.
	(bp_location_compare): Likewise.
	(bpstat_remove_breakpoint_callback): Likewise.
	(do_delete_breakpoint_cleanup): Likewise.
	* bsd-uthread.c (bsd_uthread_set_supply_uthread): Likewise.
	(bsd_uthread_set_collect_uthread): Likewise.
	(bsd_uthread_activate): Likewise.
	(bsd_uthread_fetch_registers): Likewise.
	(bsd_uthread_store_registers): Likewise.
	* btrace.c (check_xml_btrace_version): Likewise.
	(parse_xml_btrace_block): Likewise.
	(parse_xml_btrace_pt_config_cpu): Likewise.
	(parse_xml_btrace_pt_raw): Likewise.
	(parse_xml_btrace_pt): Likewise.
	(parse_xml_btrace_conf_bts): Likewise.
	(parse_xml_btrace_conf_pt): Likewise.
	(do_btrace_data_cleanup): Likewise.
	* c-typeprint.c (find_typedef_for_canonicalize): Likewise.
	* charset.c (cleanup_iconv): Likewise.
	(do_cleanup_iterator): Likewise.
	* cli-out.c (cli_uiout_dtor): Likewise.
	(cli_table_begin): Likewise.
	(cli_table_body): Likewise.
	(cli_table_end): Likewise.
	(cli_table_header): Likewise.
	(cli_begin): Likewise.
	(cli_end): Likewise.
	(cli_field_int): Likewise.
	(cli_field_skip): Likewise.
	(cli_field_string): Likewise.
	(cli_field_fmt): Likewise.
	(cli_spaces): Likewise.
	(cli_text): Likewise.
	(cli_message): Likewise.
	(cli_wrap_hint): Likewise.
	(cli_flush): Likewise.
	(cli_redirect): Likewise.
	(out_field_fmt): Likewise.
	(field_separator): Likewise.
	(cli_out_set_stream): Likewise.
	* cli/cli-cmds.c (compare_symtabs): Likewise.
	* cli/cli-dump.c (call_dump_func): Likewise.
	(restore_section_callback): Likewise.
	* cli/cli-script.c (clear_hook_in_cleanup): Likewise.
	(do_restore_user_call_depth): Likewise.
	(do_free_command_lines_cleanup): Likewise.
	* coff-pe-read.c (get_section_vmas): Likewise.
	(pe_as16): Likewise.
	(pe_as32): Likewise.
	* coffread.c (coff_symfile_read): Likewise.
	* common/agent.c (agent_look_up_symbols): Likewise.
	* common/filestuff.c (do_close_cleanup): Likewise.
	* common/format.c (free_format_pieces_cleanup): Likewise.
	* common/vec.c (vec_o_reserve): Likewise.
	* compile/compile-c-support.c (print_one_macro): Likewise.
	* compile/compile-c-symbols.c (hash_symbol_error): Likewise.
	(eq_symbol_error): Likewise.
	(del_symbol_error): Likewise.
	(error_symbol_once): Likewise.
	(gcc_convert_symbol): Likewise.
	(gcc_symbol_address): Likewise.
	(hash_symname): Likewise.
	(eq_symname): Likewise.
	* compile/compile-c-types.c (hash_type_map_instance): Likewise.
	(eq_type_map_instance): Likewise.
	(insert_type): Likewise.
	(convert_type): Likewise.
	* compile/compile-object-load.c (munmap_listp_free_cleanup): Likewise.
	(setup_sections): Likewise.
	(link_hash_table_free): Likewise.
	(copy_sections): Likewise.
	* compile/compile-object-run.c (do_module_cleanup): Likewise.
	* compile/compile.c (compile_print_value): Likewise.
	(do_rmdir): Likewise.
	(cleanup_compile_instance): Likewise.
	(cleanup_unlink_file): Likewise.
	* completer.c (free_completion_tracker): Likewise.
	* corelow.c (add_to_spuid_list): Likewise.
	* cp-namespace.c (reset_directive_searched): Likewise.
	* cp-support.c (reset_directive_searched): Likewise.
	* cris-tdep.c (cris_sigtramp_frame_unwind_cache): Likewise.
	(cris_frame_unwind_cache): Likewise.
	* d-lang.c (builtin_d_type): Likewise.
	* d-namespace.c (reset_directive_searched): Likewise.
	* dbxread.c (dbx_free_symfile_info): Likewise.
	(do_free_bincl_list_cleanup): Likewise.
	* disasm.c (hash_dis_line_entry): Likewise.
	(eq_dis_line_entry): Likewise.
	(dis_asm_print_address): Likewise.
	(fprintf_disasm): Likewise.
	(do_ui_file_delete): Likewise.
	* doublest.c (convert_floatformat_to_doublest): Likewise.
	* dummy-frame.c (pop_dummy_frame_bpt): Likewise.
	(dummy_frame_prev_register): Likewise.
	(dummy_frame_this_id): Likewise.
	* dwarf2-frame-tailcall.c (cache_hash): Likewise.
	(cache_eq): Likewise.
	(cache_find): Likewise.
	(tailcall_frame_this_id): Likewise.
	(dwarf2_tailcall_prev_register_first): Likewise.
	(tailcall_frame_prev_register): Likewise.
	(tailcall_frame_dealloc_cache): Likewise.
	(tailcall_frame_prev_arch): Likewise.
	* dwarf2-frame.c (dwarf2_frame_state_free): Likewise.
	(dwarf2_frame_set_init_reg): Likewise.
	(dwarf2_frame_init_reg): Likewise.
	(dwarf2_frame_set_signal_frame_p): Likewise.
	(dwarf2_frame_signal_frame_p): Likewise.
	(dwarf2_frame_set_adjust_regnum): Likewise.
	(dwarf2_frame_adjust_regnum): Likewise.
	(clear_pointer_cleanup): Likewise.
	(dwarf2_frame_cache): Likewise.
	(find_cie): Likewise.
	(dwarf2_frame_find_fde): Likewise.
	* dwarf2expr.c (dwarf_expr_address_type): Likewise.
	(free_dwarf_expr_context_cleanup): Likewise.
	* dwarf2loc.c (locexpr_find_frame_base_location): Likewise.
	(locexpr_get_frame_base): Likewise.
	(loclist_find_frame_base_location): Likewise.
	(loclist_get_frame_base): Likewise.
	(dwarf_expr_dwarf_call): Likewise.
	(dwarf_expr_get_base_type): Likewise.
	(dwarf_expr_push_dwarf_reg_entry_value): Likewise.
	(dwarf_expr_get_obj_addr): Likewise.
	(entry_data_value_coerce_ref): Likewise.
	(entry_data_value_copy_closure): Likewise.
	(entry_data_value_free_closure): Likewise.
	(get_frame_address_in_block_wrapper): Likewise.
	(dwarf2_evaluate_property): Likewise.
	(dwarf2_compile_property_to_c): Likewise.
	(needs_frame_read_addr_from_reg): Likewise.
	(needs_frame_get_reg_value): Likewise.
	(needs_frame_frame_base): Likewise.
	(needs_frame_frame_cfa): Likewise.
	(needs_frame_tls_address): Likewise.
	(needs_frame_dwarf_call): Likewise.
	(needs_dwarf_reg_entry_value): Likewise.
	(get_ax_pc): Likewise.
	(locexpr_read_variable): Likewise.
	(locexpr_read_variable_at_entry): Likewise.
	(locexpr_read_needs_frame): Likewise.
	(locexpr_describe_location): Likewise.
	(locexpr_tracepoint_var_ref): Likewise.
	(locexpr_generate_c_location): Likewise.
	(loclist_read_variable): Likewise.
	(loclist_read_variable_at_entry): Likewise.
	(loclist_describe_location): Likewise.
	(loclist_tracepoint_var_ref): Likewise.
	(loclist_generate_c_location): Likewise.
	* dwarf2read.c (line_header_hash_voidp): Likewise.
	(line_header_eq_voidp): Likewise.
	(dwarf2_has_info): Likewise.
	(dwarf2_get_section_info): Likewise.
	(locate_dwz_sections): Likewise.
	(hash_file_name_entry): Likewise.
	(eq_file_name_entry): Likewise.
	(delete_file_name_entry): Likewise.
	(dw2_setup): Likewise.
	(dw2_get_file_names_reader): Likewise.
	(dw2_find_pc_sect_compunit_symtab): Likewise.
	(hash_signatured_type): Likewise.
	(eq_signatured_type): Likewise.
	(add_signatured_type_cu_to_table): Likewise.
	(create_debug_types_hash_table): Likewise.
	(lookup_dwo_signatured_type): Likewise.
	(lookup_dwp_signatured_type): Likewise.
	(lookup_signatured_type): Likewise.
	(hash_type_unit_group): Likewise.
	(eq_type_unit_group): Likewise.
	(get_type_unit_group): Likewise.
	(process_psymtab_comp_unit_reader): Likewise.
	(sort_tu_by_abbrev_offset): Likewise.
	(process_skeletonless_type_unit): Likewise.
	(psymtabs_addrmap_cleanup): Likewise.
	(dwarf2_read_symtab): Likewise.
	(psymtab_to_symtab_1): Likewise.
	(die_hash): Likewise.
	(die_eq): Likewise.
	(load_full_comp_unit_reader): Likewise.
	(reset_die_in_process): Likewise.
	(free_cu_line_header): Likewise.
	(handle_DW_AT_stmt_list): Likewise.
	(hash_dwo_file): Likewise.
	(eq_dwo_file): Likewise.
	(hash_dwo_unit): Likewise.
	(eq_dwo_unit): Likewise.
	(create_dwo_cu_reader): Likewise.
	(create_dwo_unit_in_dwp_v1): Likewise.
	(create_dwo_unit_in_dwp_v2): Likewise.
	(lookup_dwo_unit_in_dwp): Likewise.
	(dwarf2_locate_dwo_sections): Likewise.
	(dwarf2_locate_common_dwp_sections): Likewise.
	(dwarf2_locate_v2_dwp_sections): Likewise.
	(hash_dwp_loaded_cutus): Likewise.
	(eq_dwp_loaded_cutus): Likewise.
	(lookup_dwo_cutu): Likewise.
	(abbrev_table_free_cleanup): Likewise.
	(dwarf2_free_abbrev_table): Likewise.
	(find_partial_die_in_comp_unit): Likewise.
	(free_line_header_voidp): Likewise.
	(follow_die_offset): Likewise.
	(follow_die_sig_1): Likewise.
	(free_heap_comp_unit): Likewise.
	(free_stack_comp_unit): Likewise.
	(dwarf2_free_objfile): Likewise.
	(per_cu_offset_and_type_hash): Likewise.
	(per_cu_offset_and_type_eq): Likewise.
	(get_die_type_at_offset): Likewise.
	(partial_die_hash): Likewise.
	(partial_die_eq): Likewise.
	(dwarf2_per_objfile_free): Likewise.
	(hash_strtab_entry): Likewise.
	(eq_strtab_entry): Likewise.
	(add_string): Likewise.
	(hash_symtab_entry): Likewise.
	(eq_symtab_entry): Likewise.
	(delete_symtab_entry): Likewise.
	(cleanup_mapped_symtab): Likewise.
	(add_indices_to_cpool): Likewise.
	(hash_psymtab_cu_index): Likewise.
	(eq_psymtab_cu_index): Likewise.
	(add_address_entry_worker): Likewise.
	(unlink_if_set): Likewise.
	(write_one_signatured_type): Likewise.
	(save_gdb_index_command): Likewise.
	* elfread.c (elf_symtab_read): Likewise.
	(elf_gnu_ifunc_cache_hash): Likewise.
	(elf_gnu_ifunc_cache_eq): Likewise.
	(elf_gnu_ifunc_record_cache): Likewise.
	(elf_gnu_ifunc_resolve_by_cache): Likewise.
	(elf_get_probes): Likewise.
	(probe_key_free): Likewise.
	* f-lang.c (builtin_f_type): Likewise.
	* frame-base.c (frame_base_append_sniffer): Likewise.
	(frame_base_set_default): Likewise.
	(frame_base_find_by_frame): Likewise.
	* frame-unwind.c (frame_unwind_prepend_unwinder): Likewise.
	(frame_unwind_append_unwinder): Likewise.
	(frame_unwind_find_by_frame): Likewise.
	* frame.c (frame_addr_hash): Likewise.
	(frame_addr_hash_eq): Likewise.
	(frame_stash_find): Likewise.
	(do_frame_register_read): Likewise.
	(unwind_to_current_frame): Likewise.
	(frame_cleanup_after_sniffer): Likewise.
	* frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise.
	* frv-tdep.c (frv_frame_unwind_cache): Likewise.
	* ft32-tdep.c (ft32_frame_cache): Likewise.
	* gcore.c (do_bfd_delete_cleanup): Likewise.
	(gcore_create_callback): Likewise.
	* gdb_bfd.c (hash_bfd): Likewise.
	(eq_bfd): Likewise.
	(gdb_bfd_open): Likewise.
	(free_one_bfd_section): Likewise.
	(gdb_bfd_ref): Likewise.
	(gdb_bfd_unref): Likewise.
	(get_section_descriptor): Likewise.
	(gdb_bfd_map_section): Likewise.
	(gdb_bfd_crc): Likewise.
	(gdb_bfd_mark_parent): Likewise.
	(gdb_bfd_record_inclusion): Likewise.
	(gdb_bfd_requires_relocations): Likewise.
	(print_one_bfd): Likewise.
	* gdbtypes.c (type_pair_hash): Likewise.
	(type_pair_eq): Likewise.
	(builtin_type): Likewise.
	(objfile_type): Likewise.
	* gnu-v3-abi.c (vtable_ptrdiff_type): Likewise.
	(vtable_address_point_offset): Likewise.
	(gnuv3_get_vtable): Likewise.
	(hash_value_and_voffset): Likewise.
	(eq_value_and_voffset): Likewise.
	(compare_value_and_voffset): Likewise.
	(compute_vtable_size): Likewise.
	(gnuv3_get_typeid_type): Likewise.
	* go-lang.c (builtin_go_type): Likewise.
	* guile/scm-block.c (bkscm_hash_block_smob): Likewise.
	(bkscm_eq_block_smob): Likewise.
	(bkscm_objfile_block_map): Likewise.
	(bkscm_del_objfile_blocks): Likewise.
	* guile/scm-breakpoint.c (bpscm_build_bp_list): Likewise.
	* guile/scm-disasm.c (gdbscm_disasm_read_memory_worker): Likewise.
	(gdbscm_disasm_print_address): Likewise.
	* guile/scm-frame.c (frscm_hash_frame_smob): Likewise.
	(frscm_eq_frame_smob): Likewise.
	(frscm_inferior_frame_map): Likewise.
	(frscm_del_inferior_frames): Likewise.
	* guile/scm-gsmob.c (gdbscm_add_objfile_ref): Likewise.
	* guile/scm-objfile.c (ofscm_handle_objfile_deleted): Likewise.
	(ofscm_objfile_smob_from_objfile): Likewise.
	* guile/scm-ports.c (ioscm_write): Likewise.
	(ioscm_file_port_delete): Likewise.
	(ioscm_file_port_rewind): Likewise.
	(ioscm_file_port_put): Likewise.
	(ioscm_file_port_write): Likewise.
	* guile/scm-progspace.c (psscm_handle_pspace_deleted): Likewise.
	(psscm_pspace_smob_from_pspace): Likewise.
	* guile/scm-safe-call.c (scscm_recording_pre_unwind_handler): Likewise.
	(scscm_recording_unwind_handler): Likewise.
	(gdbscm_with_catch): Likewise.
	(scscm_call_0_body): Likewise.
	(scscm_call_1_body): Likewise.
	(scscm_call_2_body): Likewise.
	(scscm_call_3_body): Likewise.
	(scscm_call_4_body): Likewise.
	(scscm_apply_1_body): Likewise.
	(scscm_eval_scheme_string): Likewise.
	(gdbscm_safe_eval_string): Likewise.
	(scscm_source_scheme_script): Likewise.
	(gdbscm_safe_source_script): Likewise.
	* guile/scm-string.c (gdbscm_call_scm_to_stringn): Likewise.
	(gdbscm_call_scm_from_stringn): Likewise.
	* guile/scm-symbol.c (syscm_hash_symbol_smob): Likewise.
	(syscm_eq_symbol_smob): Likewise.
	(syscm_get_symbol_map): Likewise.
	(syscm_del_objfile_symbols): Likewise.
	* guile/scm-symtab.c (stscm_hash_symtab_smob): Likewise.
	(stscm_eq_symtab_smob): Likewise.
	(stscm_objfile_symtab_map): Likewise.
	(stscm_del_objfile_symtabs): Likewise.
	* guile/scm-type.c (tyscm_hash_type_smob): Likewise.
	(tyscm_eq_type_smob): Likewise.
	(tyscm_type_map): Likewise.
	(tyscm_copy_type_recursive): Likewise.
	(save_objfile_types): Likewise.
	* guile/scm-utils.c (extract_arg): Likewise.
	* h8300-tdep.c (h8300_frame_cache): Likewise.
	* hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Likewise.
	* hppa-tdep.c (compare_unwind_entries): Likewise.
	(find_unwind_entry): Likewise.
	(hppa_frame_cache): Likewise.
	(hppa_stub_frame_unwind_cache): Likewise.
	* hppanbsd-tdep.c (hppanbsd_supply_gregset): Likewise.
	* hppaobsd-tdep.c (hppaobsd_supply_gregset): Likewise.
	(hppaobsd_supply_fpregset): Likewise.
	* i386-cygwin-tdep.c (core_process_module_section): Likewise.
	* i386-linux-tdep.c (i386_linux_init_abi): Likewise.
	* i386-tdep.c (i386_frame_cache): Likewise.
	(i386_epilogue_frame_cache): Likewise.
	(i386_sigtramp_frame_cache): Likewise.
	(i386_supply_gregset): Likewise.
	(i386_collect_gregset): Likewise.
	(i386_gdbarch_init): Likewise.
	* i386obsd-tdep.c (i386obsd_aout_supply_regset): Likewise.
	(i386obsd_trapframe_cache): Likewise.
	* i387-tdep.c (i387_supply_fsave): Likewise.
	(i387_collect_fsave): Likewise.
	(i387_supply_fxsave): Likewise.
	(i387_collect_fxsave): Likewise.
	(i387_supply_xsave): Likewise.
	(i387_collect_xsave): Likewise.
	* ia64-tdep.c (ia64_frame_cache): Likewise.
	(ia64_sigtramp_frame_cache): Likewise.
	* infcmd.c (attach_command_continuation): Likewise.
	(attach_command_continuation_free_args): Likewise.
	* inferior.c (restore_inferior): Likewise.
	(delete_thread_of_inferior): Likewise.
	* inflow.c (inflow_inferior_data_cleanup): Likewise.
	(get_inflow_inferior_data): Likewise.
	(inflow_inferior_exit): Likewise.
	* infrun.c (displaced_step_clear_cleanup): Likewise.
	(restore_current_uiout_cleanup): Likewise.
	(release_stop_context_cleanup): Likewise.
	(do_restore_infcall_suspend_state_cleanup): Likewise.
	(do_restore_infcall_control_state_cleanup): Likewise.
	(restore_inferior_ptid): Likewise.
	* inline-frame.c (block_starting_point_at): Likewise.
	* iq2000-tdep.c (iq2000_frame_cache): Likewise.
	* jit.c (get_jit_objfile_data): Likewise.
	(get_jit_program_space_data): Likewise.
	(jit_object_close_impl): Likewise.
	(jit_find_objf_with_entry_addr): Likewise.
	(jit_breakpoint_deleted): Likewise.
	(jit_unwind_reg_set_impl): Likewise.
	(jit_unwind_reg_get_impl): Likewise.
	(jit_dealloc_cache): Likewise.
	(jit_frame_sniffer): Likewise.
	(jit_frame_prev_register): Likewise.
	(jit_prepend_unwinder): Likewise.
	(jit_inferior_exit_hook): Likewise.
	(free_objfile_data): Likewise.
	* jv-lang.c (jv_per_objfile_free): Likewise.
	(get_dynamics_objfile): Likewise.
	(get_java_class_symtab): Likewise.
	(builtin_java_type): Likewise.
	* language.c (language_string_char_type): Likewise.
	(language_bool_type): Likewise.
	(language_lookup_primitive_type): Likewise.
	(language_lookup_primitive_type_as_symbol): Likewise.
	* linespec.c (hash_address_entry): Likewise.
	(eq_address_entry): Likewise.
	(iterate_inline_only): Likewise.
	(iterate_name_matcher): Likewise.
	(decode_line_2_compare_items): Likewise.
	(collect_one_symbol): Likewise.
	(compare_symbols): Likewise.
	(compare_msymbols): Likewise.
	(add_symtabs_to_list): Likewise.
	(collect_symbols): Likewise.
	(compare_msyms): Likewise.
	(add_minsym): Likewise.
	(cleanup_linespec_result): Likewise.
	* linux-fork.c (inferior_call_waitpid_cleanup): Likewise.
	* linux-nat.c (delete_lwp_cleanup): Likewise.
	(count_events_callback): Likewise.
	(select_event_lwp_callback): Likewise.
	(resume_stopped_resumed_lwps): Likewise.
	* linux-tdep.c (get_linux_gdbarch_data): Likewise.
	(invalidate_linux_cache_inf): Likewise.
	(get_linux_inferior_data): Likewise.
	(linux_find_memory_regions_thunk): Likewise.
	(linux_make_mappings_callback): Likewise.
	(linux_corefile_thread_callback): Likewise.
	(find_mapping_size): Likewise.
	* linux-thread-db.c (find_new_threads_callback): Likewise.
	* lm32-tdep.c (lm32_frame_cache): Likewise.
	* m2-lang.c (builtin_m2_type): Likewise.
	* m32c-tdep.c (m32c_analyze_frame_prologue): Likewise.
	* m32r-linux-tdep.c (m32r_linux_sigtramp_frame_cache): Likewise.
	(m32r_linux_supply_gregset): Likewise.
	(m32r_linux_collect_gregset): Likewise.
	* m32r-tdep.c (m32r_frame_unwind_cache): Likewise.
	* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise.
	* m68k-tdep.c (m68k_frame_cache): Likewise.
	* m68kbsd-tdep.c (m68kbsd_supply_fpregset): Likewise.
	(m68kbsd_supply_gregset): Likewise.
	* m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise.
	* m88k-tdep.c (m88k_frame_cache): Likewise.
	(m88k_supply_gregset): Likewise.

gdb/gdbserver/ChangeLog:

	* dll.c (match_dll): Add cast(s).
	(unloaded_dll): Likewise.
	* linux-low.c (second_thread_of_pid_p): Likewise.
	(delete_lwp_callback): Likewise.
	(count_events_callback): Likewise.
	(select_event_lwp_callback): Likewise.
	(linux_set_resume_request): Likewise.
	* server.c (accumulate_file_name_length): Likewise.
	(emit_dll_description): Likewise.
	(handle_qxfer_threads_worker): Likewise.
	(visit_actioned_threads): Likewise.
	* thread-db.c (any_thread_of): Likewise.
	* tracepoint.c (same_process_p): Likewise.
	(match_blocktype): Likewise.
	(build_traceframe_info_xml): Likewise.

gdb/testsuite/ChangeLog:

	* gdb.gdb/selftest.exp (do_steps_and_nexts): Adjust expected
	source line.
2015-09-25 14:08:07 -04:00
Simon Marchi 8d7493201c Replace some xmalloc-family functions with XNEW-family ones
This patch is part of the make-gdb-buildable-in-C++ effort.  The idea is
to change some calls to the xmalloc family of functions to calls to the
equivalents in the XNEW family.  This avoids adding an explicit cast, so
it keeps the code a bit more readable.  Some of them also map relatively
well to a C++ equivalent (XNEW (struct foo) -> new foo), so it will be
possible to do scripted replacements if needed.

I only changed calls that were obviously allocating memory for one or
multiple "objects".  Allocation of variable sizes (such as strings or
buffer handling) will be for later (and won't use XNEW).

  - xmalloc (sizeof (struct foo)) -> XNEW (struct foo)
  - xmalloc (num * sizeof (struct foo)) -> XNEWVEC (struct foo, num)
  - xcalloc (1, sizeof (struct foo)) -> XCNEW (struct foo)
  - xcalloc (num, sizeof (struct foo)) -> XCNEWVEC (struct foo, num)
  - xrealloc (p, num * sizeof (struct foo) -> XRESIZEVEC (struct foo, p, num)
  - obstack_alloc (ob, sizeof (struct foo)) -> XOBNEW (ob, struct foo)
  - obstack_alloc (ob, num * sizeof (struct foo)) -> XOBNEWVEC (ob, struct foo, num)
  - alloca (sizeof (struct foo)) -> XALLOCA (struct foo)
  - alloca (num * sizeof (struct foo)) -> XALLOCAVEC (struct foo, num)

Some instances of xmalloc followed by memset to zero the buffer were
replaced by XCNEW or XCNEWVEC.

I regtested on x86-64, Ubuntu 14.04, but the patch touches many
architecture-specific files.  For those I'll have to rely on the
buildbot or people complaining that I broke their gdb.

gdb/ChangeLog:

	* aarch64-linux-nat.c (aarch64_add_process): Likewise.
	* aarch64-tdep.c (aarch64_gdbarch_init): Likewise.
	* ada-exp.y (write_ambiguous_var): Likewise.
	* ada-lang.c (resolve_subexp): Likewise.
	(user_select_syms): Likewise.
	(assign_aggregate): Likewise.
	(ada_evaluate_subexp): Likewise.
	(cache_symbol): Likewise.
	* addrmap.c (allocate_key): Likewise.
	(addrmap_create_mutable): Likewise.
	* aix-thread.c (sync_threadlists): Likewise.
	* alpha-tdep.c (alpha_push_dummy_call): Likewise.
	(alpha_gdbarch_init): Likewise.
	* amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise.
	* arm-linux-nat.c (arm_linux_add_process): Likewise.
	* arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise.
	* arm-tdep.c (push_stack_item): Likewise.
	(arm_displaced_step_copy_insn): Likewise.
	(arm_gdbarch_init): Likewise.
	(_initialize_arm_tdep): Likewise.
	* avr-tdep.c (push_stack_item): Likewise.
	* ax-general.c (new_agent_expr): Likewise.
	* block.c (block_initialize_namespace): Likewise.
	* breakpoint.c (alloc_counted_command_line): Likewise.
	(update_dprintf_command_list): Likewise.
	(parse_breakpoint_sals): Likewise.
	(decode_static_tracepoint_spec): Likewise.
	(until_break_command): Likewise.
	(clear_command): Likewise.
	(update_global_location_list): Likewise.
	(get_breakpoint_objfile_data) Likewise.
	* btrace.c (ftrace_new_function): Likewise.
	(btrace_set_insn_history): Likewise.
	(btrace_set_call_history): Likewise.
	* buildsym.c (add_symbol_to_list): Likewise.
	(record_pending_block): Likewise.
	(start_subfile): Likewise.
	(start_buildsym_compunit): Likewise.
	(push_subfile): Likewise.
	(end_symtab_get_static_block): Likewise.
	(buildsym_init): Likewise.
	* cli/cli-cmds.c (source_command): Likewise.
	* cli/cli-decode.c (add_cmd): Likewise.
	* cli/cli-script.c (build_command_line): Likewise.
	(setup_user_args): Likewise.
	(realloc_body_list): Likewise.
	(process_next_line): Likewise.
	(copy_command_lines): Likewise.
	* cli/cli-setshow.c (do_set_command): Likewise.
	* coff-pe-read.c (read_pe_exported_syms): Likewise.
	* coffread.c (coff_locate_sections): Likewise.
	(coff_symtab_read): Likewise.
	(coff_read_struct_type): Likewise.
	* common/cleanups.c (make_my_cleanup2): Likewise.
	* common/common-exceptions.c (throw_it): Likewise.
	* common/filestuff.c (make_cleanup_close): Likewise.
	* common/format.c (parse_format_string): Likewise.
	* common/queue.h (DEFINE_QUEUE_P): Likewise.
	* compile/compile-object-load.c (munmap_list_add): Likewise.
	(compile_object_load): Likewise.
	* compile/compile-object-run.c (compile_object_run): Likewise.
	* compile/compile.c (append_args): Likewise.
	* corefile.c (specify_exec_file_hook): Likewise.
	* cp-support.c (make_symbol_overload_list): Likewise.
	* cris-tdep.c (push_stack_item): Likewise.
	(cris_gdbarch_init): Likewise.
	* ctf.c (ctf_trace_file_writer_new): Likewise.
	* dbxread.c (init_header_files): Likewise.
	(add_new_header_file): Likewise.
	(init_bincl_list): Likewise.
	(dbx_end_psymtab): Likewise.
	(start_psymtab): Likewise.
	(dbx_end_psymtab): Likewise.
	* dcache.c (dcache_init): Likewise.
	* dictionary.c (dict_create_hashed): Likewise.
	(dict_create_hashed_expandable): Likewise.
	(dict_create_linear): Likewise.
	(dict_create_linear_expandable): Likewise.
	* dtrace-probe.c (dtrace_process_dof_probe): Likewise.
	* dummy-frame.c (register_dummy_frame_dtor): Likewise.
	* dwarf2-frame-tailcall.c (cache_new_ref1): Likewise.
	* dwarf2-frame.c (dwarf2_build_frame_info): Likewise.
	(decode_frame_entry_1): Likewise.
	* dwarf2expr.c (new_dwarf_expr_context): Likewise.
	* dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise.
	* dwarf2read.c (dwarf2_has_info): Likewise.
	(create_signatured_type_table_from_index): Likewise.
	(dwarf2_read_index): Likewise.
	(dw2_get_file_names_reader): Likewise.
	(create_all_type_units): Likewise.
	(read_cutu_die_from_dwo): Likewise.
	(init_tu_and_read_dwo_dies): Likewise.
	(init_cutu_and_read_dies): Likewise.
	(create_all_comp_units): Likewise.
	(queue_comp_unit): Likewise.
	(inherit_abstract_dies): Likewise.
	(read_call_site_scope): Likewise.
	(dwarf2_add_field): Likewise.
	(dwarf2_add_typedef): Likewise.
	(dwarf2_add_member_fn): Likewise.
	(attr_to_dynamic_prop): Likewise.
	(abbrev_table_alloc_abbrev): Likewise.
	(abbrev_table_read_table): Likewise.
	(add_include_dir): Likewise.
	(add_file_name): Likewise.
	(dwarf_decode_line_header): Likewise.
	(dwarf2_const_value_attr): Likewise.
	(dwarf_alloc_block): Likewise.
	(parse_macro_definition): Likewise.
	(set_die_type): Likewise.
	(write_psymtabs_to_index): Likewise.
	(create_cus_from_index): Likewise.
	(dwarf2_create_include_psymtab): Likewise.
	(process_psymtab_comp_unit_reader): Likewise.
	(build_type_psymtab_dependencies): Likewise.
	(read_comp_units_from_section): Likewise.
	(compute_compunit_symtab_includes): Likewise.
	(create_dwo_unit_in_dwp_v1): Likewise.
	(create_dwo_unit_in_dwp_v2): Likewise.
	(read_func_scope): Likewise.
	(process_structure_scope): Likewise.
	(mark_common_block_symbol_computed): Likewise.
	(load_partial_dies): Likewise.
	(dwarf2_symbol_mark_computed): Likewise.
	* elfread.c (elf_symfile_segments): Likewise.
	(elf_read_minimal_symbols): Likewise.
	* environ.c (make_environ): Likewise.
	* eval.c (evaluate_subexp_standard): Likewise.
	* event-loop.c (create_file_handler): Likewise.
	(create_async_signal_handler): Likewise.
	(create_async_event_handler): Likewise.
	(create_timer): Likewise.
	* exec.c (build_section_table): Likewise.
	* fbsd-nat.c (fbsd_remember_child): Likewise.
	* fork-child.c (fork_inferior): Likewise.
	* frv-tdep.c (new_variant): Likewise.
	* gdbarch.sh (gdbarch_alloc): Likewise.
	(append_name): Likewise.
	* gdbtypes.c (rank_function): Likewise.
	(copy_type_recursive): Likewise.
	(add_dyn_prop): Likewise.
	* gnu-nat.c (make_proc): Likewise.
	(make_inf): Likewise.
	(gnu_write_inferior): Likewise.
	* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
	(build_std_type_info_type): Likewise.
	* guile/scm-param.c (compute_enum_list): Likewise.
	* guile/scm-utils.c (gdbscm_parse_function_args): Likewise.
	* guile/scm-value.c (gdbscm_value_call): Likewise.
	* h8300-tdep.c (h8300_gdbarch_init): Likewise.
	* hppa-tdep.c (hppa_init_objfile_priv_data): Likewise.
	(read_unwind_info): Likewise.
	* ia64-tdep.c (ia64_gdbarch_init): Likewise.
	* infcall.c (dummy_frame_context_saver_setup): Likewise.
	(call_function_by_hand_dummy): Likewise.
	* infcmd.c (step_once): Likewise.
	(finish_forward): Likewise.
	(attach_command): Likewise.
	(notice_new_inferior): Likewise.
	* inferior.c (add_inferior_silent): Likewise.
	* infrun.c (add_displaced_stepping_state): Likewise.
	(save_infcall_control_state): Likewise.
	(save_inferior_ptid): Likewise.
	(_initialize_infrun): Likewise.
	* jit.c (bfd_open_from_target_memory): Likewise.
	(jit_gdbarch_data_init): Likewise.
	* language.c (add_language): Likewise.
	* linespec.c (decode_line_2): Likewise.
	* linux-nat.c (add_to_pid_list): Likewise.
	(add_initial_lwp): Likewise.
	* linux-thread-db.c (add_thread_db_info): Likewise.
	(record_thread): Likewise.
	(info_auto_load_libthread_db): Likewise.
	* m32c-tdep.c (m32c_gdbarch_init): Likewise.
	* m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise.
	* m68k-tdep.c (m68k_gdbarch_init): Likewise.
	* m88k-tdep.c (m88k_analyze_prologue): Likewise.
	* macrocmd.c (macro_define_command): Likewise.
	* macroexp.c (gather_arguments): Likewise.
	* macroscope.c (sal_macro_scope): Likewise.
	* macrotab.c (new_macro_table): Likewise.
	* mdebugread.c (push_parse_stack): Likewise.
	(parse_partial_symbols): Likewise.
	(parse_symbol): Likewise.
	(psymtab_to_symtab_1): Likewise.
	(new_block): Likewise.
	(new_psymtab): Likewise.
	(mdebug_build_psymtabs): Likewise.
	(add_pending): Likewise.
	(elfmdebug_build_psymtabs): Likewise.
	* mep-tdep.c (mep_gdbarch_init): Likewise.
	* mi/mi-main.c (mi_execute_command): Likewise.
	* mi/mi-parse.c (mi_parse_argv): Likewise.
	* minidebug.c (lzma_open): Likewise.
	* minsyms.c (terminate_minimal_symbol_table): Likewise.
	* mips-linux-nat.c (mips_linux_insert_watchpoint): Likewise.
	* mips-tdep.c (mips_gdbarch_init): Likewise.
	* mn10300-tdep.c (mn10300_gdbarch_init): Likewise.
	* msp430-tdep.c (msp430_gdbarch_init): Likewise.
	* mt-tdep.c (mt_registers_info): Likewise.
	* nat/aarch64-linux.c (aarch64_linux_new_thread): Likewise.
	* nat/linux-btrace.c (linux_enable_bts): Likewise.
	(linux_enable_pt): Likewise.
	* nat/linux-osdata.c (linux_xfer_osdata_processes): Likewise.
	(linux_xfer_osdata_processgroups): Likewise.
	* nios2-tdep.c (nios2_gdbarch_init): Likewise.
	* nto-procfs.c (procfs_meminfo): Likewise.
	* objc-lang.c (start_msglist): Likewise.
	(selectors_info): Likewise.
	(classes_info): Likewise.
	(find_methods): Likewise.
	* objfiles.c (allocate_objfile): Likewise.
	(update_section_map): Likewise.
	* osabi.c (gdbarch_register_osabi): Likewise.
	(gdbarch_register_osabi_sniffer): Likewise.
	* parse.c (start_arglist): Likewise.
	* ppc-linux-nat.c (hwdebug_find_thread_points_by_tid): Likewise.
	(hwdebug_insert_point): Likewise.
	* printcmd.c (display_command): Likewise.
	(ui_printf): Likewise.
	* procfs.c (create_procinfo): Likewise.
	(load_syscalls): Likewise.
	(proc_get_LDT_entry): Likewise.
	(proc_update_threads): Likewise.
	* prologue-value.c (make_pv_area): Likewise.
	(pv_area_store): Likewise.
	* psymtab.c (extend_psymbol_list): Likewise.
	(init_psymbol_list): Likewise.
	(allocate_psymtab): Likewise.
	* python/py-inferior.c (add_thread_object): Likewise.
	* python/py-param.c (compute_enum_values): Likewise.
	* python/py-value.c (valpy_call): Likewise.
	* python/py-varobj.c (py_varobj_iter_next): Likewise.
	* python/python.c (ensure_python_env): Likewise.
	* record-btrace.c (record_btrace_start_replaying): Likewise.
	* record-full.c (record_full_reg_alloc): Likewise.
	(record_full_mem_alloc): Likewise.
	(record_full_end_alloc): Likewise.
	(record_full_core_xfer_partial): Likewise.
	* regcache.c (get_thread_arch_aspace_regcache): Likewise.
	* remote-fileio.c (remote_fileio_init_fd_map): Likewise.
	* remote-notif.c (remote_notif_state_allocate): Likewise.
	* remote.c (demand_private_info): Likewise.
	(remote_notif_stop_alloc_reply): Likewise.
	(remote_enable_btrace): Likewise.
	* reverse.c (save_bookmark_command): Likewise.
	* rl78-tdep.c (rl78_gdbarch_init): Likewise.
	* rx-tdep.c (rx_gdbarch_init): Likewise.
	* s390-linux-nat.c (s390_insert_watchpoint): Likewise.
	* ser-go32.c (dos_get_tty_state): Likewise.
	(dos_copy_tty_state): Likewise.
	* ser-mingw.c (ser_windows_open): Likewise.
	(ser_console_wait_handle): Likewise.
	(ser_console_get_tty_state): Likewise.
	(make_pipe_state): Likewise.
	(net_windows_open): Likewise.
	* ser-unix.c (hardwire_get_tty_state): Likewise.
	(hardwire_copy_tty_state): Likewise.
	* solib-aix.c (solib_aix_new_lm_info): Likewise.
	* solib-dsbt.c (dsbt_current_sos): Likewise.
	(dsbt_relocate_main_executable): Likewise.
	* solib-frv.c (frv_current_sos): Likewise.
	(frv_relocate_main_executable): Likewise.
	* solib-spu.c (spu_bfd_fopen): Likewise.
	* solib-svr4.c (lm_info_read): Likewise.
	(svr4_copy_library_list): Likewise.
	(svr4_default_sos): Likewise.
	* source.c (find_source_lines): Likewise.
	(line_info): Likewise.
	(add_substitute_path_rule): Likewise.
	* spu-linux-nat.c (spu_bfd_open): Likewise.
	* spu-tdep.c (info_spu_dma_cmdlist): Likewise.
	* stabsread.c (dbx_lookup_type): Likewise.
	(read_type): Likewise.
	(read_member_functions): Likewise.
	(read_struct_fields): Likewise.
	(read_baseclasses): Likewise.
	(read_args): Likewise.
	(_initialize_stabsread): Likewise.
	* stack.c (func_command): Likewise.
	* stap-probe.c (handle_stap_probe): Likewise.
	* symfile.c (addrs_section_sort): Likewise.
	(addr_info_make_relative): Likewise.
	(load_section_callback): Likewise.
	(add_symbol_file_command): Likewise.
	(init_filename_language_table): Likewise.
	* symtab.c (create_filename_seen_cache): Likewise.
	(sort_search_symbols_remove_dups): Likewise.
	(search_symbols): Likewise.
	* target.c (make_cleanup_restore_target_terminal): Likewise.
	* thread.c (new_thread): Likewise.
	(enable_thread_stack_temporaries): Likewise.
	(make_cleanup_restore_current_thread): Likewise.
	(thread_apply_all_command): Likewise.
	* tic6x-tdep.c (tic6x_gdbarch_init): Likewise.
	* top.c (gdb_readline_wrapper): Likewise.
	* tracefile-tfile.c (tfile_trace_file_writer_new): Likewise.
	* tracepoint.c (trace_find_line_command): Likewise.
	(all_tracepoint_actions_and_cleanup): Likewise.
	(make_cleanup_restore_current_traceframe): Likewise.
	(get_uploaded_tp): Likewise.
	(get_uploaded_tsv): Likewise.
	* tui/tui-data.c (tui_alloc_generic_win_info): Likewise.
	(tui_alloc_win_info): Likewise.
	(tui_alloc_content): Likewise.
	(tui_add_content_elements): Likewise.
	* tui/tui-disasm.c (tui_find_disassembly_address): Likewise.
	(tui_set_disassem_content): Likewise.
	* ui-file.c (ui_file_new): Likewise.
	(stdio_file_new): Likewise.
	(tee_file_new): Likewise.
	* utils.c (make_cleanup_restore_integer): Likewise.
	(add_internal_problem_command): Likewise.
	* v850-tdep.c (v850_gdbarch_init): Likewise.
	* valops.c (find_oload_champ): Likewise.
	* value.c (allocate_value_lazy): Likewise.
	(record_latest_value): Likewise.
	(create_internalvar): Likewise.
	* varobj.c (install_variable): Likewise.
	(new_variable): Likewise.
	(new_root_variable): Likewise.
	(cppush): Likewise.
	(_initialize_varobj): Likewise.
	* windows-nat.c (windows_make_so): Likewise.
	* x86-nat.c (x86_add_process): Likewise.
	* xcoffread.c (arrange_linetable): Likewise.
	(allocate_include_entry): Likewise.
	(process_linenos): Likewise.
	(SYMBOL_DUP): Likewise.
	(xcoff_start_psymtab): Likewise.
	(xcoff_end_psymtab): Likewise.
	* xml-support.c (gdb_xml_parse_attr_ulongest): Likewise.
	* xtensa-tdep.c (xtensa_register_type): Likewise.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.

gdb/gdbserver/ChangeLog:

	* ax.c (gdb_parse_agent_expr): Likewise.
	(compile_bytecodes): Likewise.
	* dll.c (loaded_dll): Likewise.
	* event-loop.c (append_callback_event): Likewise.
	(create_file_handler): Likewise.
	(create_file_event): Likewise.
	* hostio.c (handle_open): Likewise.
	* inferiors.c (add_thread): Likewise.
	(add_process): Likewise.
	* linux-aarch64-low.c (aarch64_linux_new_process): Likewise.
	* linux-arm-low.c (arm_new_process): Likewise.
	(arm_new_thread): Likewise.
	* linux-low.c (add_to_pid_list): Likewise.
	(linux_add_process): Likewise.
	(handle_extended_wait): Likewise.
	(add_lwp): Likewise.
	(enqueue_one_deferred_signal): Likewise.
	(enqueue_pending_signal): Likewise.
	(linux_resume_one_lwp_throw): Likewise.
	(linux_resume_one_thread): Likewise.
	(linux_read_memory): Likewise.
	(linux_write_memory): Likewise.
	* linux-mips-low.c (mips_linux_new_process): Likewise.
	(mips_linux_new_thread): Likewise.
	(mips_add_watchpoint): Likewise.
	* linux-x86-low.c (initialize_low_arch): Likewise.
	* lynx-low.c (lynx_add_process): Likewise.
	* mem-break.c (set_raw_breakpoint_at): Likewise.
	(set_breakpoint): Likewise.
	(add_condition_to_breakpoint): Likewise.
	(add_commands_to_breakpoint): Likewise.
	(clone_agent_expr): Likewise.
	(clone_one_breakpoint): Likewise.
	* regcache.c (new_register_cache): Likewise.
	* remote-utils.c (look_up_one_symbol): Likewise.
	* server.c (queue_stop_reply): Likewise.
	(start_inferior): Likewise.
	(queue_stop_reply_callback): Likewise.
	(handle_target_event): Likewise.
	* spu-low.c (fetch_ppc_memory): Likewise.
	(store_ppc_memory): Likewise.
	* target.c (set_target_ops): Likewise.
	* thread-db.c (thread_db_load_search): Likewise.
	(try_thread_db_load_1): Likewise.
	* tracepoint.c (add_tracepoint): Likewise.
	(add_tracepoint_action): Likewise.
	(create_trace_state_variable): Likewise.
	(cmd_qtdpsrc): Likewise.
	(cmd_qtro): Likewise.
	(add_while_stepping_state): Likewise.
	* win32-low.c (child_add_thread): Likewise.
	(get_image_name): Likewise.
2015-08-26 17:18:12 -04:00
Patrick Palka e3ae3c4345 Fix invoking "[kill|detach] inferiors" on inferiors that are not running
Invoking either of the above commands on an inferior that's not running
triggers the following assert failure:

  .../binutils-gdb/gdb/thread.c:514: internal-error: any_thread_of_process: Assertion `pid != 0' failed.

The fix is straightforward.  This patch also adds a test to check the
basic functionality of these commands, along with testing this fix in
particular.  Tested on x86_64 Linux.

gdb/ChangeLog:

	* inferior.c (detach_inferior_command): Don't call
	any_thread_of_process when pid is 0.
	(kill_inferior_command): Likewise.

gdb/testsuite/ChangeLog:

	* gdb.base/kill-detach-inferiors-cmd.exp: New test file.
	* gdb.base/kill-detach-inferiors-cmd.c: New test file.
2015-08-15 13:32:47 -04:00
Simon Marchi 7a41607e01 Delete program spaces directly when removing inferiors
When deleting an inferior, delete the associated program space as well
if it becomes unused. This replaces the "pruning" approach, with which
you could forget to call prune_program_spaces (as seen, with the
-remove-inferior command, see [1]).

This allows to remove the prune_program_spaces function. At the same
time, I was able to clean up the delete_inferior* family:

 - delete_inferior is unused
 - delete_inferior_silent is only used in monitor_close, but is replaced
   with discard_all_inferiors [2], so it becomes unused
 - All remaining calls to delete_inferior_1 are with silent=1, so the
   parameter is removed
 - delete_inferior_1 is renamed to delete_inferior

I renamed pspace_empty_p to program_space_empty_p. I prefer if the
"exported" functions have a more explicit and standard name.

Tested on Ubuntu 14.10.

[1] https://sourceware.org/ml/gdb-patches/2014-09/msg00717.html
[2] See https://sourceware.org/ml/gdb-patches/2015-07/msg00228.html and
    follow-ups for details.

gdb/Changelog:

	* inferior.c (delete_inferior_1): Rename to ...
	(delete_inferior): ..., remove 'silent' parameter, delete
	program space when unused and remove call to prune_program_spaces.
	Remove the old, unused, delete_inferior.
	(delete_inferior_silent): Remove.
	(prune_inferiors): Change call from delete_inferior_1 to
	delete_inferior and remove 'silent' parameter. Remove call to
	prune_program_spaces.
	(remove_inferior_command): Idem.
	* inferior.h (delete_inferior_1): Rename to...
	(delete_inferior): ..., remove 'silent' parameter and remove the
	original delete_inferior.
	(delete_inferior_silent): Remove.
	* mi/mi-main.c (mi_cmd_remove_inferior): Change call from
	delete_inferior_1 to delete_inferior and remove 'silent'
	parameter.
	* progspace.c (prune_program_spaces): Remove.
	(pspace_empty_p): Rename to...
	(program_space_empty_p): ... and make non-static.
	(delete_program_space): New.
	* progspace.h (prune_program_spaces): Remove declaration.
	(program_space_empty_p): New declaration.
	(delete_program_space): New declaration.
	* monitor.c (monitor_close): Replace call to
	delete_thread_silent and delete_inferior_silent with
	discard_all_inferiors.
2015-07-08 15:41:01 -04:00
Simon Marchi ef3f321b39 Revert "Delete program spaces directly when removing inferiors"
Reverted, since it causes a build failure.  It turns out that
delete_inferior_silent wasn't actually unused.

This reverts commit 0560c645c0.
2015-07-08 11:40:35 -04:00
Simon Marchi 0560c645c0 Delete program spaces directly when removing inferiors
When deleting an inferior, delete the associated program space as well
if it becomes unused. This replaces the "pruning" approach, with which
you could forget to call prune_program_spaces (as seen, with the
-remove-inferior command, see [1]).

This allows to remove the prune_program_spaces function. At the same
time, I was able to clean up the delete_inferior* family.
delete_inferior_silent and delete_inferior were unused, which allowed
renaming delete_inferior_1 to delete_inferior. Also, since all calls to
it were with silent=1, I removed that parameter completely.

I renamed pspace_empty_p to program_space_empty_p. I prefer if the
"exported" functions have a more explicit and standard name.

Tested on Ubuntu 14.10.

This obsoletes my previous patch "Add call to prune_program_spaces in
mi_cmd_remove_inferior" [1].

[1] https://sourceware.org/ml/gdb-patches/2014-09/msg00717.html

gdb/Changelog:

	* inferior.c (delete_inferior_1): Rename to ...
	(delete_inferior): ..., remove 'silent' parameter, delete
	program space when unused and remove call to prune_program_spaces.
	Remove the old, unused, delete_inferior.
	(delete_inferior_silent): Remove.
	(prune_inferiors): Change call from delete_inferior_1 to
	delete_inferior and remove 'silent' parameter. Remove call to
	prune_program_spaces.
	(remove_inferior_command): Idem.
	* inferior.h (delete_inferior_1): Rename to...
	(delete_inferior): ..., remove 'silent' parameter and remove the
	original delete_inferior.
	(delete_inferior_silent): Remove.
	* mi/mi-main.c (mi_cmd_remove_inferior): Change call from
	delete_inferior_1 to delete_inferior and remove 'silent'
	parameter.
	* progspace.c (prune_program_spaces): Remove.
	(pspace_empty_p): Rename to...
	(program_space_empty_p): ... and make non-static.
	(delete_program_space): New.
	* progspace.h (prune_program_spaces): Remove declaration.
	(program_space_empty_p): New declaration.
	(delete_program_space): New declaration.
2015-07-08 11:26:32 -04:00
Simon Marchi 3b462ec2be Fix =thread-exited not showing up when detaching (PR 15564)
I sent a patch in 2013 for this (incorrectly named =thread-created):

  https://cygwin.com/ml/gdb-patches/2013-06/msg00129.html

Tom Tromey was ok with the change, but suggested to add a test as well.
Then I forgot about this patch until today. So here it is again, with the
corresponding test.

The problem is that the =thread-exited event does not appear when detaching
from a local process. It does appear with remote though. It's not a really
big deal, but I'd like it to be consistent.

Tested with local and remote Linux on my Ubuntu 14.04.

gdb/ChangeLog:

	PR gdb/15564
	* inferior.c (detach_inferior): Call exit_inferior_1 with silent = 0.

gdb/testsuite/ChangeLog:

	PR gdb/15564
	* gdb.mi/mi-detach.exp: New file.
2015-06-02 15:32:57 -04:00
Pedro Alves fe978cb071 C++ keyword cleanliness, mostly auto-generated
This patch renames symbols that happen to have names which are
reserved keywords in C++.

Most of this was generated with Tromey's cxx-conversion.el script.
Some places where later hand massaged a bit, to fix formatting, etc.
And this was rebased several times meanwhile, along with re-running
the script, so re-running the script from scratch probably does not
result in the exact same output.  I don't think that matters anyway.

gdb/
2015-02-27  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	Rename symbols whose names are reserved C++ keywords throughout.

gdb/gdbserver/
2015-02-27  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	Rename symbols whose names are reserved C++ keywords throughout.
2015-02-27 16:33:07 +00:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Simon Marchi c9657e708a Introduce utility function find_inferior_ptid
This patch introduces find_inferior_ptid to replace the common idiom

  find_inferior_pid (ptid_get_pid (...));

It replaces all the instances of that idiom that I found with the new
function.

No significant changes before/after the patch in the regression suite
on amd64 linux.

gdb/ChangeLog:

	* inferior.c (find_inferior_ptid): New function.
	* inferior.h (find_inferior_ptid): New declaration.
	* ada-tasks.c (ada_get_task_number): Use find_inferior_ptid.
	* corelow.c (core_pid_to_str): Same.
	* darwin-nat.c (darwin_resume): Same.
	* infrun.c (fetch_inferior_event): Same.
	(get_inferior_stop_soon): Same.
	(handle_inferior_event): Same.
	(handle_signal_stop): Same.
	* linux-nat.c (resume_lwp): Same.
	(stop_wait_callback): Same.
	* mi/mi-interp.c (mi_new_thread): Same.
	(mi_thread_exit): Same.
	* proc-service.c (ps_pglobal_lookup): Same.
	* record-btrace.c (record_btrace_step_thread): Same.
	* remote-sim.c (gdbsim_close_inferior): Same.
	(gdbsim_resume): Same.
	(gdbsim_stop): Same.
	* sol2-tdep.c (sol2_core_pid_to_str): Same.
	* target.c (memory_xfer_partial_1): Same.
	(default_thread_address_space): Same.
	* thread.c (thread_change_ptid): Same.
	(switch_to_thread): Same.
	(do_restore_current_thread_cleanup): Same.
2014-12-15 12:00:55 -05:00
Pedro Alves 32990adaad Reduce Hg packet (select remote general thread) bouncing
A patch I wrote made GDB pull the thread list sooner when debugging
with target remote, and I noticed an intended consequence.  GDB
started bouncing around the currently selected remote/general thread
more frequently.  E.g.:

  Sending packet: $qTMinFTPILen#3b...Packet received: 5
 +Sending packet: $Hgp726d.726d#53...Packet received: OK
  Sending packet: $m400680,40#2f...Packet received: 85c0741455bff00d60004889e5ffd05de97bffffff0f1f00e973ffffff0f1f00554889e5c745fc00000000c745fc01000000e900000000c745fc02000000b800
 +Sending packet: $Hgp726d.7278#28...Packet received: OK
  Sending packet: $m4006b2,1#28...Packet received: e9
  Fast tracepoint 2 at 0x4006b2: file gdb/testsuite/gdb.trace/range-stepping.c, line 53.
  Sending packet: $qTStatus#49...Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes::

This ended up breaking "tstart" when one has fast tracepoints set,
because gdbserver isn't expecting an Hg packet in response to
qRelocInsn:

 (gdb) ftrace *set_point
 Fast tracepoint 3 at 0x4006b2: file gdb/testsuite/gdb.trace/range-stepping.c, line 53.
 (gdb) PASS: gdb.trace/range-stepping.exp: ftrace: ftrace *set_point
 tstart
 gdbserver: Malformed response to qRelocInsn, ignoring: Hgp2783.2783

 Target does not support this command.
 (gdb) FAIL: gdb.trace/range-stepping.exp: ftrace: tstart

remote_trace_start should probably start by making sure the remote
current thread matches inferior_ptid (calling set_general_thread), but
still, reducing unnecessary bouncing is a good idea.  It happens
because the memory/symbol/breakpoint routines use
switch_to_program_space_and_thread to do something in the right
context and then revert back to the previously current thread.

The fix is to simply make any_thread_of_process,
find_inferior_for_program_space, etc. give preference to the current
thread/inferior it if matches.

gdb/
2014-10-02  Pedro Alves  <palves@redhat.com>

	* gdbthread.h (any_thread_of_process, any_live_thread_of_process):
	Adjust comments.
	* inferior.c (find_inferior_for_program_space): Give preference to
	the current inferior.
	* inferior.h (find_inferior_for_program_space): Update comment.
	* progspace.c (switch_to_program_space_and_thread): Prefer the
	current inferior if it's bound to the program space requested.  If
	the inferior found doesn't have a PID yet, don't bother looking up
	a thread.
	* progspace.h (switch_to_program_space_and_thread): Adjust
	comment.
	* thread.c (any_thread_of_process, any_live_thread_of_process):
	Give preference to the current thread.
2014-10-02 09:55:38 +01:00
Simon Marchi 2ddf430110 Exit code of exited inferiors in -list-thread-groups
Don't reset the exit code at inferior exit and print it in
-list-thread-groups.

gdb/ChangeLog:

	* NEWS: Announce new exit-code field in -list-thread-groups
	output.
	* inferior.c (exit_inferior_1): Don't clear exit code.
	(inferior_appeared): Clear exit code.
	* mi/mi-main.c (print_one_inferior): Add printing of the exit
	code.

gdb/testsuite/ChangeLog:

	* gdb.mi/mi-exit-code.exp: New file.
	* gdb.mi/mi-exit-code.c: New file.

gdb/doc/ChangeLog:

	* gdb.texinfo (Miscellaneous gdb/mi Commands): Document new
	exit-code field in -list-thread-groups output.
2014-10-01 10:20:49 -04:00
Doug Evans bed8455c71 * inferior.c (prune_inferiors): Fix comment.
(remove_inferior_command): Call prune_program_spaces.
2014-05-17 11:59:34 -07:00
Honggyu Kim e261678878 Remove duplicated #include's from GDB
This patch simply removes duplicated #include statements in the gdb/
directory.  If there are two duplicated #include statements, this patch
keeps the first #include and removes the second.

Those duplicates have been found by using the checkincludes.pl tool from
the Linux kernel and double checked manually once again if the #include
statements are affected by #ifdef macros.

2014-01-06  Honggyu Kim  <hong.gyu.kim@lge.com>

	* ada-lang.c: Remove duplicated include statements.
	* alphabsd-nat.c: Ditto.
	* amd64-darwin-tdep.c: Ditto.
	* amd64fbsd-nat.c: Ditto.
	* auto-load.c: Ditto.
	* ax-gdb.c: Ditto.
	* breakpoint.c: Ditto.
	* dbxread.c: Ditto.
	* fork-child.c: Ditto.
	* gdb_usleep.c: Ditto.
	* i386-darwin-tdep.c: Ditto.
	* i386fbsd-nat.c: Ditto.
	* infcmd.c: Ditto.
	* inferior.c: Ditto.
	* jv-lang.c: Ditto.
	* linux-nat.c: Ditto.
	* linux-tdep.c: Ditto.
	* m68kbsd-nat.c: Ditto.
	* m68klinux-nat.c: Ditto.
	* microblaze-tdep.c: Ditto.
	* mips-linux-tdep.c: Ditto.
	* mn10300-tdep.c: Ditto.
	* nto-tdep.c: Ditto.
	* opencl-lang.c: Ditto.
	* osdata.c: Ditto.
	* printcmd.c: Ditto.
	* regcache.c: Ditto.
	* remote-m32r-sdi.c: Ditto.
	* remote.c: Ditto.
	* symfile.c: Ditto.
	* symtab.c: Ditto.
	* tilegx-linux-nat.c: Ditto.
	* tilegx-tdep.c: Ditto.
	* tracepoint.c: Ditto.
	* valops.c: Ditto.
	* vaxbsd-nat.c: Ditto.
	* windows-nat.c: Ditto.
	* xtensa-tdep.c: Ditto.
2014-01-07 14:14:30 -02:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Pedro Alves 08d72866c0 PR gdb/15911: "info threads" changes the default source and line (for "break", "list")
"info threads" changes the default source for "break" and "list", to
whatever the location of the first/bottom thread in the thread list
is...

 (gdb) b start
 (gdb) c
 ...
 (gdb) list
 *lists "start"*
 (gdb) b 23
 Breakpoint 3 at 0x400614: file test.c, line 23.
 (gdb) info threads
   Id   Target Id         Frame
 * 2    Thread 0x7ffff7fcb700 (LWP 1760) "test" start (arg=0x0) at test.c:23
   1    Thread 0x7ffff7fcc740 (LWP 1748) "test" 0x000000323dc08e60 in pthread_join (threadid=140737353922304, thread_return=0x0) at pthread_join.c:93
 (gdb) b 23
 Breakpoint 4 at 0x323dc08d90: file pthread_join.c, line 23.
                                    ^^^^^^^^^^^^^^^
 (gdb) list
 93          lll_wait_tid (pd->tid);
 94
 95
 96        /* Restore cancellation mode.  */
 97        CANCEL_RESET (oldtype);
 98
 99        /* Remove the handler.  */
 100       pthread_cleanup_pop (0);
 101
 102

The issue is that print_stack_frame always sets the current sal to the
frame's sal.  print_frame_info (which print_stack_frame calls to do
most of the work) also sets the last displayed sal, but only if
print_what isn't LOCATION.  Now the call in question, from within
thread.c:print_thread_info, does pass in LOCATION as print_what, but
print_stack_frame doesn't have the same check print_frame_info has.
We could consider adding it, but setting these globals depending on
print_what isn't very clean, IMO.  What we have is two logically
distinct operations mixed in the same function(s):

  #1 - print frame, in the format specified by {print_what,
    print_level and print_args}.

  #2 - We're displaying a frame to the user, and I want the default
    sal to point here, because the program stopped here, or the user
    did some context-changing command (up, down, etc.).

So I added a new parameter to print_stack_frame & friends for point
#2, and went through all calls in the tree adjusting as necessary.

Tested on x86_64 Fedora 17.

gdb/
2013-09-17  Pedro Alves  <palves@redhat.com>

	PR gdb/15911
	* ada-tasks.c (task_command_1): Adjust call to print_stack_frame.
	* bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd):
	* corelow.c (core_open):
	* frame.h (print_stack_frame, print_frame_info): New
	'set_current_sal' parameter.
	* infcmd.c (finish_command, kill_command): Adjust call to
	print_stack_frame.
	* inferior.c (inferior_command): Likewise.
	* infrun.c (normal_stop): Likewise.
	* linux-fork.c (linux_fork_context): Likewise.
	* record-full.c (record_full_goto_entry, record_full_restore):
	Likewise.
	* remote-mips.c (common_open): Likewise.
	* stack.c (print_stack_frame): New 'set_current_sal' parameter.
	Use it.
	(print_frame_info): New 'set_current_sal' parameter.  Set the last
	displayed sal depending on the new paremeter instead of looking at
	print_what.
	(backtrace_command_1, select_and_print_frame, frame_command)
	(current_frame_command, up_command, down_command): Adjust call to
	print_stack_frame.
	* thread.c (print_thread_info, restore_selected_frame)
	(do_captured_thread_select): Adjust call to print_stack_frame.
	* tracepoint.c (tfind_1): Likewise.
	* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
	(mi_cmd_stack_info_frame): Likewise.
	* mi/mi-interp.c (mi_on_normal_stop): Likewise.
	* mi/mi-main.c (mi_cmd_exec_return, mi_cmd_trace_find): Likewise.

	gdb/testsuite/
	* gdb.threads/info-threads-cur-sal-2.c: New file.
	* gdb.threads/info-threads-cur-sal.c: New file.
	* gdb.threads/info-threads-cur-sal.exp: New file.
2013-09-17 18:26:41 +00:00
Jan Kratochvil 1f0c498857 PR gdb/15415
gdb/
2013-08-27  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR gdb/15415
	* corefile.c (get_exec_file): Use exec_filename.
	* defs.h (OPF_DISABLE_REALPATH): New definition.  Add new comment.
	* exec.c (exec_close): Free EXEC_FILENAME.
	(exec_file_attach): New variable canonical_pathname.  Use
	OPF_DISABLE_REALPATH.  Call gdb_realpath explicitly.  Set
	EXEC_FILENAME.
	* exec.h (exec_filename): New.
	* inferior.c (print_inferior, inferior_command): Use
	PSPACE_EXEC_FILENAME.
	* mi/mi-main.c (print_one_inferior): Likewise.
	* progspace.c (clone_program_space, print_program_space): Likewise.
	* progspace.h (struct program_space): New field pspace_exec_filename.
	* source.c (openp): Describe OPF_DISABLE_REALPATH.  New variable
	realpath_fptr, initialize it from OPF_DISABLE_REALPATH, use it.

gdb/testsuite/
2013-08-27  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR gdb/15415
	* gdb.base/argv0-symlink.c: New file.
	* gdb.base/argv0-symlink.exp: New file.
2013-08-28 17:52:03 +00:00
Hafiz Abid Qadeer 4790207643 2013-05-30 Hafiz Abid Qadeer <abidh@codesourcery.com>
* inferior.c (top level): Include tilde.h.
	(add_inferior_command): Call tilde_expand on the value of 'exec'
	argument.
2013-05-30 12:54:17 +00:00
Joel Brobecker 28e7fd6234 Update years in copyright notice for the GDB files.
Two modifications:
  1. The addition of 2013 to the copyright year range for every file;
  2. The use of a single year range, instead of potentially multiple
     year ranges, as approved by the FSF.
2013-01-01 06:33:28 +00:00
Pedro Alves 6ecd47299a gdb/
2012-11-09  Pedro Alves  <palves@redhat.com>

	* gdbarch.sh (target_gdbarch) <gdbarch.h>: Reimplement as macro.
	(get_target_gdbarch) <gdbarch.h>: New function.
	(startup_gdbarch) <gdbarch.h>: Declare.
	<gdbarch.c> (target_gdbarch): Delete.
	<gdbarch.c> (deprecated_target_gdbarch_select_hack): Set the
	current inferior's gdbarch.
	<gdbarch.c> (get_target_gdbarch): New function.
	* inferior.c: Include target-descriptions.h.
	(free_inferior): Free target description info.
	(add_inferior_with_spaces): Set the inferior's initial
	architecture.
	(clone_inferior_command): Copy the original inferior's target
	description if it was user specified.
	(initialize_inferiors): Add comment.
	* inferior.h (struct target_desc_info): Forward declare.
	(struct inferior) <gdbarch>: New field.
	* linux-nat.c: Include target-descriptions.h.
	(linux_child_follow_fork): Copy the parent's architecture and
	target description to the child.
	* target-descriptions.c: Include inferior.h.
	(struct target_desc_info): New structure, holding the equivalents
	of ...
	(target_desc_fetched, current_target_desc)
	(target_description_filename): ... these removed globals.
	(get_tdesc_info, target_desc_info_from_user_p)
	(copy_inferior_target_desc_info, target_desc_info_free): New.
	(target_desc_fetched, current_target_desc)
	(target_description_filename): Reimplemented as convenience
	macros.
	(tdesc_filename_cmd_string): New global.
	(set_tdesc_filename_cmd): Copy the string manipulated by the "set
	tdescs filename ..." commands to the per-inferior equivalent.
	(show_tdesc_filename_cmd): Get the value to show from the
	per-inferior description filename.
	(_initilize_target_descriptions): Change the "set/show tdesc
	filename" commands' variable.
	* target-descriptions.h (struct target_desc, struct target_desc_info)
	(struct inferior): Forward declare.
	(target_find_description, target_clear_description)
	(target_current_description): Adjust comments.
	(copy_inferior_target_desc_info, target_desc_info_free)
	(target_desc_info_from_user_p). Declare.

gdb/testsuite/
2012-11-09  Pedro Alves  <palves@redhat.com>

	* gdb.multi/multi-arch.exp: New.
2012-11-09 01:47:20 +00:00
Pedro Alves 68c9da300b gdb/
2012-11-05  Pedro Alves  <palves@redhat.com>

	* inferior.c (exit_inferior_1): Clear 'vfork_parent' in the vfork
	child.  Clear 'pending_detach'.
	* infrun.c (handle_vfork_child_exec_or_exit): Clear
	'pending_detach' in the vfork parent.

gdb/testsuite/
2012-11-05  Pedro Alves  <palves@redhat.com>

	* gdb.base/foll-vfork.exp (vfork_relations_in_info_inferiors): New
	procedure.
	(do_vfork_and_follow_child_tests_exec)
	(do_vfork_and_follow_child_tests_exit): Call it.
2012-11-05 18:56:45 +00:00
Tom Tromey 6b81941e35 * registry.h (struct registry_fields): New.
(REGISTRY_FIELDS): Redefine.
	(REGISTRY_ACCESS_FIELD): New macro.
	(DEFINE_REGISTRY): Add ACCESS argument.  Update defined
	functions.
2012-08-22 15:31:12 +00:00
Tom Tromey 8e260fc026 * auto-load.c (_initialize_auto_load): Update.
* solib-svr4.c (_initialize_svr4_solib): Update
	* solib-dsbt.c (_initialize_dsbt_solib): Update.
	* solib-darwin.c (_initialize_darwin_solib): Update.
	* registry.h: New file.
	* python/py-progspace.c (gdbpy_initialize_pspace): Update.
	* python/py-inferior.c (gdbpy_initialize_inferior): Update.
	* progspace.h: Include registry.h.  Use DECLARE_REGISTRY.
	(register_program_space_data_with_cleanup)
	(register_program_space_data, program_space_alloc_data)
	(clear_program_space_data, set_program_space_data)
	(program_space_data): Don't declare.
	* progspace.c: Use DEFINE_REGISTRY.
	(struct program_space_data, struct
	program_space_data_registration, struct
	program_space_data_registry, program_space_data_registry)
	(register_program_space_data_with_cleanup)
	(register_program_space_data, program_space_alloc_data)
	(program_space_free_data, clear_program_space_data)
	(set_program_space_data, program_space_data): Remove.
	* objfiles.h: Include registry.h.  Use DECLARE_REGISTRY.
	(struct objfile) <data, num_data>: Replace with REGISTRY_FIELDS.
	(register_objfile_data_with_cleanup, register_objfile_data)
	(clear_objfile_data, set_objfile_data, objfile_data): Don't
	declare.
	* objfiles.c: Use DEFINE_REGISTRY.
	(struct objfile_data, struct objfile_data_registration, struct
	objfile_data_registry, objfile_data_registry)
	(register_objfile_data_with_cleanup, register_objfile_data)
	(objfile_alloc_data, objfile_free_data, clear_objfile_data)
	(set_objfile_data, objfile_data): Remove.
	(_initialize_objfiles): Update.
	* jit.c (_initialize_jit): Update.
	* inflow.c (_initialize_inflow): Update.
	* inferior.h: Include registry.h.  Use DECLARE_REGISTRY.
	(struct inferior) <data, num_data>: Replace with REGISTRY_FIELDS.
	(register_inferior_data_with_cleanup, register_inferior_data)
	(clear_inferior_data, set_inferior_data, inferior_data): Don't
	declare.
	* inferior.c: Use DEFINE_REGISTRY.
	(struct inferior_data, struct inferior_data_registration, struct
	inferior_data_registry, inferior_data_registry)
	(register_inferior_data_with_cleanup, register_inferior_data)
	(inferior_alloc_data, inferior_free_data  clear_inferior_data)
	(set_inferior_data, inferior_data): Remove.
	* auxv.c (_initialize_auxv): Update.
	* ada-lang.c (_initialize_ada_language): Update.
	* breakpoint.c (_initialize_breakpoint): Update.
	* i386-nat.c (i386_use_watchpoints): Update.
2012-08-22 15:17:21 +00:00
Eli Zaretskii 06da564ebe src/inferior.c: Include completer.h
(initialize_inferiors): Set completer of add-inferior to filename_completer.
2012-05-12 06:35:08 +00:00
Pedro Alves 70221824e3 2012-03-01 Pedro Alves <palves@redhat.com>
* amd64-linux-tdep.c (amd64_linux_record_signal): Make static.
	* breakpoint.c (create_exception_master_breakpoint, trace_command)
	(ftrace_command, strace_command): Make static.
	* d-lang.c (_initialize_d_language): Declare.
	* dwarf2expr.c (_initialize_dwarf2expr): Declare.
	* dwarf2loc.c (_initialize_dwarf2loc):
	* dwarf2read.c (process_psymtab_comp_unit): Make static.
	* exec.c (exec_get_section_table): Make static.
	* i386-linux-tdep.c (i386_linux_record_signal): Make static.
	* infcmd.c (ensure_valid_thread, ensure_not_tfind_mode): Make static.
	* inferior.c (remove_inferior_command, add_inferior_command)
	(clone_inferior_command): Make static.
	* linux-nat.c (linux_nat_thread_address_space)
	(linux_nat_core_of_thread): Make static.
	* linux-tdep.c (_initialize_linux_tdep): Declare.
	* objc-lang.c (_initialize_objc_lang): Declare.
	* opencl-lang.c (builtin_opencl_type, opencl_language_arch_info):
	Make static.
	(_initialize_opencl_language): Declare.
	* record.c (_initialize_record): Declare.
	* remote.c (demand_private_info, remote_get_tib_address)
	(remote_supports_cond_tracepoints)
	(remote_supports_fast_tracepoints, remote_get_tracepoint_status):
	Make static.
	* skip.c (_initialize_step_skip): Declare.
	* symtab.c (skip_prologue_using_lineinfo): Make static.
	* tracepoint.c (delete_trace_state_variable)
	(trace_variable_command, delete_trace_variable_command)
	(get_uploaded_tsv, find_matching_tracepoint_location)
	(find_matching_tsv, create_tsv_from_upload, get_traceframe_info):
	Make static.
	* value.c (pack_unsigned_long): Make static.
	* varobj.c (varobj_ensure_python_env): Make static.
	* windows-tdep.c (_initialize_windows_tdep): Declare.
	* xml-syscall.c (make_cleanup_free_syscalls_info): Make static.
2012-03-01 21:14:00 +00:00
Pedro Alves 9079102fe5 2012-03-01 Pedro Alves <palves@redhat.com>
* inferior.c (delete_threads_of_inferior): Delete.
2012-03-01 21:06:14 +00:00
Pedro Alves db2b9fdd4f 2012-02-10 Pedro Alves <palves@redhat.com>
* inferior.c (inferior_pid_to_str): New.
	(print_inferior, inferior_command): Use it.
2012-02-10 14:23:52 +00:00
Ulrich Weigand e714e1bf77 2012-01-20 Pedro Alves <palves@redhat.com>
Ulrich Weigand  <ulrich.weigand@linaro.org>

	* inferior.h (struct inferior): Add fake_pid_p.
	* inferior.c (exit_inferior_1): Clear fake_pid_p.
	* remote.c (remote_start_remote): Set fake_pid_p if we have to use
	magic_null_ptid since the remote side doesn't provide a real PID.
2012-01-20 09:42:44 +00:00
Joel Brobecker 0b30217134 Copyright year update in most files of the GDB Project.
gdb/ChangeLog:

        Copyright year update in most files of the GDB Project.
2012-01-04 08:17:56 +00:00
Pedro Alves 79a45e254f 2011-08-04 Pedro Alves <pedro@codesourcery.com>
* ui-out.h (uiout): Rename to ...
	(current_uiout): ... this.
	* ui-out.c (uiout): Rename to ...
	(current_uiout): ... this.
	* ada-lang.c (print_it_exception, print_one_exception)
	(print_mention_exception): Adjust.
	* breakpoint.c (watchpoint_check): Adjust.
	(print_breakpoint_location, print_one_breakpoint, breakpoint_1)
	(default_collect_info, watchpoints_info, print_one_catch_fork)
	(print_one_catch_vfork, print_one_catch_syscall)
	(print_one_catch_exec, mention, print_it_ranged_breakpoint)
	(print_one_ranged_breakpoint, print_mention_ranged_breakpoint)
	(print_it_watchpoint, print_mention_watchpoint)
	(print_it_masked_watchpoint, print_mention_masked_watchpoint)
	(print_it_exception_catchpoint, print_one_exception_catchpoint)
	(print_mention_exception_catchpoint, say_where, bkpt_print_it)
	(bkpt_print_mention, momentary_bkpt_print_it)
	(tracepoint_print_mention, update_static_tracepoint)
	(tracepoints_info, save_breakpoints): Adjust.
	* cli-out.c (field_separator): Adjust.
	* cp-abi.c (list_cp_abis, show_cp_abi_cmd): Adjust.
	* exceptions.c (catch_exceptions_with_msg, catch_errors): Adjust.
	* frame.c (get_current_frame): Adjust.
	* infcmd.c (run_command_1, print_return_value): Adjust.
	* inferior.c (inferior_command, info_inferiors_command): Adjust.
	* infrun.c (print_end_stepping_range_reason): Adjust.
	(print_signal_exited_reason, print_exited_reason): Adjust.
	(print_signal_received_reason, print_no_history_reason): Adjust.
	* interps.c (interp_set): Adjust.
	* osdata.c (info_osdata_command): Adjust.
	* progspace.c (maintenance_info_program_spaces_command): Adjust.
	* remote-fileio.c (remote_fileio_request): Adjust.
	* remote.c (show_remote_cmd): Adjust.
	* solib.c (info_sharedlibrary_command): Adjust.
	* source.c (print_source_lines_base): Adjust.
	* stack.c (print_stack_frame): Adjust.
	(do_gdb_disassembly, print_frame_info, print_frame): Adjust.
	* symfile-mem.c (add_vsyscall_page): Adjust.
	* symfile.c (load_progress, generic_load)
	(print_transfer_performance): Adjust.
	* thread.c (info_threads_command, restore_selected_frame)
	(thread_command): Adjust.
	* top.c (make_cleanup_restore_ui_file): Adjust.
	* tracepoint.c (tvariables_info_1, trace_status_mi, tfind_1)
	(print_one_static_tracepoint_marker): Adjust.
	* cli/cli-cmds.c (print_disassembly): Adjust.
	* cli/cli-decode.c (print_doc_line): Adjust.
	* cli/cli-interp.c (safe_execute_command): Adjust.
	* cli/cli-logging.c (set_logging_redirect, pop_output_files)
	(handle_redirections): Adjust.
	* cli/cli-script.c (show_user_1): Adjust.
	* cli/cli-setshow.c (do_setshow_command, cmd_show_list): Adjust.
	* mi/mi-cmd-break.c (breakpoint_notify): Adjust.
	* mi/mi-cmd-disas.c (mi_cmd_disassemble): Adjust.
	* mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_path)
	(mi_cmd_env_dir): Adjust.
	* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file)
	(print_partial_file_name, mi_cmd_file_list_exec_source_files): Adjust.
	* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
	(mi_cmd_stack_info_depth, mi_cmd_stack_list_args)
	(list_args_or_locals): Adjust.
	* mi/mi-cmd-var.c (print_varobj, mi_cmd_var_create)
	(mi_cmd_var_delete, mi_cmd_var_set_format, mi_cmd_var_set_frozen)
	(mi_cmd_var_show_format, mi_cmd_var_info_num_children)
	(mi_cmd_var_list_children, mi_cmd_var_info_type)
	(mi_cmd_var_info_path_expression, mi_cmd_var_info_expression)
	(mi_cmd_var_show_attributes, mi_cmd_var_evaluate_expression)
	(mi_cmd_var_assign, mi_cmd_var_update, varobj_update_one): Adjust.
	* mi/mi-interp.c (mi_on_normal_stop): Adjust.
	* mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_thread_select)
	(mi_cmd_thread_list_ids, mi_cmd_thread_info, print_one_inferior)
	(list_available_thread_groups, mi_cmd_list_thread_groups)
	(mi_cmd_data_list_register_names)
	(mi_cmd_data_list_changed_registers)
	(mi_cmd_data_list_register_values, get_register)
	(mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory)
	(mi_cmd_data_read_memory_bytes, mi_cmd_list_features)
	(mi_cmd_list_target_features, mi_cmd_add_inferior)
	(mi_execute_command, mi_load_progress): Adjust.
	* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Adjust.
	* python/py-auto-load.c (print_script, info_auto_load_scripts):
	Adjust.
	* python/py-breakpoint.c (bppy_get_commands): Adjust.
	* tui/tui-interp.c (tui_command_loop): Adjust.
	* tui/tui-io.c (tui_setup_io, tui_initialize_io): Adjust.
2011-08-04 19:10:14 +00:00
Tom Tromey 8cf64490f2 gdb
* python/py-inferior.c (python_inferior_exit): Use inferior's exit
	code fields.
	* python/py-exitedevent.c (create_exited_event_object): Change
	type of 'exit_code'.  Optionally add exit_code attribute.
	(emit_exited_event): Change type of 'exit_code'.
	* python/py-event.h (emit_exited_event): Update.
	* mi/mi-interp.c (mi_inferior_exit): Print exit code.
	* infrun.c (handle_inferior_event): Set exit code fields on
	inferior.
	* inferior.h (struct inferior) <has_exit_code, exit_code>: New
	fields.
	* inferior.c (exit_inferior_1): Initialize new fields.
gdb/doc
	* gdb.texinfo (GDB/MI Async Records): Document 'exit-code' field.
	(Events In Python): Note that exit_code is optional.
2011-06-03 15:32:44 +00:00
Pedro Alves be34f8494e 2011-05-27 Pedro Alves <pedro@codesourcery.com>
* defs.h (struct continuation, continuation_ftype)
	(continuation_free_arg_ftype, add_continuation)
	(do_all_continuations, do_all_continuations_thread)
	(discard_all_continuations, discard_all_continuations_thread)
	(add_intermediate_continuation, do_all_intermediate_continuations)
	(do_all_intermediate_continuations_thread)
	(discard_all_intermediate_continuations)
	(discard_all_intermediate_continuations_thread)
	(add_inferior_continuation, do_all_inferior_continuations)
	(discard_all_inferior_continuations): Move to ...
	* continuations.h: ... this new file.
	* breakpoint.c, continuations.c, event-top.c, inf-loop.c,
	infcmd.c, inferior.c, infrun.c, interps.c: Include
	continuations.h.
2011-05-27 18:28:18 +00:00
Tom Tromey 197f0a605d * tracepoint.c (trace_actions_command): Update.
* thread.c (thread_apply_command): Update.
	* reverse.c (delete_bookmark_command): Update.
	(bookmarks_info): Update.
	* printcmd.c (undisplay_command): Update.
	* memattr.c (mem_enable_command): Update.
	(mem_disable_command): Update.
	(mem_delete_command): Update.
	* inferior.c (detach_inferior_command): Update.
	(kill_inferior_command): Update.
	(remove_inferior_command): Update.
	* cli/cli-utils.h (struct get_number_or_range_state): New.
	(init_number_or_range): Declare.
	(get_number_or_range): Update.
	* cli/cli-utils.c (init_number_or_range): New function.
	(get_number_or_range): Change 'pp' parameter to 'state'.  Remove
	static variables.
	(number_is_in_list): Update.
	* breakpoint.h (get_tracepoint_by_number): Update.
	* breakpoint.c (map_breakpoint_numbers): Update for change to
	get_number_or_range.
	(find_location_by_number): Use get_number, not
	get_number_or_range.
	(trace_pass_set_count): New function.
	(trace_pass_command): Update for change to get_number_or_range.
	Rework loop logic.
	(get_tracepoint_by_number): Remove 'multi_p' parameter; add
	'state' parameter.
2011-03-10 18:33:59 +00:00
Tom Tromey aeaec16283 * target.h (struct target_ops) <to_has_execution>: Add ptid_t
parameter.
	(target_has_execution_1): Update.
	(target_has_execution_current): Declare.
	(target_has_execution): Call target_has_execution_current.
	(default_child_has_execution): Update.
	* target.c (default_child_has_execution): Add 'the_ptid'
	parameter.
	(target_has_execution_1): Likewise.
	(target_has_execution_current): New function.
	(add_target): Update.
	(init_dummy_target): Update.
	* remote-m32r-sdi.c (m32r_has_execution): New function.
	(init_m32r_ops): Use it.
	* record.c (record_core_has_execution): Now static.  Add
	'the_ptid' parameter.
	* inferior.c (have_live_inferiors): Don't save current thread.
	Use target_has_execution_1.
2011-03-07 15:58:13 +00:00
Michael Snyder af62414197 2011-02-25 Michael Snyder <msnyder@vmware.com>
* inferior.c (detach_inferior_command): Use get_number_or_range.
	(kill_inferior_command): Ditto.
	(remove_inferior_command): Ditto.
	(initialize_inferiors): Make command names plural.
	Update help strings.

2011-02-25  Michael Snyder  <msnyder@vmware.com>

	* gdb.texinfo (Inferiors and Programs): Update commands to show
	that they can accept multiple arguments.

2011-02-25  Michael Snyder  <msnyder@vmware.com>

	* gdb.multi/base.exp: Add test for remove-inferiors.
2011-02-27 20:49:27 +00:00
Michael Snyder c82c0b55e7 2011-02-25 Michael Snyder <msnyder@vmware.com>
* inferior.c (print_inferior): Accept a string instead of an int
	for requested_inferiors, and use get_number_or_range to parse it.
	(info_inferiors_command): Pass args string to print_inferior.
	(initialize_inferiors): Change help string for info inferiors.
	* inferior.h (print_inferior): Export prototype change.

2011-02-25  Michael Snyder  <msnyder@vmware.com>

	* gdb.multi/base.exp: Add tests for info inferiors with args.
2011-02-25 19:19:26 +00:00
Michael Snyder 1777feb0fe 2011-01-08 Michael Snyder <msnyder@vmware.com>
* h8300-tdep.c: Comment cleanup, mostly periods and spaces.
	* hppa-hpux-tdep.c: Ditto.
	* hppa-linux-nat.c: Ditto.
	* hppa-linux-tdep.c: Ditto.
	* hppanbsd-tdep.c: Ditto.
	* hppa-tdep.c: Ditto.
	* hppa-tdep.h: Ditto.
	* hpux-thread.c: Ditto.
	* i386-cygwin-tdep.c: Ditto.
	* i386-darwin-nat.c: Ditto.
	* i386gnu-nat.c: Ditto.
	* i386-linux-nat.c: Ditto.
	* i386-linux-tdep.c: Ditto.
	* i386-nat.c: Ditto.
	* i386-nat.h: Ditto.
	* i386nbsd-tdep.c: Ditto.
	* i386-sol2-nat.c: Ditto.
	* i386-stub.c: Ditto.
	* i386-tdep.c: Ditto.
	* i386-tdep.h: Ditto.
	* i387-tdep.c: Ditto.
	* ia64-linux-nat.c: Ditto.
	* ia64-linux-tdep.c: Ditto.
	* ia64-tdep.c: Ditto.
	* infcall.c: Ditto.
	* infcall.h: Ditto.
	* infcmd.c: Ditto.
	* inferior.c: Ditto.
	* inferior.h: Ditto.
	* infloop.c: Ditto.
	* inflow.c: Ditto.
	* infrun.c: Ditto.
	* interps.c: Ditto.
	* interps.h: Ditto.
	* iq2000-tdep.c: Ditto.
	* irix5-nat.c: Ditto.
	* jit.c: Ditto.
	* jit.h: Ditto.
	* jv-exp.y: Ditto.
	* jv-lang.c: Ditto.
	* jv-lang.h: Ditto.
	* jv-typeprint.c: Ditto.
	* jv-valprint.c: Ditto.
	* language.c: Ditto.
	* language.h: Ditto.
	* linespec.c: Ditto.
	* linux-fork.c: Ditto.
	* linux-nat.c: Ditto.
	* linux-thread-db.c: Ditto.
	* lm32-tdep.c: Ditto.
2011-01-09 03:08:57 +00:00
Joel Brobecker 7b6bb8daac run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
Marc Khouzam 8fa067afb2 * inferior.c (remove_inferior_command): Don't remove an active inferior.
* mi/mi-main.c (mi_cmd_remove_inferior): Ditto.
2010-12-22 18:30:19 +00:00
Jan Kratochvil 16c381f058 gdb/
Rename and move inferior_thread_state and inferior_status.
	* gdbthread.h (struct thread_control_state): New struct, move fields
	step_range_start, step_range_end, step_frame_id, step_stack_frame_id,
	trap_expected, proceed_to_finish, in_infcall, step_over_calls,
	stop_step and stop_bpstat here from struct thread_info.
	(struct thread_suspend_state): New struct, move field stop_signal here
	from struct thread_info.
	(struct thread_info): Move the fields above from this struct.
	* inferior.h: Move the inferior_thread_state and inferior_status
	declarations comment to their definitions at infrun.c.
	(struct inferior_control_state): New struct, move field stop_soon from
	struct inferior here.
	(struct inferior_suspend_state): New empty struct.
	(struct inferior): New fields control and suspend.  Move out field
	stop_soon.
	* infrun.c (struct inferior_thread_state): Rename to ...
	(infcall_suspend_state): ... here.  Replace field stop_signal by
	fields thread_suspend and inferior_suspend.
	(save_inferior_thread_state): Rename to ...
	(save_infcall_suspend_state): ... here.  New variable inf.  Update the
	code for new fields.
	(restore_inferior_thread_state): Rename to ...
	(restore_infcall_suspend_state): ... here.  New variable inf.  Update
	the code for new fields.
	(do_restore_inferior_thread_state_cleanup): Rename to ...
	(do_restore_infcall_suspend_state_cleanup): ... here.
	(make_cleanup_restore_inferior_thread_state): Rename to ...
	(make_cleanup_restore_infcall_suspend_state): ... here.
	(discard_inferior_thread_state): Rename to ...
	(discard_infcall_suspend_state): ... here.
	(get_inferior_thread_state_regcache): Rename to ...
	(get_infcall_suspend_state_regcache): ... here.
	(struct inferior_status): Rename to ...
	(struct infcall_control_state): ... here.  Replace fields
	step_range_start, step_range_end, step_frame_id, step_stack_frame_id,
	trap_expected, proceed_to_finish, in_infcall, step_over_calls,
	stop_step, stop_bpstat and stop_soon by fields thread_control and
	inferior_control.
	(save_inferior_status): Rename to ...
	(save_infcall_control_state): ... here.  Update the code for new
	fields.
	(restore_inferior_status): Rename to ...
	(restore_infcall_control_state): ... here.  Update the code for new
	fields.
	(do_restore_inferior_status_cleanup): Rename to ...
	(do_restore_infcall_control_state_cleanup): ... here.
	(make_cleanup_restore_inferior_status): Rename to ...
	(make_cleanup_restore_infcall_control_state): ... here.
	(discard_inferior_status): Rename to ...
	(discard_infcall_control_state): ... here.
	* alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h,
	exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c,
	inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c,
	mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c,
	solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the
	references to the moved fields and renamed functions.
2010-11-28 04:31:25 +00:00
Jan Kratochvil cd2effb255 gdb/
PR corefiles/12071.
	* inferior.c (have_live_inferiors): New variables old_chain, inf and
	tp.  Iterate INFERIOR_LIST and call target_has_execution.

gdb/testsuite/
	PR corefiles/12071.
	* gdb.base/corefile.exp (quit with a process, no question: load core)
	(quit with a core file): New tests.
2010-09-30 10:24:40 +00:00
Michael Snyder abbb1732a9 2010-05-14 Michael Snyder <msnyder@vmware.com>
* infcall.c: White space.
	* inf-child.c: White space.
	* infcmd.c: White space.
	* inferior.c: White space.
	* inf-loop.c: White space.
	* inflow.c: White space.
	* inline-frame.c: White space.
	* interps.c: White space.
2010-05-14 21:25:51 +00:00
Michael Snyder c6913b7d1e 2010-05-06 Michael Snyder <msnyder@vmware.com>
* xml-support.c (xinclude_start_include): Delete unused variable.
	(xml_process_xincludes): Delete unused variable.
	* xml-syscall.c (syscall_parse_xml): Delete unused variable.
	* target-descriptions.c (tdesc_gdb_type): Delete unused variable.
	(tdesc_find_arch_register): Delete unused variable.
	(tdesc_use_registers): Delete unused variable.
	* xml-tdesc.c (tdesc_start_target): Delete unused variable.
	* inferior.c (print_inferior): Delete unused variable.
	* record.c (record_open_1): Delete unused variable.
	(record_restore): Delete unused variable.
	(cmd_record_save): Delete unused variable.
	* gcore.c (derive_heap_segment): Delete unused variable.
	(objfile_find_memory_regions): Use unused variable.
	* jit.c (jit_inferior_init): Delete unused variable.
	* progspace.c (clone_program_space): Delete unused variable.
	(pspace_empty_p): Delete unused variable.
2010-05-07 02:09:55 +00:00
Vladimir Prus a79b8f6ea8 Multiexec MI
* breakpoint.c (clear_syscall_counts): Take struct inferior*.
	* inferior.c (add_inferior_silent): Notify inferior_added
	observer.
	(delete_inferior_1): Notify inferior_removed observer.
	(exit_inferior_1): Pass inferior, not pid, to observer.
	(inferior_appeared): Likewise.
	(add_inferior_with_spaces): New.
	(add_inferior_command): Use the above.
	* inferior.h (delete_inferior_1, add_inferior_with_spaces):
	Declare.

	* inflow.c (inflow_inferior_exit): Likewise.
	* jit.c (jit_inferior_exit_hook): Likewise.

	* mi/mi-cmds.c (mi_cmds): Register add-inferior and
	remove-inferior.
	* mi/mi-cmds.h (mi_cmd_add_inferior, mi_cmd_remove_inferior): New.
	* mi/mi-interp.c (mi_inferior_added, mi_inferior_removed): New.
	(report_initial_inferior): New.
	(mi_inferior_removed): Register the above. Make sure
	inferior_added observer is called on the first inferior.
	(mi_new_thread, mi_thread_exit): Thread group is now identified by
	inferior number, not pid.
	(mi_solib_loaded, mi_solib_unloaded): Report which inferiors are
	affected.
	* mi/mi-main.c (current_context): New.
	(proceed_thread_callback): Use typed closure.
	Proceed everything if pid is 0. Most implementation split into
	(proceed_thread): ... this.
	(run_one_inferior): New.
	(mi_cmd_exec_continue, mi_cmd_exec_interrupt, mi_cmd_exec_run):
	Adjust for multiexec behaviour.
	(mi_cmd_add_inferior, mi_cmd_remove_inferior): New.
	(mi_cmd_execute): Handle the 'thread-group' option here.
	Do some extra checks.
	* mi-parse.c (mi_parse): Handle the --all and --thread-group
	options.
	* mi-parse.h (struct mi_parse): New fields all and thread_group.
2010-02-24 07:51:46 +00:00
Vladimir Prus 3f81c18a86 Per-inferior args and tty and environment.
* infcmd.c (inferior_args): Rename to ...
	(inferior_args_scratch): ... this.
	(inferior_io_terminal): Rename to ...
	(inferior_io_terminal_scratch): ... this.
	(inferior_argc, inferior_argv): Remove.
	(set_inferior_io_terminal, get_inferior_io_terminal): Store
	inside current_inferior().
	(set_inferior_tty_command, show_inferior_tty_command): New.
	(get_inferior_args, set_inferior_args): Store inside
	current_inferior().
	(notice_args_set): Likewise and rename to...
	(set_args_command): ... this.
	(set_inferior_args_vector): Likewise.
	(notice_args_read): Rename to...
	(show_args_command): ...new.
	(tty_command): Remove.
	(run_command_1): Don't free old args, as they are freed by
	set_inferior_arg now.
	(run_no_args_command): Likewise.
	(inferior_environ): Remove.
	(run_command_1): Use environment of the current inferior.
	(environment_info, set_environment_command)
	(unset_environment_command, path_info, path_command): Likewise.
	(_initialize_infcmd): Adjust for function and variable renames.
	Do not init inferior_environ.
	* inferior.h (set_inferior_arg): Adjust prototype.
	(struct inferior): New fields args, argc, argv, terminal, environment.
	(inferior_environ): Remove declaration.
	* inferior.c (free_inferior): Free new fields.
	(add_inferior_silent): Initialize 'environment' field.
	* main.c (captured_main): Set arguments only after the initial
	inferior has been created.  Set set_inferior_io_terminal,
	not tty_command.
	* mi/mi-main.c (mi_cmd_env_path): Use environment of the current
	inferior.
	(_initialize_mi_cmd_env): Adjust for disappearance of global
	inferior_environ.
	* solib.c (solib_find): Use environment of the current inferior.
2010-01-20 14:23:07 +00:00
Joel Brobecker 4c38e0a4fc Update copyright year in most headers.
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Pedro Alves 6c95b8df7f 2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs	<stan@codesourcery.com>

	Add base multi-executable/process support to GDB.

	gdb/
	* Makefile.in (SFILES): Add progspace.c.
	(COMMON_OBS): Add progspace.o.
	* progspace.h: New.
	* progspace.c: New.

	* breakpoint.h (struct bp_target_info) <placed_address_space>: New
	field.
	(struct bp_location) <pspace>: New field.
	(struct breakpoint) <pspace>: New field.
	(bpstat_stop_status, breakpoint_here_p)
	(moribund_breakpoint_here_p, breakpoint_inserted_here_p)
	(regular_breakpoint_inserted_here_p)
	(software_breakpoint_inserted_here_p, breakpoint_thread_match)
	(set_default_breakpoint): Adjust prototypes.
	(remove_breakpoints_pid, breakpoint_program_space_exit): Declare.
	(insert_single_step_breakpoint, deprecated_insert_raw_breakpoint):
	Adjust prototypes.
	* breakpoint.c (executing_startup): Delete.
	(default_breakpoint_sspace): New.
	(breakpoint_restore_shadows): Skip if the address space doesn't
	match.
	(update_watchpoint): Record the frame's program space in the
	breakpoint location.
	(insert_bp_location): Record the address space in target_info.
	Adjust to pass the symbol space to solib_name_from_address.
	(breakpoint_program_space_exit): New.
	(insert_breakpoint_locations): Switch the symbol space and thread
	when inserting breakpoints.  Don't insert breakpoints in a vfork
	parent waiting for vfork done if we're not attached to the vfork
	child.
	(remove_breakpoints_pid): New.
	(reattach_breakpoints): Switch to a thread of PID.  Ignore
	breakpoints of other symbol spaces.
	(create_internal_breakpoint): Store the symbol space in the sal.
	(create_longjmp_master_breakpoint): Iterate over all symbol
	spaces.
	(update_breakpoints_after_exec): Ignore breakpoints for other
	symbol spaces.
	(remove_breakpoint): Rename to ...
	(remove_breakpoint_1): ... this.  Pass the breakpoints symbol
	space to solib_name_from_address.
	(remove_breakpoint): New.
	(mark_breakpoints_out): Ignore breakpoints from other symbol
	spaces.
	(breakpoint_init_inferior): Ditto.
	(breakpoint_here_p): Add an address space argument and adjust to
	use breakpoint_address_match.
	(moribund_breakpoint_here_p): Ditto.
	(regular_breakpoint_inserted_here_p): Ditto.
	(breakpoint_inserted_here_p): Ditto.
	(software_breakpoint_inserted_here_p): Ditto.
	(breakpoint_thread_match): Ditto.
	(bpstat_check_location): Ditto.
	(bpstat_stop_status): Ditto.
	(print_breakpoint_location): If there's a location to print,
	switch the current symbol space.
	(print_one_breakpoint_location): Add `allflag' argument.
	(print_one_breakpoint): Ditto.	Adjust.
	(do_captured_breakpoint_query): Adjust.
	(breakpoint_1): Adjust.
	(breakpoint_has_pc): Also match the symbol space.
	(describe_other_breakpoints): Add a symbol space argument and
	adjust.
	(set_default_breakpoint): Add a symbol space argument.	Set
	default_breakpoint_sspace.
	(breakpoint_address_match): New.
	(check_duplicates_for): Add an address space argument, and adjust.
	(set_raw_breakpoint): Record the symbol space in the location and
	in the breakpoint.
	(set_longjmp_breakpoint): Skip longjmp master breakpoints from
	other symbol spaces.
	(remove_thread_event_breakpoints, remove_solib_event_breakpoints)
	(disable_breakpoints_in_shlibs): Skip breakpoints from other
	symbol spaces.
	(disable_breakpoints_in_unloaded_shlib): Match symbol spaces.
	(create_catchpoint): Set the symbol space in the sal.
	(disable_breakpoints_before_startup): Skip breakpoints from other
	symbol spaces.	Set executing_startup in the current symbol space.
	(enable_breakpoints_after_startup): Clear executing_startup in the
	current symbol space.  Skip breakpoints from other symbol spaces.
	(clone_momentary_breakpoint): Also copy the symbol space.
	(add_location_to_breakpoint): Set the location's symbol space.
	(bp_loc_is_permanent): Switch thread and symbol space.
	(create_breakpoint): Adjust.
	(expand_line_sal_maybe): Expand comment to mention symbol spaces.
	Switch thread and symbol space when reading memory.
	(parse_breakpoint_sals): Set the symbol space in the sal.
	(break_command_really): Ditto.
	(skip_prologue_sal): Switch and space.
	(resolve_sal_pc): Ditto.
	(watch_command_1): Record the symbol space in the sal.
	(create_ada_exception_breakpoint): Adjust.
	(clear_command): Adjust.  Match symbol spaces.
	(update_global_location_list): Use breakpoint_address_match.
	(breakpoint_re_set_one): Switch thread and space.
	(breakpoint_re_set): Save symbol space.
	(breakpoint_re_set_thread): Also reset the symbol space.
	(deprecated_insert_raw_breakpoint): Add an address space argument.
	Adjust.
	(insert_single_step_breakpoint): Ditto.
	(single_step_breakpoint_inserted_here_p): Ditto.
	(clear_syscall_counts): New.
	(_initialize_breakpoint): Install it as inferior_exit observer.

	* exec.h: Include "progspace.h".
	(exec_bfd, exec_bfd_mtime): New defines.
	(exec_close): Declare.
	* exec.c: Include "gdbthread.h" and "progspace.h".
	(exec_bfd, exec_bfd_mtime, current_target_sections_1): Delete.
	(using_exec_ops): New.
	(exec_close_1): Rename to exec_close, and make public.
	(exec_close): Rename to exec_close_1, and adjust all callers.  Add
	description.  Remove target sections and close executables from
	all program spaces.
	(exec_file_attach): Add comment.
	(add_target_sections): Check on `using_exec_ops' to check if the
	target should be pushed.
	(remove_target_sections): Only unpush the target if there are no
	more target sections in any symbol space.
	* gdbcore.h: Include "exec.h".
	(exec_bfd, exec_bfd_mtime): Remove declarations.

	* frame.h (get_frame_program_space, get_frame_address_space)
	(frame_unwind_program_space): Declare.
	* frame.c (struct frame_info) <pspace, aspace>: New fields.
	(create_sentinel_frame): Add program space argument.  Set the
	pspace and aspace fields of the frame object.
	(get_current_frame, create_new_frame): Adjust.
	(get_frame_program_space): New.
	(frame_unwind_program_space): New.
	(get_frame_address_space): New.
	* stack.c (print_frame_info): Adjust.
	(print_frame): Use the frame's program space.

	* gdbthread.h (any_live_thread_of_process): Declare.
	* thread.c (any_live_thread_of_process): New.
	(switch_to_thread): Switch the program space as well.
	(restore_selected_frame): Don't warn if trying to restore frame
	level 0.

	* inferior.h: Include "progspace.h".
	(detach_fork): Declare.
	(struct inferior) <removable, aspace, pspace>
	<vfork_parent, vfork_child, pending_detach>
	<waiting_for_vfork_done>: New fields.
	<terminal_info>: Remove field.
	<data, num_data>: New fields.
	(register_inferior_data, register_inferior_data_with_cleanup)
	(clear_inferior_data, set_inferior_data, inferior_data): Declare.
	(exit_inferior, exit_inferior_silent, exit_inferior_num_silent)
	(inferior_appeared): Declare.
	(find_inferior_pid): Typo.
	(find_inferior_id, find_inferior_for_program_space): Declare.
	(set_current_inferior, save_current_inferior, prune_inferiors)
	(number_of_inferiors): Declare.
	(inferior_list): Declare.
	* inferior.c: Include "gdbcore.h" and "symfile.h".
	(inferior_list): Make public.
	(delete_inferior_1): Always delete thread silently.
	(find_inferior_id): Make public.
	(current_inferior_): New.
	(current_inferior): Use it.
	(set_current_inferior): New.
	(restore_inferior): New.
	(save_current_inferior): New.
	(free_inferior): Free the per-inferior data.
	(add_inferior_silent): Allocate per-inferior data.
	Call inferior_appeared.
	(delete_threads_of_inferior): New.
	(delete_inferior_1): Adjust interface to take an inferior pointer.
	(delete_inferior): Adjust.
	(delete_inferior_silent): Adjust.
	(exit_inferior_1): New.
	(exit_inferior): New.
	(exit_inferior_silent): New.
	(exit_inferior_num_silent): New.
	(detach_inferior): Adjust.
	(inferior_appeared): New.
	(discard_all_inferiors): Adjust.
	(find_inferior_id): Make public.  Assert pid is not zero.
	(find_inferior_for_program_space): New.
	(have_inferiors): Check if we have any inferior with pid not zero.
	(have_live_inferiors): Go over all pushed targets looking for
	process_stratum.
	(prune_inferiors): New.
	(number_of_inferiors): New.
	(print_inferior): Add executable column.  Print vfork parent/child
	relationships.
	(inferior_command): Adjust to cope with not running inferiors.
	(remove_inferior_command): New.
	(add_inferior_command): New.
	(clone_inferior_command): New.
	(struct inferior_data): New.
	(struct inferior_data_registration): New.
	(struct inferior_data_registry): New.
	(inferior_data_registry): New.
	(register_inferior_data_with_cleanup): New.
	(register_inferior_data): New.
	(inferior_alloc_data): New.
	(inferior_free_data): New.
	(clear_inferior_data): New.
	(set_inferior_data): New.
	(inferior_data): New.
	(initialize_inferiors): New.
	(_initialize_inferiors): Register "add-inferior",
	"remove-inferior" and "clone-inferior" commands.

	* objfiles.h: Include "progspace.h".
	(struct objfile) <pspace>: New field.
	(symfile_objfile, object_files): Don't declare.
	(ALL_PSPACE_OBJFILES): New.
	(ALL_PSPACE_OBJFILES_SAFE): New.
	(ALL_OBJFILES, ALL_OBJFILES_SAFE): Adjust.
	(ALL_PSPACE_SYMTABS): New.
	(ALL_PRIMARY_SYMTABS): Adjust.
	(ALL_PSPACE_PRIMARY_SYMTABS): New.
	(ALL_PSYMTABS): Adjust.
	(ALL_PSPACE_PSYMTABS): New.
	* objfiles.c (object_files, symfile_objfile): Delete.
	(struct objfile_sspace_info): New.
	(objfiles_pspace_data): New.
	(objfiles_pspace_data_cleanup): New.
	(get_objfile_pspace_data): New.
	(objfiles_changed_p): Delete.
	(allocate_objfile): Set the objfile's program space.  Adjust to
	reference objfiles_changed_p in pspace data.
	(free_objfile): Adjust to reference objfiles_changed_p in pspace
	data.
	(objfile_relocate): Ditto.
	(update_section_map): Add pspace argument.  Adjust to iterate over
	objfiles in the passed in pspace.
	(find_pc_section): Delete sections and num_sections statics.
	Adjust to refer to program space's objfiles_changed_p.	Adjust to
	refer to sections and num_sections store in the objfile's pspace
	data.
	(objfiles_changed): Adjust to reference objfiles_changed_p in
	pspace data.
	(_initialize_objfiles): New.
	* linespec.c (decode_all_digits, decode_dollar): Set the sal's
	program space.
	* source.c (current_source_pspace): New.
	(get_current_source_symtab_and_line): Set the sal's program space.
	(set_current_source_symtab_and_line): Set current_source_pspace.
	(select_source_symtab): Ditto.	Use ALL_OBJFILES.
	(forget_cached_source_info): Iterate over all program spaces.
	* symfile.c (clear_symtab_users): Adjust.
	* symmisc.c (print_symbol_bcache_statistics): Iterate over all
	program spaces.
	(print_objfile_statistics): Ditto.
	(maintenance_print_msymbols): Ditto.
	(maintenance_print_objfiles): Ditto.
	(maintenance_info_symtabs): Ditto.
	(maintenance_info_psymtabs): Ditto.
	* symtab.h (SYMTAB_PSPACE): New.
	(struct symtab_and_line) <pspace>: New field.
	* symtab.c (init_sal): Clear the sal's program space.
	(find_pc_sect_symtab): Set the sal's program space.  Switch thread
	and space.
	(append_expanded_sal): Add program space argument.  Iterate over
	all program spaces.
	(expand_line_sal): Iterate over all program spaces.  Switch
	program space.

	* target.h (enum target_waitkind) <TARGET_WAITKIND_VFORK_DONE>: New.
	(struct target_ops) <to_thread_address_space>: New field.
	(target_thread_address_space): Define.
	* target.c (target_detach): Only remove breakpoints from the
	inferior we're detaching.
	(target_thread_address_space): New.

	* defs.h (initialize_progspace): Declare.
	* top.c (gdb_init): Call it.

	* solist.h (struct so_list) <sspace>: New field.
	* solib.h (struct program_space): Forward declare.
	(solib_name_from_address): Adjust prototype.
	* solib.c (so_list_head): Replace with a macro referencing the
	program space.
	(update_solib_list): Set the so's program space.
	(solib_name_from_address): Add a program space argument and adjust.

	* solib-svr4.c (struct svr4_info) <pid>: Delete field.
	<interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low>
	<interp_plt_sect_high>: New fields.
	(svr4_info_p, svr4_info): Delete.
	(solib_svr4_sspace_data): New.
	(get_svr4_info): Rewrite.
	(svr4_sspace_data_cleanup): New.
	(open_symbol_file_object): Adjust.
	(svr4_default_sos): Adjust.
	(svr4_fetch_objfile_link_map): Adjust.
	(interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low)
	(interp_plt_sect_high): Delete.
	(svr4_in_dynsym_resolve_code): Adjust.
	(enable_break): Adjust.
	(svr4_clear_solib): Revert bit that removed the svr4_info here,
	and reinstate clearing debug_base, debug_loader_offset_p,
	debug_loader_offset and debug_loader_name.
	(_initialize_svr4_solib): Register solib_svr4_pspace_data.  Don't
	install an inferior_exit observer anymore.

	* printcmd.c (struct display) <pspace>: New field.
	(display_command): Set the display's sspace.
	(do_one_display): Match the display's sspace.
	(display_uses_solib_p): Ditto.

	* linux-fork.c (detach_fork): Moved to infrun.c.
	(_initialize_linux_fork): Moved "detach-on-fork" command to
	infrun.c.
	* infrun.c (detach_fork): Moved from linux-fork.c.
	(proceed_after_vfork_done): New.
	(handle_vfork_child_exec_or_exit): New.
	(follow_exec_mode_replace, follow_exec_mode_keep)
	(follow_exec_mode_names, follow_exec_mode_string)
	(show_follow_exec_mode_string): New.
	(follow_exec): New.  Reinstate the mark_breakpoints_out call.
	Remove shared libraries before attaching new executable.  If user
	wants to keep the inferior, keep it.
	(displaced_step_fixup): Adjust to pass an address space to the
	breakpoints module.
	(resume): Ditto.
	(clear_proceed_status): In all-stop mode, always clear the proceed
	status of all threads.
	(prepare_to_proceed): Adjust to pass an address space to the
	breakpoints module.
	(proceed): Ditto.
	(adjust_pc_after_break): Ditto.
	(handle_inferior_event): When handling a process exit, switch the
	program space to the inferior's that had exited.  Call
	handle_vfork_child_exec_or_exit.  Adjust to pass an address space
	to the breakpoints module.  In non-stop mode, when following a
	fork and detach-fork is off, also resume the other branch.  Handle
	TARGET_WAITKIND_VFORK_DONE.  Set the program space in sals.
	(normal_stop): Prune inferiors.
	(_initialize_infrun): Install the new "follow-exec-mode" command.
	"detach-on-fork" moved here.

	* regcache.h (get_regcache_aspace): Declare.
	* regcache.c (struct regcache) <aspace>: New field.
	(regcache_xmalloc): Clear the aspace.
	(get_regcache_aspace): New.
	(regcache_cpy): Copy the aspace field.
	(regcache_cpy_no_passthrough): Ditto.
	(get_thread_regcache): Fetch the thread's address space from the
	target, and store it in the regcache.

	* infcall.c (call_function_by_hand): Set the sal's pspace.

	* arch-utils.c (default_has_shared_address_space): New.
	* arch-utils.h (default_has_shared_address_space): Declare.

	* gdbarch.sh (has_shared_address_space): New.
	* gdbarch.h, gdbarch.c: Regenerate.

	* linux-tdep.c: Include auxv.h, target.h, elf/common.h.
	(linux_has_shared_address_space): New.
	(_initialize_linux_tdep): Declare.

	* arm-tdep.c (arm_software_single_step): Pass the frame's address
	space to insert_single_step_breakpoint.
	* arm-linux-tdep.c (arm_linux_software_single_step): Pass the
	frame's pspace to breakpoint functions.
	* cris-tdep.c (crisv32_single_step_through_delay): Ditto.
	(cris_software_single_step): Ditto.
	* mips-tdep.c (deal_with_atomic_sequence): Add frame argument.
	Pass the frame's pspace to breakpoint functions.
	(mips_software_single_step): Adjust.
	(mips_single_step_through_delay): Adjust.
	* rs6000-aix-tdep.c (rs6000_software_single_step): Adjust.
	* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust.
	* solib-irix.c (enable_break): Adjust to pass the current frame's
	address space to breakpoint functions.
	* sparc-tdep.c (sparc_software_single_step): Ditto.
	* spu-tdep.c (spu_software_single_step): Ditto.
	* alpha-tdep.c (alpha_software_single_step): Ditto.
	* record.c (record_wait): Adjust to pass an address space to the
	breakpoints module.

	* fork-child.c (fork_inferior): Set the new inferior's program and
	address spaces.
	* inf-ptrace.c (inf_ptrace_follow_fork): Copy the parent's program
	and address spaces.
	(inf_ptrace_attach): Set the inferior's program and address spaces.
	* linux-nat.c: Include "solib.h".
	(linux_child_follow_fork): Manage parent and child's program and
	address spaces.	 Clone the parent's program space if necessary.
	Don't wait for the vfork to be done here.  Refuse to resume if
	following the vfork parent while leaving the child stopped.
	(resume_callback): Don't resume a vfork parent.
	(linux_nat_resume): Also check for pending events in the
	lp->waitstatus field.
	(linux_handle_extended_wait): Report TARGET_WAITKIND_VFORK_DONE
	events to the core.
	(stop_wait_callback): Don't wait for SIGSTOP on vfork parents.
	(cancel_breakpoint): Adjust.
	* linux-thread-db.c (thread_db_wait): Don't remove thread event
	breakpoints here.
	(thread_db_mourn_inferior): Don't mark breakpoints out here.
	Remove thread event breakpoints after mourning.
	* corelow.c: Include progspace.h.
	(core_open): Set the inferior's program and address spaces.
	* remote.c (remote_add_inferior): Set the new inferior's program
	and address spaces.
	(remote_start_remote): Update address spaces.
	(extended_remote_create_inferior_1): Don't init the thread list if
	we already debugging other inferiors.
	* darwin-nat.c (darwin_attach): Set the new inferior's program and
	address spaces.
	* gnu-nat.c (gnu_attach): Ditto.
	* go32-nat.c (go32_create_inferior): Ditto.
	* inf-ttrace.c (inf_ttrace_follow_fork, inf_ttrace_attach): Ditto.
	* monitor.c (monitor_open): Ditto.
	* nto-procfs.c (procfs_attach, procfs_create_inferior): Ditto.
	* procfs.c (do_attach): Ditto.
	* windows-nat.c (do_initial_windows_stuff): Ditto.

	* inflow.c (inferior_process_group)
	(terminal_init_inferior_with_pgrp, terminal_inferior,
	(terminal_ours_1, inflow_inferior_exit, copy_terminal_info)
	(child_terminal_info, new_tty_postfork, set_sigint_trap): Adjust
	to use per-inferior data instead of inferior->terminal_info.
	(inflow_inferior_data): New.
	(inflow_new_inferior): Delete.
	(inflow_inferior_data_cleanup): New.
	(get_inflow_inferior_data): New.

	* mi/mi-interp.c (mi_new_inferior): Rename to...
	(mi_inferior_appeared): ... this.
	(mi_interpreter_init): Adjust.

	* tui/tui-disasm.c: Include "progspace.h".
	(tui_set_disassem_content): Pass an address space to
	breakpoint_here_p.

	* NEWS: Mention multi-program debugging support.  Mention new
	commands "add-inferior", "clone-inferior", "remove-inferior",
	"maint info program-spaces", and new option "set
	follow-exec-mode".

2009-10-19  Pedro Alves	 <pedro@codesourcery.com>
	    Stan Shebs	<stan@codesourcery.com>

	gdb/doc/
	* observer.texi (new_inferior): Rename to...
	(inferior_appeared): ... this.

2009-10-19  Pedro Alves	 <pedro@codesourcery.com>
	    Stan Shebs	<stan@codesourcery.com>

	gdb/testsuite/
	* gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork".
	* gdb.base/foll-exec.exp: Adjust to expect a process id before
	"Executing new program".
	* gdb.base/foll-fork.exp: Adjust to spell out "follow-fork".
	* gdb.base/multi-forks.exp: Ditto.  Adjust to the inferior being
	left listed after having been killed.
	* gdb.base/attach.exp: Adjust to spell out "symbol-file".
	* gdb.base/maint.exp: Adjust test.

	* Makefile.in (ALL_SUBDIRS): Add gdb.multi.
	* gdb.multi/Makefile.in: New.
	* gdb.multi/base.exp: New.
	* gdb.multi/goodbye.c: New.
	* gdb.multi/hangout.c: New.
	* gdb.multi/hello.c: New.
	* gdb.multi/bkpt-multi-exec.c: New.
	* gdb.multi/bkpt-multi-exec.exp: New.
	* gdb.multi/crashme.c: New.

2009-10-19  Pedro Alves	 <pedro@codesourcery.com>
	    Stan Shebs	<stan@codesourcery.com>

	gdb/doc/
	* gdb.texinfo (Inferiors): Rename node to ...
	(Inferiors and Programs): ... this.  Mention running multiple
	programs in the same debug session.
	<info inferiors>: Mention the new 'Executable' column if "info
	inferiors".  Update examples.  Document the "add-inferior",
	"clone-inferior", "remove-inferior" and "maint info
	program-spaces" commands.
	(Process): Rename node to...
	(Forks): ... this.  Document "set|show follow-exec-mode".
2009-10-19 09:51:43 +00:00
Pedro Alves 3a1ff0b639 gdb/
* inferior.c (print_inferior): Align columns left.  Remove header
	for the the "current" column.  Rename column "Id" to "Num".
	Rename column "PID" to "Description".  Print if there's no selected
	inferior.

	gdb/doc/
	* gdb.texinfo (Debugging Multiple Inferiors): Add "info inferiors"
	small example, and describe its columns.  Replace "inferior-id" by
	"infno" throughout.
2009-08-25 15:24:12 +00:00
Pedro Alves 2277426b30 gdb/
2009-07-02  Pedro Alves  <pedro@codesourcery.com>

	* linux-nat.c (linux_child_follow_fork): If we're staying attached
	to the child process, enable event reporting on it.  Don't handle
	checkpoints here.  Instead, add the child fork to the lwp thread
	and inferior lists without clobbering the previous inferior.  Let
	the thread_db layer learn about a new child process, even if
	following the parent.
	(linux_nat_switch_fork): Delete lwps of the current inferior only,
	instead of clearing the whole list.  Use thread_change_ptid to
	give the core the illusion the new checkpoint is still the same
	inferior.  Clear the register cache.
	(linux_handle_extended_wait): Handle checkpoints here.
	(linux_multi_process): Turn on.
	* linux-fork.c (struct fork_info) <pc>: Remove field.
	(init_fork_list): Do not delete the checkpoint from the inferior
	list (it is not there).
	(fork_load_infrun_state): Don't switch inferior_ptid here.  Pass
	the new checkpoint's ptid to linux_nat_switch_fork.
	(fork_save_infrun_state): Make static.  Don't stop the pc field of
	fork_info, it's gone.
	(linux_fork_mourn_inferior): Don't delete the checkpoint from the
	inferior list, it's not there.
	(linux_fork_detach): Ditto.
	(delete_fork_command): Replace mention of fork/checkpoint by
	checkpoint only.
	(detach_fork_command): Likewise.  Don't delete the checkpoint from
	the inferior list.
	(info_forks_command): Adjust.
	(restore_detach_fork): Delete.
	(checkpointing_pid): New.
	(linux_fork_checkpointing_p): New.
	(save_detach_fork): Delete.
	(checkpoint_command): Delete temp_detach_fork.  Don't remove
	breakpoints, that's a nop.  Store the pid of the process we're
	checkpointing, and use make_cleanup_restore_integer to restore it.
	Don't reinsert breakpoints here.
	(process_command, fork_command): Delete.
	(restart_command): Update comments to only mention checkpoints,
	not forks.
	(_initialize_linux_fork): Delete "fork", "process", "info forks"
	commands.
	* linux-fork.h (fork_save_infrun_state, fork_list): Delete
	declarations.
	(linux_fork_checkpointing_p): Declare.
	* cli/cli-cmds.c (killlist): New.
	* cli/cli-cmds.h (killlist): Declare.
	* gdbcmd.h (killlist): Declare.
	* inferior.c: Include "gdbthread.h".
	(detach_inferior_command, kill_inferior_command)
	(inferior_command): New.
	(info_inferiors_command): Allow specifying a specific inferior id.
	(_initialize_inferiors): Register "inferior", "kill inferior" and
	"detach inferior" commands.
	* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
	* gdbthread.h (any_thread_of_process): Declare.
	* thread.c (any_thread_of_process): New.

	* NEWS: Mention multi-inferior debugging.  Mention 'info
	inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
	new commands.
	(Removed commands): New section, mentioning that 'info forks',
	'fork', 'process', 'delete fork' and 'detach fork' are now gone.

gdb/testsuite/
2009-07-02  Pedro Alves  <pedro@codesourcery.com>

	* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
	linux.  Adjust to use "inferior", "info inferiors", "detach
	inferior" and "kill inferior" instead of "restart", "info fork",
	"detach fork" and "delete fork".
	* gdb.base/ending-run.exp: Spell out "info".
	* gdb.base/help.exp: Adjust to use test_prefix_command_help for
	the "kill" command.

gdb/doc/
2009-07-02  Pedro Alves  <pedro@codesourcery.com>

	* gdb.texinfo (Debugging multiple inferiors): Document the
	"inferior", "detach inferior" and "kill inferior" commands.
	(Debugging Programs with Multiple Processes): Adjust to mention
	generic "inferior" commands.  Delete mention of "detach fork" and
	"delete fork".  Cross reference to "Debugging multiple inferiors"
	section.
2009-07-02 21:57:28 +00:00
Tom Tromey 8bb318c686 * inferior.c (print_inferior): Make a table, not a list. Emit
table headers.
2009-06-10 22:08:19 +00:00
Pedro Alves c35b149212 * target.h (struct target_ops): Make to_has_all_memory,
to_has_memory, to_has_stack, to_has_registers and to_has_execution
	methods instead of variables.
	(target_has_all_memory_1, target_has_memory_1, target_has_stack_1)
	(target_has_registers_1, target_has_execution_1): Declare
	functions.
	(target_has_all_memory): Rewrite to call target_has_all_memory_1.
	(target_has_memory): Rewrite to call target_has_memory_1.
	(target_has_stack): Rewrite to call target_has_all_stack_1.
	(target_has_registers): Rewrite to call target_has_registers_1.
	(target_has_execution): Rewrite to call target_has_execution_1.
	(default_child_has_all_memory, default_child_has_memory)
	(default_child_has_stack, default_child_has_registers)
	(default_child_has_execution): Declare.
	(target_mark_running, target_mark_exited): Delete declarations.
	* target.c (default_child_has_all_memory,
	default_child_has_memory, default_child_has_stack,
	default_child_has_registers, default_child_has_execution): New.
	(target_has_all_memory_1, target_has_memory_1, target_has_stack_1,
	target_has_registers_1, target_has_execution_1): New.
	(add_target): Default the to_has_all_memory, to_has_all_memory,
	to_has_memory, to_has_stack, to_has_registers and to_has_execution
	callbacks to return 0.
	(update_current_target): Do not inherit to_has_all_memory,
	to_has_memory, to_has_stack, to_has_registers or to_has_execution.
	(target_mark_running, target_mark_exited): Delete.
	(memory_xfer_partial): Adjust.
	(target_read_memory, target_write_memory, target_search_memory):
	Dispatch to the the top-most target, not the flattened
	current_target.
	(target_info): Adjust.
	(init_dummy_target): Install return_zero as callback for
	to_has_all_memory, to_has_memory, to_has_stack, to_has_registers,
	to_has_execution.
	(set_maintenance_target_async_permitted): Use have_live_inferiors
	instead of target_has_execution.
	* target-memory.c (target_write_memory_blocks): Dispatch memory
	writes to the the top-most target, not the flattened
	current_target.

	* breakpoint.c (insert_breakpoints): Don't check for
	target_has_execution here.
	(update_global_location_list): Check if there are live inferiors
	to debug instead of target_has_execution.
	* infcmd.c (kill_command, detach_command): Check if there are
	inferiors instead of target_has_execution.
	* inferior.h (have_live_inferiors): Declare.
	* inferior.c (have_live_inferiors): New.
	* infrun.c (normal_stop): Don't check for target_has_execution to
	finish the thread states.
	* thread.c (is_thread_state, is_stopped, is_exited, is_running)
	(any_running, is_executing): Remove checks for
	target_has_execution.
	* top.c (kill_or_detach): Don't try to kill core inferiors.
	(quit_target): Don't check for target_has_execution.

	* corelow.c (core_has_memory, core_has_stack, core_has_registers):
	New.
	(init_core_ops): Install core_has_memory, core_has_stack and
	core_has_registers.
	* exec.c (exec_has_memory): New.
	(init_exec_ops): Install exec_has_memory.
	* remote.c (remote_add_inferior): Don't call target_mark_running.
	(remote_start_remote): Don't call target_mark_exited or call
	target_mark_running.
	(remote_open_1): Use have_inferiors instead of
	target_has_execution.  Don't use target_mark_exited.
	(init_remote_ops): Install deafult_child_has_all_memory,
	default_child_has_memory, default_child_has_stack,
	default_child_has_registers, default_child_has_execution.
	* bsd-kvm.c (bsd_kvm_return_one): New.
	(bsd_kvm_add_target): Register bsd_kvm_return_one as
	to_has_memory, to_has_stack and to_has_registers callbacks.
	* remote-m32r-sdi.c (m32r_return_one): New.
	(init_m32r_ops): Register it.
	* inf-child.c (inf_child_target): Adjust to register
	default_child_has_all_memory, default_child_has_memory,
	default_child_has_stack, default_child_has_registers,
	default_child_has_execution callbacks.
	* gnu-nat.c (init_gnu_ops): Likewise.
	* go32-nat.c (init_go32_ops): Likewise.
	* hpux-thread.c (init_hpux_thread_ops): Likewise.
	* monitor.c (init_base_monitor_ops): Likewise.
	* nto-procfs.c (init_procfs_ops): Likewise.
	* remote-mips.c (_initialize_remote_mips): Likewise.
	* windows-nat.c (init_windows_ops): Likewise.
	* remote-sim.c (gdbsim_create_inferior): Don't use
	target_mark_running or target_mark_exited.
	(gdbsim_mourn_inferior): Don't call target_mark_exited.
	(init_gdbsim_ops): Adjust to register
	default_child_has_all_memory, default_child_has_memory,
	default_child_has_stack, default_child_has_registers,
	default_child_has_execution callbacks.

	* linux-nat.c (linux_nat_xfer_partial): If reading memory, and
	there's no inferior selected, defer to a lower stratum.
2009-06-07 16:46:48 +00:00
Pedro Alves 7e1789f556 * inflow.h (our_process_group): Remove declaration.
(inferior_process_group): Delete global variable declaration.
	(inferior_process_group): New function declaration.
	* inflow.c: Include observer.h.
	(inferior_ttystate, our_ttystate, tflags_inferior, tflags_ours):
	Delete.
	(struct terminal_info): New struct.
	(our_terminal_info): New global.
	(inferior_process_group): New function.
	(inferior_thisrun_terminal): Extend description comment.
	(gdb_has_a_terminal): Adjust to write to our_terminal_info fields
	instead of globals.
	(terminal_init_inferior_with_pgrp): Adjust to per-inferior
	terminal settings.
	(terminal_inferior): Ditto.
	(terminal_ours_1): Ditto.
	(inflow_new_inferior, inflow_inferior_exit): New functions.
	(child_terminal_info): Adjust to per-inferior terminal settings.
	(osig_set): New global.
	(set_sigint_trap): Adjust to per-inferior terminal settings.  Set
	or clear `osig_set' accordingly.
	(clear_sigint_trap): Check `osig_set' to decide wheater to restore
	SIGINT handler, instead of checking the current inferior (which
	may be none).
	(_initialize_inflow): Attach inflow_new_inferior and
	inflow_inferior_exit to the "new_inferior" and "inferior_exit"
	notifications, respectively.
	* inferior.h (struct terminal_info): Forward declare.
	(struct inferior): Add `terminal_info' field.
	* inferior.c (delete_inferior_1): Notify the inferior_exit
	observers before removing the inferior from the lists and deleting
	it.
	* inf-ptrace.c (inf_ptrace_stop): `inferior_process_group' is now
	a function instead of a variable.  Adjust.
	* procfs.c (procfs_stop): Ditto.
2009-05-18 00:58:38 +00:00
Pedro Alves a562dc8f5a * inferior.c (add_inferior): Move observer_notify_new_inferior
call to ...
	(add_inferior_silent): ... here.
2009-05-06 17:25:18 +00:00
Joel Brobecker 0fb0cc7590 Updated copyright notices for most files. 2009-01-03 05:58:08 +00:00
Vladimir Prus 4a92f99bc7 Notification for attach/detach.
* inferior.c: Call the process observers.
        * mi/mi-interp.c (mi_new_inferior, mi_inferior_exit): New.
        (mi_interpreter_init): Register the above.
2008-11-17 12:28:05 +00:00
Pedro Alves e0ba674611 * defs.h (add_inferior_continuation)
(do_all_inferior_continuations)
	(discard_all_inferior_continuations): Declare.
	* utils.c (add_inferior_continuation)
	(do_all_inferior_continuations)
	(discard_all_inferior_continuations): New.
	* inferior.h (struct inferior) <continuations>: New field.
	* inferior.c (free_inferior): Discard all the inferior
	continuations.
	* inf-loop.c (inferior_event_handler): Do all current inferior
	continuations.
	* infcmd.c (attach_command): Register an inferior continuation
	instead of a thread continuation.
	* infrun.c (handle_inferior_event): If stop_soon is
	STOP_QUIETLY_NO_SIGSTOP, also expect a TARGET_SIGNAL_0.
2008-11-05 20:23:07 +00:00
Pedro Alves d6b48e9c8b Make the stop_soon global be per-inferior instead.
* infcmd.c (attach_command_post_wait): Adjust.
	(attach_command): Likewise.

	* inferior.h (stop_soon): Delete.
	(struct inferior): Add stop_soon member.

	* infrun.c (stop_soon): Delete.
	(clear_proceed_status, start_remote)
	(fetch_inferior_event, handle_inferior_event): Adjust.
	(signal_stop_state): Don't check stop_soon here.  Check in callers
	instead.
	(save_inferior_status, restore_inferior_status): Adjust.

	* linux-nat.c (linux_nat_resume, linux_nat_wait): Always pass
	signals to common code if starting up the inferior.

	* inferior.h (struct inferior_info): Added stop_soon member.
	* inferior.c (add_inferior) Clear stop_soon.

	* mips-tdep.c (heuristic_proc_start): Adjust.
	* nto-procfs.c (procfs_create_inferior): Adjust.
	* solib-irix.c (irix_solib_create_inferior_hook): Adjust.
	* solib-osf.c (osf_solib_create_inferior_hook): Adjust.
	* solib-sunos.c (sunos_solib_create_inferior_hook): Adjust.
	* solib-svr4.c (svr4_solib_create_inferior_hook): Adjust.

	* win32-nat.c (do_initial_win32_stuff): Adjust.

	* alpha-tdep.c (alpha_heuristic_proc_start): Adjust.
2008-09-22 15:20:08 +00:00
Pedro Alves 82f7388440 Implement remote multi-process extensions.
* remote.c (struct remote_state): Add extended and
	multi_process_aware fields.
	(remote_multi_process_p): New.
	(PACKET_vKill): New.
	(record_currthread): Use thread_change_ptid.  Notice new
	inferiors.
	(set_thread, remote_thread_alive): Use write_ptid.
	(write_ptid, read_ptid): New.
	(remote_current_thread, remote_threads_extra_info): Use them.
	(remote_threads_info): Likewise.  Detect new inferiors.
	(remote_start_remote): Add inferior to inferior list.
	(remote_multi_process_feature): New.
	(remote_protocol_features): Add "multiprocess" feature.
	(remote_query_supported): Pass "multiprocess+" as supported
	features.
	(remote_open_1): Clear multi_process_aware.  Set extended
	accordingly.
	(remote_detach_1): Detach current process.  Use extended packet
	format for extended-remote multi-process.  Detach process from the
	inferior list.  Only mourn after printing output.
	(extended_remote_attach_1): Add process to the inferior list.
	(remote_vcont_resume): Use write_ptid to pass the thread ids.
	(remote_wait): Use read_ptid.  Implement the extended
	multi-process extension format of the 'W' and 'X' reply packets.
	Remove exited inferiors from inferior list.
	(remote_xfer_memory): Set general thread.
	(remote_vkill): New.
	(extended_remote_kill): New.
	(remote_mourn_1): Discard all inferiors.
	(select_new_thread_callback): New.
	(extended_remote_mourn_1): If there are more processes to debug,
	switch to a thread in another process, and don't pop the target.
	(extended_remote_create_inferior_1): Add the new process to the
	inferior list.
	(remote_stopped_by_watchpoint): Indenting.
	(remote_xfer_partial): Set the general thread.
	(remote_pid_to_str): If the remote is multi-process aware, print
	the process id as well as the thread id.
	(remote_get_thread_local_address): Use write_ptid.
	(init_extended_remote_ops): Register extended_remote_kill.
	(_initialize_remote): Register new packets.  Change
	magic_null_ptid's, not_sent_ptid's and any_thread_ptid's pid
	member to 42000.

	* thread.c (thread_change_ptid): Also account for the inferior pid
	changing.

	* inferior.h (discard_all_inferiors): Declare.
	* inferior.c (discard_all_inferiors): New.
2008-09-22 15:18:30 +00:00
Pedro Alves b77209e000 gdb/
* inferior.h: Forward declare struct ui_out.
	Forward declare struct private_inferior.
	(struct inferior): New.
	(init_inferior_list, add_inferior, add_inferior_silent)
	(delete_inferior, delete_inferior_silent, detach_inferior)
	(gdb_inferior_id_to_pid, pid_to_gdb_inferior_id, in_inferior_list)
	(valid_inferior_id, find_inferior_pid): New functions.
	(inferior_callback_func): New typedef.
	(iterate_over_inferiors, print_inferior, have_inferiors)
	(current_inferior): New functions.
	* inferior.c: New file.

	* Makefile.in (SFILES): Add inferior.c.
	(COMMON_OBS): Add inferior.o.

gdb/doc/
	* gdb.texinfo (Inferiors): New section.
2008-09-22 15:12:19 +00:00