Commit Graph

588 Commits

Author SHA1 Message Date
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
Simon Marchi 17e5269b99 Fix typo in comment
gdb/ChangeLog:

	* infcmd.c (interrupt_command): Fix typo in comment.
2016-11-25 09:07:35 -05:00
Yao Qi e8b24d9ff5 Remove parameter valaddr from la_val_print
Nowadays, we pass both val and return value of
value_contents_for_printing (val) to la_val_print.  The latter is
unnecessary.  This patch removes the second parameter of la_val_print,
and get valaddr in each language's implementation by calling
value_contents_for_printing.  Since value_contents_for_printing calls
value_fetch_lazy, I also make VAL non-const.

Note that
 - I don't clean up the valaddr usages in each language's routines,
 - I don't remove valaddr from apply_ext_lang_val_pretty_printer, and
   extension language ops apply_val_pretty_printer.

They can be done in followup patches.

gdb:

2016-11-08  Yao Qi  <yao.qi@linaro.org>

	* ada-lang.h (ada_val_print): Remove second parameter.  Remove
	const from "struct value *".
	* ada-valprint.c (print_field_values): Remove const from
	"struct value *".
	(val_print_packed_array_elements): Likewise.
	(print_variant_part): Likewise.
	(ada_val_print_string): Likewise.
	(ada_val_print_gnat_array): Likewise.
	(ada_val_print_ptr): Likewise.
	(ada_val_print_num): Likewise.
	(ada_val_print_enum): Likewise.
	(ada_val_print_flt): Likewise.
	(ada_val_print_union): Likewise.
	(ada_val_print_struct_union): Likewise.
	(ada_val_print_ref): Likewise.
	(ada_val_print_1): Remove second parameter.  Remove const from
	"struct value *".
	(ada_val_print): Likewise.
	* c-lang.h (c_val_print): Likewise.
	* c-valprint.c (c_val_print_array): Remove const from
	"struct value *".
	(c_val_print_ptr): Likewise.
	(c_val_print_struct): Likewise.
	(c_val_print_union): Likewise.
	(c_val_print_int): Likewise.
	(c_val_print_memberptr): Likewise.
	(c_val_print): Remove second parameter.  Remove const from
	"struct value *".  All callers updated.
	* cp-valprint.c (cp_print_value): Remove const from
	"struct value *".
	(cp_print_value_fields): Likewise.
	(c_val_print_value): Likewise.
	* d-lang.h (d_val_print): Remove second parameter.  Remove const
	from "struct value *".
	* d-valprint.c (dynamic_array_type): Likewise.
	(d_val_print): Likewise.
	* f-lang.h (f_val_print): Likewise.
	* f-valprint.c (f_val_print): Likewise.
	* go-lang.h (go_val_print): Likewise.
	* go-valprint.c (print_go_string): Likewise.
	(go_val_print): Likewise.
	* language.c (unk_lang_val_print): Likewise.
	* language.h (struct language_defn) <la_val_print>: Likewise.
	Update comments.
	(LA_VAL_PRINT): Remove.
	* m2-lang.h (m2_val_print): Remove const from
	"struct value *".
	* m2-valprint.c (m2_print_array_contents): Likewise.
	(m2_val_print): Likewise.
	* p-lang.h (pascal_val_print): Remove second parameter.  Remove
	const from "struct value *".
	(pascal_object_print_value_fields): Likewise.
	* p-valprint.c (pascal_val_print): Likewise.
	(pascal_object_print_value_fields): Likewise.
	(pascal_object_print_value): Likewise.
	* rust-lang.c (rust_get_disr_info): Likewise.
	(val_print_struct): Likewise.
	(rust_val_print): Likewise.
	* valprint.c (generic_val_print_array): Likewise.
	(generic_val_print_ptr): Likewise.
	(generic_val_print_memberptr): Likewise.
	(generic_val_print_ref): Likewise.
	(generic_val_print_enum): Likewise.
	(generic_val_print_flags): Likewise.
	(generic_val_print_func): Likewise.
	(generic_val_print_bool): Likewise.
	(generic_val_print_int): Likewise.
	(generic_val_print_char): Likewise.
	(generic_val_print_float): Likewise.
	(generic_val_print_decfloat): Likewise.
	(generic_val_print_complex): Likewise.
	(generic_val_print): Likewise.
	(val_print): Likewise.
	(common_val_print): Likewise.
	(val_print_type_code_flags): Likewise.
	(val_print_scalar_formatted): Likewise.
	(val_print_array_elements): Likewise.
	* valprint.h (val_print_array_elements): Update declaration.
	(val_print_scalar_formatted): Likewise.
	(generic_val_print): Likewise.
	* value.h (val_print): Likewise.
2016-11-08 16:02:42 +00:00
Pedro Alves 2f408ecb92 Use ui_file_as_string throughout more
This replaces most of the remaining ui_file_xstrdup calls with
ui_file_as_string calls.  Whenever a call was replaced, that led to a
cascade of other necessary adjustments throughout, to make the code
use std::string instead of raw pointers.  And then whenever I added a
std::string as member of a struct, I needed to adjust
allocation/destruction of said struct to use new/delete instead of
xmalloc/xfree.

The stopping point was once gdb built again.  These doesn't seem to be
a way to reasonably split this out further.

Maybe-not-obvious changes:

 - demangle_for_lookup returns a cleanup today.  To get rid of that,
   and avoid unnecessary string dupping/copying, this introduces a
   demangle_result_storage type that the caller instantiates and
   passes to demangle_for_lookup.

 - Many methods returned a "char *" to indicate that the caller owns
   the memory and must free it.  Those are switched to return a
   std::string instead.  Methods that return a "view" into some
   internal string return a "const char *" instead.  I.e., we only
   copy/allocate when necessary.

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

	* ada-lang.c (ada_name_for_lookup, type_as_string): Use and return
	std::string.
	(type_as_string_and_cleanup): Delete.
	(ada_lookup_struct_elt_type): Use type_as_string.
	* ada-lang.h (ada_name_for_lookup): Now returns std::string.
	* ada-varobj.c (ada_varobj_scalar_image): Return a std::string.
	(ada_varobj_describe_child): Make 'child_name' and
	'child_path_expr' parameters std::string pointers.
	(ada_varobj_describe_struct_child, ada_varobj_describe_ptr_child):
	Likewise, and use string_printf.
	(ada_varobj_describe_simple_array_child)
	(ada_varobj_describe_child): Likewise.
	(ada_varobj_get_name_of_child, ada_varobj_get_path_expr_of_child)
	(ada_varobj_get_value_image)
	(ada_varobj_get_value_of_array_variable)
	(ada_varobj_get_value_of_variable, ada_name_of_variable)
	(ada_name_of_child, ada_path_expr_of_child)
	(ada_value_of_variable): Now returns std::string.  Use
	string_printf.
	(ada_value_of_child): Adjust.
	* break-catch-throw.c (check_status_exception_catchpoint): Adjust
	to use std::string.
	* breakpoint.c (watch_command_1): Adjust to use std::string.
	* c-lang.c (c_get_string): Adjust to use std::string.
	* c-typeprint.c (print_name_maybe_canonical): Use std::string.
	* c-varobj.c (varobj_is_anonymous_child): Use ==/!= std::string
	operators.
	(c_name_of_variable): Now returns a std::string.
	(c_describe_child): The 'cname' and 'cfull_expression' output
	parameters are now std::string pointers.  Adjust.
	(c_name_of_child, c_path_expr_of_child, c_value_of_variable)
	(cplus_number_of_children): Adjust to use std::string and
	string_printf.
	(cplus_name_of_variable): Now returns a std::string.
	(cplus_describe_child): The 'cname' and 'cfull_expression' output
	parameters are now std::string pointers.  Adjust.
	(cplus_name_of_child, cplus_path_expr_of_child)
	(cplus_value_of_variable): Now returns a std::string.
	* cp-abi.c (cplus_typename_from_type_info): Return std::string.
	* cp-abi.h (cplus_typename_from_type_info): Return std::string.
	(struct cp_abi_ops) <get_typename_from_type_info>: Return
	std::string.
	* cp-support.c (inspect_type): Use std::string.
	(cp_canonicalize_string_full, cp_canonicalize_string_no_typedefs)
	(cp_canonicalize_string): Return std::string and adjust.
	* cp-support.h (cp_canonicalize_string)
	(cp_canonicalize_string_no_typedefs, cp_canonicalize_string_full):
	Return std::string.
	* dbxread.c (read_dbx_symtab): Use std::string.
	* dwarf2read.c (dwarf2_canonicalize_name): Adjust to use std::string.
	* gdbcmd.h (lookup_struct_elt_type): Adjust to use std::string.
	* gnu-v3-abi.c (gnuv3_get_typeid): Use std::string.
	(gnuv3_get_typename_from_type_info): Return a std::string and
	adjust.
	(gnuv3_get_type_from_type_info): Adjust to use std::string.
	* guile/guile.c (gdbscm_execute_gdb_command): Adjust to use
	std::string.
	* infcmd.c (print_return_value_1): Adjust to use std::string.
	* linespec.c (find_linespec_symbols): Adjust to
	demangle_for_lookup API change.  Use std::string.
	* mi/mi-cmd-var.c (print_varobj, mi_cmd_var_set_format)
	(mi_cmd_var_info_type, mi_cmd_var_info_path_expression)
	(mi_cmd_var_info_expression, mi_cmd_var_evaluate_expression)
	(mi_cmd_var_assign, varobj_update_one): Adjust to use std::string.
	* minsyms.c (lookup_minimal_symbol): Use std::string.
	* python/py-varobj.c (py_varobj_iter_next): Use new instead of
	XNEW.  vitem->name is a std::string now, adjust.
	* rust-exp.y (convert_ast_to_type, convert_name): Adjust to use
	std::string.
	* stabsread.c (define_symbol): Adjust to use std::string.
	* symtab.c (demangle_for_lookup): Now returns 'const char *'.  Add
	a demangle_result_storage parameter.  Use it for storage.
	(lookup_symbol_in_language)
	(lookup_symbol_in_objfile_from_linkage_name): Adjust to new
	demangle_for_lookup API.
	* symtab.h (struct demangle_result_storage): New type.
	(demangle_for_lookup): Now returns 'const char *'.  Add a
	demangle_result_storage parameter.
	* typeprint.c (type_to_string): Return std::string and use
	ui_file_as_string.
	* value.h (type_to_string): Change return type to std::string.
	* varobj-iter.h (struct varobj_item) <name>: Now a std::string.
	(varobj_iter_delete): Use delete instead of xfree.
	* varobj.c (create_child): Return std::string instead of char * in
	output parameter.
	(name_of_variable, name_of_child, my_value_of_variable): Return
	std::string instead of char *.
	(varobj_create, varobj_get_handle): Constify 'objname' parameter.
	Adjust to std::string fields.
	(varobj_get_objname): Return a const char * instead of a char *.
	(varobj_get_expression): Return a std::string.
	(varobj_list_children): Adjust to use std::string.
	(varobj_get_type): Return a std::string.
	(varobj_get_path_expr): Return a const char * instead of a char *.
	Adjust to std::string fields.
	(varobj_get_formatted_value, varobj_get_value): Return a
	std::string.
	(varobj_set_value): Change type of 'expression' parameter to
	std::string.  Use std::string.
	(install_new_value): Use std::string.
	(delete_variable_1): Adjust to use std::string.
	(create_child): Change the 'name' parameter to a std::string
	reference.  Swap it into the new item's name.
	(create_child_with_value): Swap item's name into the new child's
	name.  Use string_printf.
	(new_variable): Use new instead of XNEW.
	(free_variable): Don't xfree fields that are now std::string.
	(name_of_variable, name_of_child): Now returns std::string.
	(value_of_root): Adjust to use std::string.
	(my_value_of_variable, varobj_value_get_print_value): Return
	and use std::string.
	(varobj_value_get_print_value): Adjust to use ui_file_as_string
	and std::string.
	* varobj.h (struct varobj) <name, path_expr, obj_name,
	print_value>: Now std::string's.
	<name_of_variable, name_of_child, path_expr_of_child,
	value_of_variable>: Return std::string.
	(varobj_create, varobj_get_handle): Constify 'objname' parameter.
	(varobj_get_objname): Return a const char * instead of a char *.
	(varobj_get_expression, varobj_get_type): Return a std::string.
	(varobj_get_path_expr): Return a const char * instead of a char *.
	(varobj_get_formatted_value, varobj_get_value): Return a
	std::string.
	(varobj_set_value): Constify 'expression' parameter.
	(varobj_value_get_print_value): Return a std::string.
2016-11-08 15:26:47 +00:00
Jan Kratochvil bb805577d2 PR gdb/20609 - attach of JIT-debug-enabled inf 7.11.1 regression
Regression: gdb --pid $(pidof qemu-system-x86_64) stopped working with gdb 7.11.1
https://sourceware.org/bugzilla/show_bug.cgi?id=20609

It was reported for qemu-system-x86_64 but it happens for any multithreaded
inferior with a JIT debugging hook.

136613ef0c6850427317e57be1b644080ff6decb is the first bad commit
Author: Pedro Alves <palves@redhat.com>
    Fix PR gdb/19828: gdb -p <process from a container>: internal error
Message-ID: <cbdf2e04-4fa8-872a-2a23-08c9c1b26e00@redhat.com>
https://sourceware.org/ml/gdb-patches/2016-05/msg00450.html

jit_breakpoint_re_set() is specific by trying to insert a breakpoint into the
main executable, not into a shared library.  During attachment GDB thinks it
needs to use 'breakpoint always-inserted' from
breakpoints_should_be_inserted_now() as a newly attached thread is
'thread_info->executing' due to 'lwp_info->must_set_ptrace_flags' enabled and
the task not yet stopped.  This did not happen before the 'bad commit' above
which adds tracking of such thread.

GDB then fails to insert the breakpoints to invalid address as PIE executable
gets properly relocated during later phase of attachment.  One can see in the
backtraces below:
 -> jit_breakpoint_re_set_internal()
later:
 -> svr4_exec_displacement()

One can suppress the initial breakpoint_re_set() call as there will be another
breakpoint_re_set() done from the final post_create_inferior() call in
setup_inferior().

BTW additionally 'threads_executing' cache bool is somehow stale (somewhere is
missing update_threads_executing()).  I was trying to deal with that in my
first/second attempt below but in my final third attempt (attached) I have
left it as it is.

First attempt trying not to falsely require 'breakpoint always-inserted':
  https://people.redhat.com/jkratoch/rhbz1375553-fix1.patch
Reduced first attempt:
  https://people.redhat.com/jkratoch/rhbz1375553-fix2.patch

The third attempt suppresses breakpoint insertion until PIE executable gets
relocated by svr4_exec_displacement().  Applied.

gdb/ChangeLog
2016-09-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR gdb/20609 - attach of JIT-debug-enabled inf 7.11.1 regression
	* exec.c (exec_file_locate_attach): Add parameter defer_bp_reset.
	Use it.
	* gdbcore.h (exec_file_locate_attach): Add parameter defer_bp_reset.
	* infcmd.c (setup_inferior): Update caller.
	* remote.c (remote_add_inferior): Likewise.

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

	PR gdb/20609 - attach of JIT-debug-enabled inf 7.11.1 regression
	* gdb.base/jit-attach-pie.c: New file.
	* gdb.base/jit-attach-pie.exp: New file.
2016-09-29 17:39:39 +02:00
Simon Marchi 0a1ddfa6b6 Allow resetting an empty inferior-tty
This patch allows the user to set the inferior-tty to "empty", in order
to come back to the default behaviour of using the same tty as gdb is
using.

This is already supported in MI (and tested in gdb.mi/mi-basics.exp).

I added a new test, set-inferior-tty.exp, where I test only the setting
and unsetting of the parameter.  It would be nice to actually test that
the inferior output properly goes to the separate tty, but that will be
for another day.

gdb/ChangeLog:

	* infcmd.c (set_inferior_io_terminal): Set inferior terminal to
	NULL if terminal_name is an empty string.
	(_initialize_infcmd): Make the argument of "set inferior-tty"
	optional, mention it in the help doc.

gdb/doc/ChangeLog:

	* gdb.texinfo (Input/Output): Mention possibility to unset
	inferior-tty.

gdb/testsuite/ChangeLog:

	* gdb.base/set-inferior-tty.exp: New file.
	* gdb.base/set-inferior-tty.c: New file.
2016-08-24 13:10:08 -04:00
Pedro Alves 6300088845 Forget watchpoint locations when inferior exits or is killed/detached
If you have two inferiors (or more), set watchpoints in one of the
inferiors, and then that inferior exits, until you manually delete the
watchpoint (or something forces a breakpoint re-set), you can't resume
the other inferior.

This is exercised by the test added by this commit.  Without the GDB
fix, this test fails like this:

 FAIL: gdb.multi/watchpoint-multi-exit.exp: dispose=kill: continue to marker in inferior 1
 FAIL: gdb.multi/watchpoint-multi-exit.exp: dispose=detach: continue to marker in inferior 1
 FAIL: gdb.multi/watchpoint-multi-exit.exp: dispose=exit: continue to marker in inferior 1

and gdb.log shows (in all three cases):

 (gdb) continue
 Continuing.
 Warning:
 Could not insert hardware watchpoint 2.
 Could not insert hardware breakpoints:
 You may have requested too many hardware breakpoints/watchpoints.

 Command aborted.
 (gdb) FAIL: gdb.multi/watchpoint-multi-exit.exp: dispose=kill: continue to marker in inferior 1

The problem is that GDB doesn't forget about the locations of
watchpoints set in the inferior that is now dead.  When we try to
continue the inferior that is still alive, we reach
insert_breakpoint_locations, which has the the loop that triggers the
error:

  /* If we failed to insert all locations of a watchpoint, remove
     them, as half-inserted watchpoint is of limited use.  */

That loop finds locations that are not marked inserted, but which
according to should_be_inserted should have been inserted, and so
errors out.

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

	* breakpoint.c (breakpoint_init_inferior): Discard watchpoint
	locations.
	* infcmd.c (detach_command): Call breakpoint_init_inferior.

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

	* gdb.multi/watchpoint-multi-exit.c: New file.
	* gdb.multi/watchpoint-multi-exit.exp: New file.
2016-07-01 11:25:58 +01:00
Pedro Alves 8980e177bb Push thread->control.command_interp to the struct thread_fsm
I noticed that if we step into an inline function, step_1 never
reaches proceed, and thus nevers sets the thread's
tp->control.command_interp.  Because of that,
should_print_stop_to_console fails to determine that is should print
stop output to the console.

The fix is to set the thread's command_interp earlier.  However, I
realized that we can move that field to the thread_fsm, given that its
lifetime is exactly the same as thread_fsm.  So the patch plumbs all
fsms constructors to take the command interp and store it in the
thread_fsm.

We can see the fix in action, with e.g., the gdb.opt/inline-cmds.exp
test, and issuing a step when stopped at line 67:

 &"s\n"
 ^running
 *running,thread-id="all"
 (gdb)
 ~"67\t  result = func2 ();\n"
 *stopped,reason="end-stepping-range",frame={addr="0x00000000004004d0",func="main",args=[],file="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.opt/inline-cmds.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.opt/inline-cmds.c",line="67"},thread-id="1",stopped-threads="all",core="0"
 (gdb)
 s
 &"s\n"
 ^running
 *running,thread-id="all"
 (gdb)
+ ~"func2 () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.opt/inline-cmds.c:67\n"
+ ~"67\t  result = func2 ();\n"
 *stopped,reason="end-stepping-range",frame={addr="0x00000000004004d0",func="func2",args=[],file="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.opt/inline-cmds.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.opt/inline-cmds.c",line="67"},thread-id="1",stopped-threads="all",core="0"
 (gdb)

(The inline-cmds.exp command is adjusted to exercise this.)

(Due to the follow_fork change, this also fixes "next N" across a fork
with "set follow-fork child" with "set detach-on-fork on".  Commands
that rely on internal breakpoints, like "finish" will still require
more work to migrate breakpoints etc. to the child thread.)

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

	* breakpoint.c (new_until_break_fsm): Add 'cmd_interp' parameter.
	(until_break_fsm_should_stop, until_break_fsm_clean_up): Add
	thread parameter.
	(until_break_command): Pass command interpreter to thread fsm
	ctor.
	* cli/cli-interp.c (should_print_stop_to_console): Adjust.
	* gdbthread.h (struct thread_control_state) <command_interp>:
	Delete field.
	* infcall.c (new_call_thread_fsm): Add 'cmd_interp' parameter.
	Pass it down.
	(call_thread_fsm_should_stop): Add thread parameter.
	(call_function_by_hand_dummy): Pass command interpreter to thread
	fsm ctor.  Pass thread pointer to fsm clean up method.
	* infcmd.c: Include interps.h.
	(struct step_command_fsm) <thread>: Delete field.
	(new_step_command_fsm): Add 'cmd_interp' parameter.  Pass it down.
	(step_command_fsm_prepare): Remove references to fsm's thread
	field.
	(step_1): Pass command interpreter to thread
	fsm ctor.  Pass thread pointer to fsm clean up method.
	(step_command_fsm_should_stop, step_command_fsm_clean_up): Add
	thread parameter and use it.
	(new_until_next_fsm): Add 'cmd_interp' parameter.  Pass it down.
	(until_next_fsm_should_stop, until_next_fsm_clean_up): Add thread
	parameter and use it.
	(until_next_command): Pass command interpreter to thread fsm ctor.
	(struct finish_command_fsm) <thread>: Delete field.
	(finish_command_fsm_ops): Add NULL slot for should_notify_stop.
	(new_finish_command_fsm): Add 'cmd_interp' parameter and pass it
	down.  Remove thread parameter and adjust.
	(finish_command_fsm_should_stop, finish_command_fsm_clean_up): Add
	thread parameter and use it.
	(finish_command): Pass command interpreter to thread fsm ctor.
	Don't pass thread.
	* infrun.c (follow_fork): Move thread fsm to child fork instead of
	command interpreter, only.
	(clear_proceed_status_thread): Remove reference to command_interp.
	(proceed): Don't record the thread's command interpreter.
	(clean_up_just_stopped_threads_fsms): Pass thread to fsm clean_up
	method.
	(fetch_inferior_event): Pass thread to fsm should_stop method.
	* thread-fsm.c (thread_fsm_ctor): Add 'cmd_interp' parameter.
	Store it.
	(thread_fsm_clean_up, thread_fsm_should_stop): Add thread
	parameter and pass it down.
	* thread-fsm.h (struct thread_fsm) <command_interp>: New field.
	(struct thread_fsm_ops) <clean_up, should_stop>: Add thread
	parameter.
	(thread_fsm_ctor): Add 'cmd_interp' parameter.
	(thread_fsm_clean_up, thread_fsm_should_stop): Add thread
	parameter.
	* thread.c (thread_cancel_execution_command): Pass thread to
	thread fsm clean_up method.

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

	* gdb.opt/inline-cmds.c: Add "set mi break here" marker.
	* gdb.opt/inline-cmds.exp: Add MI tests.
2016-06-21 01:11:53 +01:00
Pedro Alves a8836c9358 Fix for spurious prompts in secondary UIs
Running mi-break.exp with MI on a secondary UI reveals that MI emits
spurious prompts compared MI running as primary UI:

   -exec-continue
   ^running
   *running,thread-id="all"
   (gdb)
   =breakpoint-modified,bkpt={number="9",type="breakpoint",disp="keep",enabled="y",func="callee2",line="39",script={"set $i=0","while $i<10","print $i","set $i=$i+1","end","continue"}}
   ~"\n"
   ~"Breakpoint 9, callee2 (intarg=2, strarg=0x400730 \"A string argument.\") at ...src/gdb/testsuite/gdb.mi/basics.c:39\n"
   ~"39\t  callee3 (strarg);\n"
   *stopped,reason="breakpoint-hit",disp="keep",bkptno="9",frame={addr="0x00000000004005dd",func="callee2",...
   *running,thread-id="all"
>> (gdb)
   =breakpoint-modified,bkpt={number="9",...
   ~"\n"
   ~"Breakpoint 9, callee2 (intarg=2, strarg=0x400730 \"A string argument.\") at ...src/gdb/testsuite/gdb.mi/basics.c:39\n"
   ~"39\t  callee3 (strarg);\n"
   *stopped,reason="breakpoint-hit",disp="keep",bkptno="9",...
   *running,thread-id="all"
   ~"[Inferior 1 (process 12639) exited normally]\n"
   =thread-exited,id="1",group-id="i1"
   =thread-group-exited,id="i1",exit-code="0"
   *stopped,reason="exited-normally"
   FAIL: gdb.mi/mi-break.exp: intermediate stop and continue
   FAIL: gdb.mi/mi-break.exp: test hitting breakpoint with commands (timeout)

Note the line marked >> above.

The test sets a breakpoint that runs "continue", a foreground command.
When we get to run the "continue", we've already emitted the *stopped
event on the MI UI, and set its prompt state to PROMPT_NEEDED (this is
done from within normal_stop).  Since inferior events are always
handled with the main UI as current UI, breakpoint commands always run
with the main UI as current UI too.  This means that the "continue"
ends up always disabling the prompt on the main UI, instead of the UI
that had just been done with synchronous execution.

I think we'll want to extend this with a concept of "set of
threads/inferiors a UI/interpreter is blocked waiting on", but I'm
leaving that for a separate series.

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

	* infcmd.c (prepare_execution_command): Use
	all_uis_on_sync_execution_starting.
	* infrun.c (all_uis_on_sync_execution_starting): New function.
	* infrun.h (all_uis_on_sync_execution_starting): Declare.
2016-06-21 01:11:52 +01:00
Pedro Alves 3b12939dfc Replace the sync_execution global with a new enum prompt_state tristate
When sync_execution (a boolean) is true, it means we're running a
foreground command -- we hide the prompt stop listening to input, give
the inferior the terminal, then go to the event loop waiting for the
target to stop.

With multiple independent UIs, we need to track whether each UI is
synchronously blocked waiting for the target.  IOW, if you do
"continue" in one console, that console stops accepting commands, but
you should still be free to type other commands in the others
consoles.

Just simply making sync_execution be per-UI alone not sufficient,
because of this in fetch_inferior_event:

  /* If the inferior was in sync execution mode, and now isn't,
     restore the prompt (a synchronous execution command has finished,
     and we're ready for input).  */
  if (current_ui->async && was_sync && !sync_execution)
    observer_notify_sync_execution_done ();

We'd have to record at entry the "was_sync" state for each UI, not
just of the current UI.

This patch instead replaces the sync_execution flag by a per-UI
tristate flag indicating the command line prompt state:

 enum prompt_state
 {
   /* The command line is blocked simulating synchronous execution.
      This is used to implement the foreground execution commands
      ('run', 'continue', etc.).  We won't display the prompt and
      accept further commands until the execution is actually over.  */
   PROMPT_BLOCKED,

   /* The command finished; display the prompt before returning back to
      the top level.  */
   PROMPT_NEEDED,

   /* We've displayed the prompt already, ready for input.  */
   PROMPTED,
 ;

I think the end result is _much_ clearer than the current code, and,
it addresses the original motivation too.

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

	* annotate.c: Include top.h.
	(async_background_execution_p): Delete.
	(print_value_flags): Check the UI's prompt state rather then
	async_background_execution_p.
	* event-loop.c (start_event_loop): Set the prompt state to
	PROMPT_NEEDED.
	* event-top.c (display_gdb_prompt, async_enable_stdin)
	(async_disable_stdin): Check the current UI's prompt state instead
	of the sync_execution global.
	(command_line_handler): Set the prompt state to PROMPT_NEEDED
	before running a command, and display the prompt if still needed
	afterwards.
	* infcall.c (struct call_thread_fsm) <waiting_ui>: New field.
	(new_call_thread_fsm): New parameter 'waiting_ui'.  Store it.
	(call_thread_fsm_should_stop): Set the prompt state to
	PROMPT_NEEDED.
	(run_inferior_call): Adjust to temporarily set the prompt state to
	PROMPT_BLOCKED instead of using the sync_execution global.
	(call_function_by_hand_dummy): Pass the current UI to
	new_call_thread_fsm.
	* infcmd.c: Include top.h.
	(continue_1): Check the current UI's prompt state instead of the
	sync_execution global.
	(continue_command): Validate global execution state before calling
	prepare_execution_command.
	(step_1): Call all_uis_check_sync_execution_done.
	(attach_post_wait): Don't call async_enable_stdin here.  Remove
	reference to sync_execution.
	* infrun.c (sync_execution): Delete global.
	(follow_fork_inferior)
	(reinstall_readline_callback_handler_cleanup): Check the current
	UI's prompt state instead of the sync_execution global.
	(check_curr_ui_sync_execution_done)
	(all_uis_check_sync_execution_done): New functions.
	(fetch_inferior_event): Call all_uis_check_sync_execution_done
	instead of trying to determine whether the global sync execution
	changed.
	(handle_no_resumed): Check the prompt state of all UIs.
	(normal_stop): Emit the no unwait-for even to all PROMPT_BLOCKED
	UIs.  Emit the "Switching to" notification to all UIs.  Enable
	stdin in all UIs.
	* infrun.h (sync_execution): Delete.
	(all_uis_check_sync_execution_done): Declare.
	* main.c (captured_command_loop): Don't call
	interp_pre_command_loop if the prompt is blocked.
	(catch_command_errors, catch_command_errors_const): Adjust.
	(captured_main): Set the initial prompt state to PROMPT_NEEDED.
	* mi/mi-interp.c (display_mi_prompt): Set the prompt state to
	PROMPTED.
	(mi_interpreter_resume): Don't clear sync_execution.  Remove hack
	comment.
	(mi_execute_command_input_handler): Set the prompt state to
	PROMPT_NEEDED before executing the command, and only display the
	prompt if the prompt state is PROMPT_NEEDED afterwards.
	(mi_on_resume_1): Adjust to check the prompt state.
	* target.c (target_terminal_inferior): Adjust to check the prompt
	state.
	* top.c (wait_sync_command_done, maybe_wait_sync_command_done)
	(execute_command): Check the current UI's prompt state instead of
	sync_execution.
	* top.h (enum prompt_state): New.
	(struct ui) <prompt_state>: New field.
	(ALL_UIS): New macro.
2016-06-21 01:11:51 +01:00
Markus Metzger e3b5daf9f7 infcmd, btrace: fix crash in 'finish' for tailcall-only frames
Patch 7eb895307f Skip unwritable frames in command "finish"
skips non-writable frames in addition to tailcall frames.

If skip_tailcall_frames already returns NULL, skip_unwritable_frames
will be called with a NULL frame and crash in get_frame_arch.  This is
caught by gdb.btrace/tailcall-only.exp.

Further, if we ever end up with a mixture of tailcall and non-writable
frames, we may not skip all of them, as intended.

Loop over skip_tailcall_frames and skip_unwritable_frames as long as at least
one of them makes progress.

gdb/
	* infcmd.c (skip_finish_frames): New.
	(finish_command): Call skip_finish_frames.
2016-06-01 11:14:02 +02:00
Yao Qi 7eb895307f Skip unwritable frames in command "finish"
Nowadays, GDB can't insert breakpoint on the return address of the
exception handler on ARM M-profile, because the address is a magic
one 0xfffffff9,

 (gdb) bt
 #0  CT32B1_IRQHandler () at ../src/timer.c:67
 #1  <signal handler called>
 #2  main () at ../src/timer.c:127

(gdb) info frame
Stack level 0, frame at 0x200ffa8:
 pc = 0x4ec in CT32B1_IRQHandler (../src/timer.c:67); saved pc = 0xfffffff9
 called by frame at 0x200ffc8
 source language c.
 Arglist at 0x200ffa0, args:
 Locals at 0x200ffa0, Previous frame's sp is 0x200ffa8
 Saved registers:
  r7 at 0x200ffa0, lr at 0x200ffa4

(gdb) x/x 0xfffffff9
0xfffffff9:     Cannot access memory at address 0xfffffff9

(gdb) finish
Run till exit from #0  CT32B1_IRQHandler () at ../src/timer.c:67
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)

Warning:
Cannot insert hardware breakpoint 0.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.

Command aborted.

even some debug probe can't set hardware breakpoint on the magic
address too,

(gdb) hbreak *0xfffffff9
Hardware assisted breakpoint 2 at 0xfffffff9
(gdb) c
Continuing.
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)

Warning:
Cannot insert hardware breakpoint 2.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.

Command aborted.

The problem described above is quite similar to PR 8841, in which GDB
can't set breakpoint on signal trampoline, which is mapped to a read-only
page by kernel.  The rationale of this patch is to skip "unwritable"
frames when looking for caller frames in command "finish", and a new
gdbarch method code_of_frame_writable is added.  This patch fixes
the problem on ARM cortex-m target, but it can be used to fix
PR 8841 too.

gdb:

2016-05-10  Yao Qi  <yao.qi@arm.com>

	* arch-utils.c (default_code_of_frame_writable): New function.
	* arch-utils.h (default_code_of_frame_writable): Declare.
	* arm-tdep.c (arm_code_of_frame_writable): New function.
	(arm_gdbarch_init): Install gdbarch method
	code_of_frame_writable if the target is M-profile.
	* frame.c (skip_unwritable_frames): New function.
	* frame.h (skip_unwritable_frames): Declare.
	* gdbarch.sh (code_of_frame_writable): New.
	* gdbarch.c, gdbarch.h: Re-generated.
	* infcmd.c (finish_command): Call skip_unwritable_frames.
2016-05-23 17:32:56 +01:00
Trevor Saunders 870f88f755 remove trivialy unused variables
gdb/ChangeLog:

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

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

No need to restore terminal settings, we'll set inferior modes on the
following resume.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

	* infcmd.c (post_create_inferior, prepare_one_step): Use
	target_terminal_ours_for_output instead of target_terminal_ours.
2016-04-12 16:58:55 +01:00
Pedro Alves e42de8c7f8 Decouple target_interrupt from all-stop/non-stop modes
In non-stop mode, "interrupt" results in a "stop with no signal",
while in all-stop mode, it results in a remote interrupt request /
stop with SIGINT.  This is currently implemented in both the Linux and
remote target backends.  Move it to the core code instead, making
target_interrupt specifically always about "Interrupting as if with
Ctrl-C", just like it is documented.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

	* infcmd.c (interrupt_target_1): Call target_stop is in non-stop
	mode.
	* linux-nat.c (linux_nat_interrupt): Delete.
	(linux_nat_add_target): Don't install linux_nat_interrupt.
	* remote.c (remote_interrupt_ns): Change return type to void.
	Throw error if interrupting the target is not supported.
	(remote_interrupt): Don't call the remote_stop_ns/remote_stop_as.
2016-04-12 16:56:39 +01:00
Pedro Alves 0d5b594f86 PR remote/19496, timeout in forking-threads-plus-bkpt
This patch addresses a failure in
gdb.threads/forking-threads-plus-breakpoint.exp:

FAIL: gdb.threads/forking-threads-plus-breakpoint.exp: cond_bp_target=1:
detach_on_fork=on: inferior 1 exited (timeout)

Cause:

A fork event was reported to GDB before GDB knew about the parent
thread, followed immediately by a breakpoint event in a different
thread.  The parent thread was subsequently added via
remote_notice_new_inferior in process_stop_reply, but when the thread
was added the thread_info.state was set to THREAD_STOPPED.  The fork
event was then handled correctly, but when the fork parent was resumed
via a call to keep_going, the state was unchanged.

The breakpoint event was then handled, which caused all the
non-breakpoint threads to be stopped.  When the breakpoint thread was
resumed, all the non-breakpoint threads were resumed via
infrun.c:restart_threads.  Our old fork parent wasn't restarted,
because it still had thread_info.state set to THREAD_STOPPED.
Ultimately the program under debug hung waiting for a pthread_join
while the old fork parent was stopped forever by GDB.

Fix:

Since this is non-stop, then the bug is that the thread should have
been added in THREAD_RUNNING state.  Consider that infrun may be
pulling target events out of the target_ops backend into its own event
queue, but, not process them immediately.  E.g., infrun may be
stopping all threads temporarily for a step-over-breakpoint operation
for thread A (stop_all_threads).  The waitstatus of all threads is
thus left pending in the thread structure (save_status), including the
fork event of thread B.  Right at this point, if the user does "info
threads", that should show thread B (the fork parent) running, not
stopped, even if internally, gdb is holding it paused for a little
bit.

Thus if in non-stop mode, always add new threads in the external
user-visible THREAD_RUNNING state.  Change remote_notice_new_inferior
to accept the internal executing state of the thread instead, with
EXECUTING set to 1 when we discover a thread that is running on the
target (such as through remote_update_thread_list), and 0 when the
thread is really paused (such as when we see a stop reply).

Tested on x86_64 Linux and Nios II Linux target with x86 Linux host.

gdb/ChangeLog:
2016-03-17  Pedro Alves  <palves@redhat.com>
	    Don Breazeal  <donb@codesourcery.com>

	PR remote/19496
	* infcmd.c (notice_new_inferior): Use the 'leave_running' argument
	instead of checking the 'non_stop' global.
	* remote.c (remote_add_thread): New parameter 'executing'.  Use it
	to set the new thread's executing state.
	(remote_notice_new_inferior): Rename parameter 'running' to
	'executing'.  Always set the thread state to THREAD_RUNNING in
	non-stop mode, and to THREAD_STOPPED in all-stop mode.  Pass
	EXECUTING to remote_add_thread and notice_new_inferior.
	(remote_update_thread_list): Update to pass executing state, not
	running state.
2016-03-17 10:21:37 +00:00
Markus Metzger 33b4777ca1 btrace, frame: fix crash in get_frame_type
In skip_artificial_frames we repeatedly call get_prev_frame_always until we get
a non-inline and non-tailcall frame assuming that there must be such a frame
eventually.

For record targets, however, we may have a frame chain that consists only of
artificial frames.  This leads to a crash in get_frame_type when dereferencing a
NULL frame pointer.

Change skip_artificial_frames and skip_tailcall_frames to return NULL in such a
case and modify each caller to cope with a NULL return.

In frame_unwind_caller_pc and frame_unwind_caller_arch, we simply assert that
the returned value is not NULL.  Their caller was supposed to check
frame_unwind_caller_id before calling those functions.

In other cases, we thrown an error.

In infcmd further move the skip_tailcall_frames call to the forward-stepping
case since we don't need a frame for reverse execution and we don't want to fail
because of that.  Reverse-finish does make sense for a tailcall frame.

gdb/
	* frame.h (skip_tailcall_frames): Update comment.
	* frame.c (skip_artificial_frames, skip_tailcall_frames): Return NULL
	if only	artificial frames are found.  Update comment.
	(frame_unwind_caller_id): Handle NULL return.
	(frame_unwind_caller_pc, frame_unwind_caller_arch): Assert that
	skip_artificial_frames does not return NULL.
	(frame_pop): Add an error if only tailcall frames are found.
	* infcmd.c (finish_command): Move skip_tailcall_frames call into forward-
	execution case.  Add an error if only tailcall frames are found.

testsuite/
	* gdb.btrace/tailcall-only.exp: New.
	* gdb.btrace/tailcall-only.c: New.
	* gdb.btrace/x86_64-tailcall-only.S: New.
	* gdb.btrace/i686-tailcall-only.S: New.
2016-02-12 09:49:48 +01:00
Markus Metzger 2f3ef606b9 frame: add skip_tailcall_frames
Add a new function skip_tailcall_frames to skip TAILCALL_FRAME frames.

gdb/
	* frame.h (skip_tailcall_frames): New.
	* frame.c (skip_tailcall_frames): New.
	(frame_pop): Call skip_tailcall_frames.
	* infcmd.c (finish_command): Call skip_tailcall_frames.
2016-02-12 09:44:42 +01:00
Pedro Alves 5d5658a1d3 Per-inferior/Inferior-qualified thread IDs
This commit changes GDB to track thread numbers per-inferior.  Then,
if you're debugging multiple inferiors, GDB displays
"inferior-num.thread-num" instead of just "thread-num" whenever it
needs to display a thread:

 (gdb) info inferiors
   Num  Description       Executable
   1    process 6022     /home/pedro/gdb/tests/threads
 * 2    process 6037     /home/pedro/gdb/tests/threads
 (gdb) info threads
   Id   Target Id         Frame
   1.1  Thread 0x7ffff7fc2740 (LWP 6022) "threads" (running)
   1.2  Thread 0x7ffff77c0700 (LWP 6028) "threads" (running)
   1.3  Thread 0x7ffff7fc2740 (LWP 6032) "threads" (running)
   2.1  Thread 0x7ffff7fc1700 (LWP 6037) "threads" (running)
   2.2  Thread 0x7ffff77c0700 (LWP 6038) "threads" (running)
 * 2.3  Thread 0x7ffff7fc2740 (LWP 6039) "threads" (running)
 (gdb)
...
 (gdb) thread 1.1
 [Switching to thread 1.1 (Thread 0x7ffff7fc2740 (LWP 8155))]
 (gdb)
...

etc.

You can still use "thread NUM", in which case GDB infers you're
referring to thread NUM of the current inferior.

The $_thread convenience var and Python's InferiorThread.num attribute
are remapped to the new per-inferior thread number.  It's a backward
compatibility break, but since it only matters when debugging multiple
inferiors, I think it's worth doing.

Because MI thread IDs need to be a single integer, we keep giving
threads a global identifier, _in addition_ to the per-inferior number,
and make MI always refer to the global thread IDs.  IOW, nothing
changes from a MI frontend's perspective.

Similarly, since Python's Breakpoint.thread and Guile's
breakpoint-thread/set-breakpoint-thread breakpoint methods need to
work with integers, those are adjusted to work with global thread IDs
too.  Follow up patches will provide convenient means to access
threads' global IDs.

To avoid potencially confusing users (which also avoids updating much
of the testsuite), if there's only one inferior and its ID is "1",
IOW, the user hasn't done anything multi-process/inferior related,
then the "INF." part of thread IDs is not shown.  E.g,.:

 (gdb) info inferiors
   Num  Description       Executable
 * 1    process 15275     /home/pedro/gdb/tests/threads
 (gdb) info threads
   Id   Target Id         Frame
 * 1    Thread 0x7ffff7fc1740 (LWP 15275) "threads" main () at threads.c:40
 (gdb) add-inferior
 Added inferior 2
 (gdb) info threads
   Id   Target Id         Frame
 * 1.1  Thread 0x7ffff7fc1740 (LWP 15275) "threads" main () at threads.c:40
 (gdb)

No regressions on x86_64 Fedora 20.

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

	* NEWS: Mention that thread IDs are now per inferior and global
	thread IDs.
	* Makefile.in (SFILES): Add tid-parse.c.
	(COMMON_OBS): Add tid-parse.o.
	(HFILES_NO_SRCDIR): Add tid-parse.h.
	* ada-tasks.c: Adjust to use ptid_to_global_thread_id.
	* breakpoint.c (insert_breakpoint_locations)
	(remove_threaded_breakpoints, bpstat_check_breakpoint_conditions)
	(print_one_breakpoint_location, set_longjmp_breakpoint)
	(check_longjmp_breakpoint_for_call_dummy)
	(set_momentary_breakpoint): Adjust to use global IDs.
	(find_condition_and_thread, watch_command_1): Use parse_thread_id.
	(until_break_command, longjmp_bkpt_dtor)
	(breakpoint_re_set_thread, insert_single_step_breakpoint): Adjust
	to use global IDs.
	* dummy-frame.c (pop_dummy_frame_bpt): Adjust to use
	ptid_to_global_thread_id.
	* elfread.c (elf_gnu_ifunc_resolver_stop): Likewise.
	* gdbthread.h (struct thread_info): Rename field 'num' to
	'global_num.  Add new fields 'per_inf_num' and 'inf'.
	(thread_id_to_pid): Rename thread_id_to_pid to
	global_thread_id_to_ptid.
	(pid_to_thread_id): Rename to ...
	(ptid_to_global_thread_id): ... this.
	(valid_thread_id): Rename to ...
	(valid_global_thread_id): ... this.
	(find_thread_id): Rename to ...
	(find_thread_global_id): ... this.
	(ALL_THREADS, ALL_THREADS_BY_INFERIOR): Declare.
	(print_thread_info): Add comment.
	* tid-parse.h: New file.
	* tid-parse.c: New file.
	* infcmd.c (step_command_fsm_prepare)
	(step_command_fsm_should_stop): Adjust to use the global thread
	ID.
	(until_next_command, until_next_command)
	(finish_command_fsm_should_stop): Adjust to use the global thread
	ID.
	(attach_post_wait): Adjust to check the inferior number too.
	* inferior.h (struct inferior) <highest_thread_num>: New field.
	* infrun.c (handle_signal_stop)
	(insert_exception_resume_breakpoint)
	(insert_exception_resume_from_probe): Adjust to use the global
	thread ID.
	* record-btrace.c (record_btrace_open): Use global thread IDs.
	* remote.c (process_initial_stop_replies): Also consider the
	inferior number.
	* target.c (target_pre_inferior): Clear the inferior's highest
	thread num.
	* thread.c (clear_thread_inferior_resources): Adjust to use the
	global thread ID.
	(new_thread): New inferior parameter.  Adjust to use it.  Set both
	the thread's global ID and the thread's per-inferior ID.
	(add_thread_silent): Adjust.
	(find_thread_global_id): New.
	(find_thread_id): Make static.  Adjust to rename.
	(valid_thread_id): Rename to ...
	(valid_global_thread_id): ... this.
	(pid_to_thread_id): Rename to ...
	(ptid_to_global_thread_id): ... this.
	(thread_id_to_pid): Rename to ...
	(global_thread_id_to_ptid): ... this.  Adjust.
	(first_thread_of_process): Adjust.
	(do_captured_list_thread_ids): Adjust to use global thread IDs.
	(should_print_thread): New function.
	(print_thread_info): Rename to ...
	(print_thread_info_1): ... this, and add new show_global_ids
	parameter.  Handle it.  Iterate over inferiors.
	(print_thread_info): Reimplement as wrapper around
	print_thread_info_1.
	(show_inferior_qualified_tids): New function.
	(print_thread_id): Use it.
	(tp_array_compar): Compare inferior numbers too.
	(thread_apply_command): Use tid_range_parser.
	(do_captured_thread_select): Use parse_thread_id.
	(thread_id_make_value): Adjust.
	(_initialize_thread): Adjust "info threads" help string.
	* varobj.c (struct varobj_root): Update comment.
	(varobj_create): Adjust to use global thread IDs.
	(value_of_root_1): Adjust to use global_thread_id_to_ptid.
	* windows-tdep.c (display_tib): No longer accept an argument.
	* cli/cli-utils.c (get_number_trailer): Make extern.
	* cli/cli-utils.h (get_number_trailer): Declare.
	(get_number_const): Adjust documentation.
	* mi/mi-cmd-var.c (mi_cmd_var_update_iter): Adjust to use global
	thread IDs.
	* mi/mi-interp.c (mi_new_thread, mi_thread_exit)
	(mi_on_normal_stop, mi_output_running_pid, mi_on_resume):
	* mi/mi-main.c (mi_execute_command, mi_cmd_execute): Likewise.
	* guile/scm-breakpoint.c (gdbscm_set_breakpoint_thread_x):
	Likewise.
	* python/py-breakpoint.c (bppy_set_thread): Likewise.
	* python/py-finishbreakpoint.c (bpfinishpy_init): Likewise.
	* python/py-infthread.c (thpy_get_num): Add comment and return the
	per-inferior thread ID.
	(thread_object_getset): Update comment of "num".

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

	* gdb.base/break.exp: Adjust to output changes.
	* gdb.base/hbreak2.exp: Likewise.
	* gdb.base/sepdebug.exp: Likewise.
	* gdb.base/watch_thread_num.exp: Likewise.
	* gdb.linespec/keywords.exp: Likewise.
	* gdb.multi/info-threads.exp: Likewise.
	* gdb.threads/thread-find.exp: Likewise.
	* gdb.multi/tids.c: New file.
	* gdb.multi/tids.exp: New file.

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

	* gdb.texinfo (Threads): Document per-inferior thread IDs,
	qualified thread IDs, global thread IDs and thread ID lists.
	(Set Watchpoints, Thread-Specific Breakpoints): Adjust to refer to
	thread IDs.
	(Convenience Vars): Document the $_thread convenience variable.
	(Ada Tasks): Adjust to refer to thread IDs.
	(GDB/MI Async Records, GDB/MI Thread Commands, GDB/MI Ada Tasking
	Commands, GDB/MI Variable Objects): Update to mention global
	thread IDs.
	* guile.texi (Breakpoints In Guile)
	<breakpoint-thread/set-breakpoint-thread breakpoint>: Mention
	global thread IDs instead of thread IDs.
	* python.texi (Threads In Python): Adjust documentation of
	InferiorThread.num.
	(Breakpoint.thread): Mention global thread IDs instead of thread
	IDs.
2016-01-13 10:59:43 +00: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
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
Pedro Alves 066f6b6edc attach + target always in non-stop mode: stop all threads
When running with "maint set target-non-stop on", and in all-stop
mode, nothing is stopping all threads after attaching.  vAttach in
non-stop can leave all threads running and GDB has to explicitly pause
them.

This is not visible with the native target, as in that case, attach
always stops all threads (the core re-resumes them in case of
"attach&").

In addition, it's not defined which thread manages to report the
initial attach stop, so always pick the lowest one (otherwise
multi-attach.exp regresses).

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

	* infcmd.c (attach_post_wait): If the target is always in non-stop
	mode, and the UI is in all-stop mode, stop all threads and pick
	the one with lowest number as current.
2015-11-30 18:36:41 +00:00
Pedro Alves 6efcd9a8b3 Remote all-stop-on-top-of-non-stop
This is the first pass at implementing support for all-stop mode
running against the remote target using the non-stop variant of the
protocol.

The trickiest part here is the initial connection setup/synching.  We
need to fetch all inferiors' target descriptions etc. before stopping
threads, because stop_all_threads needs to read the threads' registers
(to record each thread's stop_pc).  But OTOH, the initial inferior
setup (target_post_attach, post_create_inferior, etc.), only works
correctly if the inferior is stopped...  So I've split that initial
setup part from attach_command_post_wait to a separate function, and
added a "still needs setup" flag to the inferior structure.  This is
similar to gdbserver/linux-low.c's handling of discovering the
process's target description).  Then if on connection all threads of
the remote inferior are running, when we go about stopping them, as
soon as they stop we call setup_inferior, from within
stop_all_threads.

Also, in all-stop, we need to process all the initial stop replies to
learn about all the pending signal the threads may already be stopped
for, and pick the one to report as current.  This is exposed by
gdb.threads/reconnect-signal.exp.

gdb/
2015-11-30  Pedro Alves  <palves@redhat.com>

	* gdbthread.h (switch_to_thread_no_regs): Declare.
	* infcmd.c (setup_inferior): New function, factored out from ...
	(attach_command_post_wait): ... this.  Rename to ...
	(attach_post_wait): ... this.  Replace parameter async_exec with
	attach_post_wait_mode parameter.  Adjust.
	(enum attach_post_wait_mode): New enum.
	(struct attach_command_continuation_args): Replace 'async_exec'
	field with 'mode' field.
	(attach_command_continuation): Adjust.
	(attach_command): Add comment.  Mark the inferior as needing
	setup.  Adjust to use enum attach_post_wait_mode.
	(notice_new_inferior): Use switch_to_thread_no_regs.  Adjust to
	use enum attach_post_wait_mode.
	* inferior.h (setup_inferior): Declare.
	(struct inferior) <needs_setup>: New field.
	* infrun.c (set_last_target_status): Make extern.
	(stop_all_threads): Make extern.  Setup inferior, if necessary.
	* infrun.h (set_last_target_status, stop_all_threads): Declare.
	* remote-notif.c (remote_async_get_pending_events_handler)
	(handle_notification): Replace non_stop checks with
	target_is_non_stop_p() checks.
	* remote.c (remote_notice_new_inferior): Remove non_stop check.
	(remote_update_thread_list): Replace non_stop check with
	target_is_non_stop_p() check.
	(print_one_stopped_thread): New function.
	(process_initial_stop_replies): New 'from_tty' parameter.
	"Notice" all new live inferiors after storing initial stops as
	pending status in each corresponding thread.  If all-stop, stop
	all threads, try picking a signalled thread as current, and print
	the status of that one thread.  Record the last target status.
	(remote_start_remote): Replace non_stop checks with
	target_is_non_stop_p() checks.  Don't query for the remote current
	thread of use qOffsets here.  Pass from_tty to
	process_initial_stop_replies.
	(extended_remote_attach): Replace non_stop checks with
	target_is_non_stop_p() checks.
	(extended_remote_post_attach): Send qOffsets here.
	(remote_vcont_resume, remote_resume, remote_stop)
	(remote_interrupt, remote_parse_stop_reply, remote_wait): Replace
	non_stop checks with target_is_non_stop_p() checks.
	(remote_async): If target is non-stop, mark/clear the pending
	events token.
	* thread.c (switch_to_thread_no_regs): New function.
2015-11-30 18:36:37 +00:00
Kevin Buettner aca20ec473 infcmd.c: Don't attempt to record a NULL value after a finish command.
Architectures which use RETURN_VALUE_STRUCT_CONVENTION will have a
NULL return value after executing a finish command.  See get_return_value()
in infcmd.c.

This patch avoids an eventual SIGSEV (caused by attempting to
derefrence a NULL pointer) by adding a suitable test to
finish_command_fsm_should_stop().

I encountered this problem while testing msp430:

(gdb) PASS: gdb.base/structs.exp: zed L<n> for finish; return 1 structs-tc
finish
Run till exit from #0  fun1 () at /ironwood1/sourceware-git/msp430-elf/../binutils-gdb/gdb/testsuite/gdb.base/structs.c:125
ERROR: Process no longer exists

gdb/ChangeLog:
    	* infcmd.c (finish_command_fsm_should_stop): Don't attempt to
    	record a NULL value.
2015-09-30 05:56:03 -07: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
Pedro Alves 0700e23e5f Garbage collect dummy_frame_ctx_saver
Since the "finish" command and infcall's FSMs are now responsible for
saving the return value, the dummy_frame_ctx_saver is no longer needed
anywhere.

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

	* infcall.c (struct dummy_frame_context_saver): Delete.
	(dummy_frame_context_saver_free, dummy_frame_context_saver_dtor)
	(dummy_frame_context_saver_drop)
	(dummy_frame_context_saver_cleanup)
	(dummy_frame_context_saver_get_regs)
	(dummy_frame_context_saver_setup): Delete.
	* infcall.h (dummy_frame_context_saver_drop)
	(dummy_frame_context_saver_cleanup)
	(dummy_frame_context_saver_get_regs, dummy_frame_context_saver):
	Delete.
	(get_return_value): Remove 'ctx_saver' paremeter.  Adjust.
	* inferior.h (get_return_value): Remove 'ctx_saver' paremeter.
	* python/py-finishbreakpoint.c (bpfinishpy_pre_stop_hook): Adjust.
2015-09-09 18:25:15 +01:00
Pedro Alves cfc3163382 Convert the until/advance commands to thread_fsm mechanism
gdb/ChangeLog:
2015-09-09  Pedro Alves  <palves@redhat.com>

	* breakpoint.c: Include "thread-fsm.h".
	(struct until_break_command_continuation_args): Delete.
	(struct until_break_fsm): New.
	(until_break_fsm_ops): New global.
	(new_until_break_fsm, until_break_fsm_should_stop): New functions.
	(until_break_command_continuation): Delete.
	(until_break_fsm_clean_up): New function.
	(until_break_fsm_async_reply_reason): New function.
	(until_break_command): Adjust to create an until_break_fsm instead
	of a continuation.
	(momentary_bkpt_print_it): No longer print MI's async-stop-reason
	here.
	* infcmd.c (struct until_next_fsm): New.
	(until_next_fsm_ops): New global.
	(new_until_next_fsm, until_next_fsm_should_stop): New function.
	(until_next_continuation): Delete.
	(until_next_fsm_clean_up, until_next_fsm_async_reply_reason): New
	functions.
	(until_next_command): Adjust to create a new until_next_fsm
	instead of a continuation.
2015-09-09 18:24:56 +01:00
Pedro Alves 243a925328 Replace "struct continuation" mechanism by something more extensible
This adds an object oriented replacement for the "struct continuation"
mechanism, and converts the stepping commands (step, next, stepi,
nexti) and the "finish" commands to use it.

It adds a new thread "class" (struct thread_fsm) that contains the
necessary info and callbacks to manage the state machine of a thread's
execution command.

This allows getting rid of some hacks.  E.g., in fetch_inferior_event
and normal_stop we no longer need to know whether a thread is doing a
multi-step (e.g., step N).  This effectively makes the
intermediate_continuations unused -- they'll be garbage collected in a
separate patch.  (They were never a proper abstraction, IMO.  See how
fetch_inferior_event needs to check step_multi before knowing whether
to call INF_EXEC_CONTINUE or INF_EXEC_COMPLETE.)

The target async vs !async uiout hacks in mi_on_normal_stop go away
too.

print_stop_event is no longer called from normal_stop.  Instead it is
now called from within each interpreter's normal_stop observer.  This
clears the path to make each interpreter print a stop event the way it
sees fit.  Currently we have some hacks in common code to
differenciate CLI vs TUI vs MI around this area.

The "finish" command's FSM class stores the return value plus that
value's position in the value history, so that those can be printed to
both MI and CLI's streams.  This fixes the CLI "finish" command when
run from MI -- it now also includes the function's return value in the
CLI stream:

  (gdb)
  ~"callee3 (strarg=0x400730 \"A string argument.\") at src/gdb/testsuite/gdb.mi/basics.c:35\n"
  ~"35\t}\n"
 +~"Value returned is $1 = 0\n"
  *stopped,reason="function-finished",frame=...,gdb-result-var="$1",return-value="0",thread-id="1",stopped-threads="all",core="0"
 -FAIL: gdb.mi/mi-cli.exp: CLI finish: check CLI output
 +PASS: gdb.mi/mi-cli.exp: CLI finish: check CLI output

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

	* Makefile.in (COMMON_OBS): Add thread-fsm.o.
	* breakpoint.c (handle_jit_event): Print debug output.
	(bpstat_what): Split event callback handling to ...
	(bpstat_run_callbacks): ... this new function.
	(momentary_bkpt_print_it): No longer handle bp_finish here.
	* breakpoint.h (bpstat_run_callbacks): Declare.
	* gdbthread.h (struct thread_info) <step_multi>: Delete field.
	<thread_fsm>: New field.
	(thread_cancel_execution_command): Declare.
	* infcmd.c: Include thread-fsm.h.
	(struct step_command_fsm): New.
	(step_command_fsm_ops): New global.
	(new_step_command_fsm, step_command_fsm_prepare): New functions.
	(step_1): Adjust to use step_command_fsm_prepare and
	prepare_one_step.
	(struct step_1_continuation_args): Delete.
	(step_1_continuation): Delete.
	(step_command_fsm_should_stop): New function.
	(step_once): Delete.
	(step_command_fsm_clean_up, step_command_fsm_async_reply_reason)
	(prepare_one_step): New function, based on step_once.
	(until_next_command): Remove step_multi reference.
	(struct return_value_info): New.
	(print_return_value): Rename to ...
	(print_return_value_1): ... this.  New struct return_value_info
	parameter.  Adjust.
	(print_return_value): Reimplement as wrapper around
	print_return_value_1.
	(struct finish_command_fsm): New.
	(finish_command_continuation): Delete.
	(finish_command_fsm_ops): New global.
	(new_finish_command_fsm, finish_command_fsm_should_stop): New
	functions.
	(finish_command_fsm_clean_up, finish_command_fsm_return_value):
	New.
	(finish_command_continuation_free_arg): Delete.
	(finish_command_fsm_async_reply_reason): New.
	(finish_backward, finish_forward): Change symbol parameter to a
	finish_command_fsm.  Adjust.
	(finish_command): Create a finish_command_fsm.  Adjust.
	* infrun.c: Include "thread-fsm.h".
	(clear_proceed_status_thread): Delete the thread's FSM.
	(infrun_thread_stop_requested_callback): Cancel the thread's
	execution command.
	(clean_up_just_stopped_threads_fsms): New function.
	(fetch_inferior_event): Handle the event_thread's should_stop
	method saying the command isn't done yet.
	(process_event_stop_test): Run breakpoint callbacks here.
	(print_stop_event): Rename to ...
	(print_stop_location): ... this.
	(restore_current_uiout_cleanup): New function.
	(print_stop_event): Reimplement.
	(normal_stop): No longer notify the end_stepping_range observers
	here handle "step N" nor "finish" here.  No longer call
	print_stop_event here.
	* infrun.h (struct return_value_info): Forward declare.
	(print_return_value): Declare.
	(print_stop_event): Change prototype.
	* thread-fsm.c: New file.
	* thread-fsm.h: New file.
	* thread.c: Include "thread-fsm.h".
	(thread_cancel_execution_command): New function.
	(clear_thread_inferior_resources): Call it.
	* cli/cli-interp.c (cli_on_normal_stop): New function.
	(cli_interpreter_init): Install cli_on_normal_stop as normal_stop
	observer.
	* mi/mi-interp.c: Include "thread-fsm.h".
	(restore_current_uiout_cleanup): Delete.
	(mi_on_normal_stop): If the thread has an FSM associated, and it
	finished, ask it for the async-reply-reason to print.  Always call
	print_stop_event here, regardless of the top-level interpreter.
	Check bpstat_what to tell whether an asynchronous breakpoint hit
	triggered.
	* tui/tui-interp.c (tui_on_normal_stop): New function.
	(tui_init): Install tui_on_normal_stop as normal_stop observer.

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

	* gdb.mi/mi-cli.exp: Add CLI finish tests.
2015-09-09 18:24:00 +01:00
Pedro Alves 0b333c5e7d Merge async and sync code paths some more
This patch makes the execution control code use largely the same
mechanisms in both sync- and async-capable targets.  This means using
continuations and use the event loop to react to target events on sync
targets as well.  The trick is to immediately mark infrun's event loop
source after resume instead of calling wait_for_inferior.  Then
fetch_inferior_event is adjusted to do a blocking wait on sync
targets.

Tested on x86_64 Fedora 20, native and gdbserver, with and without
"maint set target-async off".

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

	* breakpoint.c (bpstat_do_actions_1, until_break_command): Don't
	check whether the target can async.
	* inf-loop.c (inferior_event_handler): Only call target_async if
	the target can async.
	* infcall.c: Include top.h and interps.h.
	(run_inferior_call): For the interpreter to sync mode while
	running the infcall.  Call wait_sync_command_done instead of
	wait_for_inferior plus normal_stop.
	* infcmd.c (prepare_execution_command): Don't check whether the
	target can async when running in the foreground.
	(step_1): Delete synchronous case handling.
	(step_once): Always install a continuation, even in sync mode.
	(until_next_command, finish_forward): Don't check whether the
	target can async.
	(attach_command_post_wait, notice_new_inferior): Always install a
	continuation, even in sync mode.
	* infrun.c (mark_infrun_async_event_handler): New function.
	(proceed): In sync mode, mark infrun's event source instead of
	waiting for events here.
	(fetch_inferior_event): If the target can't async, do a blocking
	wait.
	(prepare_to_wait): In sync mode, mark infrun's event source.
	(infrun_async_inferior_event_handler): No longer bail out if the
	target can't async.
	* infrun.h (mark_infrun_async_event_handler): New declaration.
	* linux-nat.c (linux_nat_wait_1): Remove calls to
	set_sigint_trap/clear_sigint_trap.
	(linux_nat_terminal_inferior): No longer check whether the target
	can async.
	* mi/mi-interp.c (mi_on_sync_execution_done): Update and simplify
	comment.
	(mi_execute_command_input_handler): No longer check whether the
	target is async.  Update and simplify comment.
	* target.c (default_target_wait): New function.
	* target.h (struct target_ops) <to_wait>: Now defaults to
	default_target_wait.
	(default_target_wait): Declare.
	* top.c (wait_sync_command_done): New function, factored out from
	...
	(maybe_wait_sync_command_done): ... this.
	* top.h (wait_sync_command_done): Declare.
	* target-delegates.c: Regenerate.
2015-09-09 18:23:23 +01: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
Pierre-Marie de Rodat 63e43d3aed DWARF: handle non-local references in nested functions
GDB's current behavior when dealing with non-local references in the
context of nested fuctions is approximative:

  - code using valops.c:value_of_variable read the first available stack
    frame that holds the corresponding variable (whereas there can be
    multiple candidates for this);

  - code directly relying on read_var_value will instead read non-local
    variables in frames where they are not even defined.

This change adds the necessary context to symbol reads (to get the block
they belong to) and to blocks (the static link property, if any) so that
GDB can make the proper decisions when dealing with non-local varibale
references.

gdb/ChangeLog:

	* ada-lang.c (ada_read_var_value): Add a var_block argument
	and pass it to default_read_var_value.
	* block.c (block_static_link): New accessor.
	* block.h (block_static_link): Declare it.
	* buildsym.c (finish_block_internal): Add a static_link
	argument.  If there is a static link, associate it to the new
	block.
	(finish_block): Add a static link argument and pass it to
	finish_block_internal.
	(end_symtab_get_static_block): Update calls to finish_block and
	to finish_block_internal.
	(end_symtab_with_blockvector): Update call to
	finish_block_internal.
	* buildsym.h: Forward-declare struct dynamic_prop.
	(struct context_stack): Add a static_link field.
	(finish_block): Add a static link argument.
	* c-exp.y: Remove an obsolete comment (evaluation of variables
	already start from the selected frame, and now they climb *up*
	the call stack) and propagate the block information to the
	produced expression.
	* d-exp.y: Likewise.
	* f-exp.y: Likewise.
	* go-exp.y: Likewise.
	* jv-exp.y: Likewise.
	* m2-exp.y: Likewise.
	* p-exp.y: Likewise.
	* coffread.c (coff_symtab_read): Update calls to finish_block.
	* dbxread.c (process_one_symbol): Likewise.
	* xcoffread.c (read_xcoff_symtab): Likewise.
	* compile/compile-c-symbols.c (convert_one_symbol): Promote the
	"sym" parameter to struct block_symbol, update its uses and pass
	its block to calls to read_var_value.
	(convert_symbol_sym): Update the calls to convert_one_symbol.
	* compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Update
	call to read_var_value.
	* dwarf2loc.c (block_op_get_frame_base): New.
	(dwarf2_block_frame_base_locexpr_funcs): Implement the
	get_frame_base method.
	(dwarf2_block_frame_base_loclist_funcs): Likewise.
	(dwarf2locexpr_baton_eval): Add a frame argument and use it
	instead of the selected frame in order to evaluate the
	expression.
	(dwarf2_evaluate_property): Add a frame argument.  Update call
	to dwarf2_locexpr_baton_eval to provide a frame in available and
	to handle the absence of address stack.
	* dwarf2loc.h (dwarf2_evaluate_property): Add a frame argument.
	* dwarf2read.c (attr_to_dynamic_prop): Add a forward
	declaration.
	(read_func_scope): Record any available static link description.
	Update call to finish_block.
	(read_lexical_block_scope): Update call to finish_block.
	* findvar.c (follow_static_link): New.
	(get_hosting_frame): New.
	(default_read_var_value): Add a var_block argument.  Use
	get_hosting_frame to handle non-local references.
	(read_var_value): Add a var_block argument and pass it to the
	LA_READ_VAR_VALUE method.
	* gdbtypes.c (resolve_dynamic_range): Update calls to
	dwarf2_evaluate_property.
	(resolve_dynamic_type_internal): Likewise.
	* guile/scm-frame.c (gdbscm_frame_read_var): Update call to
	read_var_value, passing it the block coming from symbol lookup.
	* guile/scm-symbol.c (gdbscm_symbol_value): Update call to
	read_var_value (TODO).
	* infcmd.c (finish_command_continuation): Update call to
	read_var_value, passing it the block coming from symbol lookup.
	* infrun.c (insert_exception_resume_breakpoint): Likewise.
	* language.h (struct language_defn): Add a var_block argument to
	the LA_READ_VAR_VALUE method.
	* objfiles.c (struct static_link_htab_entry): New.
	(static_link_htab_entry_hash): New.
	(static_link_htab_entry_eq): New.
	(objfile_register_static_link): New.
	(objfile_lookup_static_link): New.
	(free_objfile): Free the STATIC_LINKS hashed map if needed.
	* objfiles.h: Include hashtab.h.
	(struct objfile): Add a static_links field.
	(objfile_register_static_link): New.
	(objfile_lookup_static_link): New.
	* printcmd.c (print_variable_and_value): Update call to
	read_var_value.
	* python/py-finishbreakpoint.c (bpfinishpy_init): Likewise.
	* python/py-frame.c (frapy_read_var): Update call to
	read_var_value, passing it the block coming from symbol lookup.
	* python/py-framefilter.c (extract_sym): Add a sym_block
	parameter and set the pointed value to NULL (TODO).
	(enumerate_args): Update call to extract_sym.
	(enumerate_locals): Update calls to extract_sym and to
	read_var_value.
	* python/py-symbol.c (sympy_value): Update call to
	read_var_value (TODO).
	* stack.c (read_frame_local): Update call to read_var_value.
	(read_frame_arg): Likewise.
	(return_command): Likewise.
	* symtab.h (struct symbol_block_ops): Add a get_frame_base
	method.
	(struct symbol): Add a block field.
	(SYMBOL_BLOCK): New accessor.
	* valops.c (value_of_variable): Remove frame/block handling and
	pass the block argument to read_var_value, which does this job
	now.
	(value_struct_elt_for_reference): Update calls to
	read_var_value.
	(value_of_this): Pass the block found to read_var_value.
	* value.h (read_var_value): Add a var_block argument.
	(default_read_var_value): Likewise.

gdb/testsuite/ChangeLog:

	* gdb.base/nested-subp1.exp: New file.
	* gdb.base/nested-subp1.c: New file.
	* gdb.base/nested-subp2.exp: New file.
	* gdb.base/nested-subp2.c: New file.
	* gdb.base/nested-subp3.exp: New file.
	* gdb.base/nested-subp3.c: New file.
2015-08-25 08:13:28 -04:00
Pedro Alves bfedc46af3 Fix interrupt-noterm.exp on targets always in non-stop
With "maint set target-non-stop on" we get:

 @@ -66,13 +66,16 @@ Continuing.
  interrupt
  (gdb) PASS: gdb.base/interrupt-noterm.exp: interrupt

 -Program received signal SIGINT, Interrupt.
 -PASS: gdb.base/interrupt-noterm.exp: inferior received SIGINT
 -testcase src/gdb/testsuite/gdb.base/interrupt-noterm.exp completed in 0 seconds
 +[process 12119] #1 stopped.
 +0x0000003615ebc6d0 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:81
 +81     T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
 +FAIL: gdb.base/interrupt-noterm.exp: inferior received SIGINT (timeout)
 +testcase src/gdb/testsuite/gdb.base/interrupt-noterm.exp completed in 10 seconds

That is, we get "[$thread] #1 stopped" instead of SIGINT.

The issue is that we don't currently distinguish send
"interrupt/ctrl-c" to target terminal vs "stop/pause" thread well;
both cases go through "target_stop".

And then, the native Linux backend (linux-nat.c) implements
target_stop with SIGSTOP in non-stop mode, and SIGINT in all-stop
mode.  Since "maint set target-non-stop on" forces the backend to be
always running in non-stop mode, even though the user-visible behavior
is "set non-stop" is "off", "interrupt" causes a SIGSTOP instead of
the SIGINT the test expects.

Fix this by introducing a target_interrupt method to use in the
"interrupt/ctrl-c" case, so "set non-stop off" can always work the
same irrespective of "maint set target-non-stop on/off".  I'm
explictly considering changing the "set non-stop on" behavior as out
of scope here.

Most of the patch is an across-the-board rename of to_stop hook
implementations to to_interrupt.  The only targets where something
more than a rename is being done are linux-nat.c and remote.c, which
are the only targets that support async, and thus are the only ones
the core side calls target_stop on.

gdb/ChangeLog:
2015-08-07  Pedro Alves  <palves@redhat.com>

	* darwin-nat.c (darwin_stop): Rename to ...
	(darwin_interrupt): ... this.
	(_initialize_darwin_inferior): Adjust.
	* gnu-nat.c (gnu_stop): Delete.
	(gnu_target): Don't install gnu_stop.
	* inf-ptrace.c (inf_ptrace_stop): Rename to ...
	(inf_ptrace_interrupt): ... this.
	(inf_ptrace_target): Adjust.
	* infcmd.c (interrupt_target_1): Use target_interrupt instead of
	target_stop.
	* linux-nat (linux_nat_stop): Rename to ...
	(linux_nat_interrupt): ... this.
	(linux_nat_stop): Reimplement.
	(linux_nat_add_target): Install linux_nat_interrupt.
	* nto-procfs.c (nto_interrupt_twice): Rename to ...
	(nto_handle_sigint_twice): ... this.
	(nto_interrupt): Rename to ...
	(nto_handle_sigint): ... this.  Call target_interrupt instead of
	target_stop.
	(procfs_wait): Adjust.
	(procfs_stop): Rename to ...
	(procfs_interrupt): ... this.
	(init_procfs_targets): Adjust.
	* procfs.c (procfs_stop): Rename to ...
	(procfs_interrupt): ... this.
	(procfs_target): Adjust.
	* remote-m32r-sdi.c (m32r_stop): Rename to ...
	(m32r_interrupt): ... this.
	(init_m32r_ops): Adjust.
	* remote-sim.c (gdbsim_stop_inferior): Rename to ...
	(gdbsim_interrupt_inferior): ... this.
	(gdbsim_stop): Rename to ...
	(gdbsim_interrupt): ... this.
	(gdbsim_cntrl_c): Adjust.
	(init_gdbsim_ops): Adjust.
	* remote.c (sync_remote_interrupt): Adjust comments.
	(remote_stop_as): Rename to ...
	(remote_interrupt_as): ... this.
	(remote_stop): Adjust comment.
	(remote_interrupt): New function.
	(init_remote_ops): Install remote_interrupt.
	* target.c (target_interrupt): New function.
	* target.h (struct target_ops) <to_interrupt>: New field.
	(target_interrupt): New declaration.
	* windows-nat.c (windows_stop): Rename to ...
	(windows_interrupt): ... this.
	* target-delegates.c: Regenerate.
2015-08-07 17:26:20 +01:00
Pedro Alves fbea99ea8a Implement all-stop on top of a target running non-stop mode
This finally implements user-visible all-stop mode running with the
target_ops backend always in non-stop mode.  This is a stepping stone
towards finer-grained control of threads, being able to do interesting
things like thread groups, associating groups with breakpoints, etc.
From the user's perspective, all-stop mode is really just a special
case of being able to stop and resume specific sets of threads, so it
makes sense to do this step first.

With this, even in all-stop, the target is no longer in charge of
stopping all threads before reporting an event to the core -- the core
takes care of it when it sees fit.  For example, when "next"- or
"step"-ing, we can avoid stopping and resuming all threads at each
internal single-step, and instead only stop all threads when we're
about to present the stop to the user.

The implementation is almost straight forward, as the heavy lifting
has been done already in previous patches.  Basically, we replace
checks for "set non-stop on/off" (the non_stop global), with calls to
a new target_is_non_stop_p function.  In a few places, if "set
non-stop off", we stop all threads explicitly, and in a few other
places we resume all threads explicitly, making use of existing
methods that were added for teaching non-stop to step over breakpoints
without displaced stepping.

This adds a new "maint set target-non-stop on/off/auto" knob that
allows both disabling the feature if we find problems, and
force-enable it for development (useful when teaching a target about
this.  The default is "auto", which means the feature is enabled if a
new target method says it should be enabled.  The patch implements the
method in linux-nat.c, just for illustration, because it still returns
false.  We'll need a few follow up fixes before turning it on by
default.  This is a separate target method from indicating regular
non-stop support, because e.g., while e.g., native linux-nat.c is
close to regression free with all-stop-non-stop (with following
patches will fixing the remaining regressions), remote.c+gdbserver
will still need more fixing, even though it supports "set non-stop
on".

Tested on x86_64 Fedora 20, native, with and without "set displaced
off", and with and without "maint set target-non-stop on"; and also
against gdbserver.

gdb/ChangeLog:
2015-08-07  Pedro Alves  <palves@redhat.com>

	* NEWS: Mention "maint set/show target-non-stop".
	* breakpoint.c (update_global_location_list): Check
	target_is_non_stop_p instead of non_stop.
	* infcmd.c (attach_command_post_wait, attach_command): Likewise.
	* infrun.c (show_can_use_displaced_stepping)
	(can_use_displaced_stepping_p, start_step_over_inferior):
	Likewise.
	(internal_resume_ptid): New function.
	(resume): Use it.
	(proceed): Check target_is_non_stop_p instead of non_stop.  If in
	all-stop mode but the target is always in non-stop mode, start all
	the other threads that are implicitly resumed too.
	(for_each_just_stopped_thread, fetch_inferior_event)
	(adjust_pc_after_break, stop_all_threads): Check
	target_is_non_stop_p instead of non_stop.
	(handle_inferior_event): Likewise.  Handle detach-fork in all-stop
	with the target always in non-stop mode.
	(handle_signal_stop) <random signal>: Check target_is_non_stop_p
	instead of non_stop.
	(switch_back_to_stepped_thread): Check target_is_non_stop_p
	instead of non_stop.
	(keep_going_stepped_thread): Use internal_resume_ptid.
	(stop_waiting): If in all-stop mode, and the target is in non-stop
	mode, stop all threads.
	(keep_going_pass): Likewise, when starting a new in-line step-over
	sequence.
	* linux-nat.c (get_pending_status, select_event_lwp)
	(linux_nat_filter_event, linux_nat_wait_1, linux_nat_wait): Check
	target_is_non_stop_p instead of non_stop.
	(linux_nat_always_non_stop_p): New function.
	(linux_nat_stop): Check target_is_non_stop_p instead of non_stop.
	(linux_nat_add_target): Install linux_nat_always_non_stop_p.
	* target-delegates.c: Regenerate.
	* target.c (target_is_non_stop_p): New function.
	(target_non_stop_enabled, target_non_stop_enabled_1): New globals.
	(maint_set_target_non_stop_command)
	(maint_show_target_non_stop_command): New functions.
	(_initilize_target): Install "maint set/show target-non-stop"
	commands.
	* target.h (struct target_ops) <to_always_non_stop_p>: New field.
	(target_non_stop_enabled): New declaration.
	(target_is_non_stop_p): New declaration.

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

	* gdb.texinfo (Maintenance Commands): Document "maint set/show
	target-non-stop".
2015-08-07 17:24:01 +01:00
Jan Kratochvil c6343a91d9 signal_command: Leftover cleanup chain regression
gdb/ChangeLog
2015-08-04  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* infcmd.c (signal_command): Call do_cleanups for args_chain.
2015-08-04 13:42:56 +02:00
Jan Kratochvil 978b9495b7 ASAN attach crash - 7.9 regression
-fsanitize=address
gdb.base/attach-pie-noexec.exp

==32586==ERROR: AddressSanitizer: heap-use-after-free on address 0x60200004ed90 at pc 0x48ad50 bp 0x7ffceb3aef50 sp 0x7ffceb3aef20
READ of size 2 at 0x60200004ed90 thread T0
    #0 0x48ad4f in __interceptor_strlen (/home/jkratoch/redhat/gdb-test-asan/gdb/gdb+0x48ad4f)
    #1 0xeafe5c in xstrdup xstrdup.c:33
    #2 0x85e024 in attach_command /home/jkratoch/redhat/gdb-test-asan/gdb/infcmd.c:2680

regressed by:

commit 6c4486e63f
Author: Pedro Alves <palves@redhat.com>
Date:   Fri Oct 17 13:31:26 2014 +0100
    PR gdb/17471: Repeating a background command makes it foreground

gdb/ChangeLog
2015-08-04  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR gdb/18767
	* infcmd.c (attach_command): Move ARGS_CHAIN cleanup after last ARGS
	use.
2015-08-04 13:42:25 +02:00
Simon Marchi f168693bc9 Remove CHECK_TYPEDEF, use check_typedef instead
I think that the CHECK_TYPEDEF macro is not necessary, and even a bit
annoying.  It makes unclear the fact that the "type" variables gets
overwritten.  It has actually bitten me a few times.  I think the
following, explicit form, is better.

  type = check_typedef (type);

This patches changes all instances of CHECK_TYPEDEF for an equivalent
call to check_typedef.  The bulk of the change was done with this sed:

  sed -i 's/CHECK_TYPEDEF (\([^)]*\));/\1 = check_typedef (\1);/' <file>.c

The ChangeLog was generated using David Malcom's generate_changelog.py.
I manually fixed those places where it gets the wrong function name,
hopefully all of them.

The patch was built-tested, and I ran a few smoke tests.

gdb/ChangeLog:
	* gdbtypes.h (CHECK_TYPEDEF): Remove.
	* aarch64-tdep.c (aarch64_return_in_memory): Replace CHECK_TYPEDEF
        with check_typedef.
	* ada-lang.c (decode_constrained_packed_array_type): Likewise.
	(ada_array_length): Likewise.
	(find_parallel_type_by_descriptive_type): Likewise.
	(ada_check_typedef): Likewise.
	* arm-tdep.c (arm_return_in_memory): Likewise.
	* ax-gdb.c (gen_trace_static_fields): Likewise.
	(gen_struct_ref_recursive): Likewise.
	* c-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise.
	(variable: block COLONCOLON name): Likewise.
	(qualified_name: TYPENAME COLONCOLON name): Likewise.
	* c-lang.c (classify_type): Likewise.
	* c-typeprint.c (c_print_type): Likewise.
	(c_print_typedef): Likewise.
	(c_type_print_base): Likewise.
	* c-valprint.c (c_val_print): Likewise.
	* compile/compile-c-types.c (convert_type): Likewise.
	* compile/compile-object-load.c (get_out_value_type): Likewise.
	* completer.c (add_struct_fields): Likewise.
	(expression_completer): Likewise.
	* cp-namespace.c (cp_find_type_baseclass_by_name): Likewise.
	(cp_lookup_nested_symbol_1): Likewise.
	(cp_lookup_nested_symbol): Likewise.
	* cp-valprint.c (cp_print_value_fields): Likewise.
	(cp_print_static_field): Likewise.
	* d-valprint.c (d_val_print): Likewise.
	* eval.c (evaluate_subexp_standard): Likewise.
	(evaluate_subexp_for_sizeof): Likewise.
	* f-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise.
	* f-typeprint.c (f_type_print_base): Likewise.
	* f-valprint.c (f_val_print): Likewise.
	* gdbtypes.c (get_discrete_bounds): Likewise.
	(create_array_type_with_stride): Likewise.
	(type_name_no_tag_or_error): Likewise.
	(lookup_struct_elt_type): Likewise.
	(get_unsigned_type_max): Likewise.
	(internal_type_vptr_fieldno): Likewise.
	(set_type_vptr_fieldno): Likewise.
	(internal_type_vptr_basetype): Likewise.
	(set_type_vptr_basetype): Likewise.
        (get_vptr_fieldno): Likewise.
	(is_integral_type): Likewise.
	(is_scalar_type): Likewise.
        (is_scalar_type_recursive): Likewise.
	(distance_to_ancestor): Likewise.
	(is_unique_ancestor_worker): Likewise.
	(check_types_equal): Likewise.
	* gnu-v2-abi.c (gnuv2_value_rtti_type): Likewise.
	* gnu-v3-abi.c (gnuv3_dynamic_class): Likewise.
	(gnuv3_get_vtable): Likewise.
	(gnuv3_pass_by_reference): Likewise.
	* go-exp.y (exp : SIZEOF_KEYWORD '(' type ')' %prec UNARY): Likewise.
	* go-lang.c (gccgo_string_p): Likewise.
	(go_classify_struct_type): Likewise.
	* go-typeprint.c (go_print_type): Likewise.
	* go-valprint.c (go_val_print): Likewise.
	* guile/scm-math.c (vlscm_binop): Likewise.
	* guile/scm-value.c (gdbscm_value_dynamic_type): Likewise.
	(gdbscm_value_to_bytevector): Likewise.
	(gdbscm_value_to_bool): Likewise.
	(gdbscm_value_to_integer): Likewise.
	(gdbscm_value_to_real): Likewise.
	* infcall.c (call_function_by_hand_dummy): Likewise.
	* infcmd.c (get_return_value): Likewise.
	* jv-lang.c (is_object_type): Likewise.
	* jv-typeprint.c (java_type_print_base): Likewise.
	* jv-valprint.c (java_print_value_fields): Likewise.
	(java_val_print): Likewise.
	* linespec.c (find_methods): Likewise.
	(collect_one_symbol): Likewise.
	* m2-typeprint.c (m2_print_type): Likewise.
	(m2_print_typedef): Likewise.
	(m2_get_discrete_bounds): Likewise.
	* m2-valprint.c (m2_print_long_set): Likewise.
	(m2_print_unbounded_array): Likewise.
	(m2_print_array_contents): Likewise.
	(m2_val_print): Likewise.
	* opencl-lang.c (opencl_print_type): Likewise.
	* p-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise.
	* p-typeprint.c (pascal_print_type): Likewise.
	(pascal_print_typedef): Likewise.
	(pascal_type_print_base): Likewise.
	* p-valprint.c (pascal_val_print): Likewise.
	(pascal_object_print_value_fields): Likewise.
	(pascal_object_print_static_field): Likewise.
	* python/py-type.c (typy_fields_items): Likewise.
	(typy_get_composite): Likewise.
	* python/py-value.c (valpy_get_dynamic_type): Likewise.
	(valpy_binop): Likewise.
	(valpy_long): Likewise.
	(valpy_float): Likewise.
	* stack.c (return_command): Likewise.
	* symtab.c (check_field): Likewise.
	(lookup_symbol_aux): Likewise.
	* tic6x-tdep.c (tic6x_return_value): Likewise.
	* typeprint.c (print_type_scalar): Likewise.
	* valarith.c (value_vector_widen): Likewise.
	* valops.c (value_cast): Likewise.
	(value_assign): Likewise.
	(do_search_struct_field): Likewise.
	(search_struct_method): Likewise.
	(find_method_list): Likewise.
	* valprint.c (val_print_scalar_type_p): Likewise.
	(valprint_check_validity): Likewise.
	(generic_val_print): Likewise.
	* value.c (unpack_double): Likewise.
	(value_primitive_field): Likewise.
	(unpack_bits_as_long): Likewise.
2015-07-14 16:42:16 -04:00
Jan Kratochvil 46c03469b3 Remove stop_registers
Now stop_registers are no longer used and it can be removed.

I am not much sure what 'proceed_to_finish' really means now so I make a wild
guess while updating comments about it.

gdb/ChangeLog
2015-05-13  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdbthread.h (struct thread_control_state): Update comment for
	proceed_to_finish.
	* infcall.c (run_inferior_call): Update comment about
	proceed_to_finish.
	* infcmd.c (get_return_value): Update comment about stop_registers.
	(finish_forward): Update comment about proceed_to_finish.
	* infrun.c (stop_registers): Remove.
	(clear_proceed_status, normal_stop): Remove stop_registers handling.
	* infrun.h (stop_registers): Remove.
2015-05-13 20:49:45 +02:00
Jan Kratochvil 8a6c403112 infcall: stop_registers -> register_dummy_frame_dtor
With dummy_frame destructors GDB no longer has to use global stop_registers.
dummy_frame's registers can be now stored associated with their specific
dummy_frame.

gdb/ChangeLog
2015-05-13  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* infcall.c (struct dummy_frame_context_saver)
	(dummy_frame_context_saver_data_free, dummy_frame_context_saver_dtor)
	(dummy_frame_context_saver_drop, dummy_frame_context_saver_cleanup)
	(dummy_frame_context_saver_get_regs, dummy_frame_context_saver_setup):
	New.
	(call_function_by_hand_dummy): Move discard_cleanups of
	inf_status_cleanup before dummy_frame_push.  Call
	dummy_frame_context_saver_setup and prepare context_saver_cleanup.
	Use dummy_frame_context_saver_get_regs instead of stop_registers.
	* infcall.h (struct dummy_frame_context_saver)
	(dummy_frame_context_saver_drop, dummy_frame_context_saver_cleanup)
	(dummy_frame_context_saver_get_regs, dummy_frame_context_saver_setup):
	New declarations.
	* infcmd.c: Include infcall.h.
	(get_return_value): Add parameter ctx_saver, use it instead of
	stop_registers.
	(print_return_value): Add parameter ctx_saver, pass it.
	(struct finish_command_continuation_args): Add field ctx_saver.
	(finish_command_continuation): Update print_return_value caller.
	(finish_command_continuation_free_arg): Free also ctx_saver.
	(finish_forward): Call dummy_frame_context_saver_setup.
	* inferior.h (struct dummy_frame_context_saver): New declaration.
	(get_return_value): Add parameter ctx_saver.
	* python/py-finishbreakpoint.c (bpfinishpy_pre_stop_hook): Update
	get_return_value caller.
2015-05-13 20:49:08 +02:00
Jan Kratochvil dd9f02a0ca Remove unused declaration of print_return_value.
gdb/ChangeLog
2015-05-08  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* infcmd.c (print_return_value): Remove unused declaration.
2015-05-08 17:59:15 +02:00
Gary Benson a10de6046f Introduce exec_file_locate_attach
This commit adds a new function, exec_file_locate_attach, which works
like exec_file_attach except that, instead of a filename argument, it
takes an integer process ID and attempts to determine the executable
filename from that.

gdb/ChangeLog:

	* gdbcore.h (exec_file_locate_attach): New declaration.
	* exec.c (exec_file_locate_attach): New function, factored
	out from...
	* infcmd.c (attach_command_post_wait): ...here.
2015-04-17 09:47:30 +01:00
Jan Kratochvil 4f45d44599 Remove --xdb
Pedro Alves:

The commands that enables aren't even documented in the manual.
Judging from that, I assume that only wdb users would ever really
be using the --xdb switch.

I think it's time to drop "support" for the --xdb switch too.  I
looked through the commands that that exposes, the only that looked
potentially interesting was "go", but then it's just an alias
for "tbreak+jump", which can easily be done with "define go...end".
I'd rather free up the "go" name for something potentially
more interesting (either run control, or maybe even unrelated,
e.g., for golang).

gdb/ChangeLog
2015-04-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* NEWS (Changes since GDB 7.9): Add removed -xdb.
	* breakpoint.c (command_line_is_silent): Remove xdb_commands
	conditional.
	(_initialize_breakpoint): Remove xdb_commands for bc, ab, sb, db, ba
	and lb.
	* cli/cli-cmds.c (_initialize_cli_cmds): Remove xdb_commands for v and
	va.
	* cli/cli-decode.c (find_command_name_length): Remove xdb_commands
	conditional.
	* defs.h (xdb_commands): Remove declaration.
	* f-valprint.c (_initialize_f_valprint): Remove xdb_commands for lc.
	* guile/scm-cmd.c (command_classes): Remove xdb from comment.
	* infcmd.c (run_no_args_command, go_command): Remove.
	(_initialize_infcmd): Remove xdb_commands for S, go, g, R and lr.
	* infrun.c (xdb_handle_command): Remove.
	(_initialize_infrun): Remove xdb_commands for lz and z.
	* main.c (xdb_commands): Remove variable.
	(captured_main): Remove "xdb" from long_options.
	(print_gdb_help): Remove --xdb from help.
	* python/py-cmd.c (gdbpy_initialize_commands): Remove xdb from comment.
	* source.c (_initialize_source): Remove xdb_commands for D, ld, / and ?.
	* stack.c (backtrace_full_command, args_plus_locals_info)
	(current_frame_command): Remove.
	(_initialize_stack): Remove xdb_commands for t, T and l.
	* symtab.c (_initialize_symtab): Remove xdb_commands for lf and lg.
	* thread.c (_initialize_thread): Remove xdb_commands condition.
	* tui/tui-layout.c (tui_toggle_layout_command)
	(tui_toggle_split_layout_command, tui_handle_xdb_layout): Remove.
	(_initialize_tui_layout): Remove xdb_commands for td and ts.
	* tui/tui-regs.c (tui_scroll_regs_forward_command)
	(tui_scroll_regs_backward_command): Remove.
	(_initialize_tui_regs): Remove xdb_commands for fr, gr, sr, +r and -r.
	* tui/tui-win.c (tui_xdb_set_win_height_command): Remove.
	(_initialize_tui_win): Remove xdb_commands for U and w.
	* utils.c (pagination_on_command, pagination_off_command): Remove.
	(initialize_utils): Remove xdb_commands for am and sm.

gdb/doc/ChangeLog
2015-04-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.texinfo (Mode Options): Remove -xdb.
2015-04-11 19:49:03 +02:00
Pedro Alves 64ce06e4cd Remove 'step' parameters from 'proceed' and 'resume'
The "step" parameters of 'proceed' and 'resume' aren't really useful
as indication of whether run control wants to single-step the target,
as that information must already be retrievable from
currently_stepping.  In fact, if currently_stepping disagrees with
whether we single-stepped the target, then things break.  Thus instead
of having the same information in two places, this patch removes those
parameters.

Setting 'step_start_function' is the only user of proceed's 'step'
argument, other than passing the 'step' argument down to 'resume' and
debug log output.  Move that instead to set_step_frame, where we
already set other related fields.

clear_proceed_status keeps its "step" parameter for now because it
needs to know which set of threads should have their state cleared,
and is called before the "stepping_command" flag is set.

Tested on x86_64 Fedora 20, native and gdbserver.

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

	* breakpoint.c (until_break_command): Adjust call to proceed.
	* gdbthread.h (struct thread_control_state) <stepping_command>:
	New field.
	* infcall.c (run_inferior_call): Adjust call to proceed.
	* infcmd.c (run_command_1, proceed_thread_callback, continue_1):
	Adjust calls to proceed.
	(set_step_frame): Set the current thread's step_start_function
	here.
	(step_once): Adjust calls to proceed.
	(jump_command, signal_command, until_next_command)
	(finish_backward, finish_forward, proceed_after_attach_callback)
	(attach_command_post_wait): Adjust calls to proceed.
	* infrun.c (proceed_after_vfork_done): Adjust call to proceed.
	(do_target_resume): New function, factored out from ...
	(resume): ... here.  Remove 'step' parameter.  Instead, check
	currently_stepping to determine whether the thread should be
	single-stepped.
	(proceed): Remove 'step' parameter and don't set the thread's
	step_start_function here.  Adjust call to 'resume'.
	(handle_inferior_event): Adjust calls to 'resume'.
	(switch_back_to_stepped_thread): Use do_target_resume instead of
	'resume'.
	(keep_going): Adjust calls to 'resume'.
	* infrun.h (proceed): Remove 'step' parameter.
	(resume): Likewise.
	* windows-nat.c (do_initial_windows_stuff): Adjust call to
	'resume'.
	* mi/mi-main.c (proceed_thread): Adjust call to 'proceed'.
2015-03-24 17:55:53 +00:00
Pedro Alves 856e7dd698 Make "set scheduler-locking step" depend on user intention, only
Currently, "set scheduler-locking step" is a bit odd.  The manual
documents it as being optimized for stepping, so that focus of
debugging does not change unexpectedly, but then it says that
sometimes other threads may run, and thus focus may indeed change
unexpectedly...  A user can then be excused to get confused and wonder
why does GDB behave like this.

I don't think a user should have to know about details of how "next"
or whatever other run control command is implemented internally to
understand when does the "scheduler-locking step" setting take effect.

This patch completes a transition that the code has been moving
towards for a while.  It makes "set scheduler-locking step" hold
threads depending on whether the _command_ the user entered was a
stepping command [step/stepi/next/nexti], or not.

Before, GDB could end up locking threads even on "continue" if for
some reason run control decides a thread needs to be single stepped
(e.g., for a software watchpoint).

After, if a "continue" happens to need to single-step for some reason,
we won't lock threads (unless when stepping over a breakpoint,
naturally).  And if a stepping command wants to continue a thread for
bit, like when skipping a function to a step-resume breakpoint, we'll
still lock threads, so focus of debugging doesn't change.

In order to make this work, we need to record in the thread structure
whether what set it running was a stepping command.

(A follow up patch will remove the "step" parameters of 'proceed' and 'resume')

FWIW, Fedora GDB, which defaults to "scheduler-locking step" (mainline
defaults to "off") carries a different patch that goes in this
direction as well.

Tested on x86_64 Fedora 20, native and gdbserver.

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

	* gdbthread.h (struct thread_control_state) <stepping_command>:
	New field.
	* infcmd.c (step_once): Pass step=1 to clear_proceed_status.  Set
	the thread's stepping_command field.
	* infrun.c (resume): Check the thread's stepping_command flag to
	determine which threads should be resumed.  Rename 'entry_step'
	local to user_step.
	(clear_proceed_status_thread): Clear 'stepping_command'.
	(schedlock_applies): Change parameter type to struct thread_info
	pointer.  Adjust.
	(find_thread_needs_step_over): Remove 'step' parameter.  Adjust.
	(switch_back_to_stepped_thread): Adjust calls to
	'schedlock_applies'.
	(_initialize_infrun): Adjust "set scheduler-locking step" help.

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

	* gdb.threads/schedlock.exp (test_step): No longer expect that
	"set scheduler-locking step" with "next" over a function call runs
	threads unlocked.

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

	* gdb.texinfo (test_step) <set scheduler-locking step>: No longer
	mention that threads may sometimes run unlocked.
2015-03-24 17:50:31 +00:00
Pedro Alves 492d29ea1c Split TRY_CATCH into TRY + CATCH
This patch splits the TRY_CATCH macro into three, so that we go from
this:

~~~
  volatile gdb_exception ex;

  TRY_CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  if (ex.reason < 0)
    {
    }
~~~

to this:

~~~
  TRY
    {
    }
  CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  END_CATCH
~~~

Thus, we'll be getting rid of the local volatile exception object, and
declaring the caught exception in the catch block.

This allows reimplementing TRY/CATCH in terms of C++ exceptions when
building in C++ mode, while still allowing to build GDB in C mode
(using setjmp/longjmp), as a transition step.

TBC, after this patch, is it _not_ valid to have code between the TRY
and the CATCH blocks, like:

  TRY
    {
    }

  // some code here.

  CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  END_CATCH

Just like it isn't valid to do that with C++'s native try/catch.

By switching to creating the exception object inside the CATCH block
scope, we can get rid of all the explicitly allocated volatile
exception objects all over the tree, and map the CATCH block more
directly to C++'s catch blocks.

The majority of the TRY_CATCH -> TRY+CATCH+END_CATCH conversion was
done with a script, rerun from scratch at every rebase, no manual
editing involved.  After the mechanical conversion, a few places
needed manual intervention, to fix preexisting cases where we were
using the exception object outside of the TRY_CATCH block, and cases
where we were using "else" after a 'if (ex.reason) < 0)' [a CATCH
after this patch].  The result was folded into this patch so that GDB
still builds at each incremental step.

END_CATCH is necessary for two reasons:

First, because we name the exception object in the CATCH block, which
requires creating a scope, which in turn must be closed somewhere.
Declaring the exception variable in the initializer field of a for
block, like:

  #define CATCH(EXCEPTION, mask) \
    for (struct gdb_exception EXCEPTION; \
         exceptions_state_mc_catch (&EXCEPTION, MASK); \
	 EXCEPTION = exception_none)

would avoid needing END_CATCH, but alas, in C mode, we build with C90,
which doesn't allow mixed declarations and code.

Second, because when TRY/CATCH are wired to real C++ try/catch, as
long as we need to handle cleanup chains, even if there's no CATCH
block that wants to catch the exception, we need for stop at every
frame in the unwind chain and run cleanups, then rethrow.  That will
be done in END_CATCH.

After we require C++, we'll still need TRY/CATCH/END_CATCH until
cleanups are completely phased out -- TRY/CATCH in C++ mode will
save/restore the current cleanup chain, like in C mode, and END_CATCH
catches otherwise uncaugh exceptions, runs cleanups and rethrows, so
that C++ cleanups and exceptions can coexist.

IMO, this still makes the TRY/CATCH code look a bit more like a
newcomer would expect, so IMO worth it even if we weren't considering
C++.

gdb/ChangeLog.
2015-03-07  Pedro Alves  <palves@redhat.com>

	* common/common-exceptions.c (struct catcher) <exception>: No
	longer a pointer to volatile exception.  Now an exception value.
	<mask>: Delete field.
	(exceptions_state_mc_init): Remove all parameters.  Adjust.
	(exceptions_state_mc): No longer pop the catcher here.
	(exceptions_state_mc_catch): New function.
	(throw_exception): Adjust.
	* common/common-exceptions.h (exceptions_state_mc_init): Remove
	all parameters.
	(exceptions_state_mc_catch): Declare.
	(TRY_CATCH): Rename to ...
	(TRY): ... this.  Remove EXCEPTION and MASK parameters.
	(CATCH, END_CATCH): New.
	All callers adjusted.

gdb/gdbserver/ChangeLog:
2015-03-07  Pedro Alves  <palves@redhat.com>

	Adjust all callers of TRY_CATCH to use TRY/CATCH/END_CATCH
	instead.
2015-03-07 15:14:14 +00:00
Pedro Alves 7556d4a4f6 Normalize TRY_CATCH exception handling block
This normalizes some exception catch blocks that check for ex.reason
to look like this:

~~~
  volatile gdb_exception ex;

  TRY_CATCH (ex, RETURN_MASK_ALL)
    {
      ...
    }
  if (ex.reason < 0)
    {
      ...
    }
~~~

This is a preparation step for running a script that converts all
TRY_CATCH uses to look like this instead:

~~~
  TRY
    {
      ...
    }
  CATCH (ex, RETURN_MASK_ALL)
    {
      ...
    }
  END_CATCH
~~~

The motivation for that change is being able to reimplent TRY/CATCH in
terms of C++ try/catch.

This commit makes it so that:

 - no condition other than ex.reason < 0 is checked in the if
   predicate

 - there's no "else" block to check whether no exception was caught

 - there's no code between the TRY_CATCH (TRY) block and the
   'if (ex.reason < 0)' block (CATCH).

 - the exception object is no longer referred to outside the if/catch
   block.  Note the local volatile exception objects that are
   currently defined inside functions that use TRY_CATCH will
   disappear.  In cases it's more convenient to still refer to the
   exception outside the catch block, a new non-volatile local is
   added and copy to that object is made within the catch block.

The following patches should make this all clearer.

gdb/ChangeLog:
2015-03-07  Pedro Alves  <palves@redhat.com>

	* amd64-tdep.c (amd64_frame_cache, amd64_sigtramp_frame_cache)
	(amd64_epilogue_frame_cache): Normal exception handling code.
	* break-catch-throw.c (check_status_exception_catchpoint)
	(re_set_exception_catchpoint): Ditto.
	* cli/cli-interp.c (safe_execute_command):
	* cli/cli-script.c (script_from_file): Ditto.
	* compile/compile-c-symbols.c (generate_c_for_for_one_variable):
	Ditto.
	* compile/compile-object-run.c (compile_object_run): Ditto.
	* cp-abi.c (baseclass_offset): Ditto.
	* cp-valprint.c (cp_print_value): Ditto.
	* exceptions.c (catch_exceptions_with_msg):
	* frame-unwind.c (frame_unwind_try_unwinder): Ditto.
	* frame.c (get_frame_address_in_block_if_available): Ditto.
	* i386-tdep.c (i386_frame_cache, i386_epilogue_frame_cache)
	(i386_sigtramp_frame_cache): Ditto.
	* infcmd.c (post_create_inferior): Ditto.
	* linespec.c (parse_linespec, find_linespec_symbols):
	* p-valprint.c (pascal_object_print_value): Ditto.
	* parse.c (parse_expression_for_completion): Ditto.
	* python/py-finishbreakpoint.c (bpfinishpy_init): Ditto.
	* remote.c (remote_get_noisy_reply): Ditto.
	* s390-linux-tdep.c (s390_frame_unwind_cache): Ditto.
	* solib-svr4.c (solib_svr4_r_map): Ditto.
2015-03-07 14:56:43 +00:00
Gary Benson 61012eef84 New common function "startswith"
This commit introduces a new inline common function "startswith"
which takes two string arguments and returns nonzero if the first
string starts with the second.  It also updates the 295 places
where this logic was written out longhand to use the new function.

gdb/ChangeLog:

	* common/common-utils.h (startswith): New inline function.
	All places where this logic was used updated to use the above.
2015-03-06 09:42:06 +00:00
Antoine Tremblay 2f41223f62 Fix print of value type in a corner case of finish
When doing finish in a function, if gdb fails to return a value, gdb
also fails at printing the value type if this type is a struct.

For example :

(gdb) fin
....
Value returned has type: . Cannot determine contents

This patch fixes this by calling type_to_string to print the type
so that we can support these types.

This patch returns the following example output :

(gdb) fin
....
Value returned has type: struct test. Cannot determine contents

Also, this patch modifies structs.exp to check that we return the
correct type.

gdb/ChangeLog:
	* gdb/infcmd.c (print_return_value): use type_to_string to print type.

gdb/testsuite/ChangeLog:
	* gdb.base/structs.exp: Check for correct struct on finish.
2015-02-26 10:58:00 -05:00
Mark Wielaard 743649fd80 Use GCC5/DWARF5 DW_AT_noreturn to mark functions that don't return normally.
Add a flag field is_noreturn to struct func_type. Make calling_convention
a small bit field to not increase the size of the struct. Set is_noreturn
if the new GCC5/DWARF5 DW_AT_noreturn is set on a DW_TAG_subprogram.
Use this information to warn the user before doing a finish or return from
a function that does not return normally to its caller.

(gdb) finish
warning: Function endless does not return normally.
Try to finish anyway? (y or n)

(gdb) return
warning: Function does not return normally to caller.
Make endless return now? (y or n)

gdb/ChangeLog

	* dwarf2read.c (read_subroutine_type): Set TYPE_NO_RETURN from
	DW_AT_noreturn.
	* gdbtypes.h (struct func_type): Add is_noreturn field flag. Make
	calling_convention an 8 bit bit field.
	(TYPE_NO_RETURN): New macro.
	* infcmd.c (finish_command): Query if function does not return
	normally.
	* stack.c (return_command): Likewise.

gdb/testsuite/ChangeLog

	* gdb.base/noreturn-return.c: New file.
	* gdb.base/noreturn-return.exp: New file.
	* gdb.base/noreturn-finish.c: New file.
	* gdb.base/noreturn-finish.exp: New file.

include/ChangeLog

	* dwarf2.def (DW_AT_noreturn): New DWARF5 attribute.

The dwarf2.h addition and the code to emit the new attribute is already in
the gcc tree.
2015-01-23 17:29:19 +01: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
Doug Evans 08be3fe322 Replace some symbol accessor macros with functions.
gdb/ChangeLog:

	* symtab.h (SYMBOL_SYMTAB): Delete
	(SYMBOL_OBJFILE): Delete.
	(symbol_symtab, symbol_set_symtab): Declare.
	(symbol_objfile, symbol_arch): Declare.
	* symtab.c (symbol_symtab): Replaces SYMBOL_SYMTAB.  All uses updated.
	All references to symbol->symtab redirected through here.
	(symbol_set_symtab): New function.  All assignments to SYMBOL_SYMTAB
	redirected through here.
	(symbol_arch): New function.
	(symbol_objfile): New function.  Replaces SYMBOL_OBJFILE.
	All uses updated.
	* cp-namespace.c (cp_lookup_symbol_imports_or_template): Call
	symbol_arch.
	* findvar.c (default_read_var_value): Call symbol_arch.
	* guile/scm-frame.c (gdbscm_frame_block): Call symbol_objfile.
	* jv-lang.c (add_class_symtab_symbol): Call symbol_arch.
	* printcmd.c (address_info): Call symbol_arch.
	* tracepoint.c (scope_info): Call symbol_arch.
2014-12-23 07:21:10 -08:00
Yao Qi cc86d1cb95 Refactor gdbarch method print_float_info
This patch is to change print_float_info gdbarch method for the
following two reasons,

 1. we want to add a default implementation of print_float_info to
    dump the float pointer registers.  It can be reused by backend to
    print something more than float point registers.
 2. we want to simplify the caller of print_float_info,
    infcmd.c:print_float_info.

gdb:

2014-12-18  Yao Qi  <yao@codesourcery.com>

 	* gdbarch.sh (print_float_info): Change its type from 'M' to 'm'.
	* gdbarch.c: Re-generated.
	* gdbarch.h: Likewise.
	* infcmd.c (default_print_float_info): New function.
	(print_float_info): Removed.  Move code to
	default_print_float_info.
	(float_info): Adjust to call gdbarch_print_float_info.
	* inferior.h (default_print_float_info): Declare it.
2014-12-18 20:47:28 +08:00
Doug Evans 253342b8e6 infcmd.c (jump_command): Minor simplification.
gdb/ChangeLog:

	* infcmd.c (jump_command): Minor simplification.
2014-12-18 01:32:59 -08:00
Andreas Arnez 71c247087c Provide completer for "info registers"
Provide a new completion function for the argument of "info
registers", "info all-registers", and the "lr" command in dbx mode.
Without this patch the default symbol completer is used, which is more
confusing than helpful.

Also add a test for this new feature to "completion.exp": Determine
the target's available set of registers/reggroups and compare this to
the completion of "info registers ".  For determining the available
registers involve the new "maint print user-registers" command.

gdb/ChangeLog:

	* completer.c: Include "target.h", "reggroups.h", and
	"user-regs.h".
	(reg_or_group_completer): New.
	* completer.h (reg_or_group_completer): Declare.
	* infcmd.c (_initialize_infcmd): Set reg_or_group_completer for
	the "info registers" and "info all-registers" commands and the
	dbx-mode "lr" command.

gdb/testsuite/ChangeLog:

	* gdb.base/completion.exp: Add test for completion of "info
	registers ".
2014-12-12 17:11:22 +01:00
Pedro Alves 6c4486e63f PR gdb/17471: Repeating a background command makes it foreground
When we repeat a command, by just pressing <ret>, the input from the
previous command is reused for the new command invocation.

When an execution command strips the "&" out of its incoming argument
string, to detect background execution, we poke a '\0' directly to the
incoming argument string.

Combine both, and a repeat of a background command loses the "&".

This is actually only visible if args other than "&" are specified
(e.g., "c 1&" or "next 2&" or "c -a&"), as in the special case of "&"
alone (e.g. "c&") doesn't actually clobber the incoming string.

Fix this by making strip_bg_char return a new string instead of poking
a hole in the input string.

New test included.

Tested on x86_64 Fedora 20, native and gdbserver.

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

	PR gdb/17471
	* infcmd.c (strip_bg_char): Change prototype and rewrite.  Now
	returns a copy of the input.
	(run_command_1, continue_command, step_1, jump_command)
	(signal_command, until_command, advance_command, finish_command)
	(attach_command): Adjust and install a cleanup to free the
	stripped args.

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

	PR gdb/17471
	* gdb.base/bg-execution-repeat.c: New file.
	* gdb.base/bg-execution-repeat.exp: New file.
2014-10-17 13:34:16 +01:00
Pedro Alves 0ff33695ee PR gdb/17300: Input after "c -a" crashes readline/GDB
If all threads in the target were already running when the user does
"c -a", nothing puts the inferior's terminal settings in effect and
removes stdin from the event loop, which we must when running a
foreground command.  The result is that user input afterwards crashes
readline/gdb:

 (gdb) start
 Temporary breakpoint 1 at 0x4005d4: file continue-all-already-running.c, line 23.
 Starting program: continue-all-already-running

 Temporary breakpoint 1, main () at continue-all-already-running.c:23
 23        sleep (10);
 (gdb) c -a&
 Continuing.
 (gdb) c -a
 Continuing.
 p 1
 readline: readline_callback_read_char() called with no handler!
 Aborted (core dumped)
 $

Backtrace:

 Program received signal SIGABRT, Aborted.
 0x0000003b36a35877 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
 56        return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
 (top-gdb) p 1
 $1 = 1
 (top-gdb) bt
 #0  0x0000003b36a35877 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
 #1  0x0000003b36a36f68 in __GI_abort () at abort.c:89
 #2  0x0000000000784aa9 in rl_callback_read_char () at readline/callback.c:116
 #3  0x0000000000619181 in rl_callback_read_char_wrapper (client_data=0x0) at gdb/event-top.c:167
 #4  0x0000000000619557 in stdin_event_handler (error=0, client_data=0x0) at gdb/event-top.c:373
 #5  0x000000000061814a in handle_file_event (data=...) at gdb/event-loop.c:763
 #6  0x0000000000617631 in process_event () at gdb/event-loop.c:340
 #7  0x00000000006176f8 in gdb_do_one_event () at gdb/event-loop.c:404
 #8  0x0000000000617748 in start_event_loop () at gdb/event-loop.c:429
 #9  0x00000000006191b3 in cli_command_loop (data=0x0) at gdb/event-top.c:182
 #10 0x000000000060f538 in current_interp_command_loop () at gdb/interps.c:318
 #11 0x0000000000610701 in captured_command_loop (data=0x0) at gdb/main.c:323
 #12 0x000000000060c3f5 in catch_errors (func=0x6106e6 <captured_command_loop>, func_args=0x0, errstring=0x9002c1 "", mask=RETURN_MASK_ALL)
     at gdb/exceptions.c:237
 #13 0x0000000000611bff in captured_main (data=0x7fffffffd780) at gdb/main.c:1151
 #14 0x000000000060c3f5 in catch_errors (func=0x610afe <captured_main>, func_args=0x7fffffffd780, errstring=0x9002c1 "", mask=RETURN_MASK_ALL)
     at gdb/exceptions.c:237
 #15 0x0000000000611c28 in gdb_main (args=0x7fffffffd780) at gdb/main.c:1159
 #16 0x000000000045ef97 in main (argc=5, argv=0x7fffffffd888) at gdb/gdb.c:32
 (top-gdb)

Tested on x86_64 Fedora 20, native and gdbserver.

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

	PR gdb/17300
	* infcmd.c (continue_1): If continuing all threads in the
	foreground, make sure the inferior's terminal settings are put in
	effect.

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

	PR gdb/17300
	* gdb.base/continue-all-already-running.c: New file.
	* gdb.base/continue-all-already-running.exp: New file.
2014-10-17 13:33:30 +01:00
Gary Benson c765fdb902 Remove spurious exceptions.h inclusions
defs.h includes utils.h, and utils.h includes exceptions.h.  All GDB
.c files include defs.h as their first line, so no file other than
utils.h needs to include exceptions.h.  This commit removes all such
inclusions.

gdb/ChangeLog:

	* ada-lang.c: Do not include exceptions.h.
	* ada-valprint.c: Likewise.
	* amd64-tdep.c: Likewise.
	* auto-load.c: Likewise.
	* block.c: Likewise.
	* break-catch-throw.c: Likewise.
	* breakpoint.c: Likewise.
	* btrace.c: Likewise.
	* c-lang.c: Likewise.
	* cli/cli-cmds.c: Likewise.
	* cli/cli-interp.c: Likewise.
	* cli/cli-script.c: Likewise.
	* completer.c: Likewise.
	* corefile.c: Likewise.
	* corelow.c: Likewise.
	* cp-abi.c: Likewise.
	* cp-support.c: Likewise.
	* cp-valprint.c: Likewise.
	* darwin-nat.c: Likewise.
	* dwarf2-frame-tailcall.c: Likewise.
	* dwarf2-frame.c: Likewise.
	* dwarf2loc.c: Likewise.
	* dwarf2read.c: Likewise.
	* eval.c: Likewise.
	* event-loop.c: Likewise.
	* event-top.c: Likewise.
	* f-valprint.c: Likewise.
	* frame-unwind.c: Likewise.
	* frame.c: Likewise.
	* gdbtypes.c: Likewise.
	* gnu-v2-abi.c: Likewise.
	* gnu-v3-abi.c: Likewise.
	* guile/scm-auto-load.c: Likewise.
	* guile/scm-breakpoint.c: Likewise.
	* guile/scm-cmd.c: Likewise.
	* guile/scm-frame.c: Likewise.
	* guile/scm-lazy-string.c: Likewise.
	* guile/scm-param.c: Likewise.
	* guile/scm-symbol.c: Likewise.
	* guile/scm-type.c: Likewise.
	* hppa-hpux-tdep.c: Likewise.
	* i386-tdep.c: Likewise.
	* inf-loop.c: Likewise.
	* infcall.c: Likewise.
	* infcmd.c: Likewise.
	* infrun.c: Likewise.
	* interps.c: Likewise.
	* interps.h: Likewise.
	* jit.c: Likewise.
	* linespec.c: Likewise.
	* linux-nat.c: Likewise.
	* linux-thread-db.c: Likewise.
	* m32r-rom.c: Likewise.
	* main.c: Likewise.
	* memory-map.c: Likewise.
	* mi/mi-cmd-break.c: Likewise.
	* mi/mi-cmd-stack.c: Likewise.
	* mi/mi-interp.c: Likewise.
	* mi/mi-main.c: Likewise.
	* monitor.c: Likewise.
	* nto-procfs.c: Likewise.
	* objc-lang.c: Likewise.
	* p-valprint.c: Likewise.
	* parse.c: Likewise.
	* ppc-linux-tdep.c: Likewise.
	* printcmd.c: Likewise.
	* probe.c: Likewise.
	* python/py-auto-load.c: Likewise.
	* python/py-breakpoint.c: Likewise.
	* python/py-cmd.c: Likewise.
	* python/py-finishbreakpoint.c: Likewise.
	* python/py-frame.c: Likewise.
	* python/py-framefilter.c: Likewise.
	* python/py-function.c: Likewise.
	* python/py-gdb-readline.c: Likewise.
	* python/py-inferior.c: Likewise.
	* python/py-infthread.c: Likewise.
	* python/py-lazy-string.c: Likewise.
	* python/py-linetable.c: Likewise.
	* python/py-param.c: Likewise.
	* python/py-prettyprint.c: Likewise.
	* python/py-symbol.c: Likewise.
	* python/py-type.c: Likewise.
	* python/py-value.c: Likewise.
	* python/python-internal.h: Likewise.
	* python/python.c: Likewise.
	* record-btrace.c: Likewise.
	* record-full.c: Likewise.
	* regcache.c: Likewise.
	* remote-fileio.c: Likewise.
	* remote-mips.c: Likewise.
	* remote.c: Likewise.
	* rs6000-aix-tdep.c: Likewise.
	* rs6000-nat.c: Likewise.
	* skip.c: Likewise.
	* solib-darwin.c: Likewise.
	* solib-dsbt.c: Likewise.
	* solib-frv.c: Likewise.
	* solib-ia64-hpux.c: Likewise.
	* solib-spu.c: Likewise.
	* solib-svr4.c: Likewise.
	* solib.c: Likewise.
	* spu-tdep.c: Likewise.
	* stack.c: Likewise.
	* stap-probe.c: Likewise.
	* symfile-mem.c: Likewise.
	* symmisc.c: Likewise.
	* target.c: Likewise.
	* thread.c: Likewise.
	* top.c: Likewise.
	* tracepoint.c: Likewise.
	* tui/tui-interp.c: Likewise.
	* typeprint.c: Likewise.
	* utils.c: Likewise.
	* valarith.c: Likewise.
	* valops.c: Likewise.
	* valprint.c: Likewise.
	* value.c: Likewise.
	* varobj.c: Likewise.
	* windows-nat.c: Likewise.
	* xml-support.c: Likewise.
2014-10-08 09:33:22 +01:00
Doug Evans 81219e5358 New command queue-signal.
If I want to change the signalled state of multiple threads
it's a bit cumbersome to do with the "signal" command.
What you really want is a way to set the signal state of the
desired threads and then just do "continue".

This patch adds a new command, queue-signal, to accomplish this.
Basically "signal N" == "queue-signal N" + "continue".
That's not precisely true in that "signal" can be used to inject
any signal, including signals set to "nopass"; whereas "queue-signal"
just queues the signal as if the thread stopped because of it.
"nopass" handling is done when the thread is resumed which
"queue-signal" doesn't do.

One could add extra complexity to allow queue-signal to be used to
deliver "nopass" signals like the "signal" command.  I have no current
need for it so in the interests of incremental complexity, I have
left such support out and just have the code flag an error if one
tries to queue a nopass signal.

gdb/ChangeLog:

	* NEWS: Mention new "queue-signal" command.
	* infcmd.c (queue_signal_command): New function.
	(_initialize_infcmd): Add new queue-signal command.

gdb/doc/ChangeLog:

	* gdb.texinfo (Signaling): Document new queue-signal command.

gdb/testsuite/ChangeLog:

	* gdb.threads/queue-signal.c: New file.
	* gdb.threads/queue-signal.exp: New file.
2014-09-13 21:44:00 -07:00
Doug Evans 0d41ba00c6 infcmd.c (program_info): Fix typo.
gdb/ChangeLog:

	* infcmd.c (program_info): Fix typo.
2014-09-06 08:24:56 -07:00
Pedro Alves 656e8868f3 infcmd.c: Remove stale TODO
This TODO has been stale for over 2 years.  In bd5635a1 (1991), we
already see the comment, when we only had a bare attach_command:

 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /*
  * TODO:
  * Should save/restore the tty state since it might be that the
  * program to be debugged was started on this tty and it wants
  * the tty in some state other than what we want.  If it's running
  * on another terminal or without a terminal, then saving and
  * restoring the tty state is a harmless no-op.
  * This only needs to be done if we are attaching to a process.
  */

 /*
  * attach_command --
  * takes a program started up outside of gdb and ``attaches'' to it.
  * This stops it cold in its tracks and allows us to start tracing it.
  * For this to work, we must be able to send the process a
  * signal and we must have the same effective uid as the program.
  */
 void
 attach_command (args, from_tty)
      char *args;
      int from_tty;
 {
   target_attach (args, from_tty);
 }
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Later in b5a3d2aa (1992) target_terminal_init, etc. calls are added to
attach_command, and in 7e97eb28 (1992) we see:

+      /* If we attached to the process, we might or might not be sharing
+        a terminal.  Avoid printing error msg if we are unable to set our
+        terminal's process group to his process group ID.  */
+      if (!attach_flag) {
+       OOPSY ("ioctl TIOCSPGRP");

Clearly the TODO has been stale for a long while.

I considered preserving the text elsewhere, but then thought the
comments in inflow.c already have all the necessary info.

gdb/ChangeLog:

	* infcmd.c (attach_command): Remove comment.
2014-08-21 17:09:24 +01:00
Gary Benson 6d3d12ebef Include string.h in common-defs.h
This commit includes string.h in common-defs.h and removes all other
inclusions.

gdb/
2014-08-07  Gary Benson  <gbenson@redhat.com>

	* common/common-defs.h: Include string.h.
	* aarch64-tdep.c: Do not include string.h.
	* ada-exp.y: Likewise.
	* ada-lang.c: Likewise.
	* ada-lex.l: Likewise.
	* ada-typeprint.c: Likewise.
	* ada-valprint.c: Likewise.
	* aix-thread.c: Likewise.
	* alpha-linux-tdep.c: Likewise.
	* alpha-mdebug-tdep.c: Likewise.
	* alpha-nat.c: Likewise.
	* alpha-osf1-tdep.c: Likewise.
	* alpha-tdep.c: Likewise.
	* alphanbsd-tdep.c: Likewise.
	* amd64-dicos-tdep.c: Likewise.
	* amd64-linux-tdep.c: Likewise.
	* amd64-nat.c: Likewise.
	* amd64-sol2-tdep.c: Likewise.
	* amd64fbsd-tdep.c: Likewise.
	* amd64obsd-tdep.c: Likewise.
	* arch-utils.c: Likewise.
	* arm-linux-nat.c: Likewise.
	* arm-linux-tdep.c: Likewise.
	* arm-tdep.c: Likewise.
	* arm-wince-tdep.c: Likewise.
	* armbsd-tdep.c: Likewise.
	* armnbsd-nat.c: Likewise.
	* armnbsd-tdep.c: Likewise.
	* armobsd-tdep.c: Likewise.
	* avr-tdep.c: Likewise.
	* ax-gdb.c: Likewise.
	* ax-general.c: Likewise.
	* bcache.c: Likewise.
	* bfin-tdep.c: Likewise.
	* breakpoint.c: Likewise.
	* build-id.c: Likewise.
	* buildsym.c: Likewise.
	* c-exp.y: Likewise.
	* c-lang.c: Likewise.
	* c-typeprint.c: Likewise.
	* c-valprint.c: Likewise.
	* charset.c: Likewise.
	* cli-out.c: Likewise.
	* cli/cli-cmds.c: Likewise.
	* cli/cli-decode.c: Likewise.
	* cli/cli-dump.c: Likewise.
	* cli/cli-interp.c: Likewise.
	* cli/cli-logging.c: Likewise.
	* cli/cli-script.c: Likewise.
	* cli/cli-setshow.c: Likewise.
	* cli/cli-utils.c: Likewise.
	* coffread.c: Likewise.
	* common/agent.c: Likewise.
	* common/buffer.c: Likewise.
	* common/buffer.h: Likewise.
	* common/common-utils.c: Likewise.
	* common/filestuff.c: Likewise.
	* common/filestuff.c: Likewise.
	* common/format.c: Likewise.
	* common/print-utils.c: Likewise.
	* common/rsp-low.c: Likewise.
	* common/signals.c: Likewise.
	* common/vec.h: Likewise.
	* common/xml-utils.c: Likewise.
	* core-regset.c: Likewise.
	* corefile.c: Likewise.
	* corelow.c: Likewise.
	* cp-abi.c: Likewise.
	* cp-name-parser.y: Likewise.
	* cp-support.c: Likewise.
	* cp-valprint.c: Likewise.
	* cris-tdep.c: Likewise.
	* d-exp.y: Likewise.
	* darwin-nat.c: Likewise.
	* dbxread.c: Likewise.
	* dcache.c: Likewise.
	* demangle.c: Likewise.
	* dicos-tdep.c: Likewise.
	* disasm.c: Likewise.
	* doublest.c: Likewise.
	* dsrec.c: Likewise.
	* dummy-frame.c: Likewise.
	* dwarf2-frame.c: Likewise.
	* dwarf2loc.c: Likewise.
	* dwarf2read.c: Likewise.
	* elfread.c: Likewise.
	* environ.c: Likewise.
	* eval.c: Likewise.
	* event-loop.c: Likewise.
	* exceptions.c: Likewise.
	* exec.c: Likewise.
	* expprint.c: Likewise.
	* f-exp.y: Likewise.
	* f-lang.c: Likewise.
	* f-typeprint.c: Likewise.
	* f-valprint.c: Likewise.
	* fbsd-nat.c: Likewise.
	* findcmd.c: Likewise.
	* findvar.c: Likewise.
	* fork-child.c: Likewise.
	* frame.c: Likewise.
	* frv-linux-tdep.c: Likewise.
	* frv-tdep.c: Likewise.
	* gdb.c: Likewise.
	* gdb_bfd.c: Likewise.
	* gdbarch.c: Likewise.
	* gdbarch.sh: Likewise.
	* gdbtypes.c: Likewise.
	* gnu-nat.c: Likewise.
	* gnu-v2-abi.c: Likewise.
	* gnu-v3-abi.c: Likewise.
	* go-exp.y: Likewise.
	* go-lang.c: Likewise.
	* go32-nat.c: Likewise.
	* guile/guile.c: Likewise.
	* guile/scm-auto-load.c: Likewise.
	* hppa-hpux-tdep.c: Likewise.
	* hppa-linux-nat.c: Likewise.
	* hppanbsd-tdep.c: Likewise.
	* hppaobsd-tdep.c: Likewise.
	* i386-cygwin-tdep.c: Likewise.
	* i386-dicos-tdep.c: Likewise.
	* i386-linux-tdep.c: Likewise.
	* i386-nto-tdep.c: Likewise.
	* i386-sol2-tdep.c: Likewise.
	* i386-tdep.c: Likewise.
	* i386bsd-tdep.c: Likewise.
	* i386gnu-nat.c: Likewise.
	* i386nbsd-tdep.c: Likewise.
	* i386obsd-tdep.c: Likewise.
	* i387-tdep.c: Likewise.
	* ia64-libunwind-tdep.c: Likewise.
	* ia64-linux-nat.c: Likewise.
	* inf-child.c: Likewise.
	* inf-ptrace.c: Likewise.
	* inf-ttrace.c: Likewise.
	* infcall.c: Likewise.
	* infcmd.c: Likewise.
	* inflow.c: Likewise.
	* infrun.c: Likewise.
	* interps.c: Likewise.
	* iq2000-tdep.c: Likewise.
	* irix5-nat.c: Likewise.
	* jv-exp.y: Likewise.
	* jv-lang.c: Likewise.
	* jv-typeprint.c: Likewise.
	* jv-valprint.c: Likewise.
	* language.c: Likewise.
	* linux-fork.c: Likewise.
	* linux-nat.c: Likewise.
	* lm32-tdep.c: Likewise.
	* m2-exp.y: Likewise.
	* m2-typeprint.c: Likewise.
	* m32c-tdep.c: Likewise.
	* m32r-linux-nat.c: Likewise.
	* m32r-linux-tdep.c: Likewise.
	* m32r-rom.c: Likewise.
	* m32r-tdep.c: Likewise.
	* m68hc11-tdep.c: Likewise.
	* m68k-tdep.c: Likewise.
	* m68kbsd-tdep.c: Likewise.
	* m68klinux-nat.c: Likewise.
	* m68klinux-tdep.c: Likewise.
	* m88k-tdep.c: Likewise.
	* machoread.c: Likewise.
	* macrocmd.c: Likewise.
	* main.c: Likewise.
	* mdebugread.c: Likewise.
	* mem-break.c: Likewise.
	* memattr.c: Likewise.
	* memory-map.c: Likewise.
	* mep-tdep.c: Likewise.
	* mi/mi-cmd-break.c: Likewise.
	* mi/mi-cmd-disas.c: Likewise.
	* mi/mi-cmd-env.c: Likewise.
	* mi/mi-cmd-stack.c: Likewise.
	* mi/mi-cmd-var.c: Likewise.
	* mi/mi-cmds.c: Likewise.
	* mi/mi-console.c: Likewise.
	* mi/mi-getopt.c: Likewise.
	* mi/mi-interp.c: Likewise.
	* mi/mi-main.c: Likewise.
	* mi/mi-parse.c: Likewise.
	* microblaze-rom.c: Likewise.
	* microblaze-tdep.c: Likewise.
	* mingw-hdep.c: Likewise.
	* minidebug.c: Likewise.
	* minsyms.c: Likewise.
	* mips-irix-tdep.c: Likewise.
	* mips-linux-tdep.c: Likewise.
	* mips-tdep.c: Likewise.
	* mips64obsd-tdep.c: Likewise.
	* mipsnbsd-tdep.c: Likewise.
	* mipsread.c: Likewise.
	* mn10300-linux-tdep.c: Likewise.
	* mn10300-tdep.c: Likewise.
	* monitor.c: Likewise.
	* moxie-tdep.c: Likewise.
	* mt-tdep.c: Likewise.
	* nat/linux-btrace.c: Likewise.
	* nat/linux-osdata.c: Likewise.
	* nat/linux-procfs.c: Likewise.
	* nat/linux-ptrace.c: Likewise.
	* nat/linux-waitpid.c: Likewise.
	* nbsd-tdep.c: Likewise.
	* nios2-linux-tdep.c: Likewise.
	* nto-procfs.c: Likewise.
	* nto-tdep.c: Likewise.
	* objc-lang.c: Likewise.
	* objfiles.c: Likewise.
	* opencl-lang.c: Likewise.
	* osabi.c: Likewise.
	* osdata.c: Likewise.
	* p-exp.y: Likewise.
	* p-lang.c: Likewise.
	* p-typeprint.c: Likewise.
	* parse.c: Likewise.
	* posix-hdep.c: Likewise.
	* ppc-linux-nat.c: Likewise.
	* ppc-sysv-tdep.c: Likewise.
	* ppcfbsd-tdep.c: Likewise.
	* ppcnbsd-tdep.c: Likewise.
	* ppcobsd-tdep.c: Likewise.
	* printcmd.c: Likewise.
	* procfs.c: Likewise.
	* prologue-value.c: Likewise.
	* python/py-auto-load.c: Likewise.
	* python/py-gdb-readline.c: Likewise.
	* ravenscar-thread.c: Likewise.
	* regcache.c: Likewise.
	* registry.c: Likewise.
	* remote-fileio.c: Likewise.
	* remote-m32r-sdi.c: Likewise.
	* remote-mips.c: Likewise.
	* remote-notif.c: Likewise.
	* remote-sim.c: Likewise.
	* remote.c: Likewise.
	* reverse.c: Likewise.
	* rs6000-aix-tdep.c: Likewise.
	* ser-base.c: Likewise.
	* ser-go32.c: Likewise.
	* ser-mingw.c: Likewise.
	* ser-pipe.c: Likewise.
	* ser-tcp.c: Likewise.
	* ser-unix.c: Likewise.
	* serial.c: Likewise.
	* sh-tdep.c: Likewise.
	* sh64-tdep.c: Likewise.
	* shnbsd-tdep.c: Likewise.
	* skip.c: Likewise.
	* sol-thread.c: Likewise.
	* solib-dsbt.c: Likewise.
	* solib-frv.c: Likewise.
	* solib-osf.c: Likewise.
	* solib-som.c: Likewise.
	* solib-spu.c: Likewise.
	* solib-target.c: Likewise.
	* solib.c: Likewise.
	* somread.c: Likewise.
	* source.c: Likewise.
	* sparc-nat.c: Likewise.
	* sparc-sol2-tdep.c: Likewise.
	* sparc-tdep.c: Likewise.
	* sparc64-tdep.c: Likewise.
	* sparc64fbsd-tdep.c: Likewise.
	* sparc64nbsd-tdep.c: Likewise.
	* sparcnbsd-tdep.c: Likewise.
	* spu-linux-nat.c: Likewise.
	* spu-multiarch.c: Likewise.
	* spu-tdep.c: Likewise.
	* stabsread.c: Likewise.
	* stack.c: Likewise.
	* std-regs.c: Likewise.
	* symfile.c: Likewise.
	* symmisc.c: Likewise.
	* symtab.c: Likewise.
	* target.c: Likewise.
	* thread.c: Likewise.
	* tilegx-linux-nat.c: Likewise.
	* tilegx-tdep.c: Likewise.
	* top.c: Likewise.
	* tracepoint.c: Likewise.
	* tui/tui-command.c: Likewise.
	* tui/tui-data.c: Likewise.
	* tui/tui-disasm.c: Likewise.
	* tui/tui-file.c: Likewise.
	* tui/tui-layout.c: Likewise.
	* tui/tui-out.c: Likewise.
	* tui/tui-regs.c: Likewise.
	* tui/tui-source.c: Likewise.
	* tui/tui-stack.c: Likewise.
	* tui/tui-win.c: Likewise.
	* tui/tui-windata.c: Likewise.
	* tui/tui-winsource.c: Likewise.
	* typeprint.c: Likewise.
	* ui-file.c: Likewise.
	* ui-out.c: Likewise.
	* user-regs.c: Likewise.
	* utils.c: Likewise.
	* v850-tdep.c: Likewise.
	* valarith.c: Likewise.
	* valops.c: Likewise.
	* valprint.c: Likewise.
	* value.c: Likewise.
	* varobj.c: Likewise.
	* vax-tdep.c: Likewise.
	* vaxnbsd-tdep.c: Likewise.
	* vaxobsd-tdep.c: Likewise.
	* windows-nat.c: Likewise.
	* xcoffread.c: Likewise.
	* xml-support.c: Likewise.
	* xstormy16-tdep.c: Likewise.
	* xtensa-linux-nat.c: Likewise.

gdb/gdbserver/
2014-08-07  Gary Benson  <gbenson@redhat.com>

	* server.h: Do not include string.h.
	* event-loop.c: Likewise.
	* linux-low.c: Likewise.
	* regcache.c: Likewise.
	* remote-utils.c: Likewise.
	* spu-low.c: Likewise.
	* utils.c: Likewise.
2014-08-07 09:06:47 +01:00
Gary Benson dccbb60975 Include gdb_assert.h in common-defs.h
This commit includes gdb_assert.h in common-defs.h and removes all
other inclusions.

gdb/
2014-08-07  Gary Benson  <gbenson@redhat.com>

	* common/common-defs.h: Include gdb_assert.h.
	* aarch64-tdep.c: Do not include gdb_assert.h.
	* addrmap.c: Likewise.
	* aix-thread.c: Likewise.
	* alpha-linux-tdep.c: Likewise.
	* alpha-mdebug-tdep.c: Likewise.
	* alphanbsd-tdep.c: Likewise.
	* amd64-nat.c: Likewise.
	* amd64-tdep.c: Likewise.
	* amd64bsd-nat.c: Likewise.
	* amd64fbsd-nat.c: Likewise.
	* amd64fbsd-tdep.c: Likewise.
	* amd64nbsd-nat.c: Likewise.
	* amd64nbsd-tdep.c: Likewise.
	* amd64obsd-nat.c: Likewise.
	* amd64obsd-tdep.c: Likewise.
	* arch-utils.c: Likewise.
	* arm-tdep.c: Likewise.
	* armbsd-tdep.c: Likewise.
	* auxv.c: Likewise.
	* bcache.c: Likewise.
	* bfin-tdep.c: Likewise.
	* blockframe.c: Likewise.
	* breakpoint.c: Likewise.
	* bsd-kvm.c: Likewise.
	* bsd-uthread.c: Likewise.
	* buildsym.c: Likewise.
	* c-exp.y: Likewise.
	* c-lang.c: Likewise.
	* charset.c: Likewise.
	* cleanups.c: Likewise.
	* cli-out.c: Likewise.
	* cli/cli-decode.c: Likewise.
	* cli/cli-dump.c: Likewise.
	* cli/cli-logging.c: Likewise.
	* cli/cli-script.c: Likewise.
	* cli/cli-utils.c: Likewise.
	* coffread.c: Likewise.
	* common/common-utils.c: Likewise.
	* common/queue.h: Likewise.
	* common/signals.c: Likewise.
	* common/vec.h: Likewise.
	* complaints.c: Likewise.
	* completer.c: Likewise.
	* corelow.c: Likewise.
	* cp-abi.c: Likewise.
	* cp-name-parser.y: Likewise.
	* cp-namespace.c: Likewise.
	* cp-support.c: Likewise.
	* cris-tdep.c: Likewise.
	* dbxread.c: Likewise.
	* dictionary.c: Likewise.
	* doublest.c: Likewise.
	* dsrec.c: Likewise.
	* dummy-frame.c: Likewise.
	* dwarf2-frame-tailcall.c: Likewise.
	* dwarf2-frame.c: Likewise.
	* dwarf2expr.c: Likewise.
	* dwarf2loc.c: Likewise.
	* dwarf2read.c: Likewise.
	* eval.c: Likewise.
	* event-loop.c: Likewise.
	* exceptions.c: Likewise.
	* expprint.c: Likewise.
	* f-valprint.c: Likewise.
	* fbsd-nat.c: Likewise.
	* findvar.c: Likewise.
	* frame-unwind.c: Likewise.
	* frame.c: Likewise.
	* frv-tdep.c: Likewise.
	* gcore.c: Likewise.
	* gdb-dlfcn.c: Likewise.
	* gdb_bfd.c: Likewise.
	* gdbarch.c: Likewise.
	* gdbarch.sh: Likewise.
	* gdbtypes.c: Likewise.
	* gnu-nat.c: Likewise.
	* gnu-v3-abi.c: Likewise.
	* go-lang.c: Likewise.
	* guile/scm-exception.c: Likewise.
	* guile/scm-gsmob.c: Likewise.
	* guile/scm-lazy-string.c: Likewise.
	* guile/scm-math.c: Likewise.
	* guile/scm-pretty-print.c: Likewise.
	* guile/scm-safe-call.c: Likewise.
	* guile/scm-utils.c: Likewise.
	* guile/scm-value.c: Likewise.
	* h8300-tdep.c: Likewise.
	* hppa-hpux-nat.c: Likewise.
	* hppa-tdep.c: Likewise.
	* hppanbsd-tdep.c: Likewise.
	* hppaobsd-tdep.c: Likewise.
	* i386-darwin-nat.c: Likewise.
	* i386-darwin-tdep.c: Likewise.
	* i386-nto-tdep.c: Likewise.
	* i386-tdep.c: Likewise.
	* i386bsd-nat.c: Likewise.
	* i386fbsd-tdep.c: Likewise.
	* i386gnu-nat.c: Likewise.
	* i386nbsd-tdep.c: Likewise.
	* i386obsd-tdep.c: Likewise.
	* i387-tdep.c: Likewise.
	* ia64-libunwind-tdep.c: Likewise.
	* ia64-tdep.c: Likewise.
	* inf-ptrace.c: Likewise.
	* inf-ttrace.c: Likewise.
	* infcall.c: Likewise.
	* infcmd.c: Likewise.
	* infrun.c: Likewise.
	* inline-frame.c: Likewise.
	* interps.c: Likewise.
	* jv-lang.c: Likewise.
	* jv-typeprint.c: Likewise.
	* linux-fork.c: Likewise.
	* linux-nat.c: Likewise.
	* linux-thread-db.c: Likewise.
	* m32c-tdep.c: Likewise.
	* m32r-linux-nat.c: Likewise.
	* m32r-tdep.c: Likewise.
	* m68k-tdep.c: Likewise.
	* m68kbsd-nat.c: Likewise.
	* m68kbsd-tdep.c: Likewise.
	* m88k-tdep.c: Likewise.
	* machoread.c: Likewise.
	* macroexp.c: Likewise.
	* macrotab.c: Likewise.
	* maint.c: Likewise.
	* mdebugread.c: Likewise.
	* memory-map.c: Likewise.
	* mep-tdep.c: Likewise.
	* mi/mi-common.c: Likewise.
	* microblaze-tdep.c: Likewise.
	* mingw-hdep.c: Likewise.
	* mips-linux-nat.c: Likewise.
	* mips-linux-tdep.c: Likewise.
	* mips-tdep.c: Likewise.
	* mips64obsd-tdep.c: Likewise.
	* mipsnbsd-tdep.c: Likewise.
	* mn10300-linux-tdep.c: Likewise.
	* mn10300-tdep.c: Likewise.
	* moxie-tdep.c: Likewise.
	* mt-tdep.c: Likewise.
	* nat/linux-btrace.c: Likewise.
	* nat/linux-osdata.c: Likewise.
	* nat/linux-ptrace.c: Likewise.
	* nat/mips-linux-watch.c: Likewise.
	* nios2-linux-tdep.c: Likewise.
	* nios2-tdep.c: Likewise.
	* objc-lang.c: Likewise.
	* objfiles.c: Likewise.
	* obsd-nat.c: Likewise.
	* opencl-lang.c: Likewise.
	* osabi.c: Likewise.
	* parse.c: Likewise.
	* ppc-linux-nat.c: Likewise.
	* ppc-sysv-tdep.c: Likewise.
	* ppcfbsd-nat.c: Likewise.
	* ppcfbsd-tdep.c: Likewise.
	* ppcnbsd-nat.c: Likewise.
	* ppcnbsd-tdep.c: Likewise.
	* ppcobsd-nat.c: Likewise.
	* ppcobsd-tdep.c: Likewise.
	* printcmd.c: Likewise.
	* procfs.c: Likewise.
	* prologue-value.c: Likewise.
	* psymtab.c: Likewise.
	* python/py-lazy-string.c: Likewise.
	* python/py-value.c: Likewise.
	* regcache.c: Likewise.
	* reggroups.c: Likewise.
	* registry.c: Likewise.
	* remote-sim.c: Likewise.
	* remote.c: Likewise.
	* rs6000-aix-tdep.c: Likewise.
	* rs6000-tdep.c: Likewise.
	* s390-linux-tdep.c: Likewise.
	* score-tdep.c: Likewise.
	* ser-base.c: Likewise.
	* ser-mingw.c: Likewise.
	* sh-tdep.c: Likewise.
	* sh64-tdep.c: Likewise.
	* solib-darwin.c: Likewise.
	* solib-spu.c: Likewise.
	* solib-svr4.c: Likewise.
	* source.c: Likewise.
	* sparc-nat.c: Likewise.
	* sparc-sol2-tdep.c: Likewise.
	* sparc-tdep.c: Likewise.
	* sparc64-sol2-tdep.c: Likewise.
	* sparc64-tdep.c: Likewise.
	* sparc64fbsd-tdep.c: Likewise.
	* sparc64nbsd-tdep.c: Likewise.
	* sparc64obsd-tdep.c: Likewise.
	* sparcnbsd-tdep.c: Likewise.
	* sparcobsd-tdep.c: Likewise.
	* spu-multiarch.c: Likewise.
	* spu-tdep.c: Likewise.
	* stabsread.c: Likewise.
	* stack.c: Likewise.
	* symfile.c: Likewise.
	* symtab.c: Likewise.
	* target-descriptions.c: Likewise.
	* target-memory.c: Likewise.
	* target.c: Likewise.
	* tic6x-linux-tdep.c: Likewise.
	* tic6x-tdep.c: Likewise.
	* tilegx-linux-nat.c: Likewise.
	* tilegx-tdep.c: Likewise.
	* top.c: Likewise.
	* tramp-frame.c: Likewise.
	* tui/tui-out.c: Likewise.
	* tui/tui-winsource.c: Likewise.
	* ui-out.c: Likewise.
	* user-regs.c: Likewise.
	* utils.c: Likewise.
	* v850-tdep.c: Likewise.
	* valops.c: Likewise.
	* value.c: Likewise.
	* varobj.c: Likewise.
	* vax-nat.c: Likewise.
	* xml-syscall.c: Likewise.
	* xml-tdesc.c: Likewise.
	* xstormy16-tdep.c: Likewise.
	* xtensa-linux-nat.c: Likewise.
	* xtensa-tdep.c: Likewise.

gdb/gdbserver/
2014-08-07  Gary Benson  <gbenson@redhat.com>

	* server.h: Do not include gdb_assert.h.
2014-08-07 09:06:45 +01:00
Yao Qi 7e09a22367 Fix PR 17206
As reported in PR 17206, an internal error is triggered when command
until is executed.  In infcmd.c:until_next_command, step_range_end is
set to 'pc',

  if (!func)
    {
      struct bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (pc);

      if (msymbol.minsym == NULL)
	error (_("Execution is not within a known function."));

      tp->control.step_range_start = BMSYMBOL_VALUE_ADDRESS (msymbol);
      tp->control.step_range_end = pc;
    }

and later in infrun.c:resume, the assert below is triggered in PR
17206.

  if (tp->control.may_range_step)
    {
      /* If we're resuming a thread with the PC out of the step
	 range, then we're doing some nested/finer run control
	 operation, like stepping the thread out of the dynamic
	 linker or the displaced stepping scratch pad.  We
	 shouldn't have allowed a range step then.  */
      gdb_assert (pc_in_thread_step_range (pc, tp));
    }

In until_next_command, we set step range to [XXX, pc), so pc isn't
within the range.  pc_in_thread_step_range returns false and the
assert is triggered.  AFAICS, the range we want in until_next_command
is [XXX, pc] instead of [XXX, pc), because we want to program step
until greater than pc.  This patch is to set step_range_end to
'pc + 1'.  Running until-nodebug.exp with unpatched GDB will get the
following fail,

FAIL: gdb.base/until-nodebug.exp: until 2 (GDB internal error)

and the fail goes away when the fix is applied.

gdb:

2014-07-29  Yao Qi  <yao@codesourcery.com>

	PR gdb/17206
	* infcmd.c (until_next_command): Set step_range_end to PC + 1.

gdb/testsuite:

2014-07-29  Yao Qi  <yao@codesourcery.com>

	PR gdb/17206
	* gdb.base/until-nodebug.exp: New.
2014-07-29 11:59:32 +08:00
Pedro Alves 705096250d Always pass signals to the right thread
Currently, GDB can pass a signal to the wrong thread in several
different but related scenarios.

E.g., if thread 1 stops for signal SIGFOO, the user switches to thread
2, and then issues "continue", SIGFOO is actually delivered to thread
2, not thread 1.  This obviously messes up programs that use
pthread_kill to send signals to specific threads.

This has been a known issue for a long while.  Back in 2008 when I
made stop_signal be per-thread (2020b7ab), I kept the behavior -- see
code in 'proceed' being removed -- wanting to come back to it later.
The time has finally come now.

The patch fixes this -- on resumption, intercepted signals are always
delivered to the thread that had intercepted them.

Another example: if thread 1 stops for a breakpoint, the user switches
to thread 2, and then issues "signal SIGFOO", SIGFOO is actually
delivered to thread 1, not thread 2, because 'proceed' first switches
to thread 1 to step over its breakpoint...  If the user deletes the
breakpoint before issuing "signal FOO", then the signal is delivered
to thread 2 (the current thread).

"signal SIGFOO" can be used for two things: inject a signal in the
program while the program/thread had stopped for none, bypassing
"handle nopass"; or changing/suppressing a signal the program had
stopped for.  These scenarios are really two faces of the same coin,
and GDB can't really guess what the user is trying to do.  GDB might
have intercepted signals in more than one thread even (see the new
signal-command-multiple-signals-pending.exp test).  At least in the
inject case, it's obviously clear to me that the user means to deliver
the signal to the currently selected thread, so best is to make the
command's behavior consistent and easy to explain.

Then, if the user is trying to suppress/change a signal the program
had stopped for instead of injecting a new signal, but, the user had
changed threads meanwhile, then she will be surprised that with:

  (gdb) continue
  Thread 1 stopped for signal SIGFOO.
  (gdb) thread 2
  (gdb) signal SIGBAR

... GDB actually delivers SIGFOO to thread 1, and SIGBAR to thread 2
(with scheduler-locking off, which is the default, because then
"signal" or any other resumption command resumes all threads).

So the patch makes GDB detect that, and ask for confirmation:

  (gdb) thread 1
  [Switching to thread 1 (Thread 10979)]
  (gdb) signal SIGUSR2
  Note:
    Thread 3 previously stopped with signal SIGUSR2, User defined signal 2.
    Thread 2 previously stopped with signal SIGUSR1, User defined signal 1.
  Continuing thread 1 (the current thread) with specified signal will
  still deliver the signals noted above to their respective threads.
  Continue anyway? (y or n)

All these scenarios are covered by the new tests.

Tested on x86_64 Fedora 20, native and gdbserver.

gdb/
2014-07-25  Pedro Alves  <palves@redhat.com>

	* NEWS: Mention signal passing and "signal" command changes.
	* gdbthread.h (struct thread_suspend_state) <stop_signal>: Extend
	comment.
	* breakpoint.c (until_break_command): Adjust clear_proceed_status
	call.
	* infcall.c (run_inferior_call): Adjust clear_proceed_status call.
	* infcmd.c (proceed_thread_callback, continue_1, step_once)
	(jump_command): Adjust clear_proceed_status call.
	(signal_command): Warn if other thread that are resumed have
	signals that will be delivered.  Adjust clear_proceed_status call.
	(until_next_command, finish_command)
	(proceed_after_attach_callback, attach_command_post_wait)
	(attach_command): Adjust clear_proceed_status call.
	* infrun.c (proceed_after_vfork_done): Likewise.
	(proceed_after_attach_callback): Adjust comment.
	(clear_proceed_status_thread): Clear stop_signal if not in pass
	state.
	(clear_proceed_status_callback): Delete.
	(clear_proceed_status): New 'step' parameter.  Only clear the
	proceed status of threads the command being prepared is about to
	resume.
	(proceed): If passed in an explicit signal, override stop_signal
	with it.  Don't pass the last stop signal to the thread we're
	resuming.
	(init_wait_for_inferior): Adjust clear_proceed_status call.
	(switch_back_to_stepped_thread): Clear the signal if it should not
	be passed.
	* infrun.h (clear_proceed_status): New 'step' parameter.
	(user_visible_resume_ptid): Add comment.
	* linux-nat.c (linux_nat_resume_callback): Don't check whether the
	signal is in pass state.
	* remote.c (append_pending_thread_resumptions): Likewise.
	* mi/mi-main.c (proceed_thread): Adjust clear_proceed_status call.

gdb/doc/
2014-07-25  Pedro Alves  <palves@redhat.com>
	    Eli Zaretskii  <eliz@gnu.org>

	* gdb.texinfo (Signaling) <signal command>: Explain what happens
	with multi-threaded programs.

gdb/testsuite/
2014-07-25  Pedro Alves  <palves@redhat.com>

	* gdb.threads/signal-command-handle-nopass.c: New file.
	* gdb.threads/signal-command-handle-nopass.exp: New file.
	* gdb.threads/signal-command-multiple-signals-pending.c: New file.
	* gdb.threads/signal-command-multiple-signals-pending.exp: New file.
	* gdb.threads/signal-delivered-right-thread.c: New file.
	* gdb.threads/signal-delivered-right-thread.exp: New file.
2014-07-25 16:57:31 +01:00
Pedro Alves 7180e04a36 Fix "attach" command vs user input race
On async targets, a synchronous attach is done like this:

   #1 - target_attach is called (PTRACE_ATTACH is issued)
   #2 - a continuation is installed
   #3 - we go back to the event loop
   #4 - target reports stop (SIGSTOP), event loop wakes up, and
        attach continuation is called
   #5 - among other things, the continuation calls
        target_terminal_inferior, which removes stdin from the event
        loop

Note that in #3, GDB is still processing user input.  If the user is
fast enough, e.g., with something like:

  echo -e "attach PID\nset xxx=1" | gdb

... then the "set" command is processed before the attach completes.

We get worse behavior even, if input is a tty and therefore
readline/editing is enabled, with e.g.,:

 (gdb) attach PID\nset xxx=1

we then crash readline/gdb, with:

 Attaching to program: attach-wait-input, process 14537
 readline: readline_callback_read_char() called with no handler!
 Aborted
 $

Fix this by calling target_terminal_inferior before #3 above.

The test covers both scenarios by running with editing/readline forced
to both on and off.

gdb/
2014-07-09  Pedro Alves  <palves@redhat.com>

	* infcmd.c (attach_command_post_wait): Don't call
	target_terminal_inferior here.
	(attach_command): Call it here instead.

gdb/testsuite/
2014-07-09  Pedro Alves  <palves@redhat.com>

	* gdb.base/attach-wait-input.exp: New file.
	* gdb.base/attach-wait-input.c: New file.
2014-07-09 15:59:02 +01:00
Markus Metzger 1f267ae3d1 reverse-finish: turn internal error into normal error
The reverse-finish command results in an internal error if it cannot determine
the current function.

  (gdb) c
  Continuing.

  Program received signal SIGSEGV, Segmentation fault.
  0x0000000000000000 in ?? ()
  (gdb) reverse-finish
  Run back to call of #0  0x0000000000000000 in ?? ()
  gdb/infcmd.c:1576: internal-error: Finish: couldn't find function.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n) y

This is not an internal error case since the command may be used in scenarios
where there is no function at the current PC, e.g. after calling through a bad
function pointer.

Turn this into a normal error.

gdb/
	* infcmd.c (finish_backward): Turn internal error into normal error.

testsuite/
	* gdb.btrace/segv.c: New.
	* gdb.btrace/segv.exp: New.
2014-07-08 10:07:59 +02:00
Tom Tromey 635c7e8a05 make calls to help_list use enumerator
Currently there are many calls to help_list that pass the constant -1
as the "class" value.  However, the parameter is declared as being of
type enum command_class, and uses of the constant violate this
abstraction.

This patch fixes the error everywhere it occurs in the gdb sources.

Tested by rebuilding.

2014-06-13  Tom Tromey  <tromey@redhat.com>

	* cp-support.c (maint_cplus_command): Pass all_commands, not -1,
	to help_list.
	* guile/guile.c (info_guile_command): Pass all_commands, not -1,
	to help_list.
	* tui/tui-win.c (tui_command): Pass all_commands, not -1, to
	help_list.
	* tui/tui-regs.c (tui_reg_command): Pass all_commands, not -1, to
	help_list.Pass all_commands, not -1, to help_list.
	* cli/cli-dump.c (dump_command, append_command)
	(srec_dump_command, ihex_dump_command, tekhex_dump_command)
	(binary_dump_command, binary_append_command): Pass all_commands,
	not -1, to help_list.
	* cli/cli-cmds.c (info_command, set_debug): Pass all_commands, not
	-1, to help_list.
	* valprint.c (set_print, set_print_raw): Pass all_commands, not
	-1, to help_list.
	* typeprint.c (set_print_type): Pass all_commands, not -1, to
	help_list.
	* top.c (set_history): Pass all_commands, not -1, to help_list.
	* target-descriptions.c (set_tdesc_cmd, unset_tdesc_cmd): Pass
	all_commands, not -1, to help_list.
	* symfile.c (overlay_command): Pass all_commands, not -1, to
	help_list.
	* spu-tdep.c (info_spu_command): Pass all_commands, not -1, to
	help_list.
	* serial.c (serial_set_cmd): Pass all_commands, not -1, to
	help_list.
	* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Pass all_commands, not
	-1, to help_list.
	* remote.c (remote_command, set_remote_cmd): Pass all_commands,
	not -1, to help_list.
	* ravenscar-thread.c (set_ravenscar_command): Pass all_commands,
	not -1, to help_list.
	* maint.c (maintenance_command, maintenance_info_command)
	(maintenance_print_command, maintenance_set_cmd): Pass
	all_commands, not -1, to help_list.
	* macrocmd.c (macro_command): Pass all_commands, not -1, to
	help_list.
	* language.c (set_check): Pass all_commands, not -1, to help_list.
	* infcmd.c (unset_command): Pass all_commands, not -1, to
	help_list.
	* frame.c (set_backtrace_cmd): Pass all_commands, not -1, to
	help_list.
	* dwarf2read.c (set_dwarf2_cmd): Pass all_commands, not -1, to
	help_list.
	* dcache.c (set_dcache_command): Pass all_commands, not -1, to
	help_list.
	* breakpoint.c (save_command): Pass all_commands, not -1, to
	help_list.
	* ada-lang.c (maint_set_ada_cmd, set_ada_command): Pass
	all_commands, not -1, to help_list.
2014-06-13 09:29:19 -06:00
Pedro Alves 329ea57934 enable target async by default; separate MI and target notions of async
This finally makes background execution commands possible by default.

However, in order to do that, there's one last thing we need to do --
we need to separate the MI and target notions of "async".  Unlike the
CLI, where the user explicitly requests foreground vs background
execution in the execution command itself (c vs c&), MI chose to treat
"set target-async" specially -- setting it changes the default
behavior of execution commands.

So, we can't simply "set target-async" default to on, as that would
affect MI frontends.  Instead we have to make the setting MI-specific,
and teach MI about sync commands on top of an async target.

Because the "target" word in "set target-async" ends up as a potential
source of confusion, the patch adds a "set mi-async" option, and makes
"set target-async" a deprecated alias.

Rather than make the targets always async, this patch introduces a new
"maint set target-async" option so that the GDB developer can control
whether the target is async.  This makes it simpler to debug issues
arising only in the synchronous mode; important because sync mode
seems unlikely to go away.

Unlike in previous revisions, "set target-async" does not affect this
new maint parameter.  The rationale for this is that then one can
easily run the test suite in the "maint set target-async off" mode and
have tests that enable mi-async fail just like they fail on
non-async-capable targets.  This emulation is exactly the point of the
maint option.

I had asked Tom in a previous iteration to split the actual change of
the target async default to a separate patch, but it turns out that
that is quite awkward in this version of the patch, because with MI
async and target async decoupled (unlike in previous versions), if we
don't flip the default at the same time, then just "set target-async
on" alone never actually manages to do anything.  It's best to not
have that transitory state in the tree.

Given "set target-async on" now only has effect for MI, the patch goes
through the testsuite removing it from non-MI tests.  MI tests are
adjusted to use the new and less confusing "mi-async" spelling.

2014-05-29  Pedro Alves  <palves@redhat.com>
	    Tom Tromey  <tromey@redhat.com>

	* NEWS: Mention "maint set target-async", "set mi-async", and that
	background execution commands are now always available.
	* target.h (target_async_permitted): Update comment.
	* target.c (target_async_permitted, target_async_permitted_1):
	Default to 1.
	(set_target_async_command): Rename to ...
	(maint_set_target_async_command): ... this.
	(show_target_async_command): Rename to ...
	(maint_show_target_async_command): ... this.
	(_initialize_target): Adjust.
	* infcmd.c (prepare_execution_command): Make extern.
	* inferior.h (prepare_execution_command): Declare.
	* infrun.c (set_observer_mode): Leave target async alone.
	* mi/mi-interp.c (mi_interpreter_init): Install
	mi_on_sync_execution_done as sync_execution_done observer.
	(mi_on_sync_execution_done): New function.
	(mi_execute_command_input_handler): Don't print the prompt if we
	just started a synchronous command with an async target.
	(mi_on_resume): Check sync_execution before printing prompt.
	* mi/mi-main.h (mi_async_p): Declare.
	* mi/mi-main.c: Include gdbcmd.h.
	(mi_async_p): New function.
	(mi_async, mi_async_1): New globals.
	(set_mi_async_command, show_mi_async_command, mi_async): New
	functions.
	(exec_continue): Call prepare_execution_command.
	(run_one_inferior, mi_cmd_exec_run, mi_cmd_list_target_features)
	(mi_execute_async_cli_command): Use mi_async_p.
	(_initialize_mi_main): Install "set mi-async".  Make
	"target-async" a deprecated alias.

2014-05-29  Pedro Alves  <palves@redhat.com>
	    Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Non-Stop Mode): Remove "set target-async 1"
	from example.
	(Asynchronous and non-stop modes): Document '-gdb-set mi-async'.
	Mention that target-async is now deprecated.
	(Maintenance Commands): Document maint set/show target-async.

2014-05-29  Pedro Alves  <palves@redhat.com>
	    Tom Tromey  <tromey@redhat.com>

	* gdb.base/async-shell.exp: Don't enable target-async.
	* gdb.base/async.exp
	* gdb.base/corefile.exp (corefile_test_attach): Remove 'async'
	parameter.  Adjust.
	(top level): Don't test with "target-async".
	* gdb.base/dprintf-non-stop.exp: Don't enable target-async.
	* gdb.base/gdb-sigterm.exp: Don't test with "target-async".
	* gdb.base/inferior-died.exp: Don't enable target-async.
	* gdb.base/interrupt-noterm.exp: Likewise.
	* gdb.mi/mi-async.exp: Use "mi-async" instead of "target-async".
	* gdb.mi/mi-nonstop-exit.exp: Likewise.
	* gdb.mi/mi-nonstop.exp: Likewise.
	* gdb.mi/mi-ns-stale-regcache.exp: Likewise.
	* gdb.mi/mi-nsintrall.exp: Likewise.
	* gdb.mi/mi-nsmoribund.exp: Likewise.
	* gdb.mi/mi-nsthrexec.exp: Likewise.
	* gdb.mi/mi-watch-nonstop.exp: Likewise.
	* gdb.multi/watchpoint-multi.exp: Adjust comment.
	* gdb.python/py-evsignal.exp: Don't enable target-async.
	* gdb.python/py-evthreads.exp: Likewise.
	* gdb.python/py-prompt.exp: Likewise.
	* gdb.reverse/break-precsave.exp: Don't test with "target-async".
	* gdb.server/solib-list.exp: Don't enable target-async.
	* gdb.threads/thread-specific-bp.exp: Likewise.
	* lib/mi-support.exp: Adjust to use mi-async.
2014-05-29 14:38:02 +01:00
Pedro Alves 45741a9c32 Add new infrun.h header.
Move infrun.c declarations out of inferior.h to a new infrun.h file.

Tested by building on:

 i686-w64-mingw32, enable-targets=all
 x86_64-linux, enable-targets=all
 i586-pc-msdosdjgpp

And also grepped the whole tree for each symbol moved to find where
infrun.h might be necessary.

gdb/
2014-05-22  Pedro Alves  <palves@redhat.com>

	* inferior.h (debug_infrun, debug_displaced, stop_on_solib_events)
	(sync_execution, sched_multi, step_stop_if_no_debug, non_stop)
	(disable_randomization, enum exec_direction_kind)
	(execution_direction, stop_registers, start_remote)
	(clear_proceed_status, proceed, resume, user_visible_resume_ptid)
	(wait_for_inferior, normal_stop, get_last_target_status)
	(prepare_for_detach, fetch_inferior_event, init_wait_for_inferior)
	(insert_step_resume_breakpoint_at_sal)
	(follow_inferior_reset_breakpoints, stepping_past_instruction_at)
	(set_step_info, print_stop_event, signal_stop_state)
	(signal_print_state, signal_pass_state, signal_stop_update)
	(signal_print_update, signal_pass_update)
	(update_signals_program_target, clear_exit_convenience_vars)
	(displaced_step_dump_bytes, update_observer_mode)
	(signal_catch_update, gdb_signal_from_command): Move
	declarations ...
	* infrun.h: ... to this new file.
	* amd64-tdep.c: Include infrun.h.
	* annotate.c: Include infrun.h.
	* arch-utils.c: Include infrun.h.
	* arm-linux-tdep.c: Include infrun.h.
	* arm-tdep.c: Include infrun.h.
	* break-catch-sig.c: Include infrun.h.
	* breakpoint.c: Include infrun.h.
	* common/agent.c: Include infrun.h instead of inferior.h.
	* corelow.c: Include infrun.h.
	* event-top.c: Include infrun.h.
	* go32-nat.c: Include infrun.h.
	* i386-tdep.c: Include infrun.h.
	* inf-loop.c: Include infrun.h.
	* infcall.c: Include infrun.h.
	* infcmd.c: Include infrun.h.
	* infrun.c: Include infrun.h.
	* linux-fork.c: Include infrun.h.
	* linux-nat.c: Include infrun.h.
	* linux-thread-db.c: Include infrun.h.
	* monitor.c: Include infrun.h.
	* nto-tdep.c: Include infrun.h.
	* procfs.c: Include infrun.h.
	* record-btrace.c: Include infrun.h.
	* record-full.c: Include infrun.h.
	* remote-m32r-sdi.c: Include infrun.h.
	* remote-mips.c: Include infrun.h.
	* remote-notif.c: Include infrun.h.
	* remote-sim.c: Include infrun.h.
	* remote.c: Include infrun.h.
	* reverse.c: Include infrun.h.
	* rs6000-tdep.c: Include infrun.h.
	* s390-linux-tdep.c: Include infrun.h.
	* solib-irix.c: Include infrun.h.
	* solib-osf.c: Include infrun.h.
	* solib-svr4.c: Include infrun.h.
	* target.c: Include infrun.h.
	* top.c: Include infrun.h.
	* windows-nat.c: Include infrun.h.
	* mi/mi-interp.c: Include infrun.h.
	* mi/mi-main.c: Include infrun.h.
	* python/py-threadevent.c: Include infrun.h.
2014-05-22 12:29:11 +01:00
Doug Evans 6339bfc47d * infcmd.c: Whitespace fixes.
(interrupt_command): Merge two function comments into one.
2014-03-22 08:22:29 -04:00
Doug Evans 0a07590bf4 * infcmd.c (interrupt_command): Renamed from interrupt_target_command. 2014-03-22 07:48:33 -04:00
Pedro Alves 8bc2fe4889 Factor out foreground/background execution command preparation.
All execution commands currently have this pattern:

  /* If we must run in the background, but the target can't do it,
     error out.  */
  if (async_exec && !target_can_async_p ())
    error (_("Asynchronous execution not supported on this target."));

  /* If we are not asked to run in the bg, then prepare to run in the
     foreground, synchronously.  */
  if (!async_exec && target_can_async_p ())
    {
      /* Simulate synchronous execution.  */
      async_disable_stdin ();
    }

This patch factors that into a shared function.

attach_command installs a cleanup to re-enable stdin, but that's not
necessary, as per the comment in prepare_execution_command.  In any
case, if someday it turns out necessary, we have a single place to
install it now.

Tested on x86_64 Fedora 17, sync and async modes.

gdb/
2014-03-12  Pedro Alves  <palves@redhat.com>

	* infcmd.c (prepare_execution_command): New function, factored out
	from several execution commands.
	(run_command_1, continue_command, step_1, jump_command)
	(signal_command, until_command, advance_command, finish_command)
	(attach_command): Use prepare_execution_command.
2014-03-12 20:32:53 +00:00
Tom Tromey b3ccfe11d3 fix regressions with target-async
A patch in the target cleanup series caused a regression when using
record with target-async.  Version 4 of the patch is here:

    https://sourceware.org/ml/gdb-patches/2014-03/msg00159.html

The immediate problem is that record supplies to_can_async_p and
to_is_async_p methods, but does not supply a to_async method.  So,
when target-async is set, record claims to support async -- but if the
underlying target does not support async, then the to_async method
call will end up in that method's default implementation, namely
tcomplain.

This worked previously because the record target used to provide a
to_async method; one that (erroneously, only at push time) checked the
other members of the target stack, and then simply dropped to_async
calls in the "does not implement async" case.

My first thought was to simply drop tcomplain as the default for
to_async.  This works, but Pedro pointed out that the only reason
record has to supply to_can_async_p and to_is_async_p is that these
default to using the find_default_run_target machinery -- and these
defaults are only needed by "run" and "attach".

So, a nicer solution presents itself: change run and attach to
explicitly call into the default run target when needed; and change
to_is_async_p and to_can_async_p to default to "return 0".  This makes
the target stack simpler to use and lets us remove the method
implementations from record.  This is also in harmony with other plans
for the target stack; namely trying to reduce the impact of
find_default_run_target.  This approach makes it clear that
find_default_is_async_p is not needed -- it is asking whether a target
that may not even be pushed is actually async, which seems like a
nonsensical question.

While an improvement, this approach proved to introduce the same bug
when using the core target.  Looking a bit deeper, the issue is that
code in "attach" and "run" may need to use either the current target
stack or the default run target -- but different calls into the target
API in those functions could wind up querying different targets.

This new patch makes the target to use more explicit in "run" and
"attach".  Then these commands explicitly make the needed calls
against that target.  This ensures that a single target is used for
all relevant operations.  This lets us remove a couple find_default_*
functions from various targets, including the dummy target.  I think
this is a decent understandability improvement.

One issue I see with this patch is that the new calls in "run" and
"attach" are not very much like the rest of the target API.  I think
fundamentally this is due to bad factoring in the target API, which
may need to be fixed for multi-target.  Tackling that seemed ambitious
for a regression fix.

While working on this I noticed that there don't seem to be any test
cases that involve both target-async and record, so this patch changes
break-precsave.exp to add some.  It also changes corefile.exp to add
some target-async tests; these pass with current trunk and with this
patch applied, but fail with the v1 patch.

This patch differs from v4 in that it moves initialization of
to_can_async_p and to_supports_non_stop into inf-child, adds some
assertions to complete_target_initialization, and adds some comments
to target.h.

Built and regtested on x86-64 Fedora 20.

2014-03-12  Tom Tromey  <tromey@redhat.com>

	* inf-child.c (return_zero): New function.
	(inf_child_target): Set to_can_async_p, to_supports_non_stop.
	* aix-thread.c (aix_thread_inferior_created): New function.
	(aix_thread_attach): Remove.
	(init_aix_thread_ops): Don't set to_attach.
	(_initialize_aix_thread): Register inferior_created observer.
	* corelow.c (init_core_ops): Don't set to_attach or
	to_create_inferior.
	* exec.c (init_exec_ops): Don't set to_attach or
	to_create_inferior.
	* infcmd.c (run_command_1): Use find_run_target.  Make direct
	target calls.
	(attach_command): Use find_attach_target.  Make direct target
	calls.
	* record-btrace.c (init_record_btrace_ops): Don't set
	to_create_inferior.
	* record-full.c (record_full_can_async_p, record_full_is_async_p):
	Remove.
	(init_record_full_ops, init_record_full_core_ops): Update.  Don't
	set to_create_inferior.
	* target.c (complete_target_initialization): Add assertion.
	(target_create_inferior): Remove.
	(find_default_attach, find_default_create_inferior): Remove.
	(find_attach_target, find_run_target): New functions.
	(find_default_is_async_p, find_default_can_async_p)
	(target_supports_non_stop, target_attach): Remove.
	(init_dummy_target): Don't set to_create_inferior or
	to_supports_non_stop.
	* target.h (struct target_ops) <to_attach>: Add comment.  Remove
	TARGET_DEFAULT_FUNC.
	<to_create_inferior>: Add comment.
	<to_can_async_p, to_is_async_p, to_supports_non_stop>: Use
	TARGET_DEFAULT_RETURN.
	<to_can_async_p, to_supports_non_stop, to_can_run>: Add comments.
	(find_attach_target, find_run_target): Declare.
	(target_create_inferior): Remove.
	(target_has_execution_1): Update comment.
	(target_supports_non_stop): Remove.
	* target-delegates.c: Rebuild.

2014-03-12  Tom Tromey  <tromey@redhat.com>

	* gdb.base/corefile.exp (corefile_test_run, corefile_test_attach):
	New procs.  Add target-async tests.
	* gdb.reverse/break-precsave.exp (precsave_tests): New proc.
	Add target-async tests.
2014-03-12 13:05:58 -06:00
Tom Tromey 77e371c079 start change to progspace independence
This patch starts changing minimal symbols to be independent of the
program space.

Specifically, it adds a new objfile parameter to MSYMBOL_VALUE_ADDRESS
and changes all the code to use it.  This is needed so we can change
gdb to apply the section offset when a minsym's address is computed,
as opposed to baking the offsets into the symbol itself.

A few spots still need the unrelocated address.  For these, we
introduce MSYMBOL_VALUE_RAW_ADDRESS.

As a convenience, we also add the new macro BMSYMBOL_VALUE_ADDRESS,
which computes the address of a bound minimal symbol.  This just does
the obvious thing with the fields.

Note that this change does not actually enable program space
independence.  That requires more changes to gdb.  However, to ensure
that these changes compile properly, this patch does add the needed
section lookup code to MSYMBOL_VALUE_ADDRESS -- it just ensures it has
no effect at runtime by multiplying the offset by 0.

2014-02-26  Tom Tromey  <tromey@redhat.com>

	* ada-lang.c (ada_main_name): Update.
	(ada_add_standard_exceptions): Update.
	* ada-tasks.c (ada_tasks_inferior_data_sniffer): Update.
	* aix-thread.c (pdc_symbol_addrs, pd_enable): Update.
	* arm-tdep.c (skip_prologue_function, arm_skip_stub): Update.
	* auxv.c (ld_so_xfer_auxv): Update.
	* avr-tdep.c (avr_scan_prologue): Update.
	* ax-gdb.c (gen_var_ref): Update.
	* blockframe.c (get_pc_function_start)
	(find_pc_partial_function_gnu_ifunc): Update.
	* breakpoint.c (create_overlay_event_breakpoint)
	(create_longjmp_master_breakpoint)
	(create_std_terminate_master_breakpoint)
	(create_exception_master_breakpoint): Update.
	* bsd-uthread.c (bsd_uthread_lookup_address): Update.
	* c-valprint.c (c_val_print): Update.
	* coff-pe-read.c (add_pe_forwarded_sym): Update.
	* common/agent.c (agent_look_up_symbols): Update.
	* dbxread.c (find_stab_function_addr, end_psymtab): Update.
	* dwarf2loc.c (call_site_to_target_addr): Update.
	* dwarf2read.c (dw2_find_pc_sect_symtab): Update.
	* elfread.c (elf_gnu_ifunc_record_cache)
	(elf_gnu_ifunc_resolve_by_got): Update.
	* findvar.c (default_read_var_value): Update.
	* frame.c (inside_main_func): Update.
	* frv-tdep.c (frv_frame_this_id): Update.
	* glibc-tdep.c (glibc_skip_solib_resolver): Update.
	* gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline):
	Update.
	* hppa-hpux-tdep.c (hppa64_hpux_search_dummy_call_sequence)
	(hppa_hpux_find_dummy_bpaddr): Update.
	* hppa-tdep.c (hppa_symbol_address): Update.
	* infcmd.c (until_next_command): Update.
	* jit.c (jit_read_descriptor, jit_breakpoint_re_set_internal):
	Update.
	* linespec.c (minsym_found, add_minsym): Update.
	* linux-nat.c (get_signo): Update.
	* linux-thread-db.c (inferior_has_bug): Update.
	* m32c-tdep.c (m32c_return_value)
	(m32c_m16c_address_to_pointer): Update.
	* m32r-tdep.c (m32r_frame_this_id): Update.
	* m68hc11-tdep.c (m68hc11_get_register_info): Update.
	* machoread.c (macho_resolve_oso_sym_with_minsym): Update.
	* maint.c (maintenance_translate_address): Update.
	* minsyms.c (lookup_minimal_symbol_by_pc_name): Update.
	(frob_address): New function.
	(lookup_minimal_symbol_by_pc_section_1): Use raw addresses,
	frob_address.  Rename parameter to "pc_in".
	(compare_minimal_symbols, compact_minimal_symbols): Use raw
	addresses.
	(find_solib_trampoline_target, minimal_symbol_upper_bound):
	Update.
	* mips-linux-tdep.c (mips_linux_skip_resolver): Update.
	* mips-tdep.c (mips_skip_pic_trampoline_code): Update.
	* objc-lang.c (find_objc_msgsend): Update.
	* objfiles.c (objfile_relocate1): Update.
	* obsd-tdep.c (obsd_skip_solib_resolver): Update.
	* p-valprint.c (pascal_val_print): Update.
	* parse.c (write_exp_msymbol): Update.
	* ppc-linux-tdep.c (ppc_linux_spe_context_lookup)
	(ppc_elfv2_skip_entrypoint): Update.
	* ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update.
	* printcmd.c (build_address_symbolic, msym_info)
	(address_info): Update.
	* proc-service.c (ps_pglobal_lookup): Update.
	* psymtab.c (find_pc_sect_psymtab_closer)
	(find_pc_sect_psymtab, find_pc_sect_symtab_from_partial):
	Change msymbol parameter to bound_minimal_symbol.
	* ravenscar-thread.c (get_running_thread_id): Update.
	* remote.c (remote_check_symbols): Update.
	* sh64-tdep.c (sh64_elf_make_msymbol_special): Use raw
	address.
	* sol2-tdep.c (sol2_skip_solib_resolver): Update.
	* solib-dsbt.c (lm_base): Update.
	* solib-frv.c (lm_base, main_got): Update.
	* solib-irix.c (locate_base): Update.
	* solib-som.c (som_solib_create_inferior_hook)
	(link_map_start): Update.
	* solib-spu.c (spu_enable_break, ocl_enable_break): Update.
	* solib-svr4.c (elf_locate_base, enable_break): Update.
	* spu-tdep.c (spu_get_overlay_table, spu_catch_start)
	(flush_ea_cache): Update.
	* stabsread.c (define_symbol, scan_file_globals): Update.
	* stack.c (find_frame_funname): Update.
	* symfile-debug.c (debug_qf_expand_symtabs_matching)
	(debug_qf_find_pc_sect_symtab): Update.
	* symfile.c (simple_read_overlay_table)
	(simple_overlay_update): Update.
	* symfile.h (struct quick_symbol_functions)
	<find_pc_sect_symtab>: Change type of msymbol to
	bound_minimal_symbol.
	* symmisc.c (dump_msymbols): Update.
	* symtab.c (find_pc_sect_symtab_via_partial)
	(find_pc_sect_psymtab, find_pc_sect_line, skip_prologue_sal)
	(search_symbols, print_msymbol_info): Update.
	* symtab.h (MSYMBOL_VALUE_RAW_ADDRESS): New macro.
	(MSYMBOL_VALUE_ADDRESS): Redefine.
	(BMSYMBOL_VALUE_ADDRESS): New macro.
	* tracepoint.c (scope_info): Update.
	* tui/tui-disasm.c (tui_find_disassembly_address)
	(tui_get_begin_asm_address): Update.
	* valops.c (find_function_in_inferior): Update.
	* value.c (value_static_field, value_fn_field): Update.
2014-02-26 12:11:17 -07:00
Tom Tromey efd66ac669 change minsym representation
In a later patch we're going to change the minimal symbol address
calculation to apply section offsets at the point of use.  To make it
simpler to catch potential problem spots, this patch changes the
representation of minimal symbols and introduces new
minimal-symbol-specific variants of the various accessors.  This is
necessary because it would be excessively ambitious to try to convert
all the symbol types at once.

The core of this change is just renaming a field in minimal_symbol;
the rest is just a fairly mechanical rewording.

2014-02-26  Tom Tromey  <tromey@redhat.com>

	* symtab.h (struct minimal_symbol) <mginfo>: Rename from ginfo.
	(MSYMBOL_VALUE, MSYMBOL_VALUE_ADDRESS, MSYMBOL_VALUE_BYTES)
	(MSYMBOL_BLOCK_VALUE, MSYMBOL_VALUE_CHAIN, MSYMBOL_LANGUAGE)
	(MSYMBOL_SECTION, MSYMBOL_OBJ_SECTION, MSYMBOL_NATURAL_NAME)
	(MSYMBOL_LINKAGE_NAME, MSYMBOL_PRINT_NAME, MSYMBOL_DEMANGLED_NAME)
	(MSYMBOL_SET_LANGUAGE, MSYMBOL_SEARCH_NAME)
	(MSYMBOL_MATCHES_SEARCH_NAME, MSYMBOL_SET_NAMES): New macros.
	* ada-lang.c (ada_main_name): Update.
	(ada_lookup_simple_minsym): Update.
	(ada_make_symbol_completion_list): Update.
	(ada_add_standard_exceptions): Update.
	* ada-tasks.c (read_atcb, ada_tasks_inferior_data_sniffer): Update.
	* aix-thread.c (pdc_symbol_addrs, pd_enable): Update.
	* amd64-windows-tdep.c (amd64_skip_main_prologue): Update.
	* arm-tdep.c (skip_prologue_function): Update.
	(arm_skip_stack_protector, arm_skip_stub): Update.
	* arm-wince-tdep.c (arm_pe_skip_trampoline_code): Update.
	(arm_wince_skip_main_prologue): Update.
	* auxv.c (ld_so_xfer_auxv): Update.
	* avr-tdep.c (avr_scan_prologue): Update.
	* ax-gdb.c (gen_var_ref): Update.
	* block.c (call_site_for_pc): Update.
	* blockframe.c (get_pc_function_start): Update.
	(find_pc_partial_function_gnu_ifunc): Update.
	* breakpoint.c (create_overlay_event_breakpoint): Update.
	(create_longjmp_master_breakpoint): Update.
	(create_std_terminate_master_breakpoint): Update.
	(create_exception_master_breakpoint): Update.
	(resolve_sal_pc): Update.
	* bsd-uthread.c (bsd_uthread_lookup_address): Update.
	* btrace.c (ftrace_print_function_name, ftrace_function_switched):
	Update.
	* c-valprint.c (c_val_print): Update.
	* coff-pe-read.c (add_pe_forwarded_sym): Update.
	* coffread.c (coff_symfile_read): Update.
	* common/agent.c (agent_look_up_symbols): Update.
	* dbxread.c (find_stab_function_addr): Update.
	(end_psymtab): Update.
	* dwarf2loc.c (call_site_to_target_addr): Update.
	(func_verify_no_selftailcall): Update.
	(tailcall_dump): Update.
	(call_site_find_chain_1): Update.
	(dwarf_expr_reg_to_entry_parameter): Update.
	* elfread.c (elf_gnu_ifunc_record_cache): Update.
	(elf_gnu_ifunc_resolve_by_got): Update.
	* f-valprint.c (info_common_command): Update.
	* findvar.c (read_var_value): Update.
	* frame.c (get_prev_frame_1): Update.
	(inside_main_func): Update.
	* frv-tdep.c (frv_skip_main_prologue): Update.
	(frv_frame_this_id): Update.
	* glibc-tdep.c (glibc_skip_solib_resolver): Update.
	* gnu-v2-abi.c (gnuv2_value_rtti_type): Update.
	* gnu-v3-abi.c (gnuv3_rtti_type): Update.
	(gnuv3_skip_trampoline): Update.
	* hppa-hpux-tdep.c (hppa32_hpux_in_solib_call_trampoline): Update.
	(hppa64_hpux_in_solib_call_trampoline): Update.
	(hppa_hpux_skip_trampoline_code): Update.
	(hppa64_hpux_search_dummy_call_sequence): Update.
	(hppa_hpux_find_import_stub_for_addr): Update.
	(hppa_hpux_find_dummy_bpaddr): Update.
	* hppa-tdep.c (hppa_symbol_address)
	(hppa_lookup_stub_minimal_symbol): Update.
	* i386-tdep.c (i386_skip_main_prologue): Update.
	(i386_pe_skip_trampoline_code): Update.
	* ia64-tdep.c (ia64_convert_from_func_ptr_addr): Update.
	* infcall.c (get_function_name): Update.
	* infcmd.c (until_next_command): Update.
	* jit.c (jit_breakpoint_re_set_internal): Update.
	(jit_inferior_init): Update.
	* linespec.c (minsym_found): Update.
	(add_minsym): Update.
	* linux-fork.c (info_checkpoints_command): Update.
	* linux-nat.c (get_signo): Update.
	* linux-thread-db.c (inferior_has_bug): Update.
	* m32c-tdep.c (m32c_return_value): Update.
	(m32c_m16c_address_to_pointer): Update.
	(m32c_m16c_pointer_to_address): Update.
	* m32r-tdep.c (m32r_frame_this_id): Update.
	* m68hc11-tdep.c (m68hc11_get_register_info): Update.
	* machoread.c (macho_resolve_oso_sym_with_minsym): Update.
	* maint.c (maintenance_translate_address): Update.
	* minsyms.c (add_minsym_to_hash_table): Update.
	(add_minsym_to_demangled_hash_table): Update.
	(msymbol_objfile): Update.
	(lookup_minimal_symbol): Update.
	(iterate_over_minimal_symbols): Update.
	(lookup_minimal_symbol_text): Update.
	(lookup_minimal_symbol_by_pc_name): Update.
	(lookup_minimal_symbol_solib_trampoline): Update.
	(lookup_minimal_symbol_by_pc_section_1): Update.
	(lookup_minimal_symbol_and_objfile): Update.
	(prim_record_minimal_symbol_full): Update.
	(compare_minimal_symbols): Update.
	(compact_minimal_symbols): Update.
	(build_minimal_symbol_hash_tables): Update.
	(install_minimal_symbols): Update.
	(terminate_minimal_symbol_table): Update.
	(find_solib_trampoline_target): Update.
	(minimal_symbol_upper_bound): Update.
	* mips-linux-tdep.c (mips_linux_skip_resolver): Update.
	* mips-tdep.c (mips_stub_frame_sniffer): Update.
	(mips_skip_pic_trampoline_code): Update.
	* msp430-tdep.c (msp430_skip_trampoline_code): Update.
	* objc-lang.c (selectors_info): Update.
	(classes_info): Update.
	(find_methods): Update.
	(find_imps): Update.
	(find_objc_msgsend): Update.
	* objfiles.c (objfile_relocate1): Update.
	* objfiles.h (ALL_OBJFILE_MSYMBOLS): Update.
	* obsd-tdep.c (obsd_skip_solib_resolver): Update.
	* p-valprint.c (pascal_val_print): Update.
	* parse.c (write_exp_msymbol): Update.
	* ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code)
	(ppc_linux_spe_context_lookup, ppc_elfv2_skip_entrypoint): Update.
	* ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update.
	* printcmd.c (build_address_symbolic): Update.
	(sym_info): Update.
	(address_info): Update.
	* proc-service.c (ps_pglobal_lookup): Update.
	* psymtab.c (find_pc_sect_psymtab_closer): Update.
	(find_pc_sect_psymtab): Update.
	* python/py-framefilter.c (py_print_frame): Update.
	* ravenscar-thread.c (get_running_thread_id): Update.
	* record-btrace.c (btrace_call_history, btrace_get_bfun_name):
	Update.
	* remote.c (remote_check_symbols): Update.
	* rs6000-tdep.c (rs6000_skip_main_prologue): Update.
	(rs6000_skip_trampoline_code): Update.
	* sh64-tdep.c (sh64_elf_make_msymbol_special): Update.
	* sol2-tdep.c (sol2_skip_solib_resolver): Update.
	* solib-dsbt.c (lm_base): Update.
	* solib-frv.c (lm_base): Update.
	(main_got): Update.
	* solib-irix.c (locate_base): Update.
	* solib-som.c (som_solib_create_inferior_hook): Update.
	(som_solib_desire_dynamic_linker_symbols): Update.
	(link_map_start): Update.
	* solib-spu.c (spu_enable_break): Update.
	(ocl_enable_break): Update.
	* solib-svr4.c (elf_locate_base): Update.
	(enable_break): Update.
	* spu-tdep.c (spu_get_overlay_table): Update.
	(spu_catch_start): Update.
	(flush_ea_cache): Update.
	* stabsread.c (define_symbol): Update.
	(scan_file_globals): Update.
	* stack.c (find_frame_funname): Update.
	(frame_info): Update.
	* symfile.c (simple_read_overlay_table): Update.
	(simple_overlay_update): Update.
	* symmisc.c (dump_msymbols): Update.
	* symtab.c (fixup_section): Update.
	(find_pc_sect_line): Update.
	(skip_prologue_sal): Update.
	(search_symbols): Update.
	(print_msymbol_info): Update.
	(rbreak_command): Update.
	(MCOMPLETION_LIST_ADD_SYMBOL): New macro.
	(completion_list_objc_symbol): Update.
	(default_make_symbol_completion_list_break_on): Update.
	* tracepoint.c (scope_info): Update.
	* tui/tui-disasm.c (tui_find_disassembly_address): Update.
	(tui_get_begin_asm_address): Update.
	* valops.c (find_function_in_inferior): Update.
	* value.c (value_static_field): Update.
	(value_fn_field): Update.
2014-02-26 12:11:16 -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
Tom Tromey 0e9f083f4c remove gdb_string.h
This removes gdb_string.h.  This patch is purely mechanical.  I
created it by running the two commands:

    git rm common/gdb_string.h
    perl -pi -e's/"gdb_string.h"/<string.h>/;'  *.[chyl] */*.[chyl]

2013-11-18  Tom Tromey  <tromey@redhat.com>

	* common/gdb_string.h: Remove.
	* aarch64-tdep.c: Use string.h, not gdb_string.h.
	* ada-exp.y: Use string.h, not gdb_string.h.
	* ada-lang.c: Use string.h, not gdb_string.h.
	* ada-lex.l: Use string.h, not gdb_string.h.
	* ada-typeprint.c: Use string.h, not gdb_string.h.
	* ada-valprint.c: Use string.h, not gdb_string.h.
	* aix-thread.c: Use string.h, not gdb_string.h.
	* alpha-linux-tdep.c: Use string.h, not gdb_string.h.
	* alpha-mdebug-tdep.c: Use string.h, not gdb_string.h.
	* alpha-nat.c: Use string.h, not gdb_string.h.
	* alpha-osf1-tdep.c: Use string.h, not gdb_string.h.
	* alpha-tdep.c: Use string.h, not gdb_string.h.
	* alphanbsd-tdep.c: Use string.h, not gdb_string.h.
	* amd64-dicos-tdep.c: Use string.h, not gdb_string.h.
	* amd64-linux-nat.c: Use string.h, not gdb_string.h.
	* amd64-linux-tdep.c: Use string.h, not gdb_string.h.
	* amd64-nat.c: Use string.h, not gdb_string.h.
	* amd64-sol2-tdep.c: Use string.h, not gdb_string.h.
	* amd64fbsd-tdep.c: Use string.h, not gdb_string.h.
	* amd64obsd-tdep.c: Use string.h, not gdb_string.h.
	* arch-utils.c: Use string.h, not gdb_string.h.
	* arm-linux-nat.c: Use string.h, not gdb_string.h.
	* arm-linux-tdep.c: Use string.h, not gdb_string.h.
	* arm-tdep.c: Use string.h, not gdb_string.h.
	* arm-wince-tdep.c: Use string.h, not gdb_string.h.
	* armbsd-tdep.c: Use string.h, not gdb_string.h.
	* armnbsd-nat.c: Use string.h, not gdb_string.h.
	* armnbsd-tdep.c: Use string.h, not gdb_string.h.
	* armobsd-tdep.c: Use string.h, not gdb_string.h.
	* avr-tdep.c: Use string.h, not gdb_string.h.
	* ax-gdb.c: Use string.h, not gdb_string.h.
	* ax-general.c: Use string.h, not gdb_string.h.
	* bcache.c: Use string.h, not gdb_string.h.
	* bfin-tdep.c: Use string.h, not gdb_string.h.
	* breakpoint.c: Use string.h, not gdb_string.h.
	* build-id.c: Use string.h, not gdb_string.h.
	* buildsym.c: Use string.h, not gdb_string.h.
	* c-exp.y: Use string.h, not gdb_string.h.
	* c-lang.c: Use string.h, not gdb_string.h.
	* c-typeprint.c: Use string.h, not gdb_string.h.
	* c-valprint.c: Use string.h, not gdb_string.h.
	* charset.c: Use string.h, not gdb_string.h.
	* cli-out.c: Use string.h, not gdb_string.h.
	* cli/cli-cmds.c: Use string.h, not gdb_string.h.
	* cli/cli-decode.c: Use string.h, not gdb_string.h.
	* cli/cli-dump.c: Use string.h, not gdb_string.h.
	* cli/cli-interp.c: Use string.h, not gdb_string.h.
	* cli/cli-logging.c: Use string.h, not gdb_string.h.
	* cli/cli-script.c: Use string.h, not gdb_string.h.
	* cli/cli-setshow.c: Use string.h, not gdb_string.h.
	* cli/cli-utils.c: Use string.h, not gdb_string.h.
	* coffread.c: Use string.h, not gdb_string.h.
	* common/common-utils.c: Use string.h, not gdb_string.h.
	* common/filestuff.c: Use string.h, not gdb_string.h.
	* common/linux-procfs.c: Use string.h, not gdb_string.h.
	* common/linux-ptrace.c: Use string.h, not gdb_string.h.
	* common/signals.c: Use string.h, not gdb_string.h.
	* common/vec.h: Use string.h, not gdb_string.h.
	* core-regset.c: Use string.h, not gdb_string.h.
	* corefile.c: Use string.h, not gdb_string.h.
	* corelow.c: Use string.h, not gdb_string.h.
	* cp-abi.c: Use string.h, not gdb_string.h.
	* cp-support.c: Use string.h, not gdb_string.h.
	* cp-valprint.c: Use string.h, not gdb_string.h.
	* cris-tdep.c: Use string.h, not gdb_string.h.
	* d-lang.c: Use string.h, not gdb_string.h.
	* dbxread.c: Use string.h, not gdb_string.h.
	* dcache.c: Use string.h, not gdb_string.h.
	* demangle.c: Use string.h, not gdb_string.h.
	* dicos-tdep.c: Use string.h, not gdb_string.h.
	* disasm.c: Use string.h, not gdb_string.h.
	* doublest.c: Use string.h, not gdb_string.h.
	* dsrec.c: Use string.h, not gdb_string.h.
	* dummy-frame.c: Use string.h, not gdb_string.h.
	* dwarf2-frame.c: Use string.h, not gdb_string.h.
	* dwarf2loc.c: Use string.h, not gdb_string.h.
	* dwarf2read.c: Use string.h, not gdb_string.h.
	* elfread.c: Use string.h, not gdb_string.h.
	* environ.c: Use string.h, not gdb_string.h.
	* eval.c: Use string.h, not gdb_string.h.
	* event-loop.c: Use string.h, not gdb_string.h.
	* exceptions.c: Use string.h, not gdb_string.h.
	* exec.c: Use string.h, not gdb_string.h.
	* expprint.c: Use string.h, not gdb_string.h.
	* f-exp.y: Use string.h, not gdb_string.h.
	* f-lang.c: Use string.h, not gdb_string.h.
	* f-typeprint.c: Use string.h, not gdb_string.h.
	* f-valprint.c: Use string.h, not gdb_string.h.
	* fbsd-nat.c: Use string.h, not gdb_string.h.
	* findcmd.c: Use string.h, not gdb_string.h.
	* findvar.c: Use string.h, not gdb_string.h.
	* fork-child.c: Use string.h, not gdb_string.h.
	* frame.c: Use string.h, not gdb_string.h.
	* frv-linux-tdep.c: Use string.h, not gdb_string.h.
	* frv-tdep.c: Use string.h, not gdb_string.h.
	* gdb.c: Use string.h, not gdb_string.h.
	* gdb_bfd.c: Use string.h, not gdb_string.h.
	* gdbarch.c: Use string.h, not gdb_string.h.
	* gdbtypes.c: Use string.h, not gdb_string.h.
	* gnu-nat.c: Use string.h, not gdb_string.h.
	* gnu-v2-abi.c: Use string.h, not gdb_string.h.
	* gnu-v3-abi.c: Use string.h, not gdb_string.h.
	* go-exp.y: Use string.h, not gdb_string.h.
	* go-lang.c: Use string.h, not gdb_string.h.
	* go32-nat.c: Use string.h, not gdb_string.h.
	* hppa-hpux-tdep.c: Use string.h, not gdb_string.h.
	* hppa-linux-nat.c: Use string.h, not gdb_string.h.
	* hppanbsd-tdep.c: Use string.h, not gdb_string.h.
	* hppaobsd-tdep.c: Use string.h, not gdb_string.h.
	* i386-cygwin-tdep.c: Use string.h, not gdb_string.h.
	* i386-dicos-tdep.c: Use string.h, not gdb_string.h.
	* i386-linux-nat.c: Use string.h, not gdb_string.h.
	* i386-linux-tdep.c: Use string.h, not gdb_string.h.
	* i386-nto-tdep.c: Use string.h, not gdb_string.h.
	* i386-sol2-tdep.c: Use string.h, not gdb_string.h.
	* i386-tdep.c: Use string.h, not gdb_string.h.
	* i386bsd-tdep.c: Use string.h, not gdb_string.h.
	* i386gnu-nat.c: Use string.h, not gdb_string.h.
	* i386nbsd-tdep.c: Use string.h, not gdb_string.h.
	* i386obsd-tdep.c: Use string.h, not gdb_string.h.
	* i387-tdep.c: Use string.h, not gdb_string.h.
	* ia64-libunwind-tdep.c: Use string.h, not gdb_string.h.
	* ia64-linux-nat.c: Use string.h, not gdb_string.h.
	* inf-child.c: Use string.h, not gdb_string.h.
	* inf-ptrace.c: Use string.h, not gdb_string.h.
	* inf-ttrace.c: Use string.h, not gdb_string.h.
	* infcall.c: Use string.h, not gdb_string.h.
	* infcmd.c: Use string.h, not gdb_string.h.
	* inflow.c: Use string.h, not gdb_string.h.
	* infrun.c: Use string.h, not gdb_string.h.
	* interps.c: Use string.h, not gdb_string.h.
	* iq2000-tdep.c: Use string.h, not gdb_string.h.
	* irix5-nat.c: Use string.h, not gdb_string.h.
	* jv-exp.y: Use string.h, not gdb_string.h.
	* jv-lang.c: Use string.h, not gdb_string.h.
	* jv-typeprint.c: Use string.h, not gdb_string.h.
	* jv-valprint.c: Use string.h, not gdb_string.h.
	* language.c: Use string.h, not gdb_string.h.
	* linux-fork.c: Use string.h, not gdb_string.h.
	* linux-nat.c: Use string.h, not gdb_string.h.
	* lm32-tdep.c: Use string.h, not gdb_string.h.
	* m2-exp.y: Use string.h, not gdb_string.h.
	* m2-typeprint.c: Use string.h, not gdb_string.h.
	* m32c-tdep.c: Use string.h, not gdb_string.h.
	* m32r-linux-nat.c: Use string.h, not gdb_string.h.
	* m32r-linux-tdep.c: Use string.h, not gdb_string.h.
	* m32r-rom.c: Use string.h, not gdb_string.h.
	* m32r-tdep.c: Use string.h, not gdb_string.h.
	* m68hc11-tdep.c: Use string.h, not gdb_string.h.
	* m68k-tdep.c: Use string.h, not gdb_string.h.
	* m68kbsd-tdep.c: Use string.h, not gdb_string.h.
	* m68klinux-nat.c: Use string.h, not gdb_string.h.
	* m68klinux-tdep.c: Use string.h, not gdb_string.h.
	* m88k-tdep.c: Use string.h, not gdb_string.h.
	* macrocmd.c: Use string.h, not gdb_string.h.
	* main.c: Use string.h, not gdb_string.h.
	* mdebugread.c: Use string.h, not gdb_string.h.
	* mem-break.c: Use string.h, not gdb_string.h.
	* memattr.c: Use string.h, not gdb_string.h.
	* memory-map.c: Use string.h, not gdb_string.h.
	* mep-tdep.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-break.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-disas.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-env.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-stack.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-var.c: Use string.h, not gdb_string.h.
	* mi/mi-cmds.c: Use string.h, not gdb_string.h.
	* mi/mi-console.c: Use string.h, not gdb_string.h.
	* mi/mi-getopt.c: Use string.h, not gdb_string.h.
	* mi/mi-interp.c: Use string.h, not gdb_string.h.
	* mi/mi-main.c: Use string.h, not gdb_string.h.
	* mi/mi-parse.c: Use string.h, not gdb_string.h.
	* microblaze-rom.c: Use string.h, not gdb_string.h.
	* microblaze-tdep.c: Use string.h, not gdb_string.h.
	* mingw-hdep.c: Use string.h, not gdb_string.h.
	* minidebug.c: Use string.h, not gdb_string.h.
	* minsyms.c: Use string.h, not gdb_string.h.
	* mips-irix-tdep.c: Use string.h, not gdb_string.h.
	* mips-linux-tdep.c: Use string.h, not gdb_string.h.
	* mips-tdep.c: Use string.h, not gdb_string.h.
	* mips64obsd-tdep.c: Use string.h, not gdb_string.h.
	* mipsnbsd-tdep.c: Use string.h, not gdb_string.h.
	* mipsread.c: Use string.h, not gdb_string.h.
	* mn10300-linux-tdep.c: Use string.h, not gdb_string.h.
	* mn10300-tdep.c: Use string.h, not gdb_string.h.
	* monitor.c: Use string.h, not gdb_string.h.
	* moxie-tdep.c: Use string.h, not gdb_string.h.
	* mt-tdep.c: Use string.h, not gdb_string.h.
	* nbsd-tdep.c: Use string.h, not gdb_string.h.
	* nios2-linux-tdep.c: Use string.h, not gdb_string.h.
	* nto-procfs.c: Use string.h, not gdb_string.h.
	* nto-tdep.c: Use string.h, not gdb_string.h.
	* objc-lang.c: Use string.h, not gdb_string.h.
	* objfiles.c: Use string.h, not gdb_string.h.
	* opencl-lang.c: Use string.h, not gdb_string.h.
	* osabi.c: Use string.h, not gdb_string.h.
	* osdata.c: Use string.h, not gdb_string.h.
	* p-exp.y: Use string.h, not gdb_string.h.
	* p-lang.c: Use string.h, not gdb_string.h.
	* p-typeprint.c: Use string.h, not gdb_string.h.
	* parse.c: Use string.h, not gdb_string.h.
	* posix-hdep.c: Use string.h, not gdb_string.h.
	* ppc-linux-nat.c: Use string.h, not gdb_string.h.
	* ppc-sysv-tdep.c: Use string.h, not gdb_string.h.
	* ppcfbsd-tdep.c: Use string.h, not gdb_string.h.
	* ppcnbsd-tdep.c: Use string.h, not gdb_string.h.
	* ppcobsd-tdep.c: Use string.h, not gdb_string.h.
	* printcmd.c: Use string.h, not gdb_string.h.
	* procfs.c: Use string.h, not gdb_string.h.
	* prologue-value.c: Use string.h, not gdb_string.h.
	* python/py-auto-load.c: Use string.h, not gdb_string.h.
	* python/py-gdb-readline.c: Use string.h, not gdb_string.h.
	* ravenscar-thread.c: Use string.h, not gdb_string.h.
	* regcache.c: Use string.h, not gdb_string.h.
	* registry.c: Use string.h, not gdb_string.h.
	* remote-fileio.c: Use string.h, not gdb_string.h.
	* remote-m32r-sdi.c: Use string.h, not gdb_string.h.
	* remote-mips.c: Use string.h, not gdb_string.h.
	* remote-sim.c: Use string.h, not gdb_string.h.
	* remote.c: Use string.h, not gdb_string.h.
	* reverse.c: Use string.h, not gdb_string.h.
	* rs6000-aix-tdep.c: Use string.h, not gdb_string.h.
	* ser-base.c: Use string.h, not gdb_string.h.
	* ser-go32.c: Use string.h, not gdb_string.h.
	* ser-mingw.c: Use string.h, not gdb_string.h.
	* ser-pipe.c: Use string.h, not gdb_string.h.
	* ser-tcp.c: Use string.h, not gdb_string.h.
	* ser-unix.c: Use string.h, not gdb_string.h.
	* serial.c: Use string.h, not gdb_string.h.
	* sh-tdep.c: Use string.h, not gdb_string.h.
	* sh64-tdep.c: Use string.h, not gdb_string.h.
	* shnbsd-tdep.c: Use string.h, not gdb_string.h.
	* skip.c: Use string.h, not gdb_string.h.
	* sol-thread.c: Use string.h, not gdb_string.h.
	* solib-dsbt.c: Use string.h, not gdb_string.h.
	* solib-frv.c: Use string.h, not gdb_string.h.
	* solib-osf.c: Use string.h, not gdb_string.h.
	* solib-spu.c: Use string.h, not gdb_string.h.
	* solib-target.c: Use string.h, not gdb_string.h.
	* solib.c: Use string.h, not gdb_string.h.
	* somread.c: Use string.h, not gdb_string.h.
	* source.c: Use string.h, not gdb_string.h.
	* sparc-nat.c: Use string.h, not gdb_string.h.
	* sparc-sol2-tdep.c: Use string.h, not gdb_string.h.
	* sparc-tdep.c: Use string.h, not gdb_string.h.
	* sparc64-tdep.c: Use string.h, not gdb_string.h.
	* sparc64fbsd-tdep.c: Use string.h, not gdb_string.h.
	* sparc64nbsd-tdep.c: Use string.h, not gdb_string.h.
	* sparcnbsd-tdep.c: Use string.h, not gdb_string.h.
	* spu-linux-nat.c: Use string.h, not gdb_string.h.
	* spu-multiarch.c: Use string.h, not gdb_string.h.
	* spu-tdep.c: Use string.h, not gdb_string.h.
	* stabsread.c: Use string.h, not gdb_string.h.
	* stack.c: Use string.h, not gdb_string.h.
	* std-regs.c: Use string.h, not gdb_string.h.
	* symfile.c: Use string.h, not gdb_string.h.
	* symmisc.c: Use string.h, not gdb_string.h.
	* symtab.c: Use string.h, not gdb_string.h.
	* target.c: Use string.h, not gdb_string.h.
	* thread.c: Use string.h, not gdb_string.h.
	* tilegx-linux-nat.c: Use string.h, not gdb_string.h.
	* tilegx-tdep.c: Use string.h, not gdb_string.h.
	* top.c: Use string.h, not gdb_string.h.
	* tracepoint.c: Use string.h, not gdb_string.h.
	* tui/tui-command.c: Use string.h, not gdb_string.h.
	* tui/tui-data.c: Use string.h, not gdb_string.h.
	* tui/tui-disasm.c: Use string.h, not gdb_string.h.
	* tui/tui-file.c: Use string.h, not gdb_string.h.
	* tui/tui-layout.c: Use string.h, not gdb_string.h.
	* tui/tui-out.c: Use string.h, not gdb_string.h.
	* tui/tui-regs.c: Use string.h, not gdb_string.h.
	* tui/tui-source.c: Use string.h, not gdb_string.h.
	* tui/tui-stack.c: Use string.h, not gdb_string.h.
	* tui/tui-win.c: Use string.h, not gdb_string.h.
	* tui/tui-windata.c: Use string.h, not gdb_string.h.
	* tui/tui-winsource.c: Use string.h, not gdb_string.h.
	* typeprint.c: Use string.h, not gdb_string.h.
	* ui-file.c: Use string.h, not gdb_string.h.
	* ui-out.c: Use string.h, not gdb_string.h.
	* user-regs.c: Use string.h, not gdb_string.h.
	* utils.c: Use string.h, not gdb_string.h.
	* v850-tdep.c: Use string.h, not gdb_string.h.
	* valarith.c: Use string.h, not gdb_string.h.
	* valops.c: Use string.h, not gdb_string.h.
	* valprint.c: Use string.h, not gdb_string.h.
	* value.c: Use string.h, not gdb_string.h.
	* varobj.c: Use string.h, not gdb_string.h.
	* vax-tdep.c: Use string.h, not gdb_string.h.
	* vaxnbsd-tdep.c: Use string.h, not gdb_string.h.
	* vaxobsd-tdep.c: Use string.h, not gdb_string.h.
	* windows-nat.c: Use string.h, not gdb_string.h.
	* xcoffread.c: Use string.h, not gdb_string.h.
	* xml-support.c: Use string.h, not gdb_string.h.
	* xstormy16-tdep.c: Use string.h, not gdb_string.h.
	* xtensa-linux-nat.c: Use string.h, not gdb_string.h.
2013-11-18 13:29:00 -07:00
Andrew Burgess f69d9aef9b Print <unavailable> for unavailable registers in info register output.
https://sourceware.org/ml/gdb-patches/2013-08/msg00171.html

gdb/ChangeLog

	* infcmd.c (default_print_one_register_info): Use val_print to
	print all values even optimized out or unavailable ones.  Don't
	try to print a raw form of optimized out or unavailable values.

gdb/testsuite/ChangeLog

	* gdb.trace/unavailable.exp (gdb_unavailable_registers_test):
	Expect <unavailable> pattern.
2013-10-29 13:26:49 +00:00
Pedro Alves 98882a2651 Make STARTUP_WITH_SHELL a runtime toggle -- add new "set/show startup-with-shell" option.
Occasionaly we hear about people having problems with GDB not being
able to start programs (with "run"/"start").  GDB spawns a shell to
start the program, and most often, it'll be the case that the problem
is actually with the user's shell setup.

GDB has code to disable the use of the shell to start programs.
That's the STARTUP_WITH_SHELL macro that native targets could set to 0
in their nm.h file (though no target actually uses it nowadays).

This patch makes that setting a run-time knob instead.  This will be
useful to quickly diagnose such shell issues, and might also come in
handy at other times (such as when debugging the shell itself, if you
don't have a different shell handy).

gdb/
2013-10-24  Pedro Alves  <palves@redhat.com>

	* NEWS (New options): Mention set/show startup-with-shell.
	* config/alpha/nm-osf3.h (START_INFERIOR_TRAPS_EXPECTED): Set to 2
	instead of 3.
	* fork-child.c (fork_inferior, startup_inferior): Handle 'set
	startup-with-shell'.
	(show_startup_with_shell): New function.
	(_initialize_fork_child): Register the set/show startup-with-shell
	commands.
	* inf-ptrace.c (inf_ptrace_create_inferior): Remove comment.
	* inf-ttrace.c (inf_ttrace_him): Remove comment.
	* procfs.c (procfs_init_inferior): Remove comment.
	* infcmd.c (startup_with_shell): New global.
	* inferior.h (startup_with_shell): Declare global.
	(STARTUP_WITH_SHELL): Delete.
	(START_INFERIOR_TRAPS_EXPECTED): Set to 1 by default instead of 2.

gdb/doc/
2013-10-24  Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (Starting): Document set/show startup-with-shell.
2013-10-25 14:02:59 +00:00
Pedro Alves 901461f8eb Print registers not saved in the frame as "<not saved>" instead of "<optimized out>".
Currently, in some scenarios, GDB prints <optimized out> when printing
outer frame registers.  An <optimized out> register is a confusing
concept.  What this really means is that the register is
call-clobbered, or IOW, not saved by the callee.  This patch makes GDB
say that instead.

Before patch:

 (gdb) p/x $rax $1 = <optimized out>
 (gdb) info registers rax
 rax            <optimized out>

After patch:

 (gdb) p/x $rax
 $1 = <not saved>
 (gdb) info registers rax
 rax            <not saved>

However, if for some reason the debug info describes a variable as
being in such a register (**), we still want to print <optimized out>
when printing the variable.  IOW, <not saved> is reserved for
inspecting registers at the machine level.  The patch uses
lval_register+optimized_out to encode the not saved registers, and
makes it so that optimized out variables always end up in
!lval_register values.

** See <https://sourceware.org/ml/gdb-patches/2012-08/msg00787.html>.
Current/recent enough GCC doesn't mark variables/arguments as being in
call-clobbered registers in the ranges corresponding to function
calls, while older GCCs did.  Newer GCCs will just not say where the
variable is, so GDB will end up realizing the variable is optimized
out.

frame_unwind_got_optimized creates not_lval optimized out registers,
so by default, in most cases, we'll see <optimized out>.

value_of_register is the function eval.c uses for evaluating
OP_REGISTER (again, $pc, etc.), and related bits.  It isn't used for
anything else.  This function makes sure to return lval_register
values.  The patch makes "info registers" and the MI equivalent use it
too.  I think it just makes a lot of sense, as this makes it so that
when printing machine registers ($pc, etc.), we go through a central
function.

We're likely to need a different encoding at some point, if/when we
support partially saved registers.  Even then, I think
value_of_register will still be the spot to tag the intention to print
machine register values differently.

value_from_register however may also return optimized out
lval_register values, so at a couple places where we're computing a
variable's location from a dwarf expression, we convert the resulting
value away from lval_register to a regular optimized out value.

Tested on x86_64 Fedora 17

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

	* cp-valprint.c (cp_print_value_fields): Adjust calls to
	val_print_optimized_out.
	* jv-valprint.c (java_print_value_fields): Likewise.
	* p-valprint.c (pascal_object_print_value_fields): Likewise.
	* dwarf2loc.c (dwarf2_evaluate_loc_desc_full)
	<DWARF_VALUE_REGISTER>: If the register was not saved, return a
	new optimized out value.
	* findvar.c (address_from_register): Likewise.
	* frame.c (put_frame_register): Tweak error string to say the
	register was not saved, rather than optimized out.
	* infcmd.c (default_print_one_register_info): Adjust call to
	val_print_optimized_out.  Use value_of_register instead of
	get_frame_register_value.
	* mi/mi-main.c (output_register): Use value_of_register instead of
	get_frame_register_value.
	* valprint.c (valprint_check_validity): Likewise.
	(val_print_optimized_out): New value parameter.  If the value is
	lval_register, print <not saved> instead.
	(value_check_printable, val_print_scalar_formatted): Adjust calls
	to val_print_optimized_out.
	* valprint.h (val_print_optimized_out): New value parameter.
	* value.c (struct value) <optimized_out>: Extend comment.
	(error_value_optimized_out): New function.
	(require_not_optimized_out): Use it.  Use a different string for
	lval_register values.
	* value.h (error_value_optimized_out): New declaration.
	* NEWS: Mention <not saved>.

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

	* gdb.dwarf2/dw2-reg-undefined.exp <pattern_rax_rbx_rcx_print,
	pattern_rax_rbx_rcx_info>: Set to "<not saved>".
	* gdb.mi/mi-reg-undefined.exp (opt_out_pattern): Delete.
	(not_saved_pattern): New.
	Replace use of the former with the latter.

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

	* gdb.texinfo (Registers): Expand description of saved registers
	in frames.  Explain <not saved>.
2013-10-02 16:15:46 +00:00
Luis Machado dfd4cc6311 * aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid.
Replace TIDGET with ptid_get_lwp.
	Replace GET_LWP with ptid_get_lwp.
	* aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove.
	Replace BUILD_THREAD with ptid_build.
	Replace BUILD_LWP with ptid_build.
	Replace PIDGET with ptid_get_pid.
	Replace TIDGET with ptid_get_lwp.
	* alphabsd-nat.c: Replace PIDGET with ptid_get_pid.
	* amd64-linux-nat.c: Replace PIDGET with ptid_get_pid.
	Replace TIDGET with ptid_get_lwp.
	* amd64bsd-nat.c: Replace PIDGET with ptid_get_pid.
	* arm-linux-nat.c: Replace PIDGET with ptid_get_pid.
	Replace TIDGET with ptid_get_lwp.
	Replace GET_LWP with ptid_get_lwp.
	* armnbsd-nat.c: Replace PIDGET with ptid_get_pid.
	* auxv.c: Likewise.
	* breakpoint.c: Likewise.
	* common/ptid.c (ptid_is_pid): Condense check for
	null_ptid and minus_one_ptid.
	(ptid_lwp_p): New function.
	(ptid_tid_p): New function.
	* common/ptid.h: Update comments for accessors.
	(ptid_lwp_p): New prototype.
	(ptid_tid_p): New prototype.
	* defs.h (PIDGET, TIDGET, MERGEPID): Do not define.
	* gcore.c: Replace PIDGET with ptid_get_pid.
	* gdbthread.h: Likewise.
	* gnu-nat.c: Likewise.
	* hppa-linux-nat.c: Replace PIDGET with ptid_get_pid.
	Replace TIDGET with ptid_get_lwp.
	* hppabsd-nat.c: Replace PIDGET with ptid_get_pid.
	* hppanbsd-nat.c: Likewise.
	* i386-linux-nat.c: Replace PIDGET with ptid_get_pid.
	Replace TIDGET with ptid_get_lwp.
	* i386bsd-nat.c: Replace PIDGET with ptid_get_pid.
	* ia64-linux-nat.c: Replace PIDGET with ptid_get_pid.
	* infcmd.c: Likewise.
	* inferior.h: Likewise.
	* inflow.c: Likewise.
	* infrun.c: Likewise.
	* linux-fork.c: Likewise.
	* linux-nat.c: Replace PIDGET with ptid_get_pid.
	Replace GET_PID with ptid_get_pid.
	Replace is_lwp with ptid_lwp_p.
	Replace GET_LWP with ptid_get_lwp.
	Replace BUILD_LWP with ptid_build.
2013-09-30 11:50:12 +00:00
Andrew Burgess e4c6a2c42d Consistent display of "<optimized out>" for register values.
https://sourceware.org/ml/gdb-patches/2013-08/msg00170.html

gdb/ChangeLog

        * infcmd.c (default_print_one_register_info): Add detection of
        optimized out values.
        (default_print_registers_info): Switch to using
        get_frame_register_value.

gdb/testsuite/ChangeLog

        * gdb.dwarf2/dw2-reg-undefined.exp: Change pattern for info
        register to "<optimized out>", and also print the registers.
2013-09-18 14:02:31 +00: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
Andrew Burgess cf0063592d Reuse print_hex_chars function.
http://sourceware.org/ml/gdb-patches/2013-07/msg00234.html

	* infcmd.c (default_print_one_register_info): Reuse code in
	print_hex_chars.
2013-07-11 09:07:41 +00:00
Doug Evans 2a998fc037 * defs.h (enum val_prettyformat): Renamed from val_prettyprint.
Enum values rename as well.  All uses updated.
	* valprint.h (value_print_options): Rename member pretty to
	pretty format.  Rename member prettyprint_arrays to
	prettyformat_arrays.  Rename member prettyprint_structs to
	prettyformat_structs.  All uses updated.
	(get_no_prettyformat_print_options): Renamed from
	get_raw_print_options.
	* valprint.c (get_no_prettyformat_print_options): Renamed from
	get_raw_print_options.  All callers updated.
	(show_prettyformat_structs): Renamed from show_prettyprint_structs.
	All callers updated.
	(show_prettyformat_arrays): Renamed from show_prettyprint_arrays.
	All callers updated.
	(_initialize_valprint): Improve help text for "set print pretty" and
	"set print arrays".

	testsuite/
	* gdb.base/default.exp: Update expected output of "show print array"
	and "show print pretty".
2013-07-09 16:57:09 +00:00
Pedro Alves c1e36e3e91 range stepping: gdb
This patch teaches GDB to take advantage of target-assisted range
stepping.  It adds a new 'r ADDR1,ADDR2' action to vCont (vCont;r),
meaning, "step once, and keep stepping as long as the thread is in the
[ADDR1,ADDR2) range".

Rationale:

When user issues the "step" command on the following line of source,

   a = b + c + d * e - a;

GDB single-steps every single instruction until the program reaches a
new different line.  E.g., on x86_64, that line compiles to:

   0x08048434 <+65>:    mov    0x1c(%esp),%eax
   0x08048438 <+69>:    mov    0x30(%esp),%edx
   0x0804843c <+73>:    add    %eax,%edx
   0x0804843e <+75>:    mov    0x18(%esp),%eax
   0x08048442 <+79>:    imul   0x2c(%esp),%eax
   0x08048447 <+84>:    add    %edx,%eax
   0x08048449 <+86>:    sub    0x34(%esp),%eax
   0x0804844d <+90>:    mov    %eax,0x34(%esp)
   0x08048451 <+94>:    mov    0x1c(%esp),%eax

and the following is the RSP traffic between GDB and GDBserver:

 --> vCont;s:p2e13.2e13;c
 <-- T0505:68efffbf;04:30efffbf;08:3c840408;thread:p2e13.2e13;core:1;
 --> vCont;s:p2e13.2e13;c
 <-- T0505:68efffbf;04:30efffbf;08:3e840408;thread:p2e13.2e13;core:2;
 --> vCont;s:p2e13.2e13;c
 <-- T0505:68efffbf;04:30efffbf;08:42840408;thread:p2e13.2e13;core:2;
 --> vCont;s:p2e13.2e13;c
 <-- T0505:68efffbf;04:30efffbf;08:47840408;thread:p2e13.2e13;core:0;
 --> vCont;s:p2e13.2e13;c
 <-- T0505:68efffbf;04:30efffbf;08:49840408;thread:p2e13.2e13;core:0;
 --> vCont;s:p2e13.2e13;c
 <-- T0505:68efffbf;04:30efffbf;08:4d840408;thread:p2e13.2e13;core:0;
 --> vCont;s:p2e13.2e13;c
 <-- T0505:68efffbf;04:30efffbf;08:51840408;thread:p2e13.2e13;core:0;

IOW, a lot of roundtrips between GDB and GDBserver.

If we add a new command to the RSP, meaning "keep stepping and don't
report a stop until the program goes out of the [0x08048434,
0x08048451) address range", then the RSP traffic can be reduced down
to:

 --> vCont;r8048434,8048451:p2db0.2db0;c
 <-- T0505:68efffbf;04:30efffbf;08:51840408;thread:p2db0.2db0;core:1;

As number of packets is reduced dramatically, the performance of
stepping source lines is much improved.

In case something is wrong with range stepping on the stub side, the
debug info or even gdb, this adds a "set/show range-stepping" command
to be able to turn range stepping off.

gdb/
2013-05-23  Yao Qi  <yao@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* gdbthread.h (struct thread_control_state) <may_range_step>: New
	field.
	* infcmd.c (step_once, until_next_command): Enable range stepping.
	* infrun.c (displaced_step_prepare): Disable range stepping.
	(resume): Disable range stepping if stepping over a breakpoint or
	we have software watchpoints.  If range stepping is enabled,
	assert the thread is in the stepping range.
	(clear_proceed_status_thread): Clear may_range_step.
	(handle_inferior_event): Disable range stepping as soon as we know
	the thread that hit the event.  Re-enable it whenever we're going
	to step with a step range.
	* remote.c (struct vCont_action_support) <r>: New field.
	(use_range_stepping): New global.
	(remote_vcont_probe): Handle 'r' action.
	(append_resumption): Append an 'r' action if the thread may range
	step.
	(show_range_stepping): New function.
	(set_range_stepping): New function.
	(_initialize_remote): Call add_setshow_boolean_cmd to register the
	'set range-stepping' and 'show range-stepping' commands.
	* NEWS: Mention range stepping, the new vCont;r action, and the
	new "set/show range-stepping" commands.

gdb/doc/
2013-05-23  Yao Qi  <yao@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (Packets): Document 'vCont;r'.
	(Continuing and Stepping): Document target-assisted range
	stepping, and the 'set range-stepping' and 'show range-stepping'
	commands.
2013-05-23 17:15:35 +00:00
Joel Brobecker 4d1eb6b4d2 Reimplement shared library support on ppc-aix...
... using the target_so_ops framework.

gdb/ChangeLog:

        * target.h (TARGET_OBJECT_AIX_LIBRARIES): New target_object enum.
        * features/library-list-aix.dtd: New file.
        * solib-aix.h, solib-aix.c: New file.
        * rs6000-aix-tdep.c: #include "solib.h" and "solib-aix.h".
        (rs6000_find_toc_address_hook): Delete.
        (rs6000_push_dummy_call): Rewrite code setting the TOC value.
        (rs6000_aix_init_osabi): Register solib_aix_so_ops.
        * rs6000-nat.c: Remove "xcoffsolib.h" include.  Include
        "xml-utils.h".
        (map_vmap, vmap_exec, vmap_ldinfo, add_vmap, objfile_symbol_add)
        (vmap_symtab, fixup_breakpoints): Delete.
        (rs6000_xfer_shared_libraries): New function.
        (rs6000_xfer_partial): Add TARGET_OBJECT_AIX_LIBRARIES handling.
        (vmap_secs, bss_data_overlap, vmap_add_symbols): Delete.
        (xcoff_relocate_symtab, xcoff_relocate_core): Delete.
        (rs6000_ptrace_ldinfo, rs6000_core_ldinfo)
        (rs6000_xfer_shared_library): New function.
        (find_toc_address): Delete.
        (_initialize_rs6000_nat): Do not set rs6000_find_toc_address_hook.
        * rs6000-tdep.h (rs6000_find_toc_address_hook): Remove.
        * xcoffread.c (record_minimal_symbol): Reloate symbol address
        before creating minimal symbol.  Adjust function description
        accordingly.
        (scan_xcoff_symtab): Replace call to
        prim_record_minimal_symbol_and_info by call to
        record_minimal_symbol.
        (xcoff_symfile_offsets): Reimplement mostly as a wrapper
        around default_symfile_offsets.
        * configure.tgt: Add solib-aix.o to gdb_target_obs for
        powerpc-aix targets.
        * config/rs6000/nm-rs6000.h: Delete.
        * config/powerpc/aix.mh (NAT_FILE): Delete.
        (NATDEPFILES): Remove xcoffsolib.o.
        * Makefile.in (XMLFILES): Add library-list-aix.dtd.
        (ALL_TARGET_OBS): Add solib-aix.o.
        (HFILES_NO_SRCDIR): Remove xcoffsolib.h and
        config/rs6000/nm-rs6000.h.  Add solib-aix.h.
        (ALLDEPFILES): Add solib-aix.c.  Remove xcoffsolib.c.
        * xcoffsolib.h, xcoffsolib.c: Delete.

        * solib.c (reload_shared_libraries): Remove reference to
        SOLIB_CREATE_INFERIOR_HOOK.
        * breakpoint.c (handle_solib_event): Remove reference to SOLIB_ADD.
        (disable_breakpoints_in_shlibs): Remove reference to PC_SOLIB.
        (momentary_bkpt_re_set): Replace SOLIB_ADD by solib_add in
        comment.
        * corelow.c (deprecated_core_resize_section_table): Delete.
        * exec.c: Remove include of xcoffsolib.h".
        (map_vmap, vmap): Delete.
        (exec_close_1): Remove references to vmap.
        (exec_file_attach): Remove vmap handling code, and reference
        to DEPRECATED_IBM6000_TARGET.
        (bfdsec_to_vmap): Delete.
        (exec_files_info): Remove block of code handling VMAP.
        * infcmd.c (post_create_inferior): Remove reference to
        SOLIB_CREATE_INFERIOR_HOOK and SOLIB_ADD.
        * infrun.c (follow_exec): Remove reference to
        SOLIB_CREATE_INFERIOR_HOOK.
        * stack.c (print_frame): Remove reference to PC_SOLIB.
        * solib-dsbt.c (dsbt_current_sos): Adjust comment.
        (dsbt_relocate_main_executable): Likewise.
        * solib-frv.c (frv_current_sos): Likewise.

gdb/doc/ChangeLog:

        * gdbint.texinfo (Algorithms): Remove entries documenting
        DEPRECATED_IBM6000_TARGET, SOLIB_ADD, and
        SOLIB_CREATE_INFERIOR_HOOK.
2013-05-06 14:15:50 +00:00
Jan Kratochvil faab992242 gdb/
* event-top.c (display_gdb_prompt): Call missing do_cleanups.
	* infcmd.c (get_return_value) <!stop_regs>: Do not overwrite CLEANUP.
	* symfile.c (symfile_bfd_open): New variable back_to.  Do not leave
	a stale cleanup.  Fix double free of NAME.
2013-05-05 16:54:26 +00:00
Pedro Alves 2f9d54cfce make -gdb-exit call disconnect_tracing too, and don't lose history if the target errors on "quit"
Gareth mentions in PR gdb/15275:

 "The MI '-gdb-exit' command mi_cmd_gdb_exit() never calls disconnect_tracing()
 and therefore exits correctly."

It should, so to get out of tfind mode, as quit may detach instead of
kill, and we don't want to confuse the memory/register accesses
etc. of the detach process.  So we should push down the disconnect
tracing bits at least to quit_force.  But we can't as is, as that
would swallow the error thrown by answering "no" to:

  Trace is running but will stop on detach; detach anyway? (y or n)

So to address that, we split disconnect_tracing in two.  One part that
does the query, and another part that does the rest, and we make
quit_force call the latter.

Looking at quit_force, it does several things, some of which are a bit
independent of the others.  It first kills/detaches, and then writes
history, and then runs the final cleanups.  It seems better to me to
do each of these things even if the previous thing throws.  E.g., as
is, if something throws while detaching, then we skip writing history.

Tested on x86_64 Fedora 17.

gdb/
2013-04-10  Pedro Alves  <palves@redhat.com>

	* cli/cli-cmds.c (quit_command): Call query_if_trace_running
	instead of disconnect_tracing.
	* infcmd.c (detach_command, disconnect_command): Call
	query_if_trace_running.  Adjust.
	* top.c: Include "tracepoint.h".
	(quit_target): Delete.  Contents moved ...
	(quit_force): ... here.  Wrap each stage of teardown in
	TRY_CATCH.  Call disconnect_tracing before detaching.
2013-04-10 14:10:35 +00:00
Tom Tromey e27d198cc4 PR symtab/8424:
* blockframe.c (find_pc_partial_function_gnu_ifunc): Check
	SYMBOL_SECTION, not SYMBOL_OBJ_SECTION.
	* breakpoint.c (resolve_sal_pc): Update.
	* elfread.c (elf_gnu_ifunc_record_cache): Update.
	* findvar.c (struct minsym_lookup_data) <objfile>: New field.
	(minsym_lookup_iterator_cb): Use it.
	(default_read_var_value): Update.
	* hppa-hpux-tdep.c (hppa64_hpux_in_solib_call_trampoline):
	Update.
	* infcmd.c (jump_command): Update.
	* linespec.c (minsym_found): Update.
	* maint.c (maintenance_translate_address): Update.
	* minsyms.c (lookup_minimal_symbol_by_pc_section_1): Update.
	(prim_record_minimal_symbol_full): Don't set SYMBOL_OBJ_SECTION.
	* parse.c (write_exp_msymbol): Update.
	* printcmd.c (address_info): Update.
	* psymtab.c (find_pc_sect_psymbol): Update.
	(fixup_psymbol_section): Check SYMBOL_SECTION, not
	SYMBOL_OBJ_SECTION.
	(add_psymbol_to_bcache): Correctly initialize SYMBOL_SECTION.
	Don't initialize SYMBOL_OBJ_SECTION.
	* spu-tdep.c (spu_catch_start): Update.
	* stabsread.c (define_symbol): Don't set SYMBOL_SECTION.
	* symmisc.c (dump_msymbols, print_symbol): Update.
	* symtab.c (fixup_section): Don't set 'obj_section'.  Change
	how fallback section is computed.
	(fixup_symbol_section): Update.
	(find_pc_sect_symtab, find_function_start_sal, skip_prologue_sal):
	Update.
	(allocate_symbol, initialize_symbol, allocate_template_symbol):
	Initialize SYMBOL_SECTION.
	* symtab.h (struct general_symbol_info) <section>: Update comment.
	<obj_section>: Remove.
	(SYMBOL_OBJ_SECTION): Add 'objfile' argument.  Rewrite.
	(SYMBOL_OBJFILE): New macro.
2013-04-08 20:18:11 +00:00
Tom Tromey 7cbd4a934e * minsyms.h (struct bound_minimal_symbol): New.
(lookup_minimal_symbol_and_objfile): Return bound_minimal_symbol.
	Remove objfile argument.
	(lookup_minimal_symbol_by_pc_section, lookup_minimal_symbol_by_pc):
	Return bound_minimal_symbol.
	* minsyms.c (lookup_minimal_symbol_by_pc_1)
	(lookup_minimal_symbol_by_pc_section, lookup_minimal_symbol_by_pc):
	Return bound_minimal_symbol.
	(in_gnu_ifunc_stub): Update.
	(lookup_minimal_symbol_and_objfile): Return bound_minimal_symbol.
	Remove 'objfile_p' argument.
	(lookup_solib_trampoline_symbol_by_pc): Update.
	* ada-tasks.c, amd64-windows-tdep.c, arm-tdep.c,
	arm-wince-tdep.c, block.c, blockframe.c, breakpoint.c, btrace.c,
	c-valprint.c, dwarf2loc.c, elfread.c, frame.c, frv-tdep.c,
	glibc-tdep.c, gnu-v2-abi.c, gnu-v3-abi.c, hppa-hpux-tdep.c,
	i386-tdep.c, ia64-tdep.c, infcall.c, infcmd.c, jit.c,
	linux-fork.c, m32c-tdep.c, m68hc11-tdep.c, maint.c,
	mips-tdep.c, p-valprint.c, parse.c, ppc-linux-tdep.c,
	ppc-sysv-tdep.c, printcmd.c, rs6000-tdep.c, sh64-tdep.c,
	stack.c, symtab.c, tui/tui-disasm.c: Update.
2013-04-08 19:59:09 +00:00
Pedro Alves 6f937416b9 Constify strings in tracepoint.c, lookup_cmd and the completers.
This is sort of a continuation of Keith's parse_exp_1 constification
patch.  It started out by undoing these bits:

  @@ -754,9 +754,12 @@ validate_actionline (char **line, struct
   	  tmp_p = p;
   	  for (loc = t->base.loc; loc; loc = loc->next)
   	    {
  -	      p = tmp_p;
  -	      exp = parse_exp_1 (&p, loc->address,
  +	      const char *q;
  +
  +	      q = tmp_p;
  +	      exp = parse_exp_1 (&q, loc->address,
   				 block_for_pc (loc->address), 1);
  +	      p = (char *) q;

and progressively making more things const upwards, fixing fallout,
rinse repeat, until GDB built again (--enable-targets=all).

That ended up constifying lookup_cmd/add_cmd and (lots of) friends,
and the completers.

I didn't try to constify the command hooks themselves, because I know
upfront there are commands that write to the command string argument,
and I think I managed to stop at a nice non-hacky split point already.

I think the only non-really-super-obvious changes are
tracepoint.c:validate_actionline, and tracepoint.c:trace_dump_actions.

The rest is just mostly about 'char *' => 'const char *', 'char **'=>
'const char **', and the occasional (e.g., deprecated_cmd_warning)
case of 'char **'=> 'const char *', where/when I noticed that nothing
actually cares about the pointer to pointer output.

Tested on x86_64 Fedora 17, native and gdbserver.

gdb/
2013-03-13  Pedro Alves  <palves@redhat.com>

	* ada-lang.c (struct add_partial_datum) <text, text0, word>: Make
	fields const.
	(ada_make_symbol_completion_list): Make "text0" parameter const.
	* ax-gdb.c (agent_eval_command_one): Make "exp" parameter const.
	* breakpoint.c (condition_completer): Make "text" and "word"
	parameters const.  Adjust.
	(check_tracepoint_command): Adjust to validate_actionline
	prototype change.
	(catch_syscall_completer): Make "text" and "word" parameters
	const.
	* cli/cli-cmds.c (show_user): Make "comname" local const.
	(valid_command_p): Make "command" parameter const.
	(alias_command): Make "alias_prefix" and "command_prefix" locals
	const.
	* cli/cli-decode.c (add_cmd): Make "name" parameter const.
	(add_alias_cmd): Make "name" and "oldname" parameters const.
	Adjust.  No longer make copy of OLDNAME.
	(add_prefix_cmd, add_abbrev_prefix_cmd, add_set_or_show_cmd)
	(add_setshow_cmd_full, add_setshow_enum_cmd)
	(add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd)
	(add_setshow_filename_cmd, add_setshow_string_cmd)
	(add_setshow_string_noescape_cmd)
	(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
	(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
	(add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd)
	(delete_cmd, add_info, add_info_alias, add_com, add_com_alias):
	Make "name" parameter const.
	(help_cmd): Rename "command" parameter to "arg".  New const local
	"command".
	(find_cmd): Make "command" parameter const.
	(lookup_cmd_1): Make "text" parameter pointer to const.  Adjust to
	deprecated_cmd_warning prototype change.
	(undef_cmd_error): Make "cmdtype" parameter const.
	(lookup_cmd): Make "line" parameter const.
	(deprecated_cmd_warning): Change type of "text" parameter to
	pointer to const char, from pointer to pointer to char.  Adjust.
	(lookup_cmd_composition): Make "text" parameter const.
	(complete_on_cmdlist, complete_on_enum): Make "text" and "word"
	parameters const.
	* cli/cli-decode.h (struct cmd_list_element) <name>: Make field
	const.
	* cli/cli-script.c (validate_comname): Make "tem" local const.
	(define_command): New const local "tem_c".  Use it in calls to
	lookup_cmd.
	(document_command): Make "tem" and "comfull" locals const.
	(show_user_1): Make "prefix" and "name" parameters const.
	* cli-script.h (show_user_1): Make "prefix" and "name" parameters
	const.
	* command.h (add_cmd, add_alias_cmd, add_prefix_cmd)
	(add_abbrev_prefix_cmd, completer_ftype, lookup_cmd, lookup_cmd_1)
	(deprecated_cmd_warning, lookup_cmd_composition, add_com)
	(add_com_alias, add_info, add_info_alias, complete_on_cmdlist)
	(complete_on_enum, add_setshow_enum_cmd)
	(add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd)
	(add_setshow_filename_cmd, add_setshow_string_cmd)
	(add_setshow_string_noescape_cmd)
	(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
	(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
	(add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd):
	Change prototypes, constifying strings.
	* completer.c (noop_completer, filename_completer): Make "text"
	and "prefix" parameters const.
	(location_completer, expression_completer)
	(complete_line_internal): Make "text" and "prefix" parameters
	const and adjust.
	(command_completer, signal_completer): Make "text" and "prefix"
	parameters const.
	* completer.h (noop_completer, filename_completer)
	(expression_completer, location_completer, command_completer)
	(signal_completer): Change prototypes.
	* corefile.c (complete_set_gnutarget): Make "text" and "word"
	parameters const.
	* cp-abi.c (cp_abi_completer): Likewise.
	* expression.h (parse_expression_for_completion): Change
	prototype.
	* f-lang.c (f_make_symbol_completion_list): Make "text" and "word"
	parameters const.
	* infcmd.c (_initialize_infcmd): Make "cmd_name" local const.
	* infrun.c (handle_completer): Make "text" and "word" parameters
	const.
	* interps.c (interpreter_completer): Make "text" and "word"
	parameters const.
	* language.h (struct language_defn)
	<la_make_symbol_completion_list>: Make "text" and "word"
	parameters const.
	* parse.c (parse_exp_1): Move const hack to parse_exp_in_context.
	(parse_exp_in_context): Rename to ...
	(parse_exp_in_context_1): ... this.
	(parse_exp_in_context): Reimplement, with const hack from
	parse_exp_1.
	(parse_expression_for_completion): Make "string" parameter const.
	* printcmd.c (decode_format): Make "string_ptr" parameter pointer
	to pointer to const char.  Adjust.
	(print_command_1): Make "exp" parameter const.
	(output_command): Rename to ...
	(output_command_const): ... this.  Make "exp" parameter const.
	(output_command): Reimplement.
	(x_command): Adjust.
	(display_command): Rename "exp" parameter to "arg".  New "exp"
	local, const version of "arg".
	* python/py-auto-load.c (gdbpy_initialize_auto_load): Make
	"cmd_name" local const.
	* python/py-cmd.c (cmdpy_destroyer): Cast const away in xfree
	call.
	(cmdpy_completer): Make "text" and "word" parameters const.
	(gdbpy_parse_command_name): Make "prefix_text2" local const.
	* python/py-param.c (add_setshow_generic): Make "tmp_name" local
	const.
	* remote.c (_initialize_remote): Make "cmd_name" local const.
	* symtab.c (language_search_unquoted_string): Make "text" and "p"
	parameters const.  Adjust.
	(completion_list_add_fields): Make "sym_text", "text" and "word"
	parameters const.
	(struct add_name_data) <sym_text, text, word>: Make fields const.
	(default_make_symbol_completion_list_break_on): Make "text" and
	"word" parameters const.  Adjust locals.
	(default_make_symbol_completion_list)
	(make_symbol_completion_list, make_symbol_completion_type)
	(make_symbol_completion_list_fn): Make "text" and "word"
	parameters const.
	(make_file_symbol_completion_list): Make "text", "word" and
	"srcfile" parameters const.  Adjust locals.
	(add_filename_to_list): Make "text" and "word" parameters const.
	(struct add_partial_filename_data) <text, word>: Make fields
	const.
	(make_source_files_completion_list): Make "text" and "word"
	parameters const.
	* symtab.h (default_make_symbol_completion_list_break_on)
	(default_make_symbol_completion_list, make_symbol_completion_list)
	(make_symbol_completion_type enum type_code)
	(make_symbol_completion_list_fn make_file_symbol_completion_list)
	(make_source_files_completion_list): Change prototype.
	* top.c (execute_command): Adjust to pass pointer to pointer to
	const char to lookup_cmd, and to deprecated_cmd_warning prototype
	change.
	(set_verbose): Make "cmdname" local const.
	* tracepoint.c (decode_agent_options): Make "exp" parameter const,
	and adjust.
	(validate_actionline): Make "line" parameter a pointer to const
	char, and adjust.
	(encode_actions_1): Make "action_exp" local const, and adjust.
	(encode_actions): Adjust.
	(replace_comma): Delete.
	(trace_dump_actions): Make "action_exp" and "next_comma" locals
	const, and adjust.  Don't frob the action string while splitting
	it at commas.  Instead, make a copy of each split substring in
	turn.
	(trace_dump_command): Adjust to validate_actionline prototype
	change.
	* tracepoint.h (decode_agent_options, decode_agent_options)
	(encode_actions, validate_actionline): Change prototypes.
	* valprint.h (output_command): Delete declaration.
	(output_command_const): Declare.
	* value.c (function_destroyer): Cast const away in xfree call.
2013-03-13 18:34:55 +00:00
Keith Seitz 529480d058 * breakpoint.c (catch_syscall_split_args): Use skip_spaces.
(trace_pass_command): Likewise.
	* cli/cli-cmds.c: Include cli/cli-utils.h.
	(source_command): Use skip-spaces.
	(disassemble_command): Likewise.
	* findcmd.c: Include cli/cli-utils.h.
	(parse_find_args): Use skip_spaces.
	* go32-nat.c: Include cli/cli-utils.h.
	(go32_sldt): Use skip_spaces.
	(go32_sgdt): Likewise.
	(go32_sidt): Likewise.
	(go32_pde): Likewise.
	(go32_pte): Likewise.
	(go32_pte_for_address): Likewise.
	* infcmd.c: Include cli/cli-utils.h.
	(registers_info): Use skip_spaces.
	* linux-tdep.c (read_mapping): Use skip_spaces_const.
	(linux_info_proc): Likewise.
	* linux-thread-db.c: Include cli/cli-utils.h.
	(info_auto_load_libthread_db): Use skip_spaces_const.
	* m32r-rom.c: Include cli/cli-utils.h.
	(m32r_upload_command): Use skip_spaces.
	* maint.c: Include cli/cli-utils.h.
	(maintenance_translate_address): Use skip_spaces.
	* mi/mi-parse.c: Include cli/cli-utils.h.
	(mi_parse_argv): Use skip_spaces.
	(mi_parse): Likewise.
	* minsyms.c: Include cli/cli-utils.h.
	(msymbol_hash_iw): Use skip_spaces_const.
	* objc-lang.c: Include cli/cli-utils.h.
	(parse_selector): Use skip_spaces.
	(parse_method): Likewise.
	* python/python.c: Include cli/cli-utils.h.
	(python_interactive_command)[HAVE_PYTHON]: Use skip_spaces.
	(python_command)[HAVE_PYTHON]: Likewise.
	(python_interactive_command)[!HAVE_PYTHON]: Likewise.
	* remote-m32r-sdi.c: Include cli/cli-utils.h.
	(m32r_load): Use skip_spaces.
	* serial.c: Include cli/cli-utils.h.
	(serial_open): Use skip_spaces_const.
	* stack.c: Include cli/cli-utils.h.
	(parse_frame_specification_1): Use skip_spaces_const.
	* symfile.c: Include cli/cli-utils.h.
	(set_ext_lang_command): Use skip_spaces.
	* symtab.c: Include cli/cli-utils.h.
	(rbreak_command): Use skip_spaces.
	* thread.c (thread_name_command): Use skip_spaces.
	* tracepoint.c (validate_actionline): Use skip_spaces.
	(encode_actions_1): Likewise.
	(trace_find_range_command): Likewise.
	(trace_find_outside_command): Likewise.
	(trace_dump_actions): Likewise.
2013-03-07 21:57:30 +00:00
Yao Qi 53778a978f gdb/
* infcmd.c (breakpoint_proceeded): Remove it.
2013-02-14 04:00:16 +00:00
Aleksandar Ristovski 5799c0b969 2013-01-31 Aleksandar Ristovski <aristovski@qnx.com>
* charset.c (intermediate_encoding): Remove unused i.
	* completer.c (signal_completer): Remove unused i.
	* continuations.c (discard_my_continuations_1): Remove unused
	continuation_ptr.
	* corelow.c (core_close): Remove unuseD name.
	(get_core_siginfo): Remove unused pid.
	* cp-namespace.c (cp_lookup_symbol_imports_or_template): Remove unused
	i, cps.
	* dwarf2loc.c (dwarf2_compile_expr_to_ax): Remove unused base_offset.
	(loclist_describe_location): Remove unused first.
	* event-top.c (command_line_handler): Remove unused got_eof.
	* exec.c (exec_close_1): Remove unused need_symtab_cleanup.
	(resize_section_table): Remove unused old_value.
	* gdb_bfd.c (gdb_bfd_map_section): Remove unused header.
	* gnu-v3-abi.c (compute_vtable_size): Remove unused addr.
	* i386-tdep.c (i386_process_record): Remove unused rex.
	* infcmd.c (get_return_value): Remove unused uiout.
	* jv-lang.c (type_from_class): Remove unused is_array.
	* jv-valprint.c (java_val_print): Remove unused i.
	* linux-nat.c (linux_nat_stop_lwp): Remove unused ptid.
	* linux-thread-db.c (thread_db_find_new_threads_2): Remove unuseD pid.
	* m2-typeprint.c (m2_print_type): Remove unused code.
	* macroexp.c (get_character_constant): Remove unused body_start.
	(macro_stringify): Remove unused result.
	* objc-lang.c (find_methods): Remove unused gdbarch.
	* objfiles.c (filter_overlapping_sections): Remove unused abfd1, abfd2.
	* regcache.c (regcache_cooked_read): Remove unused gdbarch.
	* stack.c (print_frame_args): Remove unused summary.
	* thread.c (thread_apply_command): Remove unused p.
	* valarith.c (value_x_unop): Remove unused mangle_ptr.
	* valops.c (search_struct_method): Remove unused skip.
	* valprint.c (generic_val_print): Remove unused byte_order.
	* varobj.c (varobj_update): Remove unused changed.
	* cli/cli-cmds.c (complete_command): Remove unused next_item.
	(alias_command): Remove unused c.
	* mi/mi-cmd-catch.c (mi_catch_load_unload): Remove unused c.
	* mi/mi-main.c (mi_cmd_data_write_register_values): Remove unused
	format.
	(mi_cmd_data_write_memory): Remove unused word_format.
	(mi_cmd_data_write_memory_bytes): Remove unused r.
	* python/py-gdb-readline.c (gdbpy_readline_wrapper): Remove unused
	p_start, p_end.
	* python/python.c (_initialize_python): Remove unused cmd_name, cmd.
	* tui/tui-disasm.c (tui_set_disassem_content): Remove unused
	line_width.

Reference: http://sourceware.org/ml/gdb-patches/2013-01/msg00766.html
2013-01-31 18:37:39 +00:00
Yao Qi 3f01d0d042 gdb/
* infcmd.c (step_once): Don't check '!single_inst' as it was
	checked before.
2013-01-16 14:44:03 +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
Tom Tromey 1dd5fedcf5 * infcmd.c (all_registers_info, nexti_command, stepi_command)
(continue_command, interrupt_target_command): Now static.
	(registers_info): Remove declaration.
	* inferior.h (all_registers_info, nexti_command, stepi_command)
	(continue_command, interrupt_target_command): Don't declare.
2012-12-18 19:31:17 +00:00
Tom Tromey 451b7c33cb gdb
* NEWS: Mention "info proc" and core files.
        * corelow.c (core_info_proc): New function.
        (init_core_ops): Set to_info_proc.
        * gdbarch.c, gdbarch.h: Rebuild.
        * gdbarch.sh (core_info_proc): New method.
        * infcmd.c (info_proc_cmd_1): Invoke target_info_proc first.
        * linux-tdep.c (linux_core_info_proc_mappings)
        (linux_core_info_proc): New functions.
        (linux_find_memory_region_ftype): New typedef.
        (linux_find_memory_regions_full): New function, from
        linux_find_memory_regions.
        (struct linux_find_memory_regions_data): New.
        (linux_find_memory_regions_thunk): New function.
        (linux_find_memory_regions): Rewrite.
        (struct linux_make_mappings_data): New.
        (linux_make_mappings_callback)
        (linux_make_mappings_corefile_notes): New functions.
        (linux_make_corefile_notes): Call linux_make_mappings_corefile_notes.
        (linux_init_abi): Call set_gdbarch_core_info_proc.
        * target.c (target_info_proc): Return 'int'.
        * target.h (target_info_proc): Update.
gdb/doc
        * gdb.texinfo (SVR4 Process Information): Mention core files.
gdb/testsuite
        * gdb.base/info-proc.exp: Add core file tests.
bfd
        * elf.c (elfcore_grok_note) <NT_FILE>: New case.
2012-12-14 15:30:38 +00:00
Yao Qi 3d3fef6beb gdb/
2012-11-30  Yao Qi  <yao@codesourcery.com>

	* infrun.c (error_is_running, ensure_not_running): Move them
	to ...
	* infcmd.c (error_is_running, ensure_not_running): ... here.
	Make them 'static'.
	* inferior.h: Remove declarations of error_is_running and
	ensure_not_running.
2012-11-30 14:35:50 +00:00
Joel Brobecker ca9d61b90f rename frame_register_read into deprecated_frame_register_read.
gdb/ChangeLog:

        * frame.h (deprecated_frame_register_read): Renames
        frame_register_read.
        * frame.c (deprecated_frame_register_read): Renames
        frame_register_read.  Update all callers.
        * i386-tdep.c: Update all callers of frame_register_read.
        * infcmd.c: Likewise.
        * jit.c: Likewise.
        * mips-tdep.c: Likewise.
        * mt-tdep.c: Likewise.
        * sh64-tdep.c: Likewise.
2012-11-12 21:59:07 +00:00
Tom Tromey f5656eadf4 * gdbarch.sh (target_gdbarch): Remove macro.
(get_target_gdbarch): Rename to target_gdbarch.
	* gdbarch.c, gdbarch.h: Rebuild.
	* ada-tasks.c, aix-thread.c, amd64-linux-nat.c, arch-utils.c,
	arm-tdep.c, auxv.c, breakpoint.c, bsd-uthread.c, corefile.c,
	darwin-nat-info.c, dcache.c, dsrec.c, exec.c, fbsd-nat.c,
	filesystem.c, gcore.c, gnu-nat.c, i386-darwin-nat.c, i386-nat.c,
	ia64-vms-tdep.c, inf-ptrace.c, infcmd.c, jit.c, linux-nat.c,
	linux-tdep.c, linux-thread-db.c, m32r-rom.c, memattr.c,
	mep-tdep.c, microblaze-tdep.c, mips-linux-nat.c,
	mips-linux-tdep.c, mips-tdep.c, monitor.c, moxie-tdep.c,
	nto-procfs.c, nto-tdep.c, ppc-linux-nat.c, proc-service.c,
	procfs.c, progspace.c, ravenscar-thread.c, record.c,
	remote-m32r-sdi.c, remote-mips.c, remote-sim.c, remote.c,
	rl78-tdep.c, rs6000-nat.c, rx-tdep.c, s390-nat.c, sol-thread.c,
	solib-darwin.c, solib-dsbt.c, solib-frv.c, solib-ia64-hpux.c,
	solib-irix.c, solib-pa64.c, solib-som.c, solib-spu.c,
	solib-sunos.c, solib-svr4.c, solib.c, spu-linux-nat.c,
	spu-multiarch.c, spu-tdep.c, symfile-mem.c, symfile.c, symtab.c,
	target-descriptions.c, target.c, target.h, tracepoint.c,
	windows-nat.c, windows-tdep.c, xcoffsolib.c, cli/cli-dump.c,
	common/agent.c, mi/mi-interp.c, python/py-finishbreakpoint.c,
	python/py-inferior.c, python/python.c: Update.
2012-11-09 19:58:03 +00:00
Sergio Durigan Junior c1d780c2c7 gdb/ChangeLog:
2012-09-18  Sergio Durigan Junior  <sergiodj@redhat.com>

	* infcmd.c (_initialize_infcmd): Register `j' as an alias for
	`jump'.

gdb/doc/ChangeLog:
2012-09-18  Sergio Durigan Junior  <sergiodj@redhat.com>

	* gdb.texinfo (jump): Mention new alias `j' for `jump'.
2012-09-18 20:14:56 +00:00
Jan Kratochvil 1ab3b62c9d gdb/
PR 14119
	* frame.c (skip_inlined_frames): Skip also TAILCALL_FRAME frames.
	(frame_pop): Drop also TAILCALL_FRAME frames.
	* infcmd.c (finish_command): Ignore also TAILCALL_FRAME frames.

gdb/testsuite/
	PR 14119
	* gdb.arch/amd64-tailcall-ret.S: New file.
	* gdb.arch/amd64-tailcall-ret.c: New file.
	* gdb.arch/amd64-tailcall-ret.exp: New file.
	* gdb.reverse/amd64-tailcall-reverse.S: New file.
	* gdb.reverse/amd64-tailcall-reverse.c: New file.
	* gdb.reverse/amd64-tailcall-reverse.exp: New file.
2012-09-17 07:15:48 +00:00
Pedro Alves 1292279a4e 2012-08-28 Pedro Alves <palves@redhat.com>
PR gdb/14428

	gdb/
	* infcmd.c (default_print_one_register_info): New, factored out
	from default_print_registers_info.
	(default_print_registers_info): Use it.  Mark value unavailable if
	necessary.
	(registers_info): Print user registers with
	default_print_one_register_info.

	gdb/testsuite/
	* gdb.base/pc-fp.exp: Adjust expected output of 'info registers pc fp'.
2012-08-28 09:05:35 +00:00
Pedro Alves 2edda2ffe8 2012-08-23 Pedro Alves <palves@redhat.com>
* infcmd.c (_initialize_infcmd) <signal command>: Fix typo in help
	string.
2012-08-23 16:44:24 +00:00
Mike Frysinger dbf6a605ee gdb: fix test failures after updating usage strings 2012-08-17 03:06:11 +00:00
Mike Frysinger 486c773953 gdb: improve usage strings
This adds Usage strings to a bunch of commands, tweaks the grammar in a
few, and improves the help text for the handle command.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-08-15 01:59:42 +00:00
Mike Frysinger de0bea007c gdb: add completion handler for "handle" and "signal"
The command line completion has spoiled me.  Thus the lack of completion with
the "handle" command annoys me.  Patch!

This does a few things:
 - adds a VEC_merge helper
 - adds a generic signal completer
 - adds a completion handler for the "handle" command
 - sets the completion handler for the "signal" command

URL: http://sourceware.org/bugzilla/show_bug.cgi?id=10436
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-08-10 05:03:13 +00:00
Yao Qi 6ace3df1ec * cli/cli-setshow.c (do_setshow_command): Handle case 'var_filename'
and case 'var_optional_filename' together.
	* infcmd.c (_initialize_infcmd): Call add_setshow_string_noescape_cmd
	instead of add_setshow_optional_filename_cmd for setshow command
	'args'.  Set completer for 'set args'.

gdb/testsuite:

	* gdb.base/setshow.exp: Test 'set args ~'.
2012-07-19 12:48:17 +00:00
Doug Evans 39cf75f7e0 * linespec.c: #include "stack.h".
(decode_line_with_current_source): Moved here from symtab.c and
	renamed from decode_line_spec.  All callers updated.
	(decode_line_with_last_displayed): Moved here from breakpoint.c and
	renamed from decode_line_spec_1.  All callers updated.
	* linespec.h (decode_line_with_current_source): Move declaration here
	from symtab.h and renamed from decode_line_spec.
	(decode_line_with_last_displayed): Move declaration here from symtab.h
	and renamed from decode_line_spec_1.
	* macrocmd.c: #include "linespec.h".
	* symtab.c: Remove #include "linespec.h".
2012-06-29 22:46:46 +00:00
Eli Zaretskii 5d60742e2d Fix quoting of special characters for the MinGW build.
infcmd.c (construct_inferior_arguments) [__MINGW32__]: Quote
 special characters correctly for the Windows shells.  See
 http://sourceware.org/ml/gdb/2012-06/msg00047.html for the bug
 report.
 [!__MINGW32__]: Remove extra double quote character from special
 characters.
2012-06-12 16:36:42 +00:00
Pedro Alves a493e3e2e4 gdb/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

gdb/gdbserver/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

include/gdb/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        * gdb/signals.def: Replace TARGET_SIGNAL_ with GDB_SIGNAL_
	throughout.

sim/arm/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/avr/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/common/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/cr16/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/d10v/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/erc32/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/m32c/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/ppc/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/rl78/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/rx/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.
2012-05-24 16:51:47 +00:00
Pedro Alves 2ea286498f gdb/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

	Replace target_signal with gdb_signal throughout.

gdb/gdbserver/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

	Replace target_signal with gdb_signal throughout.

include/gdb/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

	Replace target_signal with gdb_signal throughout.

sim/common/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

	Replace target_signal with gdb_signal throughout.
2012-05-24 16:39:15 +00:00
Maciej W. Rozycki 6a3a010ba6 gdb/
* breakpoint.h (bp_location): Add related_address member.
	* inferior.h (get_return_value): Take a pointer to struct value
	instead of struct type for the function requested.
	* value.h (using_struct_return): Likewise.
	* gdbarch.sh (return_value): Take a pointer to struct value
	instead of struct type for the function requested.
	* breakpoint.c (set_breakpoint_location_function): Initialize
	related_address for bp_gnu_ifunc_resolver breakpoints.
	* elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the
	requested function's address to gdbarch_return_value.
	* eval.c (evaluate_subexp_standard): Pass the requested
	function's address to using_struct_return.
	* infcall.c (call_function_by_hand): Pass the requested
	function's address to using_struct_return and
	gdbarch_return_value.
	* infcmd.c (get_return_value): Take a pointer to struct value
	instead of struct type for the function requested.
	(print_return_value): Update accordingly.
	(finish_command_continuation): Likewise.
	* stack.c (return_command): Pass the requested function's
	address to using_struct_return and gdbarch_return_value.
	* value.c (using_struct_return): Take a pointer to struct value
	instead of struct type for the function requested.  Pass the
	requested function's address to gdbarch_return_value.
	* python/py-finishbreakpoint.c (finish_breakpoint_object):
	New function_value member, replacing function_type.
	(bpfinishpy_dealloc): Update accordingly.
	(bpfinishpy_pre_stop_hook): Likewise.
	(bpfinishpy_init): Likewise.  Record the requested function's
	address.
	* mips-tdep.c (mips_fval_reg): New enum.
	(mips_o32_push_dummy_call): For MIPS16 FP doubles do not swap
	words put in GP registers.
	(mips_o64_push_dummy_call): Update a comment.
	(mips_o32_return_value): Take a pointer to struct value instead
	of struct type for the function requested and use it to check if
	using the MIPS16 calling convention.  Return the designated
	general purpose registers for floating-point values returned in
	MIPS16 mode.
	(mips_o64_return_value): Likewise.
	* ppc-tdep.h (ppc_sysv_abi_return_value): Update prototype.
	(ppc_sysv_abi_broken_return_value): Likewise.
	(ppc64_sysv_abi_return_value): Likewise.
	* alpha-tdep.c (alpha_return_value): Take a pointer to struct
	value instead of struct type for the function requested.
	* amd64-tdep.c (amd64_return_value): Likewise.
	* amd64-windows-tdep.c (amd64_windows_return_value): Likewise.
	* arm-tdep.c (arm_return_value): Likewise.
	* avr-tdep.c (avr_return_value): Likewise.
	* bfin-tdep.c (bfin_return_value): Likewise.
	* cris-tdep.c (cris_return_value): Likewise.
	* frv-tdep.c (frv_return_value): Likewise.
	* h8300-tdep.c (h8300_return_value): Likewise.
	(h8300h_return_value): Likewise.
	* hppa-tdep.c (hppa32_return_value): Likewise.
	(hppa64_return_value): Likewise.
	* i386-tdep.c (i386_return_value): Likewise.
	* ia64-tdep.c (ia64_return_value): Likewise.
	* iq2000-tdep.c (iq2000_return_value): Likewise.
	* lm32-tdep.c (lm32_return_value): Likewise.
	* m32c-tdep.c (m32c_return_value): Likewise.
	* m32r-tdep.c (m32r_return_value): Likewise.
	* m68hc11-tdep.c (m68hc11_return_value): Likewise.
	* m68k-tdep.c (m68k_return_value): Likewise.
	(m68k_svr4_return_value): Likewise.
	* m88k-tdep.c (m88k_return_value): Likewise.
	* mep-tdep.c (mep_return_value): Likewise.
	* microblaze-tdep.c (microblaze_return_value): Likewise.
	* mn10300-tdep.c (mn10300_return_value): Likewise.
	* moxie-tdep.c (moxie_return_value): Likewise.
	* mt-tdep.c (mt_return_value): Likewise.
	* ppc-linux-tdep.c (ppc_linux_return_value): Likewise.
	* ppc-sysv-tdep.c (ppc_sysv_abi_return_value): Likewise.
	(ppc_sysv_abi_broken_return_value): Likewise.
	(ppc64_sysv_abi_return_value): Likewise.
	* ppcnbsd-tdep.c (ppcnbsd_return_value): Likewise.
	* rl78-tdep.c (rl78_return_value): Likewise.
	* rs6000-aix-tdep.c (rs6000_return_value): Likewise.
	* rx-tdep.c (rx_return_value): Likewise.
	* s390-tdep.c (s390_return_value): Likewise.
	* score-tdep.c (score_return_value): Likewise.
	* sh-tdep.c (sh_return_value_nofpu): Likewise.
	(sh_return_value_fpu): Likewise.
	* sh64-tdep.c (sh64_return_value): Likewise.
	* sparc-tdep.c (sparc32_return_value): Likewise.
	* sparc64-tdep.c (sparc64_return_value): Likewise.
	* spu-tdep.c (spu_return_value): Likewise.
	* tic6x-tdep.c (tic6x_return_value): Likewise.
	* v850-tdep.c (v850_return_value): Likewise.
	* vax-tdep.c (vax_return_value): Likewise.
	* xstormy16-tdep.c (xstormy16_return_value): Likewise.
	* xtensa-tdep.c (xtensa_return_value): Likewise.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.

	gdb/testsuite/
	* gdb.base/return-nodebug.exp: Also test float and double types.
2012-05-16 14:35:09 +00:00
Pedro Alves f99d8bf46c 2012-03-27 Pedro Alves <palves@redhat.com>
Eliminate struct ui_stream.

	* ui-out.h (struct ui_stream): Delete.
	(ui_out_field_stream): Adjust prototype.
	(ui_out_stream_new, ui_out_stream_delete)
	(make_cleanup_ui_out_stream_delete): Delete declarations.
	* ui-out.c (ui_out_field_stream): Change prototype to take a
	ui_file instead of a ui_stream.  Adjust.
	(ui_out_stream_new, ui_out_stream_delete, do_stream_delete)
	(make_cleanup_ui_out_stream_delete): Delete.
	* breakpoint.c (print_breakpoint_location)
	(print_one_detail_ranged_breakpoint, print_it_watchpoint): Use
	ui_file/mem_fileopen instead of ui_stream/ui_out_stream_new.
	* disasm.c (dump_insns): Ditto.
	(do_mixed_source_and_assembly, do_assembly_only): Adjust
	prototype.
	(gdb_disassembly): Use ui_file/mem_fileopen instead of
	ui_stream/ui_out_stream_new.
	* infcmd.c (print_return_value): Ditto.
	* osdata.c (info_osdata_command): Don't allocate a local
	ui_stream.
	* stack.c (print_frame_arg, print_frame_args, print_frame): Use
	ui_file/mem_fileopen instead of ui_stream/ui_out_stream_new.
	* tracepoint.c (print_one_static_tracepoint_marker): Don't
	allocate a local ui_stream.
	* mi/mi-cmd-stack.c (list_arg_or_local): Use ui_file/mem_fileopen
	instead of ui_stream/ui_out_stream_new.
	(list_args_or_locals): Don't allocate a local ui_stream.
	* mi/mi-main.c (get_register, mi_cmd_data_evaluate_expression)
	(mi_cmd_data_read_memory): Use ui_file/mem_fileopen instead of
	ui_stream/ui_out_stream_new.
	* cli/cli-setshow.c (do_setshow_command): Ditto.
2012-03-27 19:08:37 +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
Jan Kratochvil c70a6932bb gdb/
* arm-linux-tdep.c (arm_linux_copy_svc): Reset stale FRAME.
	* breakpoint.c (until_break_command): Likewise.
	* elfread.c (elf_gnu_ifunc_resolver_stop): Likewise.
	* infcall.c (call_function_by_hand): Likewise.
	* infcmd.c (finish_forward): Likewise.
	* infrun.c (insert_exception_resume_breakpoint): Likewise.
2012-02-29 14:52:44 +00:00
Jan Kratochvil def166f668 gdb/
PR backtrace/13716
	* infcmd.c (finish_forward): New variable frame_id, initialize it, use
	it after set_momentary_breakpoint.
2012-02-23 08:15:04 +00:00
Tom Tromey 3af2590d3e PR gdb/12659:
* infcmd.c (registers_info): Print just the current register's
	name.
gdb/testsuite
	* gdb.base/pc-fp.exp: Add "info register" tests.
2012-02-15 19:13:14 +00:00
Doug Evans 2c02bd7290 * blockframe.c (find_pc_partial_function_gnu_ifunc): Change type of
"name" parameter to const char ** from char **.  All callers updated.
	(find_pc_partial_function): Ditto.
	(cache_pc_function_name): Change type to const char * from char *.
	* symtab.h ((find_pc_partial_function_gnu_ifunc): Update.
	(find_pc_partial_function): Update.
	* alpha-tdep.h (struct gdbarch_tdep, member pc_in_sigtramp): Change
	type of "name" parameter to const char * from char *.
	All uses updated.
	* arch-utils.c (generic_in_solib_return_trampoline): Change
	type of "name" parameter to const char * from char *.
	* arch-utils.h (generic_in_solib_return_trampoline): Update.
	* frv-linux-tdep.c (frv_linux_pc_in_sigtramp): Change
	type of "name" parameter to const char * from char *.
	* gdbarch.sh (in_solib_return_trampoline): Ditto.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.
	* hppa-hpux-tdep.c (hppa_hpux_in_solib_return_trampoline): Update.
	* rs6000-tdep.c (rs6000_in_solib_return_trampoline): Update.
	* m32r-linux-tdep.c (m32r_linux_pc_in_sigtramp): Change
	type of "name" parameter to const char * from char *.
	* skip.c (skip_function_pc): Ditto.
	* sparc-sol2-tdep.c (sparc_sol2_pc_in_sigtramp): Ditto.
	* sparc-tdep.h (sparc_sol2_pc_in_sigtramp): Update.
	* sparc64fbsd-tdep.c (sparc64fbsd_pc_in_sigtramp): Ditto.
	* sparc64nbsd-tdep.c (sparc64nbsd_pc_in_sigtramp): Ditto.
	* sparc64obsd-tdep.c (sparc64obsd_pc_in_sigtramp): Ditto.
	* sparcnbsd-tdep.c (sparc32nbsd_pc_in_sigtramp): Ditto.
	* sparcobsd-tdep.c (sparc32obsd_pc_in_sigtramp): Ditto.
	* nbsd-tdep.c (nbsd_pc_in_sigtramp): Similary for "func_name".
	* nbsd-tdep.h (nbsd_pc_in_sigtramp): Update.
2012-02-02 20:19:17 +00:00
Ulrich Weigand 3030c96e66 * gdbarch.sh (info_proc): New callback.
* gdbarch.c, gdbarch.h: Regenerate.

	* infcmd.c (info_proc_cmd_1): Try gdbarch info_proc callback
	before falling back to the target info_proc callback.

	* linux-nat.c: Do not include "cli/cli-utils.h".
	(linux_nat_info_proc): Remove.
	(linux_target_install_ops): No longer install it.

	* linux-tdep.c: Include "cli/cli-utils.h" and <ctype.h>.
	(read_mapping): New function.
	(linux_info_proc): Likewise.
	(linux_init_abi): Install it.
2012-01-20 09:49:58 +00:00
Ulrich Weigand 145b16a97a ChangeLog:
* defs.h (enum info_proc_what): Moved here from linux-nat.c
	* infcmd.c: (info_proc_cmd_1): New function.
	(info_proc_cmd): New function, moved here from equivalent routine
	orignally in linux-nat.c.
	(info_proc_cmd_mappings): Likewise.
	(info_proc_cmd_stat): Likewise.
	(info_proc_cmd_status): Likewise.
	(info_proc_cmd_cwd): Likewise.
	(info_proc_cmd_cmdline): Likewise.
	(info_proc_cmd_exe): Likewise.
	(info_proc_cmd_all): Likewise.
	(_initialize_infcmd): Install "info proc" command and subcommands.

	* target.h (struct target_ops): Add to_info_proc.
	(target_info_proc): Add prototype.
	* target.c (target_info_proc): New function.

	* procfs.c (procfs_info_proc): Add prototype.
	(info_proc_cmd): Rename into ...
	(procfs_info_proc): ... this.  Update argument types as appropriate
	for a to_info_proc implementation.  Handle "what" argument.
	(procfs_target): Install procfs_info_proc.
	(_initialize_procfs): No longer install "info proc" command.

	* linux-nat.c: (enum info_proc_what): Remove.
	(linux_nat_info_proc_cmd_1): Rename into ...
	(linux_nat_info_proc): ... this.  Update argument types as appropriate
	for a to_info_proc implementation.
	(linux_nat_info_proc_cmd): Remove.
	(linux_nat_info_proc_cmd_mappings): Likewise.
	(linux_nat_info_proc_cmd_stat): Likewise.
	(linux_nat_info_proc_cmd_status): Likewise.
	(linux_nat_info_proc_cmd_cwd): Likewise.
	(linux_nat_info_proc_cmd_cmdline): Likewise.
	(linux_nat_info_proc_cmd_exe): Likewise.
	(linux_nat_info_proc_cmd_all): Likewise.
	(linux_target_install_ops): Install linux_nat_info_proc.
	(_initialize_linux_nat): No longer install "info proc" command
	and subcommands.

testsuite/ChangeLog:

	* gdb.base/info-proc.exp: Also run on remote targets.  Main
	"info proc" command is now always present; whether target supports
	actual info proc operation is detected when attempting to issue
	the command.
2012-01-20 09:49:01 +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
Kevin Pouget cc72b2a2da Introduce gdb.FinishBreakpoint in Python
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-finishbreakpoint.o.
	(SUBDIR_PYTHON_SRCS): Add python/py-finishbreakpoint.c.
	Add build rule for this file.
	* infcmd.c (print_return_value): Split to create get_return_value.
	(get_return_value): New function based on print_return_value. Handle
	case where stop_registers are not set.
	* inferior.h (get_return_value): New prototype.
	* python/py-breakpoint.c (bppy_pending_object): Make non-static.
	(gdbpy_breakpoint_created): Set is_py_finish_bp is necessary.
	(struct breakpoint_object): Move to python-internal.h
	(BPPY_REQUIRE_VALID): Likewise.
	(BPPY_SET_REQUIRE_VALID): Likewise.
	(gdbpy_breakpoint_created): Initialize is_finish_bp.
	(gdbpy_should_stop): Add  pre/post hooks before/after calling stop
	method.
	* python/python-internal.h (breakpoint_object_type): Add as extern.
	(bppy_pending_object): Likewise.
	(typedef struct breakpoint_object) Removed.
	(struct breakpoint_object): Moved from py-breakpoint.c.
	Add field is_finish_bp.
	(BPPY_REQUIRE_VALID): Moved from py-breakpoint.c.
	(BPPY_SET_REQUIRE_VALID): Likewise.
	(frame_object_to_frame_info): New prototype.
	(gdbpy_initialize_finishbreakpoints): New prototype.
	(bpfinishpy_is_finish_bp): Likewise.
	(bpfinishpy_pre_stop_hook): Likewise.
	(bpfinishpy_post_stop_hook): Likewise.
	* python/py-finishbreakpoint.c: New file.
	* python/py-frame.c(frame_object_to_frame_info): Make non-static and
	accept PyObject instead of frame_object.
	(frapy_is_valid): Don't cast to frame_object.
	(frapy_name): Likewise.
	(frapy_type): Likewise.
	(frapy_unwind_stop_reason): Likewise.
	(frapy_pc): Likewise.
	(frapy_block): Likewise.
	(frapy_function): Likewise.
	(frapy_older): Likewise.
	(frapy_newer): Likewise.
	(frapy_find_sal): Likewise.
	(frapy_read_var): Likewise.
	(frapy_select): Likewise.
	* python/python.c (gdbpy_is_stopped_at_finish_bp): New noop function.
	(_initialize_python): Add gdbpy_initialize_finishbreakpoints.
	* python/python.h: Include breakpoint.h
	(gdbpy_is_stopped_at_finish_bp): New prototype.

doc/
	* gdb.texinfo (Finish Breakpoints in Python): New subsection.
	(Python API): Add menu entry for Finish Breakpoints.

testsuite/
	* Makefile.in (EXECUTABLES): Add py-finish-breakpoint and
	py-finish-breakpoint2
	(MISCALLANEOUS): Add py-events-shlib.so and py-events-shlib-nodebug.so
	* gdb.python/py-breakpoint.exp (mult_line): Define and use variable
	instead of line number.
	* gdb.python/py-finish-breakpoint.c: New file.
	* gdb.python/py-finish-breakpoint.exp: New file.
	* gdb.python/py-finish-breakpoint.py: New file.
	* gdb.python/py-finish-breakpoint2.cc: New file.
	* gdb.python/py-finish-breakpoint2.exp: New file.
	* gdb.python/py-finish-breakpoint2.py: New file.
2011-12-23 17:06:16 +00:00
Tom Tromey f8eba3c616 the "ambiguous linespec" series
gdb
2011-12-06  Joel Brobecker  <brobecker@acacore.com>

        * language.h (struct language_defn): Add new component
        la_symbol_name_compare.
        * symfile.h (struct quick_symbol_functions): Update the profile
        of parameter "name_matcher" for the expand_symtabs_matching
        method.  Update the documentation accordingly.
        * ada-lang.h (ada_name_for_lookup): Add declaration.
        * ada-lang.c (ada_name_for_lookup): New function, extracted out
        from ada_iterate_over_symbols.
        (ada_iterate_over_symbols): Do not encode symbol name anymore.
        (ada_expand_partial_symbol_name): Adjust profile.
        (ada_language_defn): Add value for la_symbol_name_compare field.
        * linespec.c: #include "ada-lang.h".
        (iterate_name_matcher): Add language parameter. Replace call
        to strcmp_iw by call to language->la_symbol_name_compare.
        (decode_variable): Encode COPY if current language is Ada.
        * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile
        of name_matcher parameter.  Adjust call to name_matcher.
        * psymtab.c (expand_symtabs_matching_via_partial): Likewise.
        (expand_partial_symbol_names): Update profile of parameter "fun".
        * psymtab.h (expand_partial_symbol_names): Update profile of
        parameter "fun".
        * symtab.c (demangle_for_lookup): Update function documentation.
        (search_symbols_name_matches): Add language parameter.
        (expand_partial_symbol_name): Likewise.
        * c-lang.c (c_language_defn, cplus_language_defn)
        (asm_language_defn, minimal_language_defn): Add value for
        la_symbol_name_compare field.
        * d-lang.c (d_language_defn): Likewise.
        * f-lang.c (f_language_defn): Ditto.
        * jv-lang.c (java_language_defn): Ditto.
        * m2-lang.c (m2_language_defn): Ditto.
        * objc-lang.c (objc_language_defn): Ditto.
        * opencl-lang.c (opencl_language_defn): Ditto.
        * p-lang.c (pascal_language_defn): Ditto.
        * language.c (unknown_language_defn, auto_language_defn)
        (local_language_defn): Ditto.

2011-12-06  Tom Tromey  <tromey@redhat.com>

	* linespec.c (iterate_over_all_matching_symtabs): Use
	LA_ITERATE_OVER_SYMBOLS.
	(lookup_prefix_sym, add_matching_symbols_to_info): Likewise.
	(find_function_symbols, decode_variable): Remove Ada special
	case.
	* language.h (struct language_defn) <la_iterate_over_symbols>: New
	field.
	(LA_ITERATE_OVER_SYMBOLS): New macro.
	* language.c (unknown_language_defn, auto_language_defn)
	(local_language_defn): Update.
	* c-lang.c (c_language_defn, cplus_language_defn)
	(asm_language_defn, minimal_language_defn): Update.
	* d-lang.c (d_language_defn): Update.
	* f-lang.c (f_language_defn): Update.
	* jv-lang.c (java_language_defn): Update.
	* m2-lang.c (m2_language_defn): Update.
	* objc-lang.c (objc_language_defn): Update.
	* opencl-lang.c (opencl_language_defn): Update.
	* p-lang.c (pascal_language_defn): Update.
	* ada-lang.c (ada_iterate_over_symbols): New function.
	(ada_language_defn): Update.

2011-12-06  Tom Tromey  <tromey@redhat.com>
	    Joel Brobecker  <brobecker@acacore.com>

	PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366,
	PR objc/8535, PR breakpoints/11657, PR breakpoints/11970,
	PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856,
	PR shlibs/8929, PR shlibs/7393:
	* python/py-type.c (compare_maybe_null_strings): Rename from
	compare_strings.
	(check_types_equal): Update.
	* utils.c (compare_strings): New function.
	* tui/tui-winsource.c (tui_update_breakpoint_info): Update for
	location changes.
	* tracepoint.c (scope_info): Update.
	(trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE.
	* symtab.h (iterate_over_minimal_symbols)
	(iterate_over_some_symtabs, iterate_over_symtabs)
	(find_pcs_for_symtab_line, iterate_over_symbols)
	(demangle_for_lookup): Declare.
	(expand_line_sal): Remove.
	* symtab.c (iterate_over_some_symtabs, iterate_over_symtabs)
	(lookup_symtab_callback): New functions.
	(lookup_symtab): Rewrite.
	(demangle_for_lookup): New function, extract from
	lookup_symbol_in_language.
	(lookup_symbol_in_language): Use it.
	(iterate_over_symbols): New function.
	(find_line_symtab): Update.
	(find_pcs_for_symtab_line): New functions.
	(find_line_common): Add 'start' argument.
	(decode_line_spec): Update.  Change argument to 'flags', change
	interpretation.
	(append_expanded_sal): Remove.
	(append_exact_match_to_sals): Remove.
	(expand_line_sal): Remove.
	* symfile.h (struct quick_symbol_functions) <lookup_symtab>:
	Remove.
	<map_symtabs_matching_filename>: New field.
	* stack.c (func_command): Only look in the current program space.
	Use DECODE_LINE_FUNFIRSTLINE.
	* source.c (line_info): Set pspace on sal.  Check program space in
	the loop.  Use DECODE_LINE_LIST_MODE.
	(select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE.
	* solib-target.c: Remove DEF_VEC_I(CORE_ADDR).
	* python/python.c (gdbpy_decode_line): Update.
	* psymtab.c (partial_map_expand_apply): New function.
	(partial_map_symtabs_matching_filename): Rename from
	lookup_partial_symbol.  Update arguments.
	(lookup_symtab_via_partial_symtab): Remove.
	(psym_functions): Update.
	* objc-lang.h (parse_selector, parse_method): Don't declare.
	(find_imps): Update.
	* objc-lang.c (parse_selector, parse_method): Now static.
	(find_methods): Change arguments.  Fill in a vector of symbol
	names.
	(uniquify_strings): New function.
	(find_imps): Change arguments.
	* minsyms.c (iterate_over_minimal_symbols): New function.
	* linespec.h (enum decode_line_flags): New.
	(struct linespec_sals): New.
	(struct linespec_result) <canonical>: Remove.
	<pre_expanded, addr_string, sals>: New fields.
	(destroy_linespec_result, make_cleanup_destroy_linespec_result)
	(decode_line_full): Declare.
	(decode_line_1): Update.
	* linespec.c (struct address_entry, struct linespec_state, struct
	collect_info): New types.
	(add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry)
	(eq_address_entry, maybe_add_address): New functions.
	(total_number_of_methods): Remove.
	(iterate_name_matcher, iterate_over_all_matching_symtabs): New
	functions.
	(find_methods): Change arguments.  Don't canonicalize input.
	Simplify logic.
	(add_matching_methods, add_constructors)
	(build_canonical_line_spec): Remove.
	(filter_results, convert_results_to_lsals): New functions.
	(decode_line_2): Change arguments.  Rewrite for new data
	structures.
	(decode_line_internal): Rename from decode_line_1.  Change
	arguments.  Add cleanups.  Update for new data structures.
	(linespec_state_constructor, linespec_state_destructor)
	(decode_line_full, decode_line_1): New functions.
	(decode_indirect): Change arguments.  Update.
	(locate_first_half): Use skip_spaces.
	(decode_objc): Change arguments.  Update for new data structures.
	Simplify logic.
	(decode_compound): Change arguments.  Add cleanups.  Remove
	fallback code, replace with error.
	(struct decode_compound_collector): New type.
	(collect_one_symbol): New function.
	(lookup_prefix_sym): Change arguments.  Update.
	(compare_symbol_name, add_all_symbol_names_from_pspace)
	(find_superclass_methods ): New functions.
	(find_method): Rewrite.
	(struct symtab_collector): New type.
	(add_symtabs_to_list, collect_symtabs_from_filename): New
	functions.
	(symtabs_from_filename): Change API.  Rename from
	symtab_from_filename.
	(collect_function_symbols): New function.
	(find_function_symbols): Change API.  Rename from
	find_function_symbol.  Rewrite.
	(decode_all_digits): Change arguments.  Rewrite.
	(decode_dollar): Change arguments.  Use decode_variable.
	(decode_label): Change arguments.  Rewrite.
	(collect_symbols): New function.
	(minsym_found): Change arguments.  Rewrite.
	(check_minsym, search_minsyms_for_name)
	(add_matching_symbols_to_info): New function.
	(decode_variable): Change arguments.  Iterate over all symbols.
	(symbol_found): Remove.
	(symbol_to_sal): New function.
	(init_linespec_result, destroy_linespec_result)
	(cleanup_linespec_result, make_cleanup_destroy_linespec_result):
	New functions.
	(decode_digits_list_mode, decode_digits_ordinary): New functions.
	* dwarf2read.c (dw2_map_expand_apply): New function.
	(dw2_map_symtabs_matching_filename): Rename from
	dw2_lookup_symtab.  Change arguments.
	(dwarf2_gdb_index_functions): Update.
	* dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR).
	* defs.h (compare_strings): Declare.
	* cli/cli-cmds.c (compare_strings): Move to utils.c.
	(edit_command, list_command): Use DECODE_LINE_LIST_MODE.  Call
	filter_sals.
	(compare_symtabs, filter_sals): New functions.
	* breakpoint.h (struct bp_location) <line_number, source_file>:
	New fields.
	(struct breakpoint) <line_number, source_file>: Remove.
	<filter>: New field.
	* breakpoint.c (print_breakpoint_location, init_raw_breakpoint)
	(momentary_breakpoint_from_master, add_location_to_breakpoint):
	Update for changes to locations.
	(init_breakpoint_sal): Add 'filter' argument.  Set 'filter' on
	breakpoint.
	(create_breakpoint_sal): Add 'filter' argument.
	(remove_sal, expand_line_sal_maybe): Remove.
	(create_breakpoints_sal): Remove 'sals' argument.  Handle
	pre-expanded sals and the filter.
	(parse_breakpoint_sals): Use decode_line_full.
	(check_fast_tracepoint_sals): Use get_sal_arch.
	(create_breakpoint): Create a linespec_sals.  Update.
	(break_range_command): Use decode_line_full.  Update.
	(until_break_command): Update.
	(clear_command): Update match conditions for linespec.c changes.
	Use DECODE_LINE_LIST_MODE.
	(say_where): Update for changes to locations.
	(bp_location_dtor): Free 'source_file'.
	(base_breakpoint_dtor): Free 'filter'.  Don't free 'source_file'.
	(update_static_tracepoint): Update for changes to locations.
	(update_breakpoint_locations): Disable ranged breakpoint if too
	many locations match.  Update.
	(addr_string_to_sals): Use decode_line_full.  Resolve all sal
	PCs.
	(breakpoint_re_set_default): Don't call expand_line_sal_maybe.
	(decode_line_spec_1): Update.  Change argument name to 'flags',
	change interpretation.
	* block.h (block_containing_function): Declare.
	* block.c (block_containing_function): New function.
	* skip.c (skip_function_command): Update.
	(skip_re_set): Update.
	* infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE.
	* mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE.
	* NEWS: Add entry.

2011-12-06  Tom Tromey  <tromey@redhat.com>

	* elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow
	breakpoint's pspace to be NULL.
	* breakpoint.h (struct breakpoint) <pspace>: Update comment.
	* breakpoint.c (init_raw_breakpoint): Conditionally set
	breakpoint's pspace.
	(init_breakpoint_sal): Don't set breakpoint's pspace.
	(prepare_re_set_context): Conditionally switch program space.
	(addr_string_to_sals): Check executing_startup on location's
	program space.

2011-12-06  Tom Tromey  <tromey@redhat.com>

	* breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove.
	* breakpoint.c (should_be_inserted): Explicitly check if program
	space is executing startup.
	(describe_other_breakpoints): Update.
	(disable_breakpoints_before_startup): Change executing_startup
	earlier.  Remove loop.
	(enable_breakpoints_after_startup): Likewise.
	(init_breakpoint_sal): Don't use bp_startup_disabled.
	(create_breakpoint): Don't use bp_startup_disabled.
	(update_global_location_list): Use should_be_inserted.
	(bkpt_re_set): Update.
gdb/testsuite
2011-12-06  Joel Brobecker  <brobecker@acacore.com>

        * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs
        involving a fully qualified function name.

2011-12-06  Tom Tromey  <tromey@redhat.com>

	* gdb.ada/homonym.exp: Add three breakpoint tests.

2011-12-06  Tom Tromey  <tromey@redhat.com>

	* gdb.base/solib-weak.exp (do_test): Remove kfail.
	* gdb.trace/tracecmd.exp: Disable pending breakpoints earlier.
	* gdb.objc/objcdecode.exp: Update for output changes.
	* gdb.linespec/linespec.exp: New file.
	* gdb.linespec/lspec.cc: New file.
	* gdb.linespec/lspec.h: New file.
	* gdb.linespec/body.h: New file.
	* gdb.linespec/base/two/thefile.cc: New file.
	* gdb.linespec/base/one/thefile.cc: New file.
	* gdb.linespec/Makefile.in: New file.
	* gdb.cp/templates.exp (test_template_breakpoints): Update for
	output changes.
	* gdb.cp/re-set-overloaded.exp: Remove kfail.
	* gdb.cp/ovldbreak.exp: Update for output changes.  "all" test now
	makes one breakpoint.
	* gdb.cp/method2.exp (test_break): Update for output changes.
	* gdb.cp/mb-templates.exp: Update for output changes.
	* gdb.cp/mb-inline.exp: Update for output changes.
	* gdb.cp/mb-ctor.exp: Update for output changes.
	* gdb.cp/ovsrch.exp: Use fully-qualified names.
	* gdb.base/solib-symbol.exp: Run to main later.  Breakpoint now
	has multiple matches.
	* gdb.base/sepdebug.exp: Disable pending breakpoints.  Update for
	error message change.
	* gdb.base/list.exp (test_list_filename_and_number): Update for
	error message change.
	* gdb.base/break.exp: Disable pending breakpoints.  Update for
	output changes.
	* configure.ac: Add gdb.linespec.
	* configure: Rebuild.
	* Makefile.in (ALL_SUBDIRS): Add gdb.linespec.
gdb/doc
2011-12-06  Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 18:54:43 +00:00
Yao Qi d31647d24b gdb/
* infcmd.c (disconnect_command): Call disconnect_tracing.
2011-10-29 12:36:09 +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
Paul Pluzhnikov 2eff07b325 2011-07-26 Paul Pluzhnikov <ppluzhnikov@google.com>
* progspace.h (struct program_space): Add solib_add_generation.
	* infcmd.c (post_create_inferior): Only call solib_add if not
	already done.
	* solib.c (solib_add): Increment solib_add_generation.
2011-07-26 15:17:47 +00:00
Pedro Alves fa4cd53f7d 2011-05-30 Pedro Alves <pedro@codesourcery.com>
gdb/
	* continuations.h (continuation_ftype): Add `err' parameter.
	Document parameters.
	(do_all_continuations, do_all_continuations_thread)
	(do_all_intermediate_continuations)
	(do_all_intermediate_continuations_thread)
	(do_all_inferior_continuations): Add `err' parameter.
	* continuations.c (do_my_continuations_1, do_my_continuations)
	(do_all_inferior_continuations, do_all_continuations_ptid)
	(do_all_continuations_thread_callback)
	(do_all_continuations_thread, do_all_continuations)
	(do_all_intermediate_continuations_thread_callback)
	(do_all_intermediate_continuations_thread)
	(do_all_intermediate_continuations): Add `err' parameter, and pass
	it down all the way to the continuations proper.
	* inf-loop.c (inferior_event_handler): If fetching an inferior
	event throws an error, don't pop the target, and still call the
	continuations, but with `err' set.  Adjust all other continuation
	calls.
	* breakpoint.c (until_break_command_continuation): Add `err'
	parameter.
	* infcmd.c (step_1_continuation): Add `err' parameter.  Don't
	issue another step if `err' is set.
	(struct until_next_continuation_args): New.
	(until_next_continuation): Add `err' parameter.  Adjust.
	(until_next_command): Adjust.
	(struct finish_command_continuation_args): Add `thread' field.
	(finish_command_continuation): Add `err' parameter.  Handle it.
	(finish_forward): Adjust.
	(attach_command_continuation): Add `err' parameter.  Handle it.
	* infrun.c (infrun_thread_stop_requested_callback): Adjust to
	cancel the continuations.
	* interps.c (interp_set): Adjust to cancel the continuations.
	* thread.c (clear_thread_inferior_resources): Adjust to cancel the
	continuations rather than discarding.
	(free_thread): Don't clear thread inferior resources here.
	(delete_thread_1): Do it here instead.  And do it before removing
	the thread from the threads list.  Tag the thread as exited before
	clearing thread inferior resources.
2011-05-30 18:04:32 +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
Pedro Alves c13bd2b52e 2011-05-26 Pedro Alves <pedro@codesourcery.com>
gdb/
	* infcmd.c (finish_command): Allow async finish in reverse.
2011-05-26 16:11:45 +00:00
Pedro Alves 9da8c2a0fa 2011-05-26 Pedro Alves <pedro@codesourcery.com>
gdb/
	* infcmd.c (finish_backward): Set a step-resume breakpoint at the
	function's entry point instead of a manually managed momentary
	breakpoint, and only ever issue one proceed call.
	* infrun.c (handle_inferior_event) <BPSTAT_WHAT_STEP_RESUME>: If
	doing a reverse-finish, switch to stepi mode, to do another step.
	(insert_step_resume_breakpoint_at_sal): Make public.
	(normal_stop): No need to save function value return registers if
	going reverse.
	* inferior.h (insert_step_resume_breakpoint_at_sal): Declare.

	gdb/testsuite/
	* gdb.reverse/finish-reverse-bkpt.exp: New test.
2011-05-26 15:32:38 +00:00
Pedro Alves 09cee04be9 2011-05-20 Pedro Alves <pedro@codesourcery.com>
gdb/
	* infcmd.c: Include "inf-loop.h".
	(step_once): When stepping into an inline subroutine, pretend the
	target has run.  If the target can async, switch the inferior
	event loop to INF_EXEC_COMPLETE.
	* inferior.h (user_visible_resume_ptid): Declare.
	* infrun.c (user_visible_resume_ptid): New function, factored out
	from `resume'.
	(resume): Use it.
	* mi/mi-main.c (mi_execute_async_cli_command): Remove assertion
	that the current thread is running.  Merge async and sync
	branches.
2011-05-20 16:31:31 +00:00
Pedro Alves 751b8ce122 2011-05-20 Pedro Alves <pedro@codesourcery.com>
gdb/
	* infcmd.c (step_1): Simplify synchronous case.
2011-05-20 16:20:25 +00:00
Pedro Alves e4c8541fca 2011-05-09 Pedro Alves <pedro@codesourcery.com>
* inferior.h (wait_for_inferior): Remove `thread_exec_as_sigtrap'
	parameter.
	* infrun.c (proceed, start_remote): Adjust.
	(wait_for_inferior): Remove `thread_exec_as_sigtrap' parameter,
	and adjust to not handle it.
	* 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.
	* windows-nat.c (do_initial_windows_stuff): Adjust.
	* infcmd.c (attach_command): Adjust.
	(notice_new_inferior): Adjust.
2011-05-09 14:25:37 +00:00
Tom Tromey 7a9dd1b270 gdb
* windows-tdep.c (windows_xfer_shared_library):
	* windows-nat.c (get_module_name, windows_make_so):
	* v850-tdep.c (v850_handle_pushm):
	* utils.c (null_cleanup, gdb_realpath):
	* ui-out.c (get_next_header):
	* tracepoint.c (clear_traceframe_info):
	* symtab.c (lookup_symtab):
	* serial.h (struct serial_ops):
	* mipsread.c (read_alphacoff_dynamic_symtab):
	* infcmd.c (print_return_value):
	* ia64-linux-tdep.c (ia64_linux_sigcontext_register_address):
	* f-exp.y (parse_number):
	* exceptions.c (catch_exceptions):
	* dummy-frame.c (dummy_frame_this_id):
	* defs.h (struct cleanup):
	* breakpoint.c (disable_breakpoints_in_unloaded_shlib):
	* arm-tdep.c (arm_push_dummy_call):
	* amd64-tdep.h (amd64_collect_xsave):
	* amd64-tdep.c (amd64_collect_xsave):
	* alpha-tdep.c (alpha_heuristic_frame_unwind_cache):
	* README (typing): Remove duplicate words.
	* cli/cli-decode.c (lookup_cmd_composition): Add comma.
	* infrun.c (siginfo_value_read): Fix typo.
	* solib-frv.c (frv_fdpic_find_global_pointer): Likewise.
	* top.c (source_line_number): Add comma.
gdb/doc
	* gdbint.texinfo (Register Information Functions): Remove
	duplicate "the".
	* gdb.texinfo (Emacs): Remove duplicate "to".
	(GDB/MI Variable Objects): Remove duplicate "the".
	(General Query Packets): Likewise.
gdb/testsuite
	* gdb.mi/mi-nsmoribund.exp:
	* gdb.hp/gdb.objdbg/objdbg01.exp:
	* gdb.base/structs.exp (test_struct_returns):
	* gdb.base/call-sc.exp (test_scalar_returns):
	* gdb.base/bigcore.exp: Remove duplicate words.
gdb/gdbserver
	* win32-low.c (handle_load_dll): Remove duplicate "the".
2011-04-19 18:04:11 +00:00
Pedro Alves ce40653717 * infcmd.c (post_create_inferior): Ignore NOT_AVAILABLE_ERROR
errors when reading the `stop_pc'.
	* printcmd.c (pc_prefix): Use get_frame_pc_if_available instead of
	get_frame_pc.
2011-03-22 14:39:40 +00:00
Michael Snyder df983543b9 2011-02-28 Michael Snyder <msnyder@vmware.com>
* infcmd.c (_initialize_infcmd): Discard unused values.
2011-02-28 23:37:07 +00:00
Tom Tromey 45a4356715 * infcmd.c (finish_backward): Use breakpoint_set_silent.
* python/py-breakpoint.c (bppy_set_silent): Use
	breakpoint_set_silent.
	(bppy_set_thread): Use breakpoint_set_thread.
	(bppy_set_task): Use breakpoint_set_task.
	* breakpoint.h (breakpoint_set_silent, breakpoint_set_thread)
	(breakpoint_set_task): Declare.
	(make_breakpoint_silent): Remove.
	* breakpoint.c (breakpoint_set_silent): New function.
	(breakpoint_set_thread): Likewise.
	(breakpoint_set_task): Likewise.
	(make_breakpoint_silent): Remove.
2011-01-31 15:16:59 +00:00
Pedro Alves ab2188aa2a * printcmd.c (print_formatted): Use val_print_scalar_formatted
instead of print_scalar_formatted.
	(print_scalar_formatted): Don't handle 's' format strings here,
	and add an assertion that we never see such format here.
	* valprint.h (val_print_scalar_formatted): Declare.
	* valprint.c (val_print_scalar_formatted): New.
	* c-valprint.c (c_val_print): Use val_print_scalar_formatted
	instead of print_scalar_formatted.
	* jv-valprint.c (java_val_print): Ditto.
	* p-valprint.c (pascal_val_print): Ditto.
	* ada-valprint.c (ada_val_print_1): Ditto.
	* f-valprint.c (f_val_print): Ditto.
	* infcmd.c (registers_info): Ditto.
	* m2-valprint.c (m2_val_print): Ditto.
2011-01-25 17:59:00 +00:00
Pedro Alves 29ec526351 gdb/
* infcmd.c (default_print_registers_info): Allocate values so to
	never pass a NULL value to val_print.
2011-01-25 15:47:58 +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
Michael Snyder 3e43a32aaa 2011-01-05 Michael Snyder <msnyder@vmware.com>
* addrmap.c: Shorten lines of >= 80 columns.
	* arch-utils.c: Ditto.
	* arch-utils.h: Ditto.
	* ax-gdb.c: Ditto.
	* ax-general.c: Ditto.
	* bcache.c: Ditto.
	* blockframe.c: Ditto.
	* breakpoint.c: Ditto.
	* buildsym.c: Ditto.
	* c-lang.c: Ditto.
	* c-typeprint.c: Ditto.
	* charset.c: Ditto.
	* coffread.c: Ditto.
	* command.h: Ditto.
	* corelow.c: Ditto.
	* cp-abi.c: Ditto.
	* cp-namespace.c: Ditto.
	* cp-support.c: Ditto.
	* dbug-rom.c: Ditto.
	* dbxread.c: Ditto.
	* defs.h: Ditto.
	* dfp.c: Ditto.
	* dfp.h: Ditto.
	* dictionary.c: Ditto.
	* disasm.c: Ditto.
	* doublest.c: Ditto.
	* dwarf2-frame.c: Ditto.
	* dwarf2expr.c: Ditto.
	* dwarf2loc.c: Ditto.
	* dwarf2read.c: Ditto.
	* elfread.c: Ditto.
	* eval.c: Ditto.
	* event-loop.c: Ditto.
	* event-loop.h: Ditto.
	* exceptions.h: Ditto.
	* exec.c: Ditto.
	* expprint.c: Ditto.
	* expression.h: Ditto.
	* f-lang.c: Ditto.
	* f-valprint.c: Ditto.
	* findcmd.c: Ditto.
	* frame-base.c: Ditto.
	* frame-unwind.c: Ditto.
	* frame-unwind.h: Ditto.
	* frame.c: Ditto.
	* frame.h: Ditto.
	* gcore.c: Ditto.
	* gdb-stabs.h: Ditto.
	* gdb_assert.h: Ditto.
	* gdb_dirent.h: Ditto.
	* gdb_obstack.h: Ditto.
	* gdbcore.h: Ditto.
	* gdbtypes.c: Ditto.
	* gdbtypes.h: Ditto.
	* inf-ttrace.c: Ditto.
	* infcall.c: Ditto.
	* infcmd.c: Ditto.
	* inflow.c: Ditto.
	* infrun.c: Ditto.
	* inline-frame.h: Ditto.
	* language.c: Ditto.
	* language.h: Ditto.
	* libunwind-frame.c: Ditto.
	* libunwind-frame.h: Ditto.
	* linespec.c: Ditto.
	* linux-nat.c: Ditto.
	* linux-nat.h: Ditto.
	* linux-thread-db.c: Ditto.
	* machoread.c: Ditto.
	* macroexp.c: Ditto.
	* macrotab.c: Ditto.
	* main.c: Ditto.
	* maint.c: Ditto.
	* mdebugread.c: Ditto.
	* memattr.c: Ditto.
	* minsyms.c: Ditto.
	* monitor.c: Ditto.
	* monitor.h: Ditto.
	* objfiles.c: Ditto.
	* objfiles.h: Ditto.
	* osabi.c: Ditto.
	* p-typeprint.c: Ditto.
	* p-valprint.c: Ditto.
	* parse.c: Ditto.
	* printcmd.c: Ditto.
	* proc-events.c: Ditto.
	* procfs.c: Ditto.
	* progspace.c: Ditto.
	* progspace.h: Ditto.
	* psympriv.h: Ditto.
	* psymtab.c: Ditto.
	* record.c: Ditto.
	* regcache.c: Ditto.
	* regcache.h: Ditto.
	* remote-fileio.c: Ditto.
	* remote.c: Ditto.
	* ser-mingw.c: Ditto.
	* ser-tcp.c: Ditto.
	* ser-unix.c: Ditto.
	* serial.c: Ditto.
	* serial.h: Ditto.
	* solib-frv.c: Ditto.
	* solib-irix.c: Ditto.
	* solib-osf.c: Ditto.
	* solib-pa64.c: Ditto.
	* solib-som.c: Ditto.
	* solib-sunos.c: Ditto.
	* solib-svr4.c: Ditto.
	* solib-target.c: Ditto.
	* solib.c: Ditto.
	* somread.c: Ditto.
	* source.c: Ditto.
	* stabsread.c: Ditto.
	* stabsread.c: Ditto.
	* stack.c: Ditto.
	* stack.h: Ditto.
	* symfile-mem.c: Ditto.
	* symfile.c: Ditto.
	* symfile.h: Ditto.
	* symmisc.c: Ditto.
	* symtab.c: Ditto.
	* symtab.h: Ditto.
	* target-descriptions.c: Ditto.
	* target-memory.c: Ditto.
	* target.c: Ditto.
	* target.h: Ditto.
	* terminal.h: Ditto.
	* thread.c: Ditto.
	* top.c: Ditto.
	* tracepoint.c: Ditto.
	* tracepoint.h: Ditto.
	* ui-file.c: Ditto.
	* ui-file.h: Ditto.
	* ui-out.h: Ditto.
	* user-regs.c: Ditto.
	* user-regs.h: Ditto.
	* utils.c: Ditto.
	* valarith.c: Ditto.
	* valops.c: Ditto.
	* valprint.c: Ditto.
	* valprint.h: Ditto.
	* value.c: Ditto.
	* varobj.c: Ditto.
	* varobj.h: Ditto.
	* vec.h: Ditto.
	* xcoffread.c: Ditto.
	* xcoffsolib.c: Ditto.
	* xcoffsolib.h: Ditto.
	* xml-syscall.c: Ditto.
	* xml-tdesc.c: Ditto.
2011-01-05 22:22:53 +00:00
Joel Brobecker 7b6bb8daac run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
Tom Tromey 186c406b19 gdb
PR c++/9593:
	* thread.c (clear_thread_inferior_resources): Call
	delete_longjmp_breakpoint.
	* infrun.c (handle_inferior_event): Handle exception breakpoints.
	(handle_inferior_event): Likewise.
	(insert_exception_resume_breakpoint): New function.
	(check_exception_resume): Likewise.
	* inferior.h (delete_longjmp_breakpoint_cleanup): Declare.
	* infcmd.c (delete_longjmp_breakpoint_cleanup): No longer static.
	(step_1): Set thread's initiating frame.
	(until_next_continuation): New function.
	(until_next_command): Support exception breakpoints.
	(finish_command_continuation): Delete longjmp breakpoint.
	(finish_forward): Support exception breakpoints.
	* gdbthread.h (struct thread_info) <initiating_frame>: New field.
	* breakpoint.h (enum bptype) <bp_exception, bp_exception_resume,
	bp_exception_master>: New constants.
	(struct bpstat_what) <is_longjmp>: New field.
	(set_longjmp_breakpoint): Update.
	* breakpoint.c (create_exception_master_breakpoint): New function.
	(update_breakpoints_after_exec): Handle bp_exception_master.  Call
	create_exception_master_breakpoint.
	(print_it_typical): Handle bp_exception_master, bp_exception.
	(bpstat_stop_status): Handle bp_exception_master.
	(bpstat_what): Handle bp_exception_master, bp_exception,
	bp_exception_resume.
	(bptype_string): Likewise.
	(print_one_breakpoint_location): Likewise.
	(allocate_bp_location): Likewise.
	(set_longjmp_breakpoint): Handle exception breakpoints.  Change
	interface.
	(delete_longjmp_breakpoint): Handle exception breakpoints.
	(mention): Likewise.
	(struct until_break_command_continuation_args) <thread_num>: New
	field.
	(until_break_command_continuation): Call
	delete_longjmp_breakpoint.
	(until_break_command): Support exception breakpoints.
	(delete_command): Likewise.
	(breakpoint_re_set_one): Likewise.
	(breakpoint_re_set): Likewise.
gdb/testuite
	* gdb.java/jnpe.java: New file.
	* gdb.java/jnpe.exp: New file.
	* gdb.cp/nextoverthrow.exp: New file.
	* gdb.cp/nextoverthrow.cc: New file.
2010-12-09 16:09:54 +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
Pedro Alves cce7e648b9 * breakpoint.c (update_watchpoint, _initialize_breakpoint): Remove
unnecessary space in string.
	* filesystem.c (_initialize_filesystem): Ditto.
	* frame.c (_initialize_frame): Ditto.
	* infcmd.c (step_once): Ditto.
	* infrun.c (_initialize_infrun): Ditto.
	* linux-nat.c (linux_child_follow_fork): Ditto.
	* maint.c (maintenance_deprecate): Ditto.
	* memattr.c (_initialize_mem): Ditto.
	* mips-tdep.c (_initialize_mips_tdep): Ditto.
	* monitor.c (monitor_open): Ditto.
	* procfs.c (procfs_xfer_memory): Ditto.
	* reverse.c (bookmarks_info): Ditto.
	* sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Ditto.
	* stack.c (_initialize_stack): Ditto.
	* tracepoint.c (_initialize_tracepoint): Ditto.
	* xtensa-tdep.c (xtensa_supply_gregset,
	xtensa_regset_from_core_section): Ditto.
2010-07-01 15:36:18 +00:00
Tom Tromey 0e03807e1c gdb
PR gdb/9977, PR exp/11636:
	* value.h (value_offset): Update.
	(struct lval_funcs) <check_validity>: New field.
	<copy_closure>: Make argument const.
	(value_computed_closure): Update.
	(value_contents_for_printing): Declare.
	(value_bits_valid): Likewise.
	(val_print): Likewise.
	(set_value_component_location): Update.
	(value_entirely_optimized_out): Declare.
	* value.c (value_offset): Argument now const.
	(require_not_optimized_out): New function.
	(value_contents_for_printing): New function.
	(value_contents_all): Call require_not_optimized_out.
	(value_contents): Likewise.
	(value_bits_valid): New function.
	(value_computed_closure): Argument now const.
	(set_value_component_location): Make 'whole' argument const.
	(value_entirely_optimized_out): New function.
	(value_bitsize): Argument now 'const'.
	(value_bitpos): Likewise.
	(value_type): Likewise.
	* valprint.h (val_print_array_elements): Update.
	* valprint.c (val_print): Add 'val' argument.  Use
	valprint_check_validity.
	(valprint_check_validity): New function.
	(value_check_printable): Use value_entirely_optimized_out.
	(common_val_print): Update.
	(value_print): Likewise.
	(val_print_array_elements): Add 'val' argument.
	* valops.c (value_fetch_lazy): Use value_contents_for_printing,
	value_bits_valid.  Reinit frame cache for lval_computed.
	* sh64-tdep.c (sh64_do_register): Update.
	* scm-valprint.c (scm_val_print): Add 'val' argument.
	* scm-lang.h (scm_val_print): Update.
	* python/python.h (apply_val_pretty_printer): Update.
	* python/py-prettyprint.c (apply_val_pretty_printer): Add 'val'
	argument.  Call set_value_component_location.
	* printcmd.c (print_scalar_formatted): Update.
	* p-valprint.c (pascal_val_print): Add 'val' argument.
	(pascal_object_print_value_fields): Likewise.
	(pascal_object_print_value): Likewise.
	(pascal_object_print_static_field): Update.
	* p-lang.h (pascal_val_print): Update.
	(pascal_object_print_value_fields): Update.
	* mt-tdep.c (mt_registers_info): Update.
	* mi/mi-main.c (get_register): Update.
	(mi_cmd_data_evaluate_expression): Use common_val_print.
	* m2-valprint.c (m2_print_array_contents): Add 'val' argument.
	(m2_print_unbounded_array): Likewise.
	(m2_val_print): Likewise.
	* m2-lang.h (m2_val_print): Update.
	* language.h (struct language_defn) <la_val_print>: Add 'val'
	argument.
	(LA_VAL_PRINT): Likewise.
	* language.c (unk_lang_val_print): Add 'val' argument.
	* jv-valprint.c (java_print_value_fields): Add 'val' argument.
	(java_val_print): Likewise.
	* jv-lang.h (java_val_print): Add 'val' argument.
	* infcmd.c (default_print_registers_info): Update.
	* f-valprint.c (f77_print_array_1): Add 'val' argument.
	(f77_print_array): Likewise.
	(f_val_print): Likewise.
	* f-lang.h (f_val_print): Add 'val' argument.
	* dwarf2loc.c (read_pieced_value): Use value_bitsize and
	value_bitpos.
	<DWARF_VALUE_OPTIMIZED_OUT>: Don't print warning.  Call
	set_value_optimized_out.
	(write_pieced_value): Use value_bitsize and value_bitpos.
	<default>: Don't exit loop.
	(check_pieced_value_validity): New function.
	(pieced_value_funcs): Reference check_pieced_value_validity,
	check_pieced_value_invalid.
	(copy_pieced_value_closure): Update.
	(check_pieced_value_bits): New function.
	(check_pieced_value_invalid): New function.
	* d-valprint.c (dynamic_array_type): Add 'val' argument.
	(d_val_print): Likewise.
	* d-lang.h (d_val_print): Update.
	* cp-valprint.c (cp_print_value_fields): Add 'val' argument.
	(cp_print_value_fields_rtti): Likewise.
	(cp_print_value): Likewise.
	(cp_print_static_field): Update.
	* c-valprint.c (c_val_print): Add 'val' argument.
	(c_value_print): Update.
	* c-lang.h (c_val_print): Update.
	(cp_print_value_fields): Likewise.
	(cp_print_value_fields_rtti): Likewise.
	* ada-valprint.c (struct ada_val_print_args): Remove.
	(val_print_packed_array_elements): Add 'val' argument.
	(ada_val_print): Likewise.  Rewrite.
	(ada_val_print_stub): Remove.
	(ada_val_print_array): Add 'val' argument.
	(ada_val_print_1): Likewise.
	(print_variant_part): Likewise.
	(ada_value_print): Update.
	(print_record): Add 'val' argument.
	(print_field_values): Likewise.
	* ada-lang.h (ada_val_print): Update.
gdb/testsuite
	PR gdb/9977, PR exp/11636::
	* gdb.dwarf2/pieces.exp (pieces_test_f3): Remove kfail.
	(pieces_test_f6): Update expected output.
2010-06-11 15:36:10 +00:00