summaryrefslogtreecommitdiff
path: root/gdb/tracepoint.c
AgeCommit message (Collapse)Author
2018-01-02Update copyright year range in all GDB filesJoel Brobecker
gdb/ChangeLog: Update copyright year range in all GDB files
2017-12-05Remove some unused variablesSimon Marchi
This patch removes some unused variables, found with -Wunused. I have not removed everything reported by -Wunused, because some expressions such as struct type *arg_type = check_typedef (value_type); in bfin-tdep.c could have an unexpected but important side-effect. I removed others that I considered more low-risk, such as: struct gdbarch *gdbarch = get_objfile_arch (objfile); I tested building with Python 2/Python 3/no Python, with/without expat, with/without libipt and with/without babeltrace. gdb/ChangeLog: * ada-lang.c (ada_collect_symbol_completion_matches): Remove unused variables. (ada_is_redundant_range_encoding): Likewise. * ada-varobj.c (ada_varobj_get_value_of_array_variable): Likewise. * alpha-tdep.c (alpha_software_single_step): Likewise. * arm-tdep.c (_initialize_arm_tdep): Likewise. * auto-load.c (info_auto_load_cmd): Likewise. * break-catch-syscall.c (insert_catch_syscall): Likewise. (remove_catch_syscall): Likewise. * breakpoint.c (condition_completer): Likewise. (clear_command): Likewise. (update_breakpoint_locations): Likewise. * btrace.c (btrace_disable): Likewise. (btrace_teardown): Likewise. (btrace_maint_update_pt_packets): Likewise. (maint_btrace_clear_cmd): Likewise. * cli/cli-decode.c (lookup_cmd_1): Likewise. (lookup_cmd_composition): Likewise. * cli/cli-dump.c (scan_filename): Likewise. (restore_command): Likewise. * compile/compile-loc2c.c (compute_stack_depth): Likewise. * compile/compile-object-load.c (compile_object_load): Likewise. * compile/compile-object-run.c (compile_object_run): Likewise. * compile/compile.c (compile_to_object): Likewise. * completer.c (filename_completer): Likewise. (complete_files_symbols): Likewise. (complete_expression): Likewise. * corelow.c (core_open): Likewise. * ctf.c (ctf_start): Likewise. (ctf_write_status): Likewise. (ctf_write_uploaded_tsv): Likewise. (ctf_write_definition_end): Likewise. (ctf_open_dir): Likewise. (ctf_xfer_partial): Likewise. (ctf_trace_find): Likewise. * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn): Likewise. * dwarf2loc.c (allocate_piece_closure): Likewise. (indirect_pieced_value): Likewise. (dwarf2_evaluate_loc_desc_full): Likewise. * dwarf2read.c (dw2_expand_marked_cus): Likewise. (dw2_expand_symtabs_matching): Likewise. (dw2_map_symbol_filenames): Likewise. (read_and_check_comp_unit_head): Likewise. (read_cutu_die_from_dwo): Likewise. (lookup_dwo_unit): Likewise. (read_comp_units_from_section): Likewise. (dwarf2_compute_name): Likewise. (handle_DW_AT_stmt_list): Likewise. (create_cus_hash_table): Likewise. (create_dwp_v2_section): Likewise. (dwarf2_rnglists_process): Likewise. (dwarf2_ranges_process): Likewise. (dwarf2_record_block_ranges): Likewise. (is_vtable_name): Likewise. (read_formatted_entries): Likewise. (skip_form_bytes): Likewise. * elfread.c (elf_symtab_read): Likewise. * exec.c (exec_file_command): Likewise. * f-valprint.c (f_val_print): Likewise. (info_common_command_for_block): Likewise. * guile/guile.c (initialize_scheme_side): Likewise. * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise. * guile/scm-cmd.c (cmdscm_completer): Likewise. (gdbscm_register_command_x): Likewise. * guile/scm-frame.c (gdbscm_frame_read_var): Likewise. * guile/scm-param.c (gdbscm_parameter_value): Likewise. * guile/scm-ports.c (file_port_magic): Likewise. * guile/scm-pretty-print.c (ppscm_search_pp_list): Likewise. (ppscm_pretty_print_one_value): Likewise. (ppscm_print_children): Likewise. * guile/scm-string.c (gdbscm_string_to_argv): Likewise. * guile/scm-symtab.c (gdbscm_sal_symtab): Likewise. * guile/scm-type.c (gdbscm_type_next_field_x): Likewise. * guile/scm-utils.c (gdbscm_parse_function_args): Likewise. * i386-tdep.c (i386_register_reggroup_p): Likewise. * infcmd.c (run_command_1): Likewise. (until_next_fsm_clean_up): Likewise. * linespec.c (linespec_complete): Likewise. (find_label_symbols): Likewise. * m2-valprint.c (m2_val_print): Likewise. * memattr.c (require_user_regions): Likewise. (lookup_mem_region): Likewise. (disable_mem_command): Likewise. (mem_delete): Likewise. * mep-tdep.c (mep_register_name): Likewise. (mep_analyze_prologue): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries): Likewise. * mi/mi-interp.c (mi_on_sync_execution_done): Likewise. * mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise. * microblaze-linux-tdep.c (microblaze_linux_init_abi): Likewise. * minidebug.c (lzma_open): Likewise. * minsyms.c (lookup_minimal_symbol): Likewise. * mips-linux-tdep.c (mips64_fill_fpregset): Likewise. * mips-tdep.c (mips_stub_frame_sniffer): Likewise. (mips_o64_return_value): Likewise. (mips_single_step_through_delay): Likewise. (_initialize_mips_tdep): Likewise. * nios2-tdep.c (nios2_push_dummy_call): Likewise. (nios2_software_single_step): Likewise. * parse.c (find_minsym_type_and_address): Likewise. * psymtab.c (psym_relocate): Likewise. * python/py-breakpoint.c (bppy_get_commands): Likewise. (gdbpy_breakpoint_modified): Likewise. * python/py-infevents.c (create_inferior_call_event_object): Likewise. * python/py-record-btrace.c (btpy_list_item): Likewise. * python/py-type.c (typy_str): Likewise. * python/py-value.c (valpy_call): Likewise. * python/python.c (do_start_initialization): Likewise. * record-btrace.c (record_btrace_insn_history_range): Likewise. (record_btrace_call_history_range): Likewise. (record_btrace_record_method): Likewise. (record_btrace_xfer_partial): Likewise. (btrace_get_frame_function): Likewise. * record-full.c (record_full_open): Likewise. * record.c (get_context_size): Likewise. * registry.h (DEFINE_REGISTRY): Likewise. * remote-fileio.c (remote_fileio_request): Likewise. * remote.c (remote_update_thread_list): Likewise. (remote_check_symbols): Likewise. (remote_commit_resume): Likewise. (remote_interrupt): Likewise. (remote_insert_breakpoint): Likewise. (compare_sections_command): Likewise. * rust-exp.y (super_name): Likewise. (lex_string): Likewise. (convert_ast_to_type): Likewise. (convert_ast_to_expression): Likewise. * rust-lang.c (rust_print_struct_def): Likewise. (rust_print_type): Likewise. (rust_evaluate_subexp): Likewise. * rx-tdep.c (rx_register_type): Likewise. * ser-event.c (serial_event_clear): Likewise. * serial.c (serial_open): Likewise. * spu-tdep.c (spu_overlay_new_objfile): Likewise. * symfile.c (section_is_overlay): Likewise. (overlay_unmapped_address): Likewise. (overlay_mapped_address): Likewise. (simple_overlay_update_1): Likewise. (simple_overlay_update): Likewise. * symtab.c (symbol_find_demangled_name): Likewise. (search_symbols): Likewise. * target-descriptions.c (tdesc_predefined_type): Likewise. * target.c (target_commit_resume): Likewise. * thread.c (print_selected_thread_frame): Likewise. * top.c (new_ui_command): Likewise. (gdb_readline_no_editing): Likewise. * tracefile-tfile.c (tfile_open): Likewise. * tracepoint.c (create_tsv_from_upload): Likewise. * utils.c (quit): Likewise. (defaulted_query): Likewise. * valarith.c (value_concat): Likewise. * xml-syscall.c (xml_list_syscalls_by_group): Likewise. * xml-tdesc.c (target_fetch_description_xml): Likewise. * xtensa-tdep.c (xtensa_pseudo_register_read): Likewise. (xtensa_pseudo_register_write): Likewise. gdb/gdbserver/ChangeLog: * regcache.c (registers_to_string): Remove unused variable.
2017-11-22Convert generic probe interface to C++ (and perform some cleanups)Sergio Durigan Junior
This patch converts the generic probe interface (gdb/probe.[ch]) to C++, and also performs some cleanups that were on my TODO list for a while. The main changes were the conversion of 'struct probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. Even though I'm sending a series of patches, they need to be tested and committed as a single unit, because of inter-dependencies. But it should be easier to review in separate logical units. I've regtested this patch on BuildBot, no regressions found. gdb/ChangeLog: 2017-11-22 Sergio Durigan Junior <sergiodj@redhat.com> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-08Make encode_actions_rsp use std::vectorSimon Marchi
Currently, encode_actions_rsp returns two malloc'ed arrays of malloc'ed strings (char *) by pointer. Change this to use std::vector<std::string>. This eliminates some cleanups in remote.c. Regtested on the buildbot. gdb/ChangeLog: * tracepoint.h (class collection_list) <stringify>: Return std::vector<std::string>. (encode_actions_rsp): Change parameters to std::vector<std::string> *. * tracepoint.c (collection_list::stringify): Return std::vector<std::string> and adjust accordingly. (encode_actions_rsp): Changee parameters to std::vector<std::string> and adjust accordingly. * remote.c (free_actions_list), free_actions_list_cleanup_wrapper): Remove. (remote_download_tracepoint): Adjust to std::vector.
2017-11-07Constify add_setshow_*Tom Tromey
This constifies the add_setshow_* family of functions, and then fixes up the fallout. The bulk of this patch was written by script. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * ada-lang.c (catch_ada_exception_command): Constify. (catch_assert_command): Constify. * break-catch-throw.c (catch_catch_command, catch_throw_command) (catch_rethrow_command): Constify. (catch_exception_command_1): Constify. * breakpoint.h (add_catch_command): Constify. * break-catch-syscall.c (catch_syscall_command_1): Constify. (catch_syscall_split_args): Constify. * break-catch-sig.c (catch_signal_command): Constify. (catch_signal_split_args): Constify. * cli/cli-decode.h (struct cmd_list_element) <function>: Use cmd_const_sfunc_ftype. * cli/cli-decode.c (add_setshow_cmd_full): Constify. (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, struct cmd_list_element) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd): Constify. (set_cmd_sfunc): Constify. (empty_sfunc): Constify. * command.h (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd): Constify. (set_cmd_sfunc): Constify. (cmd_sfunc_ftype): Remove. * compile/compile.c (set_compile_args): Constify. * infrun.c (set_disable_randomization): Constify. * infcmd.c (set_args_command, set_cwd_command): Constify. * breakpoint.c (set_condition_evaluation_mode): Constify. (add_catch_command): Constify. (catch_fork_command_1, catch_exec_command_1) (catch_load_command_1, catch_unload_command_1): Constify. (catch_load_or_unload): Constify. * guile/scm-param.c (pascm_set_func): Constify. (add_setshow_generic): Constify. * python/py-param.c (get_set_value): Constify. * top.h (set_verbose): Constify. * tui/tui-win.c (tui_set_var_cmd): Constify. * mi/mi-main.c (set_mi_async_command): Constify. * cli/cli-logging.c (set_logging_overwrite) (set_logging_redirect): Constify. * value.c (set_max_value_size): Constify. * valprint.c (set_input_radix, set_output_radix): Constify. * utils.c (set_width_command, set_height_command): Constify. * typeprint.c (set_print_type_methods, set_print_type_typedefs): Constify. * tracepoint.c (set_disconnected_tracing) (set_circular_trace_buffer, set_trace_buffer_size) (set_trace_user, set_trace_notes, set_trace_stop_notes): Constify. * top.c (set_history_size_command, set_verbose, set_editing) (set_gdb_datadir, set_history_filename): Constify. * target.c (set_targetdebug, maint_set_target_async_command) (maint_set_target_non_stop_command, set_target_permissions) (set_write_memory_permission): Constify. (open_target): Constify. * target-descriptions.c (set_tdesc_filename_cmd): Constify. * target-dcache.c (set_stack_cache, set_code_cache): Constify. * symtab.c (set_symbol_cache_size_handler): Constify. * symfile.c (set_ext_lang_command): Constify. * symfile-debug.c (set_debug_symfile): Constify. * source.c (set_directories_command): Constify. * solib.c (reload_shared_libraries, gdb_sysroot_changed): Constify. * serial.c (set_parity): Constify. * rs6000-tdep.c (powerpc_set_soft_float, powerpc_set_vector_abi): Constify. * remote.c (set_remote_exec_file, set_remotebreak) (set_remote_protocol_Z_packet_cmd, set_range_stepping): Constify. * record.c (set_record_insn_history_size) (set_record_call_history_size): Constify. * record-full.c (set_record_full_insn_max_num): Constify. * proc-api.c (set_procfs_trace_cmd, set_procfs_file_cmd): Constify. * osabi.c (set_osabi): Constify. * mips-tdep.c (set_mips64_transfers_32bit_regs) (reinit_frame_cache_sfunc, mips_abi_update): Constify. * maint.c (maintenance_set_profile_cmd): Constify. * linux-thread-db.c (set_libthread_db_search_path): Constify. * language.c (set_language_command, set_range_command) (set_case_command): Constify. * infrun.c (set_non_stop, set_observer_mode) (set_stop_on_solib_events, set_schedlock_func) (set_exec_direction_func): Constify. * infcmd.c (set_inferior_tty_command): Constify. * disasm.c (set_disassembler_options_sfunc): Constify. * demangle.c (set_demangling_command): Constify. * dcache.c (set_dcache_size, set_dcache_line_size): Constify. * cris-tdep.c (set_cris_version, set_cris_mode) (set_cris_dwarf2_cfi): Constify. * corefile.c (set_gnutarget_command): Constify. * charset.c (set_host_charset_sfunc, set_target_charset_sfunc) (set_target_wide_charset_sfunc): Constify. * breakpoint.c (update_dprintf_commands): Constify. * auto-load.c (set_auto_load_dir, set_auto_load_safe_path): Constify. * arm-tdep.c (set_fp_model_sfunc, arm_set_abi) (set_disassembly_style_sfunc): Constify. * arch-utils.c (set_endian, set_architecture): Constify. * alpha-tdep.c (reinit_frame_cache_sfunc): Constify. * agent.c (set_can_use_agent): Constify.
2017-11-07Constify add_infoTom Tromey
This patch constifies add_info and updates all the info commands. The bulk of this patch was written using a script; and then I did a manual pass to fix up the remaining compilation errors. I could not compile every changed file; in particular nto-procfs.c, gnu-nat.c, and darwin-nat-info.c; but I at least tried to check the correctness by inspection. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * frame.h (info_locals_command, info_args_command): Constify. * auto-load.h (auto_load_info_scripts): Constify. * inferior.h (registers_info): Constify. * copying.c: Rebuild. * copying.awk: Constify generated commands. * auto-load.c (auto_load_info_scripts) (info_auto_load_gdb_scripts): Constify. * cli/cli-decode.c (struct cmd_list_element): Take a cmd_const_cfunc_ftype. * command.h (add_info): Take a cmd_const_cfunc_ftype. * tui/tui-win.c (tui_all_windows_info): Constify. * python/py-auto-load.c (info_auto_load_python_scripts): Constify. * cli/cli-cmds.c (show_command): Remove non-const overload. * tracepoint.c (info_tvariables_command, info_scope_command): Constify. (info_static_tracepoint_markers_command): Constify. * thread.c (info_threads_command): Constify. (print_thread_info_1): Constify. * target.c (info_target_command): Constify. * symtab.c (info_sources_command, info_functions_command) (info_types_command): Constify. (info_variables_command): Remove non-const overload. * symfile.c (info_ext_lang_command): Constify. * stack.c (info_frame_command, info_locals_command) (info_args_command): Constify. (backtrace_command): Remove non-const overload. * source.c (info_source_command, info_line_command): Constify. * solib.c (info_sharedlibrary_command): Constify. * skip.c (info_skip_command): Constify. * ser-go32.c (info_serial_command): Constify. * reverse.c (info_bookmarks_command): Constify. * printcmd.c (info_symbol_command, info_address_command) (info_display_command): Constify. * osdata.c (info_osdata_command): Constify. * objc-lang.c (info_selectors_command, info_classes_command): Constify. * nto-procfs.c (procfs_pidlist, procfs_meminfo): Constify. * memattr.c (info_mem_command): Constify. * macrocmd.c (info_macro_command, info_macros_command): Constify. * linux-fork.c (info_checkpoints_command): Constify. * infrun.c (info_signals_command): Constify. * inflow.c (info_terminal_command): Constify. * inferior.c (info_inferiors_command): Constify. (print_inferior): Constify. * infcmd.c (info_program_command, info_all_registers_command) (info_registers_command, info_vector_command) (info_float_command): Constify. (registers_info): Constify. * gnu-nat.c (info_send_rights_cmd, info_recv_rights_cmd) (info_port_sets_cmd, info_dead_names_cmd, info_port_rights_cmd): Constify. * f-valprint.c (info_common_command): Constify. * dcache.c (info_dcache_command): Constify. (dcache_info_1): Constify. * darwin-nat-info.c (info_mach_tasks_command) (info_mach_task_command, info_mach_ports_command) (info_mach_port_command, info_mach_threads_command) (info_mach_thread_command, info_mach_regions_command) (info_mach_regions_recurse_command, info_mach_region_command) (info_mach_exceptions_command): Constify. (get_task_from_args): Constify. * cp-support.c (info_vtbl_command): Constify. * breakpoint.c (info_watchpoints_command) (info_tracepoints_command): Constify. (info_breakpoints_command): Remove non-const overload. * avr-tdep.c (avr_io_reg_read_command): Constify. * auxv.c (info_auxv_command): Constify. * ada-tasks.c (info_tasks_command): Constify. (info_task): Constify. * ada-lang.c (info_exceptions_command): Constify.
2017-11-07Constify add_comTom Tromey
This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-31tracepoint: Remove unnecessary const_castSimon Marchi
We are passing a const char * to a const char * parameter, the const_cast is not necessary. gdb/ChangeLog: * tracepoint.c (tfind_command): Remove const_cast.
2017-10-16Get rid of VEC(mem_range_s)Simon Marchi
This patch replaces the last usages of VEC(mem_range_s) with std::vector<mem_range>. This allows getting rid of a few cleanups and of the DEF_VEC_O(mem_range_s). I added a test for normalize_mem_ranges to make sure I didn't break anything there. Regtested on the buildbot. gdb/ChangeLog: * memrange.h (struct mem_range): Define operator< and operator==. (mem_range_s): Remove. (DEF_VEC_O (mem_range_s)): Remove. (normalize_mem_ranges): Change parameter type to std::vector. * memrange.c (compare_mem_ranges): Remove. (normalize_mem_ranges): Change parameter type to std::vector, adjust to vector change. * exec.c (section_table_available_memory): Return vector, remove parameter. (section_table_read_available_memory): Adjust to std::vector change. * remote.c (remote_read_bytes): Adjust to std::vector change. * tracepoint.h (traceframe_available_memory): Change parameter type to std::vector. * tracepoint.c (traceframe_available_memory): Change parameter type to std::vector, adjust. * gdb/mi/mi-main.c (mi_cmd_trace_frame_collected): Adjust to std::vector change. * gdb/Makefile.in (SUBDIR_UNITTESTS_SRCS): Add unittests/memrange-selftests.c. (SUBDIR_UNITTESTS_OBS): Add memrange-selftests.o. * gdb/unittests/memrange-selftests.c: New file.
2017-10-15Fix GDB build without expatSimon Marchi
An earlier patch of mine changed parse_traceframe_info to make it return a unique_ptr. I forgot to update the version of the function used in an expat-less build, this patch fixes it. gdb/ChangeLog: * tracepoint.c (parse_traceframe_info): Return a unique_ptr (the !HAVE_LIBEXPAT version).
2017-10-14Make to_traceframe_info return a unique_ptrSimon Marchi
Since this target method returns an allocated object, return a unique_ptr. It allows getting rid a some cleanups here and there. I had to shuffle the includes around. First, target.h now needs to include tracepoint.h, to get the definition of traceframe_info_up. However, the definition of enum trace_find_type was later in target, so I had to move it to tracepoint.h, so that the declaration of tfind_1 could know about it. I then had to remove the include of target.h from tracepoint.h, which caused a circular dependency (it was probably included to get enum trace_find_type in the first place anyway). Regression tested on the buildbot. gdb/ChangeLog: * target.h: Include tracepoint.h. (enum trace_find_type): Move to tracepoint.h. (struct target_ops) <to_traceframe_info>: Return a unique ptr. * tracepoint.h: Don't include target.h (enum trace_find_type): Move from target.h. (parse_traceframe_info): Return a unique ptr. * tracepoint.c (current_traceframe_info): Change type to unique ptr. (free_traceframe_info): Remove. (clear_traceframe_info): Don't manually free current_traceframe_info. (free_result): Remove. (parse_traceframe_info): Return a unique ptr. (get_traceframe_info): Adjust to unique ptr. * ctf.c (ctf_traceframe_info): Return a unique ptr. * remote.c (remote_traceframe_info): Return a unique ptr. * tracefile-tfile.c (tfile_traceframe_info): Return a unique ptr. * target-debug.h (target_debug_print_traceframe_info_up): New macro. * target-delegates.c: Regenerate.
2017-10-14Use std::vector for traceframe_info::memorySimon Marchi
Straightforward change from a VEC to std::vector. This allows making the destruction of a traceframe_info trivial. I added a constructor with parameters to mem_range to be able to emplace_back directly with the values. It is necessary to leave a default constructor there because mem_range is still used in a VEC. gdb/ChangeLog: * memrange.h (struct mem_range): Add constructors. * tracepoint.h (struct traceframe_info) <memory>: Change type to std::vector<mem_range>. * tracepoint.c (free_traceframe_info): Don't manually free vector. (traceframe_info_start_memory): Adjust to vector change. (traceframe_available_memory): Likewise. * tracefile-tfile.c (build_traceframe_info): Likewise. * ctf.c (ctf_traceframe_info): Likewise.
2017-10-14Use std::vector for traceframe_info::tvarsSimon Marchi
Straightforward change to get rid of a VEC. We need to new/delete traceframe_info instead of malloc/free it. I found three places that allocate a traceframe_info (ctf_traceframe_info, tfile_traceframe_info and parse_traceframe_info) and only one that frees it (free_traceframe_info). gdb/ChangeLog: * tracepoint.h (struct traceframe_info) <tvars>: Change type to std::vector<int>. * tracepoint.c (free_traceframe_info): Deallocate with delete. (traceframe_info_start_tvar): Adjust to vector change. (parse_traceframe_info): Allocate with new. * ctf.c (ctf_traceframe_info): Allocate with new, adjust to vector change. * tracefile-tfile.c (build_traceframe_info): Adjust to vector change. tfile_traceframe_info): Allocate with new. * mi/mi-main.c (mi_cmd_trace_frame_collected): Adjust to vector change.
2017-10-14Rename traceframe_info variable to current_traceframe_infoSimon Marchi
... so it doesn't shadow the traceframe_info type. It think it's a clearer name anyway. gdb/ChangeLog: * tracepoint.c (traceframe_info): Rename to... (current_traceframe_info): ...this. (clear_traceframe_info): Adjust. (get_traceframe_info): Adjust.
2017-10-11Constify add_prefix_cmdTom Tromey
This changes add_prefix_cmd to accept a const-taking function as an argument; then fixes up all the callers. In a couple of spots I had to add a non-const overload of a function, because the function is passed to two different command-adding "constructors". These overloads are temporary; once constification is complete they can be removed. This patch also fixes a typo I happened to notice while constifying. Note that this touches a couple of files (gnu-nat.c and go32-nat.c) that I can't build. So, while I made a best-effort there, I am not certain they will still compile. Tested by rebuilding. gdb/ChangeLog 2017-10-11 Tom Tromey <tom@tromey.com> * gdbthread.h (thread_command): Constify. * inferior.h (detach_command): Constify. * top.h (set_history, show_history): Constify. * arm-tdep.c (set_arm_command, show_arm_command): Constify. * serial.c (serial_set_cmd, serial_show_cmd): Constify. * bsd-kvm.c (bsd_kvm_cmd): Constify. * printcmd.c (set_command): Constify. (non_const_set_command): New function. * dcache.c (set_dcache_command, show_dcache_command): Constify. * breakpoint.c (enable_command, disable_command, delete_command) (catch_command, tcatch_command, set_breakpoint_cmd) (show_breakpoint_cmd): Constify. * macrocmd.c (macro_command): Constify. * infcmd.c (unset_command, kill_command, detach_command) (info_proc_cmd): Constify. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify. * auto-load.c (show_auto_load_cmd, set_auto_load_cmd) (info_auto_load_cmd): Constify. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Constify. * ada-lang.c (set_ada_command, show_ada_command) (maint_set_ada_cmd, maint_show_ada_cmd): Constify. * guile/guile.c (set_guile_command, show_guile_command) (info_guile_command): Constify. * tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd): Constify. * skip.c (skip_command): Constify. * compile/compile.c (_initialize_compile): Constify. * dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd): Constify. * remote.c (set_remote_cmd, show_remote_cmd, remote_command): Constify. * python/python.c (user_show_python, user_set_python): Constify. * mips-tdep.c (set_mips_command, show_mips_command) (set_mipsfpu_command): Constify. * record-btrace.c (cmd_record_btrace_start) (cmd_set_record_btrace, cmd_show_record_btrace) (cmd_set_record_btrace_bts, cmd_show_record_btrace_bts) (cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): Constify. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command): Constify. * symfile.c (overlay_command): Constify. * spu-tdep.c (set_spu_command, show_spu_command): Constify. * cli/cli-logging.c (set_logging_command, show_logging_command): Constify. * cli/cli-dump.c (dump_command, append_command) (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * cli/cli-cmds.c (info_command, show_command, set_debug) (show_debug): Constify. (show_command): Add non-const overload. * top.c (set_history, show_history): Constify. * sh-tdep.c (set_sh_command, show_sh_command): Constify. * command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype. * target.c (target_command): Constify. * sparc64-tdep.c (info_adi_command): Constify. * record-full.c (cmd_record_full_start): Constify. (set_record_full_command): Constify. Fix typo. (show_record_full_command): Constify. * thread.c (thread_command, thread_apply_command): Constify. * memattr.c (dummy_cmd): Constify. * value.c (function_command): Constify. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify. * probe.c (info_probes_command): Constify. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify. * gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd) (show_thread_cmd, set_thread_default_cmd) (show_thread_default_cmd): Constify. (check_empty): Constify. * tracepoint.c (tfind_command): Constify. * cp-support.c (maint_cplus_command): Constify. * windows-tdep.c (info_w32_command): Constify. * record.c (cmd_record_start, set_record_command) (show_record_command, info_record_command, cmd_record_goto): Constify. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Constify. * utils.c (set_internal_problem_cmd, show_internal_problem_cmd): Constify. (add_internal_problem_command): Remove casts. * arc-tdep.c (maintenance_print_arc_command): Constify. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Constify. * maint.c (maintenance_command, maintenance_info_command) (maintenance_print_command, maintenance_set_cmd) (maintenance_show_cmd, set_per_command_cmd) (show_per_command_cmd, maintenance_check_command): Constify. * language.c (set_check, show_check): Constify. * typeprint.c (show_print_type, set_print_type): Constify. * go32-nat.c (go32_info_dos_command): Constify.
2017-09-29Remove some cleanups from tracepoint.cTom Tromey
This removes some cleanups from tracepoint.c by using std::string. It also removes some unused cleanup declarations. gdb/ChangeLog 2017-09-29 Tom Tromey <tom@tromey.com> * tracepoint.c (trace_variable_command): Use std::string. (encode_actions_1): Remove unused declarations. (create_tsv_from_upload): Use std::string.
2017-09-29Constify unpack_varlen_hex & fix falloutPedro Alves
I ran into non-const unpack_varlen_hex while working on something else, and decided to just fix it first. Ends up constifying a good deal of remote packet parsing. gdb/ChangeLog: 2017-09-29 Pedro Alves <palves@redhat.com> * common/rsp-low.c (unpack_varlen_hex): Constify. * common/rsp-low.h (unpack_varlen_hex): Constify. * linux-nat.c (linux_child_static_tracepoint_markers_by_strid): Constify. * remote.c (remote_set_permissions, read_ptid) (remote_current_thread, remote_get_threads_with_qthreadinfo) (remote_static_tracepoint_marker_at) (remote_static_tracepoint_markers_by_strid) (stop_reply_extract_thread, remote_parse_stop_reply): Constify. * tracepoint.c (parse_trace_status, parse_tracepoint_status) (parse_tracepoint_definition, parse_tsv_definition) (parse_static_tracepoint_marker_definition): Constify. * tracepoint.h (parse_static_tracepoint_marker_definition) (parse_trace_status, parse_tracepoint_status) (parse_tracepoint_definition, parse_tsv_definition): Constify. gdb/gdbserver/ChangeLog: 2017-09-29 Pedro Alves <palves@redhat.com> * ax.c (gdb_parse_agent_expr): Constify. * ax.h (gdb_parse_agent_expr): Constify. * mem-break.c (add_breakpoint_condition, add_breakpoint_commands): Constify. * mem-break.h (add_breakpoint_condition, add_breakpoint_commands): Constify. * remote-utils.c (hex_or_minus_one, read_ptid): Constify. * remote-utils.h (read_ptid): Constify. * server.c (handle_qxfer_exec_file, handle_query, handle_v_cont) (process_point_options, process_serial_event): Constify. * tracepoint.c (add_tracepoint_action, cmd_qtdp, cmd_qtdpsrc) (cmd_qtdv, cmd_qtenable_disable, cmd_qtro, cmd_qtframe, cmd_qtp) (cmd_qtbuffer): Constify.
2017-09-27Constify some commands in tracepoint.cTom Tromey
In addition to the constification, this fixes a command-repeat bug. gdb/ChangeLog 2017-09-27 Tom Tromey <tom@tromey.com> * tracepoint.c (delete_trace_variable_command) (tfind_end_command, tfind_start_command, tfind_pc_command) (tfind_tracepoint_command, tfind_line_command) (tfind_range_command, tfind_outside_command): Constify.
2017-09-27Constify some linespec functionsTom Tromey
This changes a few linespec functions to work on "const char *" and then fixes up all the callers. This allows further constification elsewhere. gdb/ChangeLog 2017-09-27 Tom Tromey <tom@tromey.com> * tracepoint.c (info_scope_command): Constify. * python/python.c (gdbpy_decode_line): Constify. * python/py-breakpoint.c (bppy_init): Constify. * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Constify. * location.h: (new_linespec_location) (string_to_event_location_basic, string_to_event_location): Constify. * location.c (new_linespec_location) (string_to_event_location_basic, string_to_event_location): Constify. * linespec.h (decode_line_with_current_source) (decode_line_with_last_displayed, linespec_lex_to_end): Constify. * linespec.c (linespec_lex_to_end) (decode_line_with_current_source) (decode_line_with_last_displayed): Constify. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Constify. * cli/cli-cmds.c (edit_command, list_command): Constify. * breakpoint.h (until_break_command, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (init_ada_exception_breakpoint): Constify. * breakpoint.c (break_command_1, dprintf_command) (break_range_command, watch_command_wrapper) (rwatch_command_wrapper, awatch_command_wrapper) (until_break_command, init_ada_exception_breakpoint) (strace_marker_create_sals_from_location, trace_command) (ftrace_command, strace_command, struct tracepoint): Constify. * ax-gdb.c (agent_command_1): Constify. * ada-lang.c (ada_exception_sal): Constify.
2017-09-27Add add_cmd function overloadsTom Tromey
This adds two add_cmd overloads: one whose callback takes a const char *, and one that doesn't accept a function at all. The no-function overload was introduced to avoid ambiguity when NULL was passed as the function. Long term the goal is for all commands to take const arguments, and for the non-const variants to be removed entirely. gdb/ChangeLog 2017-09-27 Tom Tromey <tom@tromey.com> * cli/cli-decode.c (add_cmd, set_cmd_cfunc): New function overloads. (do_add_cmd): Rename from add_cmd. Don't call set_cmd_cfunc. (do_const_cfunc): New function. (cmd_cfunc_eq): New overload. (cli_user_command_p): Check do_const_cfunc. * cli/cli-decode.h (struct cmd_list_element) <function>: New field const_cfunc. * command.h (add_cmd): Add const overload and no-function overload. (set_cmd_cfunc): Add const overload. (cmd_const_cfunc_ftype): Declare. (cmd_cfunc_eq): Add const overload. * breakpoint.c, cli-cmds.c, cli-dump.c, guile/scm-cmd.c, python/py-cmd.c, target.c, tracepoint.c: Use no-function add_cmd overload.
2017-09-11Rename _const functions to use overloading insteadTom Tromey
This renames a few functions -- skip_spaces_const, skip_to_space_const, get_number_const, extract_arg_const -- to drop the "_const" suffix and instead rely on overloading. This makes future const fixes simpler by reducing the number of lines that must be changed. I think it is also not any less clear, as all these functions have the same interface as their non-const versions by design. Furthermore there's an example of using an overload in-tree already, namely check_for_argument. This patch was largely created using some perl one-liners; then a few fixes were applied by hand. ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * common/common-utils.h (skip_to_space): Remove macro, redeclare as function. (skip_to_space): Rename from skip_to_space_const. * common/common-utils.c (skip_to_space): New function. (skip_to_space): Rename from skip_to_space_const. * cli/cli-utils.h (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. * cli/cli-utils.c (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. (number_or_range_parser::get_number): Use ::get_number. * aarch64-linux-tdep.c, ada-lang.c, arm-linux-tdep.c, ax-gdb.c, break-catch-throw.c, breakpoint.c, cli/cli-cmds.c, cli/cli-dump.c, cli/cli-script.c, cli/cli-setshow.c, compile/compile.c, completer.c, demangle.c, disasm.c, findcmd.c, linespec.c, linux-tdep.c, linux-thread-db.c, location.c, mi/mi-parse.c, minsyms.c, nat/linux-procfs.c, printcmd.c, probe.c, python/py-breakpoint.c, record.c, rust-exp.y, serial.c, stack.c, stap-probe.c, tid-parse.c, tracepoint.c: Update all callers.
2017-09-09Remove unnecessary function prototypes.John Baldwin
These prototypes were required when compiling GDB as C but are not required for C++. gdb/ChangeLog: * aarch64-linux-nat.c: Remove _initialize_aarch64_linux_nat prototype. * aarch64-linux-tdep.c: Remove _initialize_aarch64_linux_tdep prototype. * aarch64-newlib-tdep.c: Remove _initialize_aarch64_newlib_tdep prototype. * aarch64-tdep.c: Remove _initialize_aarch64_tdep prototype. * ada-exp.y: Remove _initialize_ada_exp prototype. * ada-lang.c: Remove _initialize_ada_language prototype. * ada-tasks.c: Remove _initialize_tasks prototype. * addrmap.c: Remove _initialize_addrmap prototype. * agent.c: Remove _initialize_agent prototype. * aix-thread.c: Remove _initialize_aix_thread prototype. * alpha-bsd-nat.c: Remove _initialize_alphabsd_nat prototype. * alpha-linux-nat.c: Remove _initialize_alpha_linux_nat prototype. * alpha-linux-tdep.c: Remove _initialize_alpha_linux_tdep prototype. * alpha-nbsd-tdep.c: Remove _initialize_alphanbsd_tdep prototype. * alpha-obsd-tdep.c: Remove _initialize_alphaobsd_tdep prototype. * alpha-tdep.c: Remove _initialize_alpha_tdep prototype. * amd64-darwin-tdep.c: Remove _initialize_amd64_darwin_tdep prototype. * amd64-dicos-tdep.c: Remove _initialize_amd64_dicos_tdep prototype. * amd64-fbsd-nat.c: Remove _initialize_amd64fbsd_nat prototype. * amd64-fbsd-tdep.c: Remove _initialize_amd64fbsd_tdep prototype. * amd64-linux-nat.c: Remove _initialize_amd64_linux_nat prototype. * amd64-linux-tdep.c: Remove _initialize_amd64_linux_tdep prototype. * amd64-nbsd-nat.c: Remove _initialize_amd64nbsd_nat prototype. * amd64-nbsd-tdep.c: Remove _initialize_amd64nbsd_tdep prototype. * amd64-obsd-nat.c: Remove _initialize_amd64obsd_nat prototype. * amd64-obsd-tdep.c: Remove _initialize_amd64obsd_tdep prototype. * amd64-sol2-tdep.c: Remove _initialize_amd64_sol2_tdep prototype. * amd64-tdep.c: Remove _initialize_amd64_tdep prototype. * amd64-windows-nat.c: Remove _initialize_amd64_windows_nat prototype. * amd64-windows-tdep.c: Remove _initialize_amd64_windows_tdep prototype. * annotate.c: Remove _initialize_annotate prototype. * arc-newlib-tdep.c: Remove _initialize_arc_newlib_tdep prototype. * arc-tdep.c: Remove _initialize_arc_tdep prototype. * arch-utils.c: Remove _initialize_gdbarch_utils prototype. * arm-linux-nat.c: Remove _initialize_arm_linux_nat prototype. * arm-linux-tdep.c: Remove _initialize_arm_linux_tdep prototype. * arm-nbsd-tdep.c: Remove _initialize_arm_netbsd_tdep prototype. * arm-obsd-tdep.c: Remove _initialize_armobsd_tdep prototype. * arm-symbian-tdep.c: Remove _initialize_arm_symbian_tdep prototype. * arm-tdep.c: Remove _initialize_arm_tdep prototype. * arm-wince-tdep.c: Remove _initialize_arm_wince_tdep prototype. * auto-load.c: Remove _initialize_auto_load prototype. * auxv.c: Remove _initialize_auxv prototype. * avr-tdep.c: Remove _initialize_avr_tdep prototype. * ax-gdb.c: Remove _initialize_ax_gdb prototype. * bfin-linux-tdep.c: Remove _initialize_bfin_linux_tdep prototype. * bfin-tdep.c: Remove _initialize_bfin_tdep prototype. * break-catch-sig.c: Remove _initialize_break_catch_sig prototype. * break-catch-syscall.c: Remove _initialize_break_catch_syscall prototype. * break-catch-throw.c: Remove _initialize_break_catch_throw prototype. * breakpoint.c: Remove _initialize_breakpoint prototype. * bsd-uthread.c: Remove _initialize_bsd_uthread prototype. * btrace.c: Remove _initialize_btrace prototype. * charset.c: Remove _initialize_charset prototype. * cli/cli-cmds.c: Remove _initialize_cli_cmds prototype. * cli/cli-dump.c: Remove _initialize_cli_dump prototype. * cli/cli-interp.c: Remove _initialize_cli_interp prototype. * cli/cli-logging.c: Remove _initialize_cli_logging prototype. * cli/cli-script.c: Remove _initialize_cli_script prototype. * coff-pe-read.c: Remove _initialize_coff_pe_read prototype. * coffread.c: Remove _initialize_coffread prototype. * compile/compile.c: Remove _initialize_compile prototype. * complaints.c: Remove _initialize_complaints prototype. * completer.c: Remove _initialize_completer prototype. * copying.awk: Remove _initialize_copying prototype. * copying.c: Regenerate. * core-regset.c: Remove _initialize_core_regset prototype. * corefile.c: Remove _initialize_core prototype. * corelow.c: Remove _initialize_corelow prototype. * cp-abi.c: Remove _initialize_cp_abi prototype. * cp-namespace.c: Remove _initialize_cp_namespace prototype. * cp-support.c: Remove _initialize_cp_support prototype. * cp-valprint.c: Remove _initialize_cp_valprint prototype. * cris-linux-tdep.c: Remove _initialize_cris_linux_tdep prototype. * cris-tdep.c: Remove _initialize_cris_tdep prototype. * ctf.c: Remove _initialize_ctf prototype. * d-lang.c: Remove _initialize_d_language prototype. * darwin-nat-info.c: Remove _initialize_darwin_info_commands prototype. * darwin-nat.c: Remove _initialize_darwin_inferior prototype. * dbxread.c: Remove _initialize_dbxread prototype. * dcache.c: Remove _initialize_dcache prototype. * demangle.c: Remove _initialize_demangler prototype. * disasm-selftests.c: Remove _initialize_disasm_selftests prototype. * disasm.c: Remove _initialize_disasm prototype. * dtrace-probe.c: Remove _initialize_dtrace_probe prototype. * dummy-frame.c: Remove _initialize_dummy_frame prototype. * dwarf2-frame-tailcall.c: Remove _initialize_tailcall_frame prototype. * dwarf2-frame.c: Remove _initialize_dwarf2_frame prototype. * dwarf2expr.c: Remove _initialize_dwarf2expr prototype. * dwarf2loc.c: Remove _initialize_dwarf2loc prototype. * dwarf2read.c: Remove _initialize_dwarf2_read prototype. * elfread.c: Remove _initialize_elfread prototype. * exec.c: Remove _initialize_exec prototype. * extension.c: Remove _initialize_extension prototype. * f-lang.c: Remove _initialize_f_language prototype. * f-valprint.c: Remove _initialize_f_valprint prototype. * fbsd-nat.c: Remove _initialize_fbsd_nat prototype. * fbsd-tdep.c: Remove _initialize_fbsd_tdep prototype. * filesystem.c: Remove _initialize_filesystem prototype. * findcmd.c: Remove _initialize_mem_search prototype. * fork-child.c: Remove _initialize_fork_child prototype. * frame-base.c: Remove _initialize_frame_base prototype. * frame-unwind.c: Remove _initialize_frame_unwind prototype. * frame.c: Remove _initialize_frame prototype. * frv-linux-tdep.c: Remove _initialize_frv_linux_tdep prototype. * frv-tdep.c: Remove _initialize_frv_tdep prototype. * ft32-tdep.c: Remove _initialize_ft32_tdep prototype. * gcore.c: Remove _initialize_gcore prototype. * gdb_bfd.c: Remove _initialize_gdb_bfd prototype. * gdbarch.c: Regenerate. * gdbarch.sh: Remove _initialize_gdbarch prototype. * gdbtypes.c: Remove _initialize_gdbtypes prototype. * gnu-nat.c: Remove _initialize_gnu_nat prototype. * gnu-v2-abi.c: Remove _initialize_gnu_v2_abi prototype. * gnu-v3-abi.c: Remove _initialize_gnu_v3_abi prototype. * go-lang.c: Remove _initialize_go_language prototype. * go32-nat.c: Remove _initialize_go32_nat prototype. * guile/guile.c: Remove _initialize_guile prototype. * h8300-tdep.c: Remove _initialize_h8300_tdep prototype. * hppa-linux-nat.c: Remove _initialize_hppa_linux_nat prototype. * hppa-linux-tdep.c: Remove _initialize_hppa_linux_tdep prototype. * hppa-nbsd-nat.c: Remove _initialize_hppanbsd_nat prototype. * hppa-nbsd-tdep.c: Remove _initialize_hppanbsd_tdep prototype. * hppa-obsd-nat.c: Remove _initialize_hppaobsd_nat prototype. * hppa-obsd-tdep.c: Remove _initialize_hppaobsd_tdep prototype. * hppa-tdep.c: Remove _initialize_hppa_tdep prototype. * i386-bsd-nat.c: Remove _initialize_i386bsd_nat prototype. * i386-cygwin-tdep.c: Remove _initialize_i386_cygwin_tdep prototype. * i386-darwin-tdep.c: Remove _initialize_i386_darwin_tdep prototype. * i386-dicos-tdep.c: Remove _initialize_i386_dicos_tdep prototype. * i386-fbsd-nat.c: Remove _initialize_i386fbsd_nat prototype. * i386-fbsd-tdep.c: Remove _initialize_i386fbsd_tdep prototype. * i386-gnu-nat.c: Remove _initialize_i386gnu_nat prototype. * i386-gnu-tdep.c: Remove _initialize_i386gnu_tdep prototype. * i386-linux-nat.c: Remove _initialize_i386_linux_nat prototype. * i386-linux-tdep.c: Remove _initialize_i386_linux_tdep prototype. * i386-nbsd-nat.c: Remove _initialize_i386nbsd_nat prototype. * i386-nbsd-tdep.c: Remove _initialize_i386nbsd_tdep prototype. * i386-nto-tdep.c: Remove _initialize_i386nto_tdep prototype. * i386-obsd-nat.c: Remove _initialize_i386obsd_nat prototype. * i386-obsd-tdep.c: Remove _initialize_i386obsd_tdep prototype. * i386-sol2-nat.c: Remove _initialize_amd64_sol2_nat prototype. * i386-sol2-tdep.c: Remove _initialize_amd64_sol2_tdep prototype. * i386-tdep.c: Remove _initialize_i386_tdep prototype. * i386-windows-nat.c: Remove _initialize_i386_windows_nat prototype. * ia64-libunwind-tdep.c: Remove _initialize_libunwind_frame prototype. * ia64-linux-nat.c: Remove _initialize_ia64_linux_nat prototype. * ia64-linux-tdep.c: Remove _initialize_ia64_linux_tdep prototype. * ia64-tdep.c: Remove _initialize_ia64_tdep prototype. * ia64-vms-tdep.c: Remove _initialize_ia64_vms_tdep prototype. * infcall.c: Remove _initialize_infcall prototype. * infcmd.c: Remove _initialize_infcmd prototype. * inferior.c: Remove _initialize_inferiors prototype. * inflow.c: Remove _initialize_inflow prototype. * infrun.c: Remove _initialize_infrun prototype. * interps.c: Remove _initialize_interpreter prototype. * iq2000-tdep.c: Remove _initialize_iq2000_tdep prototype. * jit.c: Remove _initialize_jit prototype. * language.c: Remove _initialize_language prototype. * linux-fork.c: Remove _initialize_linux_fork prototype. * linux-nat.c: Remove _initialize_linux_nat prototype. * linux-tdep.c: Remove _initialize_linux_tdep prototype. * linux-thread-db.c: Remove _initialize_thread_db prototype. * lm32-tdep.c: Remove _initialize_lm32_tdep prototype. * m2-lang.c: Remove _initialize_m2_language prototype. * m32c-tdep.c: Remove _initialize_m32c_tdep prototype. * m32r-linux-nat.c: Remove _initialize_m32r_linux_nat prototype. * m32r-linux-tdep.c: Remove _initialize_m32r_linux_tdep prototype. * m32r-tdep.c: Remove _initialize_m32r_tdep prototype. * m68hc11-tdep.c: Remove _initialize_m68hc11_tdep prototype. * m68k-bsd-nat.c: Remove _initialize_m68kbsd_nat prototype. * m68k-bsd-tdep.c: Remove _initialize_m68kbsd_tdep prototype. * m68k-linux-nat.c: Remove _initialize_m68k_linux_tdep prototype. * m68k-linux-tdep.c: Remove _initialize_m68k_linux_tdep prototype. * m68k-tdep.c: Remove _initialize_m68k_tdep prototype. * m88k-bsd-nat.c: Remove _initialize_m68kbsd_nat prototype. * m88k-tdep.c: Remove _initialize_m68kbsd_tdep prototype. * machoread.c: Remove _initialize_machoread prototype. * macrocmd.c: Remove _initialize_macrocmd prototype. * macroscope.c: Remove _initialize_macroscope prototype. * maint.c: Remove _initialize_maint_cmds prototype. * mdebugread.c: Remove _initialize_mdebugread prototype. * memattr.c: Remove _initialize_mem prototype. * mep-tdep.c: Remove _initialize_mep_tdep prototype. * mi/mi-cmd-env.c: Remove _initialize_mi_cmd_env prototype. * mi/mi-cmds.c: Remove _initialize_mi_cmds prototype. * mi/mi-interp.c: Remove _initialize_mi_interp prototype. * mi/mi-main.c: Remove _initialize_mi_main prototype. * microblaze-linux-tdep.c: Remove _initialize_microblaze_linux_tdep prototype. * microblaze-tdep.c: Remove _initialize_microblaze_tdep prototype. * mips-fbsd-nat.c: Remove _initialize_mips_fbsd_nat prototype. * mips-fbsd-tdep.c: Remove _initialize_mips_fbsd_tdep prototype. * mips-linux-nat.c: Remove _initialize_mips_linux_nat prototype. * mips-linux-tdep.c: Remove _initialize_mips_linux_tdep prototype. * mips-nbsd-nat.c: Remove _initialize_mipsnbsd_nat prototype. * mips-nbsd-tdep.c: Remove _initialize_mipsnbsd_tdep prototype. * mips-sde-tdep.c: Remove _initialize_mips_sde_tdep prototype. * mips-tdep.c: Remove _initialize_mips_tdep prototype. * mips64-obsd-nat.c: Remove _initialize_mips64obsd_nat prototype. * mips64-obsd-tdep.c: Remove _initialize_mips64obsd_tdep prototype. * mipsread.c: Remove _initialize_mipsread prototype. * mn10300-linux-tdep.c: Remove _initialize_mn10300_linux_tdep prototype. * mn10300-tdep.c: Remove _initialize_mn10300_tdep prototype. * moxie-tdep.c: Remove _initialize_moxie_tdep prototype. * msp430-tdep.c: Remove _initialize_msp430_tdep prototype. * mt-tdep.c: Remove _initialize_mt_tdep prototype. * nds32-tdep.c: Remove _initialize_nds32_tdep prototype. * nios2-linux-tdep.c: Remove _initialize_nios2_linux_tdep prototype. * nios2-tdep.c: Remove _initialize_nios2_tdep prototype. * nto-procfs.c: Remove _initialize_procfs prototype. * nto-tdep.c: Remove _initialize_nto_tdep prototype. * objc-lang.c: Remove _initialize_objc_language prototype. * objfiles.c: Remove _initialize_objfiles prototype. * observer.c: Remove observer_test_first_notification_function, observer_test_second_notification_function, observer_test_third_notification_function, and _initialize_observer prototypes. * opencl-lang.c: Remove _initialize_opencl_language prototypes. * osabi.c: Remove _initialize_gdb_osabi prototype. * osdata.c: Remove _initialize_osdata prototype. * p-valprint.c: Remove _initialize_pascal_valprint prototype. * parse.c: Remove _initialize_parse prototype. * ppc-fbsd-nat.c: Remove _initialize_ppcfbsd_nat prototype. * ppc-fbsd-tdep.c: Remove _initialize_ppcfbsd_tdep prototype. * ppc-linux-nat.c: Remove _initialize_ppc_linux_nat prototype. * ppc-linux-tdep.c: Remove _initialize_ppc_linux_tdep prototype. * ppc-nbsd-nat.c: Remove _initialize_ppcnbsd_nat prototype. * ppc-nbsd-tdep.c: Remove _initialize_ppcnbsd_tdep prototype. * ppc-obsd-nat.c: Remove _initialize_ppcobsd_nat prototype. * ppc-obsd-tdep.c: Remove _initialize_ppcobsd_tdep prototype. * printcmd.c: Remove _initialize_printcmd prototype. * probe.c: Remove _initialize_probe prototype. * proc-api.c: Remove _initialize_proc_api prototype. * proc-events.c: Remove _initialize_proc_events prototype. * proc-service.c: Remove _initialize_proc_service prototype. * procfs.c: Remove _initialize_procfs prototype. * psymtab.c: Remove _initialize_psymtab prototype. * python/python.c: Remove _initialize_python prototype. * ravenscar-thread.c: Remove _initialize_ravenscar prototype. * record-btrace.c: Remove _initialize_record_btrace prototype. * record-full.c: Remove _initialize_record_full prototype. * record.c: Remove _initialize_record prototype. * regcache.c: Remove _initialize_regcache prototype. * reggroups.c: Remove _initialize_reggroup prototype. * remote-notif.c: Remove _initialize_notif prototype. * remote-sim.c: Remove _initialize_remote_sim prototype. * remote.c: Remove _initialize_remote prototype. * reverse.c: Remove _initialize_reverse prototype. * rl78-tdep.c: Remove _initialize_rl78_tdep prototype. * rs6000-aix-tdep.c: Remove _initialize_rs6000_aix_tdep prototype. * rs6000-lynx178-tdep.c: Remove _initialize_rs6000_lynx178_tdep prototype. * rs6000-nat.c: Remove _initialize_rs6000_nat prototype. * rs6000-tdep.c: Remove _initialize_rs6000_tdep prototype. * rust-exp.y: Remove _initialize_rust_exp prototype. * rx-tdep.c: Remove _initialize_rx_tdep prototype. * s390-linux-nat.c: Remove _initialize_s390_nat prototype. * s390-linux-tdep.c: Remove _initialize_s390_tdep prototype. * score-tdep.c: Remove _initialize_score_tdep prototype. * selftest-arch.c: Remove _initialize_selftests_foreach_arch prototype. * ser-go32.c: Remove _initialize_ser_dos prototype. * ser-mingw.c: Remove _initialize_ser_windows prototype. * ser-pipe.c: Remove _initialize_ser_pipe prototype. * ser-tcp.c: Remove _initialize_ser_tcp prototype. * ser-unix.c: Remove _initialize_ser_hardwire prototype. * serial.c: Remove _initialize_serial prototype. * sh-linux-tdep.c: Remove _initialize_sh_linux_tdep prototype. * sh-nbsd-nat.c: Remove _initialize_shnbsd_nat prototype. * sh-nbsd-tdep.c: Remove _initialize_shnbsd_tdep prototype. * sh-tdep.c: Remove _initialize_sh_tdep prototype. * skip.c: Remove _initialize_step_skip prototype. * sol-thread.c: Remove _initialize_sol_thread prototype. * solib-aix.c: Remove _initialize_solib_aix prototype. * solib-darwin.c: Remove _initialize_darwin_solib prototype. * solib-dsbt.c: Remove _initialize_dsbt_solib prototype. * solib-frv.c: Remove _initialize_frv_solib prototype. * solib-spu.c: Remove _initialize_spu_solib prototype. * solib-svr4.c: Remove _initialize_svr4_solib prototype. * solib-target.c: Remove _initialize_solib_target prototype. * solib.c: Remove _initialize_solib prototype. * source.c: Remove _initialize_source prototype. * sparc-linux-nat.c: Remove _initialize_sparc_linux_nat prototype. * sparc-linux-tdep.c: Remove _initialize_sparc_linux_tdep prototype. * sparc-nat.c: Remove _initialize_sparc_nat prototype. * sparc-nbsd-nat.c: Remove _initialize_sparcnbsd_nat prototype. * sparc-nbsd-tdep.c: Remove _initialize_sparcnbsd_tdep prototype. * sparc-obsd-tdep.c: Remove _initialize_sparc32obsd_tdep prototype. * sparc-sol2-nat.c: Remove _initialize_sparc_sol2_nat prototype. * sparc-sol2-tdep.c: Remove _initialize_sparc_sol2_tdep prototype. * sparc-tdep.c: Remove _initialize_sparc_tdep prototype. * sparc64-fbsd-nat.c: Remove _initialize_sparc64fbsd_nat prototype. * sparc64-fbsd-tdep.c: Remove _initialize_sparc64fbsd_tdep prototype. * sparc64-linux-nat.c: Remove _initialize_sparc64_linux_nat prototype. * sparc64-linux-tdep.c: Remove _initialize_sparc64_linux_tdep prototype. * sparc64-nat.c: Remove _initialize_sparc64_nat prototype. * sparc64-nbsd-nat.c: Remove _initialize_sparc64nbsd_nat prototype. * sparc64-nbsd-tdep.c: Remove _initialize_sparc64nbsd_tdep prototype. * sparc64-obsd-nat.c: Remove _initialize_sparc64obsd_nat prototype. * sparc64-obsd-tdep.c: Remove _initialize_sparc64obsd_tdep prototype. * sparc64-sol2-tdep.c: Remove _initialize_sparc64_sol2_tdep prototype. * spu-linux-nat.c: Remove _initialize_spu_nat prototype. * spu-multiarch.c: Remove _initialize_spu_multiarch prototype. * spu-tdep.c: Remove _initialize_spu_tdep prototype. * stabsread.c: Remove _initialize_stabsread prototype. * stack.c: Remove _initialize_stack prototype. * stap-probe.c: Remove _initialize_stap_probe prototype. * std-regs.c: Remove _initialize_frame_reg prototype. * symfile-debug.c: Remove _initialize_symfile_debug prototype. * symfile-mem.c: Remove _initialize_symfile_mem prototype. * symfile.c: Remove _initialize_symfile prototype. * symmisc.c: Remove _initialize_symmisc prototype. * symtab.c: Remove _initialize_symtab prototype. * target-dcache.c: Remove _initialize_target_dcache prototype. * target-descriptions.c: Remove _initialize_target_descriptions prototype. * thread.c: Remove _initialize_thread prototype. * tic6x-linux-tdep.c: Remove _initialize_tic6x_linux_tdep prototype. * tic6x-tdep.c: Remove _initialize_tic6x_tdep prototype. * tilegx-linux-nat.c: Remove _initialize_tile_linux_nat prototype. * tilegx-linux-tdep.c: Remove _initialize_tilegx_linux_tdep prototype. * tilegx-tdep.c: Remove _initialize_tilegx_tdep prototype. * tracefile-tfile.c: Remove _initialize_tracefile_tfile prototype. * tracefile.c: Remove _initialize_tracefile prototype. * tracepoint.c: Remove _initialize_tracepoint prototype. * tui/tui-hooks.c: Remove _initialize_tui_hooks prototype. * tui/tui-interp.c: Remove _initialize_tui_interp prototype. * tui/tui-layout.c: Remove _initialize_tui_layout prototype. * tui/tui-regs.c: Remove _initialize_tui_regs prototype. * tui/tui-stack.c: Remove _initialize_tui_stack prototype. * tui/tui-win.c: Remove _initialize_tui_win prototype. * tui/tui.c: Remove _initialize_tui prototype. * typeprint.c: Remove _initialize_typeprint prototype. * user-regs.c: Remove _initialize_user_regs prototype. * utils.c: Remove _initialize_utils prototype. * v850-tdep.c: Remove _initialize_v850_tdep prototype. * valarith.c: Remove _initialize_valarith prototype. * valops.c: Remove _initialize_valops prototype. * valprint.c: Remove _initialize_valprint prototype. * value.c: Remove _initialize_values prototype. * varobj.c: Remove _initialize_varobj prototype. * vax-bsd-nat.c: Remove _initialize_vaxbsd_nat prototype. * vax-nbsd-tdep.c: Remove _initialize_vaxnbsd_tdep prototype. * vax-tdep.c: Remove _initialize_vax_tdep prototype. * windows-nat.c: Remove _initialize_windows_nat, _initialize_check_for_gdb_ini, and _initialize_loadable prototypes. * windows-tdep.c: Remove _initialize_windows_tdep prototype. * xcoffread.c: Remove _initialize_xcoffread prototype. * xml-support.c: Remove _initialize_xml_support prototype. * xstormy16-tdep.c: Remove _initialize_xstormy16_tdep prototype. * xtensa-linux-nat.c: Remove _initialize_xtensa_linux_nat prototype. * xtensa-linux-tdep.c: Remove _initialize_xtensa_linux_tdep prototype. * xtensa-tdep.c: Remove _initialize_xtensa_tdep prototype.
2017-09-04Kill init_salPedro Alves
Instead, make symtab_and_line initialize its members itself. Many symtab_and_line declarations are moved to where the object is initialized at the same time both for clarity and to avoid double initialization. A few functions, like e.g., find_frame_sal are adjusted to return the sal using normal function return instead of an output parameter likewise to avoid having to default-construct a sal and then immediately have the object overwritten. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ada-lang.c (is_known_support_routine): Move sal declaration to where it is initialized. * breakpoint.c (create_internal_breakpoint, init_catchpoint) (parse_breakpoint_sals, decode_static_tracepoint_spec) (clear_command, update_static_tracepoint): Remove init_sal references. Move declarations closer to initializations. * cli/cli-cmds.c (list_command): Move sal declarations closer to initializations. * elfread.c (elf_gnu_ifunc_resolver_stop): Remove init_sal references. Move sal declarations closer to initializations. * frame.c (find_frame_sal): Return a symtab_and_line via function return instead of output parameter. Remove init_sal references. * frame.h (find_frame_sal): Return a symtab_and_line via function return instead of output parameter. * guile/scm-frame.c (gdbscm_frame_sal): Adjust. * guile/scm-symtab.c (stscm_make_sal_smob): Use in-place new instead of memset. (gdbscm_find_pc_line): Remove init_sal reference. * infcall.c (call_function_by_hand_dummy): Remove init_sal references. Move declarations closer to initializations. * infcmd.c (set_step_frame): Update. Move declarations closer to initializations. (finish_backward): Remove init_sal references. Move declarations closer to initializations. * infrun.c (process_event_stop_test, handle_step_into_function) (insert_hp_step_resume_breakpoint_at_frame) (insert_step_resume_breakpoint_at_caller): Likewise. * linespec.c (create_sals_line_offset, decode_digits_ordinary) (symbol_to_sal): Likewise. * probe.c (parse_probes_in_pspace): Remove init_sal reference. * python/py-frame.c (frapy_find_sal): Move sal declaration closer to its initialization. * reverse.c (save_bookmark_command): Use new/delete. Remove init_sal references. Move declarations closer to initializations. * source.c (get_current_source_symtab_and_line): Remove brace initialization. (set_current_source_symtab_and_line): Now takes the sal by const reference. Remove brace initialization. (line_info): Remove init_sal reference. * source.h (set_current_source_symtab_and_line): Now takes a symtab_and_line via const reference. * stack.c (set_current_sal_from_frame): Adjust. (print_frame_info): Adjust. (get_last_displayed_sal): Return the sal via function return instead of via output parameter. Simplify. (frame_info): Adjust. * stack.h (get_last_displayed_sal): Return the sal via function return instead of via output parameter. * symtab.c (init_sal): Delete. (find_pc_sect_line): Remove init_sal references. Move declarations closer to initializations. (find_function_start_sal): Remove init_sal references. Move declarations closer to initializations. * symtab.h (struct symtab_and_line): In-class initialize all fields. * tracepoint.c (set_traceframe_context) (print_one_static_tracepoint_marker): Remove init_sal references. Move declarations closer to initializations. * tui/tui-disasm.c (tui_show_disassem_and_update_source): Adjust. * tui/tui-stack.c (tui_show_frame_info): Adjust. Move declarations closer to initializations. * tui/tui-winsource.c (tui_update_source_window_as_is): Remove init_sal references. Adjust.
2017-09-04struct symtabs_and_lines -> std::vector<symtab_and_line>Pedro Alves
This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-08-22Rename some command functionsSimon Marchi
This patch renames a few functions implementing CLI commands to follow the style <command-name>_command, so that they are easier to search for. gdb/ChangeLog: * breakpoint.c (breakpoints_info): Rename to ... (info_breakpoints_command): ... this. (watchpoints_info): Rename to ... (info_watchpoints_command): ... this. (tracepoints_info): Rename to ... (info_tracepoints_command): ... this. (_initialize_breakpoint): Adjust. * dcache.c (dcache_info): Rename to ... (info_display_command): ... this. (_initialize_dcache): Adjust. * frame.h (args_info): Rename to ... (info_args_command): ... this. (locals_info): Rename to ... (info_locals_command): ... this. * infcmd.c (nofp_registers_info): Rename to ... (info_registers_command): ... this. (float_info): Rename to ... (info_float_command): ... this. (program_info): Rename to ... (info_program_command): ... this. (all_registers_info): Rename to ... (info_all_registers_command): ... this. (vector_info): Rename to ... (info_vector_command): ... this. (float_info): Rename to ... (info_float_command): ... this. (_initialize_infcmd): Adjust. * inferior.h (term_info): Rename to ... (info_terminal_command): ... this. * inflow.c (term_info): Rename to ... (info_terminal_command): ... this. (_initialize_inflow): Adjust. * infrun.c (signals_info): Rename to ... (info_signals_command): ... this. (_initialize_infrun): Adjust. * objc-lang.c (classes_info): Rename to ... (info_classes_command): ... this. (selectors_info): Rename to ... (info_selectors_command): ... this. (_initialize_objc_language): Adjust. * printcmd.c (sym_info): Rename to ... (info_symbol_command): ... this. (address_info): Rename to ... (info_address_command): ... this. (display_info): Rename to ... (info_display_command): ... this. (_initialize_printcmd): Adjust. * reverse.c (bookmarks_info): Rename to ... (info_breakpoints_command): ... this. (_initialize_reverse): Adjust. * ser-go32.c (dos_info): Rename to ... (info_serial_command): ... this. (_initialize_ser_dos): Adjust. * skip.c (skip_info): Rename to ... (info_skip_command): ... this. (_initialize_step_skip): Adjust. * source.c (line_info): Rename to ... (info_line_command): ... this. (source_info): Rename to ... (info_source_command) * stack.c (frame_info): Rename to ... (info_frame_command): ... this. (locals_info): Rename to ... (info_locals_command): ... this. (args_info): Rename to ... (info_args_command): ... this. (_initialize_stack): Adjust. * symtab.c (sources_info): Rename to ... (info_sources_command): ... this. (variables_info): Rename to ... (info_variables_command): ... this. (functions_info): Rename to ... (info_functions_command): ... this. (types_info): Rename to ... (info_types_command): ... this. (_initialize_symtab): Adjust. * target.c (target_info): Rename to ... (info_target_command): ... this. (initialize_targets): Adjust. * tracepoint.c (tvariables_info): Rename to ... (info_tvariables_command): ... this. (scope_info): Rename to ... (info_scope_command): ... this. (trace_dump_actions): Adjust. (_initialize_tracepoint): Adjust.
2017-08-03Introduce gdb_argv, a class wrapper for buildargvTom Tromey
This introduces gdb_argv, a class wrapping an "argv" pointer; that is, a pointer to a NULL-terminated array of char*, where both the array and each non-NULL element in the array are xmalloc'd. This patch then changes most users of gdb_buildargv to use gdb_argv instead. ChangeLog 2017-08-03 Tom Tromey <tom@tromey.com> * utils.h (struct gdb_argv_deleter): New. (gdb_argv): New class. * utils.c (gdb_argv::reset): New method. * tracepoint.c (delete_trace_variable_command): Use gdb_argv. * tracefile.c (tsave_command): Use gdb_argv. * top.c (new_ui_command): Use gdb_argv. * symmisc.c (maintenance_print_symbols) (maintenance_print_msymbols, maintenance_expand_symtabs): Use gdb_argv. * symfile.c (symbol_file_command, generic_load) (remove_symbol_file_command): Use gdb_argv. * stack.c (backtrace_command): Use gdb_argv. * source.c (add_path, show_substitute_path_command) (unset_substitute_path_command, set_substitute_path_command): Use gdb_argv. * skip.c (skip_command): Use gdb_argv. Use gdb_buildargv. * ser-mingw.c (pipe_windows_open): Use gdb_argv. * remote.c (extended_remote_run, remote_put_command) (remote_get_command, remote_delete_command): Use gdb_argv. * remote-sim.c (gdbsim_load, gdbsim_create_inferior) (gdbsim_open): Use gdb_argv. * python/py-cmd.c (gdbpy_string_to_argv): Use gdb_argv. * psymtab.c (maintenance_print_psymbols): Use gdb_argv. * procfs.c (procfs_info_proc): Use gdb_argv. * interps.c (interpreter_exec_cmd): Use gdb_argv. * infrun.c (handle_command): Use gdb_argv. * inferior.c (add_inferior_command, clone_inferior_command): Use gdb_argv. * guile/scm-string.c (gdbscm_string_to_argv): Use gdb_argv. * exec.c (exec_file_command): Use gdb_argv. * cli/cli-cmds.c (alias_command): Use gdb_argv. * compile/compile.c (build_argc_argv): Use gdb_argv.
2017-08-03Introduce and use ui_out_emit_tableTom Tromey
This introduces ui_out_emit_table, similar to the other existing ui_out RAII classes, and then uses it in a number of places. This replaces some cleanups. ChangeLog 2017-08-03 Tom Tromey <tom@tromey.com> * tracepoint.c (tvariables_info_1): Use ui_out_emit_table. (info_static_tracepoint_markers_command): Likewise. * solib.c (info_sharedlibrary_command): Use ui_out_emit_table. * skip.c (skip_info): Use ui_out_emit_table. * progspace.c (print_program_space): Use ui_out_emit_table. * osdata.c (info_osdata): Use ui_out_emit_table. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Use ui_out_emit_table. * linux-thread-db.c (info_auto_load_libthread_db): Use ui_out_emit_table. * inferior.c (print_inferior): Use ui_out_emit_table. * gdb_bfd.c (maintenance_info_bfds): Use ui_out_emit_table. * breakpoint.c (breakpoint_1): Use ui_out_emit_table. * auto-load.c (auto_load_info_scripts): Use ui_out_emit_table. * ada-tasks.c (print_ada_task_info): Use ui_out_emit_table. * ui-out.h (class ui_out_emit_table): New.
2017-06-02C++ify breakpoint class hierarchy (destructors only)Simon Marchi
Breakpoints are currently in a limbo state between C and C++. There is a pseudo class hierarchy implemented using struct fields. Taking watchpoint as an example: struct watchpoint { /* The base class. */ struct breakpoint base; ... } and it is instantianted with "new watchpoint ()". When destroyed, a destructor is first invoked through the breakpoint_ops, and then the memory is freed by calling delete through a pointer to breakpoint. Address sanitizer complains about this, for example, because we new and delete the same memory using different types. This patch takes the logical step of making breakpoint subclasses extend the breakpoint class for real, and converts their destructors to actual C++ destructors. Regtested on the buildbot. gdb/ChangeLog: * breakpoint.h (struct breakpoint_ops) <dtor>: Remove. (struct breakpoint) <~breakpoint>: New. (struct watchpoint): Inherit from breakpoint. <~watchpoint>: New. <base>: Remove. (struct tracepoint): Inherit from breakpoint. <base>: Remove. * breakpoint.c (longjmp_breakpoint_ops): Remove. (struct longjmp_breakpoint): Inherit from breakpoint. <~longjmp_breakpoint>: New. <base>: Remove. (new_breakpoint_from_type): Remove casts. (watchpoint_in_thread_scope): Remove reference to base field. (watchpoint_del_at_next_stop): Likewise. (update_watchpoint): Likewise. (watchpoint_check): Likewise. (bpstat_check_watchpoint): Likewise. (set_longjmp_breakpoint): Likewise. (struct fork_catchpoint): Inherit from breakpoint. <base>: Remove. (struct solib_catchpoint): Inherit from breakpoint. <~solib_catchpoint>: New. <base>: Remove. (dtor_catch_solib): Change to ... (solib_catchpoint::~solib_catchpoint): ... this. (breakpoint_hit_catch_solib): Remove reference to base field. (add_solib_catchpoint): Likewise. (create_fork_vfork_event_catchpoint): Likewise. (struct exec_catchpoint): Inherit from breakpoint. <~exec_catchpoint>: New. <base>: Remove. (dtor_catch_exec): Change to ... (exec_catchpoint::~exec_catchpoint): ... this. (dtor_watchpoint): Change to ... (watchpoint::~watchpoint): ... this. (watch_command_1): Remove reference to base field. (catch_exec_command_1): Likewise. (base_breakpoint_dtor): Change to ... (breakpoint::~breakpoint): ... this. (base_breakpoint_ops): Remove dtor field value. (longjmp_bkpt_dtor): Change to ... (longjmp_breakpoint::~longjmp_breakpoint): ... this. (strace_marker_create_breakpoints_sal): Remove reference to base field. (delete_breakpoint): Don't manually call breakpoint destructor. (create_tracepoint_from_upload): Remove reference to base field. (trace_pass_set_count): Likewise. (initialize_breakpoint_ops): Don't initialize momentary_breakpoint_ops, don't set dtors. * ada-lang.c (struct ada_catchpoint): Inherit from breakpoint. <~ada_catchpoint>: New. <base>: Remove. (create_excep_cond_exprs): Remove reference to base field. (dtor_exception): Change to ... (ada_catchpoint::~ada_catchpoint): ... this. (dtor_catch_exception): Remove. (dtor_catch_exception_unhandled): Remove. (dtor_catch_assert): Remove. (create_ada_exception_catchpoint): Remove reference to base field. (initialize_ada_catchpoint_ops): Don't set dtors. * break-catch-sig.c (struct signal_catchpoint): Inherit from breakpoint. <~signal_catchpoint>: New. <base>: Remove. (signal_catchpoint_dtor): Change to ... (signal_catchpoint::~signal_catchpoint): ... this. (create_signal_catchpoint): Remove reference to base field. (initialize_signal_catchpoint_ops): Don't set dtor. * break-catch-syscall.c (struct syscall_catchpoint): Inherit from breakpoint. <~syscall_catchpoint>: New. <base>: Remove. (dtor_catch_syscall): Change to ... (syscall_catchpoint::~syscall_catchpoint): ... this. (create_syscall_event_catchpoint): Remove reference to base field. (initialize_syscall_catchpoint_ops): Don't set dtor. * break-catch-throw.c (struct exception_catchpoint): Inherit from breakpoint. <~exception_catchpoint>: New. <base>: Remove. (dtor_exception_catchpoint): Change to ... (exception_catchpoint::~exception_catchpoint): ... this. (handle_gnu_v3_exceptions): Remove reference to base field. (initialize_throw_catchpoint_ops): Don't set dtor. * ctf.c (ctf_get_traceframe_address): Remove reference to base field. * remote.c (remote_get_tracepoint_status): Likewise. * tracefile-tfile.c (tfile_get_traceframe_address): Likewise. * tracefile.c (tracefile_fetch_registers): Likewise. * tracepoint.c (actions_command): Likewise. (validate_actionline): Likewise. (tfind_1): Likewise. (get_traceframe_location): Likewise. (find_matching_tracepoint_location): Likewise. (parse_tracepoint_status): Likewise. * mi/mi-cmd-break.c (mi_cmd_break_passcount): Likewise.
2017-05-04RAII-fy make_cleanup_restore_current_thread & friendsPedro Alves
After all the make_cleanup_restore_current_thread fixing, I thought I'd convert that and its relatives (which are all cleanups) to RAII classes. scoped_restore_current_pspace_and_thread was put in a separate file to avoid a circular dependency. Tested on x86-64 Fedora 23, native and gdbserver. gdb/ChangeLog: 2017-05-04 Pedro Alves <palves@redhat.com> * Makefile.in (SFILES): Add progspace-and-thread.c. (HFILES_NO_SRCDIR): Add progspace-and-thread.h. (COMMON_OBS): Add progspace-and-thread.o. * breakpoint.c: Include "progspace-and-thread.h". (update_inserted_breakpoint_locations) (insert_breakpoint_locations, create_longjmp_master_breakpoint): Use scoped_restore_current_pspace_and_thread. (create_std_terminate_master_breakpoint): Use scoped_restore_current_program_space. (remove_breakpoint): Use scoped_restore_current_pspace_and_thread. (print_breakpoint_location): Use scoped_restore_current_program_space. (bp_loc_is_permanent): Use scoped_restore_current_pspace_and_thread. (resolve_sal_pc): Use scoped_restore_current_pspace_and_thread. (download_tracepoint_locations): Use scoped_restore_current_pspace_and_thread. (breakpoint_re_set): Use scoped_restore_current_pspace_and_thread. * exec.c (exec_close_1): Use scoped_restore_current_program_space. (enum step_over_calls_kind): Moved from inferior.h. (class scoped_restore_current_thread): New class. * gdbthread.h (make_cleanup_restore_current_thread): Delete declaration. (scoped_restore_current_thread): New class. * infcmd.c: Include "common/gdb_optional.h". (continue_1, proceed_after_attach): Use scoped_restore_current_thread. (notice_new_inferior): Use scoped_restore_current_thread. * inferior.c: Include "progspace-and-thread.h". (restore_inferior, save_current_inferior): Delete. (add_inferior_command, clone_inferior_command): Use scoped_restore_current_pspace_and_thread. * inferior.h (scoped_restore_current_inferior): New class. * infrun.c: Include "progspace-and-thread.h" and "common/gdb_optional.h". (follow_fork_inferior): Use scoped_restore_current_pspace_and_thread. (scoped_restore_exited_inferior): New class. (handle_vfork_child_exec_or_exit): Use scoped_restore_exited_inferior, scoped_restore_current_pspace_and_thread, scoped_restore_current_thread and scoped_restore. (fetch_inferior_event): Use scoped_restore_current_thread. * linespec.c (decode_line_full, decode_line_1): Use scoped_restore_current_program_space. * mi/mi-main.c: Include "progspace-and-thread.h". (exec_continue): Use scoped_restore_current_thread. (mi_cmd_exec_run): Use scoped_restore_current_pspace_and_thread. (mi_cmd_trace_frame_collected): Use scoped_restore_current_thread. * proc-service.c (ps_pglobal_lookup): Use scoped_restore_current_program_space. * progspace-and-thread.c: New file. * progspace-and-thread.h: New file. * progspace.c (release_program_space, clone_program_space): Use scoped_restore_current_program_space. (restore_program_space, save_current_program_space) (save_current_space_and_thread): Delete. (switch_to_program_space_and_thread): Moved to progspace-and-thread.c. * progspace.h (save_current_program_space) (save_current_space_and_thread): Delete declarations. (scoped_restore_current_program_space): New class. * remote.c (remote_btrace_maybe_reopen): Use scoped_restore_current_thread. * symtab.c: Include "progspace-and-thread.h". (skip_prologue_sal): Use scoped_restore_current_pspace_and_thread. * thread.c (print_thread_info_1): Use scoped_restore_current_thread. (struct current_thread_cleanup): Delete. (do_restore_current_thread_cleanup) (restore_current_thread_cleanup_dtor): Rename/convert both to ... (scoped_restore_current_thread::~scoped_restore_current_thread): ... this new dtor. (make_cleanup_restore_current_thread): Rename/convert to ... (scoped_restore_current_thread::scoped_restore_current_thread): ... this new ctor. (thread_apply_all_command): Use scoped_restore_current_thread. (thread_apply_command): Use scoped_restore_current_thread. * tracepoint.c (tdump_command): Use scoped_restore_current_thread. * varobj.c (value_of_root_1): Use scoped_restore_current_thread.
2017-04-22Use ui_out_emit_tuple in tracepoint.cTom Tromey
This changes some code in tracepoint.c to use ui_out_emit_tuple. One of these involved removing an otherwise unrelated cleanup (changing type to std::string) and the other involved introducing a new block. ChangeLog 2017-04-22 Tom Tromey <tom@tromey.com> * tracepoint.c (tvariables_info_1) (print_one_static_tracepoint_marker): Use ui_out_emit_tuple.
2017-04-12Introduce command_line_upTom Tromey
This introduces command_line_up, a unique_ptr for command_line objects, and changes many places to use it. This removes a number of cleanups. Command lines are funny in that sometimes they are reference counted. Once there is more C++-ification of some of the users, perhaps all of these can be changed to use shared_ptr instead. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * tracepoint.c (actions_command): Update. * python/python.c (python_command, python_interactive_command): Update. * mi/mi-cmd-break.c (mi_cmd_break_commands): Update. * guile/guile.c (guile_command): Update. * defs.h (read_command_lines, read_command_lines_1): Return command_line_up. (command_lines_deleter): New struct. (command_line_up): New typedef. * compile/compile.c (compile_code_command) (compile_print_command): Update. * cli/cli-script.h (get_command_line, copy_command_lines): Return command_line_up. (make_cleanup_free_command_lines): Remove. * cli/cli-script.c (get_command_line, read_command_lines_1) (copy_command_lines): Return command_line_up. (while_command, if_command, read_command_lines, define_command) (document_command): Update. (do_free_command_lines_cleanup, make_cleanup_free_command_lines): Remove. * breakpoint.h (breakpoint_set_commands): Change type of "commands". * breakpoint.c (breakpoint_set_commands): Change type of "commands". Update. (do_map_commands_command, update_dprintf_command_list) (create_tracepoint_from_upload): Update.
2017-04-12Introduce event_location_upTom Tromey
This removes make_cleanup_delete_event_location and instead changes the various location functions to return an event_location_up, a new unique_ptr typedef. This is largely straightforward, but be sure to examine the init_breakpoint_sal change. I believe the code I deleted there is dead, because "location != NULL" can never be true in that branch; but you should double-check. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * tracepoint.c (scope_info): Update. * spu-tdep.c (spu_catch_start): Update. * python/python.c (gdbpy_decode_line): Update. * python/py-finishbreakpoint.c (bpfinishpy_init): Update. * python/py-breakpoint.c (bppy_init): Update. * probe.c (parse_probes): Update. * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Update. * location.h (event_location_deleter): New struct. (event_location_up): New typedef. (new_linespec_location, new_address_location, new_probe_location) (new_explicit_location, copy_event_location) (string_to_event_location, string_to_event_location_basic) (string_to_explicit_location): Update return type. (make_cleanup_delete_event_location): Remove. * location.c (new_linespec_location, new_address_location) (new_probe_location, new_explicit_location, copy_event_location): Return event_location_up. (delete_event_location_cleanup) (make_cleanup_delete_event_location): Remove. (string_to_explicit_location, string_to_event_location_basic) (string_to_event_location): Return event_location_up. * linespec.c (canonicalize_linespec, event_location_to_sals) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc): Update. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Update. * completer.c (location_completer): Update. * cli/cli-cmds.c (edit_command, list_command): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint) (create_thread_event_breakpoint): Update. (init_breakpoint_sal): Update. Remove some dead code. (create_breakpoint_sal): Change type of "location". Update. (create_breakpoints_sal, create_breakpoint, break_command_1) (dprintf_command, break_range_command, until_break_command) (init_ada_exception_breakpoint) (strace_marker_create_sals_from_location) (update_static_tracepoint, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Update. * break-catch-throw.c (re_set_exception_catchpoint): Update. * ax-gdb.c (agent_command_1): Update.
2017-04-05-Wwrite-strings: The RestPedro Alves
This is the remainder boring constification that all looks more of less borderline obvious IMO. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * ada-exp.y (yyerror): Constify. * ada-lang.c (bound_name, get_selections) (ada_variant_discrim_type) (ada_variant_discrim_name, ada_value_struct_elt) (ada_lookup_struct_elt_type, is_unchecked_variant) (ada_which_variant_applies, standard_exc, ada_get_next_arg) (catch_ada_exception_command_split) (catch_ada_assert_command_split, catch_assert_command) (ada_op_name): Constify. * ada-lang.h (ada_yyerror, get_selections) (ada_variant_discrim_name, ada_value_struct_elt): Constify. * arc-tdep.c (arc_print_frame_cache): Constify. * arm-tdep.c (arm_skip_stub): Constify. * ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref) (gen_aggregate_elt_ref): Constify. * bcache.c (print_bcache_statistics): Constify. * bcache.h (print_bcache_statistics): Constify. * break-catch-throw.c (catch_exception_command_1): * breakpoint.c (struct ep_type_description::description): Constify. (add_solib_catchpoint): Constify. (catch_fork_command_1): Add cast. (add_catch_command): Constify. * breakpoint.h (add_catch_command, add_solib_catchpoint): Constify. * bsd-uthread.c (bsd_uthread_state): Constify. * buildsym.c (patch_subfile_names): Constify. * buildsym.h (next_symbol_text_func, patch_subfile_names): Constify. * c-exp.y (yyerror): Constify. (token::oper): Constify. * c-lang.h (c_yyerror, cp_print_class_member): Constify. * c-varobj.c (cplus_describe_child): Constify. * charset.c (find_charset_names): Add cast. (find_charset_names): Constify array and add const_cast. * cli/cli-cmds.c (complete_command, cd_command): Constify. (edit_command): Constify. * cli/cli-decode.c (lookup_cmd): Constify. * cli/cli-dump.c (dump_memory_command, dump_value_command): Constify. (struct dump_context): Constify. (add_dump_command, restore_command): Constify. * cli/cli-script.c (get_command_line): Constify. * cli/cli-script.h (get_command_line): Constify. * cli/cli-utils.c (check_for_argument): Constify. * cli/cli-utils.h (check_for_argument): Constify. * coff-pe-read.c (struct read_pe_section_data): Constify. * command.h (lookup_cmd): Constify. * common/print-utils.c (decimal2str): Constify. * completer.c (gdb_print_filename): Constify. * corefile.c (set_gnutarget): Constify. * cp-name-parser.y (yyerror): Constify. * cp-valprint.c (cp_print_class_member): Constify. * cris-tdep.c (cris_register_name, crisv32_register_name): Constify. * d-exp.y (yyerror): Constify. (struct token::oper): Constify. * d-lang.h (d_yyerror): Constify. * dbxread.c (struct header_file_location::name): Constify. (add_old_header_file, add_new_header_file, last_function_name) (dbx_next_symbol_text, add_bincl_to_list) (find_corresponding_bincl_psymtab, set_namestring) (find_stab_function_addr, read_dbx_symtab, start_psymtab) (dbx_end_psymtab, read_ofile_symtab, process_one_symbol): * defs.h (command_line_input, print_address_symbolic) (deprecated_readline_begin_hook): Constify. * dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name): Constify. * event-top.c (handle_line_of_input): Constify and add cast. * exceptions.c (catch_errors): Constify. * exceptions.h (catch_errors): Constify. * expprint.c (print_subexp_standard, op_string, op_name) (op_name_standard, dump_raw_expression, dump_raw_expression): * expression.h (op_name, op_string, dump_raw_expression): Constify. * f-exp.y (yyerror): Constify. (struct token::oper): Constify. (struct f77_boolean_val::name): Constify. * f-lang.c (f_word_break_characters): Constify. * f-lang.h (f_yyerror): Constify. * fork-child.c (fork_inferior): Add cast. * frv-tdep.c (struct gdbarch_tdep::register_names): Constify. (new_variant): Constify. * gdbarch.sh (pstring_ptr, pstring_list): Constify. * gdbarch.c: Regenerate. * gdbcore.h (set_gnutarget): Constify. * go-exp.y (yyerror): Constify. (token::oper): Constify. * go-lang.h (go_yyerror): Constify. * go32-nat.c (go32_sysinfo): Constify. * guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify. * guile/scm-cmd.c (cmdscm_function): Constify. * guile/scm-param.c (pascm_param_value): Constify. * h8300-tdep.c (h8300_register_name, h8300s_register_name) (h8300sx_register_name): Constify. * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Constify. * ia64-tdep.c (ia64_register_names): Constify. * infcmd.c (construct_inferior_arguments): Constify. (path_command, attach_post_wait): Constify. * language.c (show_range_command, show_case_command) (unk_lang_error): Constify. * language.h (language_defn::la_error) (language_defn::la_name_of_this): Constify. * linespec.c (decode_line_2): Constify. * linux-thread-db.c (thread_db_err_str): Constify. * lm32-tdep.c (lm32_register_name): Constify. * m2-exp.y (yyerror): Constify. * m2-lang.h (m2_yyerror): Constify. * m32r-tdep.c (m32r_register_names): Constify and make static. * m68hc11-tdep.c (m68hc11_register_names): Constify. * m88k-tdep.c (m88k_register_name): Constify. * macroexp.c (appendmem): Constify. * mdebugread.c (fdr_name, add_data_symbol, parse_type) (upgrade_type, parse_external, parse_partial_symbols) (mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab) (new_symbol): Constify. * memattr.c (mem_info_command): Constify. * mep-tdep.c (register_name_from_keyword): Constify. * mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env): Constify. * mi/mi-cmd-stack.c (list_args_or_locals): Constify. * mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify. * mi/mi-main.c (captured_mi_execute_command): Constify and add cast. (mi_execute_async_cli_command): Constify. * mips-tdep.c (mips_register_name): Constify. * mn10300-tdep.c (register_name, mn10300_generic_register_name) (am33_register_name, am33_2_register_name) * moxie-tdep.c (moxie_register_names): Constify. * nat/linux-osdata.c (osdata_type): Constify fields. * nto-tdep.c (nto_parse_redirection): Constify. * objc-lang.c (lookup_struct_typedef, lookup_objc_class) (lookup_child_selector): Constify. (objc_methcall::name): Constify. * objc-lang.h (lookup_objc_class, lookup_child_selector) (lookup_struct_typedef): Constify. * objfiles.c (pc_in_section): Constify. * objfiles.h (pc_in_section): Constify. * p-exp.y (struct token::oper): Constify. (yyerror): Constify. * p-lang.h (pascal_yyerror): Constify. * parser-defs.h (op_name_standard): Constify. (op_print::string): Constify. (exp_descriptor::op_name): Constify. * printcmd.c (print_address_symbolic): Constify. * psymtab.c (print_partial_symbols): Constify. * python/py-breakpoint.c (stop_func): Constify. (bppy_get_expression): Constify. * python/py-cmd.c (cmdpy_completer::name): Constify. (cmdpy_function): Constify. * python/py-event.c (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-event.h (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-evts.c (add_new_registry): Constify. * python/py-finishbreakpoint.c (outofscope_func): Constify. * python/py-framefilter.c (get_py_iter_from_func): Constify. * python/py-inferior.c (get_buffer): Add cast. * python/py-param.c (parm_constant::name): Constify. * python/py-unwind.c (fprint_frame_id): Constify. * python/python.c (gdbpy_parameter_value): Constify. * remote-fileio.c (remote_fio_func_map): Make 'name' const. * remote.c (memory_packet_config::name): Constify. (show_packet_config_cmd, remote_write_bytes) (remote_buffer_add_string): * reverse.c (exec_reverse_once): Constify. * rs6000-tdep.c (variant::name, variant::description): Constify. * rust-exp.y (rustyyerror): Constify. * rust-lang.c (rust_op_name): Constify. * rust-lang.h (rustyyerror): Constify. * serial.h (serial_ops::name): Constify. * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name) (sh_sh3e_register_name, sh_sh2e_register_name) (sh_sh2a_register_name, sh_sh2a_nofpu_register_name) (sh_sh_dsp_register_name, sh_sh3_dsp_register_name) (sh_sh4_register_name, sh_sh4_nofpu_register_name) (sh_sh4al_dsp_register_name): Constify. * sh64-tdep.c (sh64_register_name): Constify. * solib-darwin.c (lookup_symbol_from_bfd): Constify. * spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify. * stabsread.c (patch_block_stabs, read_type_number) (ref_map::stabs, ref_add, process_reference) (symbol_reference_defined, define_symbol, define_symbol) (error_type, read_type, read_member_functions, read_cpp_abbrev) (read_one_struct_field, read_struct_fields, read_baseclasses) (read_tilde_fields, read_struct_type, read_array_type) (read_enum_type, read_sun_builtin_type, read_sun_floating_type) (read_huge_number, read_range_type, read_args, common_block_start) (find_name_end): Constify. * stabsread.h (common_block_start, define_symbol) (process_one_symbol, symbol_reference_defined, ref_add): * symfile.c (get_section_index, add_symbol_file_command): * symfile.h (get_section_index): Constify. * target-descriptions.c (tdesc_type::name): Constify. (tdesc_free_type): Add cast. * target.c (find_default_run_target): (add_deprecated_target_alias, find_default_run_target) (target_announce_detach): Constify. (do_option): Constify. * target.h (add_deprecated_target_alias): Constify. * thread.c (print_thread_info_1): Constify. * top.c (deprecated_readline_begin_hook, command_line_input): Constify. (init_main): Add casts. * top.h (handle_line_of_input): Constify. * tracefile-tfile.c (tfile_write_uploaded_tsv): Constify. * tracepoint.c (tvariables_info_1, trace_status_mi): Constify. (tfind_command): Rename to ... (tfind_command_1): ... this and constify. (tfind_command): New function. (tfind_end_command, tfind_start_command): Adjust. (encode_source_string): Constify. * tracepoint.h (encode_source_string): Constify. * tui/tui-data.c (tui_partial_win_by_name): Constify. * tui/tui-data.h (tui_partial_win_by_name): Constify. * tui/tui-source.c (tui_set_source_content_nil): Constify. * tui/tui-source.h (tui_set_source_content_nil): Constify. * tui/tui-win.c (parse_scrolling_args): Constify. * tui/tui-windata.c (tui_erase_data_content): Constify. * tui/tui-windata.h (tui_erase_data_content): Constify. * tui/tui-winsource.c (tui_erase_source_content): Constify. * tui/tui.c (tui_enable): Add cast. * utils.c (defaulted_query): Constify. (init_page_info): Add cast. (puts_debug, subset_compare): Constify. * utils.h (subset_compare): Constify. * varobj.c (varobj_format_string): Constify. * varobj.h (varobj_format_string): Constify. * vax-tdep.c (vax_register_name): Constify. * windows-nat.c (windows_detach): Constify. * xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify. * xml-support.c (gdb_xml_end_element): Constify. * xml-tdesc.c (tdesc_start_reg): Constify. * xstormy16-tdep.c (xstormy16_register_name): Constify. * xtensa-tdep.c (xtensa_find_register_by_name): Constify. * xtensa-tdep.h (xtensa_register_t::name): Constify. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * gdbreplay.c (sync_error): Constify. * linux-x86-low.c (push_opcode): Constify.
2017-04-05-Wwrite-strings: Don't initialize string command variables to empty stringPedro Alves
-Wwrite-strings flags these initializations as requiring a cast. However, these variables are command variables, and as such point to heap-allocated memory. The initial allocation is always done when the corresponding command is registered. E.g.,: dprintf_function = xstrdup ("printf"); add_setshow_string_cmd ("dprintf-function", class_support, &dprintf_function, _("\ Set the function to use for dynamic printf"), _("\ Show the function to use for dynamic printf"), NULL, update_dprintf_commands, NULL, &setlist, &showlist); That's why we never reach a bogus attempt to free these string literals. So, just drop the incorrect initializations. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * breakpoint.c (dprintf_function, dprintf_channel): Don't initialize. * tracepoint.c (default_collect): Don't initialize.
2017-02-02Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchyPedro Alves
This patch starts from the desire to eliminate make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file & friends a real C++ class hierarchy, and switches temporary ui_file-like objects to stack-based allocation. - mem_fileopen -> string_file mem_fileopen is replaced with a new string_file class that is treated as a value class created on the stack. This alone eliminates most make_cleanup_ui_file_delete calls, and, simplifies code a whole lot (diffstat shows around 1k loc dropped.) string_file's internal buffer is a std::string, thus the "string" in the name. This simplifies the implementation much, compared to mem_fileopen, which managed growing its internal buffer manually. - ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone The new string_file class has a string() method that provides direct writable access to the internal std::string buffer. This replaced ui_file_as_string, which forced a copy of the same data the stream had inside. With direct access via a writable reference, we can instead move the string out of the string_stream, avoiding deep string copying. Related, ui_file_xstrdup calls are replaced with xstrdup'ping the stream's string, and ui_file_obsavestring is replaced by obstack_copy0. With all those out of the way, getting rid of the weird ui_file_put mechanism was possible. - New ui_file::printf, ui_file::puts, etc. methods These simplify / clarify client code. I considered splitting client-code changes, like these, e.g.: - stb = mem_fileopen (); - fprintf_unfiltered (stb, "%s%s%s", - _("The valid values are:\n"), - regdesc, - _("The default is \"std\".")); + string_file stb; + stb.printf ("%s%s%s", + _("The valid values are:\n"), + regdesc, + _("The default is \"std\".")); In two steps, with the first step leaving fprintf_unfiltered (etc.) calls in place, and only afterwards do a pass to change all those to call stb.printf etc.. I didn't do that split, because (when I tried), it turned out to be pointless make-work: the first pass would have to touch the fprintf_unfiltered line anyway, to replace "stb" with "&stb". - gdb_fopen replaced with stack-based objects This avoids the need for cleanups or unique_ptr's. I.e., this: struct ui_file *file = gdb_fopen (filename, "w"); if (filename == NULL) perror_with_name (filename); cleanups = make_cleanup_ui_file_delete (file); // use file. do_cleanups (cleanups); is replaced with this: stdio_file file; if (!file.open (filename, "w")) perror_with_name (filename); // use file. - odd contorsions in null_file_write / null_file_fputs around when to call to_fputs / to_write eliminated. - Global null_stream object A few places that were allocating a ui_file in order to print to "nowhere" are adjusted to instead refer to a new 'null_stream' global stream. - TUI's tui_sfileopen eliminated. TUI's ui_file much simplified The TUI's ui_file was serving a dual purpose. It supported being used as string buffer, and supported being backed by a stdio FILE. The string buffer part is gone, replaced by using of string_file. The 'FILE *' support is now much simplified, by making the TUI's ui_file inherit from stdio_file. gdb/ChangeLog: 2017-02-02 Pedro Alves <palves@redhat.com> * ada-lang.c (type_as_string): Use string_file. * ada-valprint.c (ada_print_floating): Use string_file. * ada-varobj.c (ada_varobj_scalar_image) (ada_varobj_get_value_image): Use string_file. * aix-thread.c (aix_thread_extra_thread_info): Use string_file. * arm-tdep.c (_initialize_arm_tdep): Use string_printf. * breakpoint.c (update_inserted_breakpoint_locations) (insert_breakpoint_locations, reattach_breakpoints) (print_breakpoint_location, print_one_detail_ranged_breakpoint) (print_it_watchpoint): Use string_file. (save_breakpoints): Use stdio_file. * c-exp.y (oper): Use string_file. * cli/cli-logging.c (set_logging_redirect): Use ui_file_up and tee_file. (pop_output_files): Use delete. (handle_redirections): Use stdio_file and tee_file. * cli/cli-setshow.c (do_show_command): Use string_file. * compile/compile-c-support.c (c_compute_program): Use string_file. * compile/compile-c-symbols.c (generate_vla_size): Take a 'string_file &' instead of a 'ui_file *'. (generate_c_for_for_one_variable): Take a 'string_file &' instead of a 'ui_file *'. Use string_file. (generate_c_for_variable_locations): Take a 'string_file &' instead of a 'ui_file *'. * compile/compile-internal.h (generate_c_for_for_one_variable): Take a 'string_file &' instead of a 'ui_file *'. * compile/compile-loc2c.c (push, pushf, unary, binary) (print_label, pushf_register_address, pushf_register) (do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a 'ui_file *'. Adjust. * compile/compile.c (compile_to_object): Use string_file. * compile/compile.h (compile_dwarf_expr_to_c) (compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a 'ui_file *'. * cp-support.c (inspect_type): Use string_file and obstack_copy0. (replace_typedefs_qualified_name): Use string_file and obstack_copy0. * disasm.c (gdb_pretty_print_insn): Use string_file. (gdb_disassembly): Adjust reference the null_stream global. (do_ui_file_delete): Delete. (gdb_insn_length): Use null_stream. * dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file. * dwarf2loc.c (dwarf2_compile_property_to_c) (locexpr_generate_c_location, loclist_generate_c_location): Take a 'string_file &' instead of a 'ui_file *'. * dwarf2loc.h (dwarf2_compile_property_to_c): Likewise. * dwarf2read.c (do_ui_file_peek_last): Delete. (dwarf2_compute_name): Use string_file. * event-top.c (gdb_setup_readline): Use stdio_file. * gdbarch.sh (verify_gdbarch): Use string_file. * gdbtypes.c (safe_parse_type): Use null_stream. * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use string_file. * guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a 'string_file *' instead of a 'ui_file *'. (gdbscm_arch_disassemble): Use string_file. * guile/scm-frame.c (frscm_print_frame_smob): Use string_file. * guile/scm-ports.c (class ioscm_file_port): Now a class that inherits from ui_file. (ioscm_file_port_delete, ioscm_file_port_rewind) (ioscm_file_port_put): Delete. (ioscm_file_port_write): Rename to ... (ioscm_file_port::write): ... this. Remove file_port_magic checks. (ioscm_file_port_new): Delete. (ioscm_with_output_to_port_worker): Use ioscm_file_port and ui_file_up. * guile/scm-type.c (tyscm_type_name): Use string_file. * guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print): Use string_file. * infcmd.c (print_return_value_1): Use string_file. * infrun.c (print_target_wait_results): Use string_file. * language.c (add_language): Use string_file. * location.c (explicit_to_string_internal): Use string_file. * main.c (captured_main_1): Use null_file. * maint.c (maintenance_print_architecture): Use stdio_file. * mi/mi-cmd-stack.c (list_arg_or_local): Use string_file. * mi/mi-common.h (struct mi_interp) <out, err, log, targ, event_channel>: Change type to mi_console_file pointer. * mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush) (mi_console_file_delete): Delete. (struct mi_console_file): Delete. (mi_console_file_magic): Delete. (mi_console_file_new): Delete. (mi_console_file::mi_console_file): New. (mi_console_file_delete): Delete. (mi_console_file_fputs): Delete. (mi_console_file::write): New. (mi_console_raw_packet): Delete. (mi_console_file::flush): New. (mi_console_file_flush): Delete. (mi_console_set_raw): Rename to ... (mi_console_file::set_raw): ... this. * mi/mi-console.h (class mi_console_file): New class. (mi_console_file_new, mi_console_set_raw): Delete. * mi/mi-interp.c (mi_interpreter_init): Use mi_console_file. (mi_set_logging): Use delete and tee_file. Adjust. * mi/mi-main.c (output_register): Use string_file. (mi_cmd_data_evaluate_expression): Use string_file. (mi_cmd_data_read_memory): Use string_file. (mi_cmd_execute, print_variable_or_computed): Use string_file. * mi/mi-out.c (mi_ui_out::main_stream): New. (mi_ui_out::rewind): Use main_stream and string_file. (mi_ui_out::put): Use main_stream and string_file. (mi_ui_out::mi_ui_out): Remove 'stream' parameter. Allocate a 'string_file' instead. (mi_out_new): Don't allocate a mem_fileopen stream here. * mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter. (mi_ui_out::main_stream): Declare method. * printcmd.c (eval_command): Use string_file. * psymtab.c (maintenance_print_psymbols): Use stdio_file. * python/py-arch.c (archpy_disassemble): Use string_file. * python/py-breakpoint.c (bppy_get_commands): Use string_file. * python/py-frame.c (frapy_str): Use string_file. * python/py-framefilter.c (py_print_type, py_print_single_arg): Use string_file. * python/py-type.c (typy_str): Use string_file. * python/py-unwind.c (unwind_infopy_str): Use string_file. * python/py-value.c (valpy_str): Use string_file. * record-btrace.c (btrace_insn_history): Use string_file. * regcache.c (regcache_print): Use stdio_file. * reggroups.c (maintenance_print_reggroups): Use stdio_file. * remote.c (escape_buffer): Use string_file. * rust-lang.c (rust_get_disr_info): Use string_file. * serial.c (serial_open_ops_1): Use stdio_file. (do_serial_close): Use delete. * stack.c (print_frame_arg): Use string_file. (print_frame_args): Remove local mem_fileopen stream, not used. (print_frame): Use string_file. * symmisc.c (maintenance_print_symbols): Use stdio_file. * symtab.h (struct symbol_computed_ops) <generate_c_location>: Take a 'string_file *' instead of a 'ui_file *'. * top.c (new_ui): Use stdio_file and stderr_file. (free_ui): Use delete. (execute_command_to_string): Use string_file. (quit_confirm): Use string_file. * tracepoint.c (collection_list::append_exp): Use string_file. * tui/tui-disasm.c (tui_disassemble): Use string_file. * tui/tui-file.c: Don't include "ui-file.h". (enum streamtype, struct tui_stream): Delete. (tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen) (tui_file_isatty, tui_file_rewind, tui_file_put): Delete. (tui_file::tui_file): New method. (tui_file_fputs): Delete. (tui_file_get_strbuf): Delete. (tui_file::puts): New method. (tui_file_adjust_strbuf): Delete. (tui_file_flush): Delete. (tui_file::flush): New method. * tui/tui-file.h: Tweak intro comment. Include ui-file.h. (tui_fileopen, tui_sfileopen, tui_file_get_strbuf) (tui_file_adjust_strbuf): Delete declarations. (class tui_file): New class. * tui/tui-io.c (tui_initialize_io): Use tui_file. * tui/tui-regs.c (tui_restore_gdbout): Use delete. (tui_register_format): Use string_stream. * tui/tui-stack.c (tui_make_status_line): Use string_file. (tui_get_function_from_frame): Use string_file. * typeprint.c (type_to_string): Use string_file. * ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete. (null_stream): New global. (ui_file_delete): Delete. (ui_file::ui_file): New. (null_file_isatty): Delete. (ui_file::~ui_file): New. (null_file_rewind): Delete. (ui_file::printf): New. (null_file_put): Delete. (null_file_flush): Delete. (ui_file::putstr): New. (null_file_write): Delete. (ui_file::putstrn): New. (null_file_read): Delete. (ui_file::putc): New. (null_file_fputs): Delete. (null_file_write_async_safe): Delete. (ui_file::vprintf): New. (null_file_delete): Delete. (null_file::write): New. (null_file_fseek): Delete. (null_file::puts): New. (ui_file_data): Delete. (null_file::write_async_safe): New. (gdb_flush, ui_file_isatty): Adjust. (ui_file_put, ui_file_rewind): Delete. (ui_file_write): Adjust. (ui_file_write_for_put): Delete. (ui_file_write_async_safe, ui_file_read): Adjust. (ui_file_fseek): Delete. (fputs_unfiltered): Adjust. (set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind) (set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe) (set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek) (set_ui_file_data): Delete. (string_file::~string_file, string_file::write) (struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup) (do_ui_file_as_string, ui_file_as_string): Delete. (do_ui_file_obsavestring, ui_file_obsavestring): Delete. (struct mem_file): Delete. (mem_file_new): Delete. (stdio_file::stdio_file): New. (mem_file_delete): Delete. (stdio_file::stdio_file): New. (mem_fileopen): Delete. (stdio_file::~stdio_file): New. (mem_file_rewind): Delete. (stdio_file::set_stream): New. (mem_file_put): Delete. (stdio_file::open): New. (mem_file_write): Delete. (stdio_file_magic, struct stdio_file): Delete. (stdio_file_new, stdio_file_delete, stdio_file_flush): Delete. (stdio_file::flush): New. (stdio_file_read): Rename to ... (stdio_file::read): ... this. Adjust. (stdio_file_write): Rename to ... (stdio_file::write): ... this. Adjust. (stdio_file_write_async_safe): Rename to ... (stdio_file::write_async_safe) ... this. Adjust. (stdio_file_fputs): Rename to ... (stdio_file::puts) ... this. Adjust. (stdio_file_isatty): Delete. (stdio_file_fseek): Delete. (stdio_file::isatty): New. (stderr_file_write): Rename to ... (stderr_file::write) ... this. Adjust. (stderr_file_fputs): Rename to ... (stderr_file::puts) ... this. Adjust. (stderr_fileopen, stdio_fileopen, gdb_fopen): Delete. (stderr_file::stderr_file): New. (tee_file_magic): Delete. (struct tee_file): Delete. (tee_file::tee_file): New. (tee_file_new): Delete. (tee_file::~tee_file): New. (tee_file_delete): Delete. (tee_file_flush): Rename to ... (tee_file::flush): ... this. Adjust. (tee_file_write): Rename to ... (tee_file::write): ... this. Adjust. (tee_file::write_async_safe): New. (tee_file_fputs): Rename to ... (tee_file::puts): ... this. Adjust. (tee_file_isatty): Rename to ... (tee_file::isatty): ... this. Adjust. * ui-file.h (struct obstack, struct ui_file): Don't forward-declare. (ui_file_new, ui_file_flush_ftype, set_ui_file_flush) (ui_file_write_ftype) (set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs) (ui_file_write_async_safe_ftype, set_ui_file_write_async_safe) (ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype) (set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind) (ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put) (ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype) (set_ui_file_fseek): Delete. (ui_file_data, ui_file_delete, ui_file_rewind) (struct ui_file): New. (ui_file_up): New. (class null_file): New. (null_stream): Declare. (ui_file_write_for_put, ui_file_put): Delete. (ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring): Delete. (ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen) (gdb_fopen, tee_file_new): Delete. (struct string_file): New. (struct stdio_file): New. (stdio_file_up): New. (struct stderr_file): New. (class tee_file): New. * ui-out.c (ui_out::field_stream): Take a 'string_file &' instead of a 'ui_file *'. Adjust. * ui-out.h (class ui_out) <field_stream>: Likewise. * utils.c (do_ui_file_delete, make_cleanup_ui_file_delete) (null_stream): Delete. (error_stream): Take a 'string_file &' instead of a 'ui_file *'. Adjust. * utils.h (struct ui_file): Delete forward declaration.. (make_cleanup_ui_file_delete, null_stream): Delete declarations. (error_stream): Take a 'string_file &' instead of a 'ui_file *'. * varobj.c (varobj_value_get_print_value): Use string_file. * xtensa-tdep.c (xtensa_verify_config): Use string_file. * gdbarch.c: Regenerate.
2017-01-01update copyright year range in GDB filesJoel Brobecker
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.
2016-12-22Class-ify ui_outSimon Marchi
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-02Rename some trace functionsSimon Marchi
This patch renames a few trace-related functions, so that they adhere to the de facto standard of naming command entry point functions <command>_command. I like the ease of looking up a command entry point if they all follow that rule. An enum label "tstop_command" conflicts with a new function name, so I renamed this one trace_stop_command. In v2: - Rename functions of the trace_find family, as well as trace_dump_command. gdb/ChangeLog: * tracefile-tfile.c (tfile_write_status): Adjust to renames. * tracefile.c (trace_save_command): Rename to... (tsave_command): ...this. (_initialize_tracefile): Adjust to renames. * tracepoint.c (trace_actions_command): Rename to... (actions_command): ...this. (trace_start_command): Rename to... (tstart_command): ...this, and adjust to renames.. (trace_stop_command): Rename to... (tstop_command): ...this. (trace_status_command): Rename to... (tstatus_command): ...this, and adjust to renames. (trace_find_command): Rename to... (tfind_command): ...this. (trace_find_pc_command): Rename to... (tfind_pc_command): ...this. (trace_find_tracepoint_command): Rename to... (tfind_tracepoint_command): ...this. (trace_find_line_command): Rename to... (tfind_line_command): ...this. (trace_find_range_command): Rename to... (tfind_range_command): ...this. (trace_find_outside_command): Rename to... (tfind_outside_command): ...this. (trace_dump_command): Rename to... (tdump_command): ...this. (tfind_1): Adjust to renames. (trace_find_end_command): Rename to... (tfind_end_command): ...this, and adjust to renames.. (trace_status_mi): Adjust to renames. (parse_trace_status): Adjust to renames. (_initialize_tracepoint): Adjust to renames. * tracepoint.h (enum trace_stop_reason) <tstop_command>: Rename to... <trace_stop_command>: ...this.
2016-11-17gdb/tracepoint.c: Don't use printf_vmaPedro Alves
I noticed that bfd's printf_vma prints to stdout directly: bfd-in2.h:202:#define printf_vma(x) fprintf_vma(stdout,x) This is a bad idea in gdb, where we should use gdb_stdout/gdb_stderr/gdb_stdlog, etc., to support redirection. Eliminate uses of sprintf_vma too while at it. Tested on Fedora 23, w/ gdbserver. gdb/ChangeLog: 2016-11-17 Pedro Alves <palves@redhat.com> * tracepoint.c (collection_list::add_memrange): Add gdbarch parameter. Use paddress instead of printf_vma. Adjust recursive calls. (collection_list::stringify): Use paddress and phex_nz instead of sprintf_vma. Adjust add_memrange call. * tracepoint.h (collection_list::add_memrange): Add gdbarch parameter.
2016-11-09agent_expr_up: gdb::unique_ptr -> std::unique_ptrPedro Alves
Now that we require C++11, use std::unique_ptr directly. This allows simplifying collection_list a bit by placing unique pointers in the vector directly, making the vector own its elements. gdb/ChangeLog: 2016-11-09 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_eval_command_one): Use std::move instead of gdb::move. * ax.h (agent_expr_up): Use std::unique_ptr instead of gdb::unique_ptr. * breakpoint.c (parse_cond_to_aexpr): Use std::move instead of gdb::move. * tracepoint.c (collection_list::collect_symbol): Likewise. (collection_list::~collection_list): Delete. (encode_actions_1): Use std::move instead of gdb::move. (collection_list::add_aexpr): Use std::move instead of unique_ptr::release. * tracepoint.h (collection_list) <~collection_list>: Delete declaration. <m_aexprs>: Now a vector of agent_ptr_up.
2016-11-09gdb: Use vector::emplace_backPedro Alves
Now that we require C++11, we can use vector::emplace_back to construct elements in place instead of constructing and then copying. gdb/ChangeLog: 2016-11-09 Pedro Alves <palves@redhat.com> * main.c (struct cmdarg): Add constructor. (captured_main_1): Use vector::emplace_back. * tracepoint.c (collection_list::add_memrange): Likewise.
2016-11-08'struct agent_expr *' -> unique_ptr<agent_expr>Pedro Alves
This patch makes the gen_* functions return a unique_ptr instead of raw pointer: typedef gdb::unique_ptr<agent_expr> agent_expr_up; and then adjusts the codebase throughout to stop using make_cleanup_free_agent_expr. The cond_bytecode and cmd_bytecode fields of struct bp_location are owning pointers, so they're changed to be unique_ptr's instead of raw pointers. gdb/ChangeLog: 2016-11-08 Pedro Alves <palves@redhat.com> * ax-gdb.c (is_nontrivial_conversion): Use agent_expr_up. (gen_trace_for_var, gen_trace_for_expr, gen_eval_for_expr) (gen_trace_for_return_address, gen_printf): Use and return an agent_expr_up. Don't use make_cleanup_free_agent_expr. (agent_eval_command_one, maint_agent_printf_command): Use agent_expr_up. Don't use make_cleanup_free_agent_expr. * ax-gdb.h (gen_trace_for_expr, gen_trace_for_var) (gen_trace_for_return_address, gen_eval_for_expr, gen_printf): Use agent_expr_up. * ax-general.c (new_agent_expr): Rename to ... (agent_expr::agent_expr): ... this, and now a constructor. (free_agent_expr): Rename to ... (agent_expr::~agent_exp): ... this, and now a destructor. (do_free_agent_expr_cleanup, make_cleanup_free_agent_expr): Delete. * ax.h (struct agent_expr): Add ctor/dtor. (agent_expr_up): New typedef. (new_agent_expr, free_agent_expr, make_cleanup_free_agent_expr): Delete declarations. * breakpoint.c (parse_cond_to_aexpr): Use and return an agent_expr_up. Don't use make_cleanup_free_agent_expr. (build_target_condition_list): Adjust to use agent_expr_up. (parse_cmd_to_aexpr): Use and return an agent_expr_up. Don't use make_cleanup_free_agent_expr. (build_target_command_list): Adjust to use agent_expr_up. (force_breakpoint_reinsertion): Adjust to use agent_expr_up. (bp_location_dtor): Remove unnecessary free_agent_expr and xfree calls. * breakpoint.h (struct bp_target_info) <cond_bytecode, cmd_bytecode>: Now agent_expr_up's. * remote.c (remote_download_tracepoint): Adjust to use agent_expr_up and remove use of make_cleanup_free_agent_expr. * tracepoint.c (validate_actionline, collect_symbol): Adjust to use agent_expr_up and remove uses of make_cleanup_free_agent_expr. (collection_list::~collection_list): Call delete instead of free_agent_expr. (encode_actions_1): Adjust to use agent_expr_up and remove uses of make_cleanup_free_agent_expr. (add_aexpr): Change parameter type to agent_expr_up; Return a raw agent_expr pointer.
2016-11-08Clean up tracepoint.h/c:collection_listPedro Alves
Noticed we could do this while working on the expression_up change. The main goal here was getting rid of the encode_actions_and_make_cleanup / do_clear_collection_list cleanups. While at it, uncrustify the code: - Make collection_list a C++ class, with data members private (and thus renamed m_...). - Make related functions be member methods. - Use std::vector instead of an open coding a vector implementation. - Use std::sort instead of qsort. - Rename the "list" member of collection_list, which is an incredibly obfuscating name. - Rename a couple other things here and there for clarify. - Use "bool" more. gdb/ChangeLog: 2016-11-08 Pedro Alves <palves@redhat.com> * mi/mi-main.c (print_variable_or_computed): Constify 'expression' parameter. (mi_cmd_trace_frame_collected): Call encode_actions instead of encode_actions_and_make_cleanup. Adjust to use std::vector. * tracepoint.c (memrange_cmp): Delete. (memrange_comp): New. (memrange_sortmerge): Take a memrange vector as parameter instead of a collection_list. Use std::sort instead of qsort. (add_register): Now a method of collection_list. Adjust to m_ prefix of data fields. (add_memrange): Now a method of collection_list. Adjust to m_ prefix of data fields. Adjust to use std::vector. (collect_symbol): Now a method of collection_list. Adjust to m_ prefix of data fields. (do_collect_symbol): Adjust. Call add_wholly_collected instead of accessing the vector directly. (collection_list::add_wholly_collected): New. (add_local_symbols): Now a method of collection_list. (add_static_trace_data): Now a method of collection_list. Adjust to use bool. (clear_collection_list, do_clear_collection_list): Delete. (init_collection_list): Delete. (collection_list::collection_list): New. (collection_list::~collection_list): New. (stringify_collection_list): Rename to ... (collection_list::stringify): ... this and adjust to being a method of collection_list. Adjust to use of std::vector. (append_exp): Now a method of collection_list. Use ui_file_as_string. Adjust to std::vector. (collection_list::finish): New. (encode_actions_1): Adjust. (encode_actions_and_make_cleanup): Rename to ... (encode_actions)... this. No longer returns a cleanup. No longer call init_collection_list nor install do_clear_collection_list cleanups. Call collection_list::finish instead of memrange_sortmerge directly. (encode_actions_rsp): Adjust to call encode_actions instead of encode_actions_and_make_cleanup. Adjust to method renames. (add_aexpr): Now a method of collection_list. * tracepoint.h: Include <vector> and <string>. (struct memrange): Add constructors. (struct collection_list): Now a class. (class collection_list) <collection_list, ~collection_list, add_wholly_collected, append_exp, add_aexpr, add_register, add_memrange, collect_symbol, add_local_symbols, add_static_trace_data, finish, stringify, wholly_collected, and computed>: New methods. <regs_mask>: Rename to ... <m_regs_mask>: ... this. <listsize, next_memrange, list>: Delete fields. <m_memranges>: New field. <aexpr_listsize, next_aexpr_elt, aexpr_list>: Delete fields. <m_aexprs>: New field. <strace_data>: Rename to ... <m_strace_data>: ... this. Now a bool. <wholly_collected>: Rename to ... <m_wholly_collected>: ... this. Now a std::vector<std::string>. <computed>: Rename to ... <m_computed>: ... this. Now a std::vector<std::string>. (encode_actions_and_make_cleanup): Delete declaration. (encode_actions): New declaration.
2016-11-08'struct expression *' -> gdb::unique_xmalloc_ptr<expression>Pedro Alves
This patch makes parse_expression and friends return a unique_ptr instead of raw pointer [1]: typedef gdb::unique_malloc_ptr<expression> expression_up; and then adjusts the codebase throughout to stop using cleanups to manage lifetime of expression pointers. Whenever I found a structure owning an expression pointer, I made it store a unique_ptr instead of a raw pointer, which then requires using new/delete of the holding structure, instead of XNEW/xfree. [1] - I'd like to set the rule that types named with an "_up" suffix are unique_ptr typedefs. Note I used gdb::unique_xmalloc_ptr instead of gdb::unique_ptr, simply because we still use xmalloc instead of new to allocate expression objects. Once that's changed, all we need to do is change the expression_up typedef and the smart pointer will then call delete instead of xfree. gdb/ChangeLog: 2016-11-08 Pedro Alves <palves@redhat.com> * ada-lang.c (ada_read_renaming_var_value): Use expression_up. (struct ada_catchpoint_location) <excep_cond_expr>: Now an expression_up. (ada_catchpoint_location_dtor): Reset excep_cond_expr instead of using xfree. (create_excep_cond_exprs): Use expression_up and gdb::move. (allocate_location_exception): Use new instead of XNEW. (should_stop_exception): Likewise. Adjust to use expression_up. (create_ada_exception_catchpoint): Use new instead of XNEW. * ax-gdb.c (agent_eval_command_one): Use expression_up instead of cleanups. (maint_agent_printf_command): Use expression_up. * break-catch-sig.c (create_signal_catchpoint): Use new instead of XNEW. * break-catch-syscall.c (create_syscall_event_catchpoint): Likewise. * break-catch-throw.c (handle_gnu_v3_exceptions): Use new instead of XCNEW. Use gdb::unique_ptr instead of cleanups. * breakpoint.c (set_breakpoint_condition, update_watchpoint) (parse_cmd_to_aexpr, watchpoint_check) (bpstat_check_breakpoint_conditions, watchpoint_locations_match): Adjust to use expression_up. (init_bp_location): Adjust. (free_bp_location): Use delete instead of xfree. (set_raw_breakpoint_without_location, set_raw_breakpoint) (add_solib_catchpoint, create_fork_vfork_event_catchpoint) (new_single_step_breakpoint, create_breakpoint_sal): Use new instead of XNEW. (find_condition_and_thread): Adjust to use expression_up. (create_breakpoint): Use new instead of XNEW. (dtor_watchpoint): Don't xfree expression pointers, they're unique_ptr's now. (insert_watchpoint, remove_watchpoint): Adjust. (watch_command_1): Use expression_up. Use new instead of XCNEW. (catch_exec_command_1): Use new instead of XNEW. (bp_location_dtor): Don't xfree expression pointers, they're unique_ptr's now. (base_breakpoint_allocate_location) (strace_marker_create_breakpoints_sal): Use new instead of XNEW. (delete_breakpoint): Use delete instead of xfree. * breakpoint.h (struct bp_location) <cond>: Now an unique_ptr<expression> instead of a raw pointer. (struct watchpoint) <exp, cond_exp>: Likewise. * cli/cli-script.c (execute_control_command): Use expression_up instead of cleanups. * dtrace-probe.c (dtrace_process_dof_probe): Use expression_up. * eval.c (parse_and_eval_address, parse_and_eval_long) (parse_and_eval, parse_to_comma_and_eval, parse_and_eval_type): Use expression_up instead of cleanups. * expression.h (expression_up): New typedef. (parse_expression, parse_expression_with_language, parse_exp_1): Change return type to expression_up. * mi/mi-main.c (mi_cmd_data_evaluate_expression) (print_variable_or_computed): Use expression_up. * objc-lang.c (print_object_command): Use expression_up instead of cleanups. * parse.c (parse_exp_1, parse_exp_in_context) (parse_exp_in_context_1, parse_expression) (parse_expression_with_language): Return an expression_up instead of a raw pointer. (parse_expression_for_completion): Use expression_up. * printcmd.c (struct display) <exp>: Now an expression_up instead of a raw pointer. (print_command_1, output_command_const, set_command, x_command): Use expression_up instead of cleanups. (display_command): Likewise. Use new instead of XNEW. (free_display): Use delete instead of xfree. (do_one_display): Adjust to use expression_up. * remote.c (remote_download_tracepoint): Likewise. * stack.c (return_command): Likewise. * tracepoint.c (validate_actionline, encode_actions_1): Use expression_up instead of cleanups. * typeprint.c (whatis_exp, maintenance_print_type): Likewise. * value.c (init_if_undefined_command): Likewise. * varobj.c (struct varobj_root) <exp>: Now an expression_up instead of a raw pointer. (varobj_create): Adjust. (varobj_set_value): Use an expression_up instead of cleanups. (new_root_variable): Use new instead of XNEW. (free_variable): Use delete instead of xfree. (value_of_root_1): Use std::swap.
2016-10-12Remove unnecessary null_cleanupTom Tromey
This patch removes an unnecessary null_cleanup. 2016-10-12 Tom Tromey <tom@tromey.com> * tracepoint.c (trace_dump_command): Remove unnecessary null_cleanup.
2016-09-16gdb: Use std::min and std::max throughoutPedro Alves
Otherwise including <string> or some other C++ header is broken. E.g.: In file included from /opt/gcc/include/c++/7.0.0/bits/char_traits.h:39:0, from /opt/gcc/include/c++/7.0.0/string:40, from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/infrun.c:68: /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2 min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2 max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ In file included from .../src/gdb/infrun.c:21:0: To the best of my grepping abilities, I believe I adjusted all min/max calls. gdb/ChangeLog: 2016-09-16 Pedro Alves <palves@redhat.com> * defs.h (min, max): Delete. * aarch64-tdep.c: Include <algorithm> and use std::min and std::max throughout. * aarch64-tdep.c: Likewise. * alpha-tdep.c: Likewise. * amd64-tdep.c: Likewise. * amd64-windows-tdep.c: Likewise. * arm-tdep.c: Likewise. * avr-tdep.c: Likewise. * breakpoint.c: Likewise. * btrace.c: Likewise. * ctf.c: Likewise. * disasm.c: Likewise. * doublest.c: Likewise. * dwarf2loc.c: Likewise. * dwarf2read.c: Likewise. * environ.c: Likewise. * exec.c: Likewise. * f-exp.y: Likewise. * findcmd.c: Likewise. * ft32-tdep.c: Likewise. * gcore.c: Likewise. * hppa-tdep.c: Likewise. * i386-darwin-tdep.c: Likewise. * i386-tdep.c: Likewise. * linux-thread-db.c: Likewise. * lm32-tdep.c: Likewise. * m32r-tdep.c: Likewise. * m88k-tdep.c: Likewise. * memrange.c: Likewise. * minidebug.c: Likewise. * mips-tdep.c: Likewise. * moxie-tdep.c: Likewise. * nds32-tdep.c: Likewise. * nios2-tdep.c: Likewise. * nto-procfs.c: Likewise. * parse.c: Likewise. * ppc-sysv-tdep.c: Likewise. * probe.c: Likewise. * record-btrace.c: Likewise. * remote.c: Likewise. * rs6000-tdep.c: Likewise. * rx-tdep.c: Likewise. * s390-linux-nat.c: Likewise. * s390-linux-tdep.c: Likewise. * ser-tcp.c: Likewise. * sh-tdep.c: Likewise. * sh64-tdep.c: Likewise. * source.c: Likewise. * sparc-tdep.c: Likewise. * symfile.c: Likewise. * target-memory.c: Likewise. * target.c: Likewise. * tic6x-tdep.c: Likewise. * tilegx-tdep.c: Likewise. * tracefile-tfile.c: Likewise. * tracepoint.c: Likewise. * valprint.c: Likewise. * value.c: Likewise. * xtensa-tdep.c: Likewise. * cli/cli-cmds.c: Likewise. * compile/compile-object-load.c: Likewise.
2016-05-07remove trivialy unused variablesTrevor Saunders
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-02-11Use the target architecture when encoding tracepoint actionsAntoine Tremblay
This patch uses the target architecture rather then the objfile architecture when encoding tracepoint actions. The target architecture may contain additional registers. E.g. ARM VFP registers. This information is needed to allow their collection. Since we can never know whether the registers numbers in the target match the binary's we have to use tdesc here. One note about combined debuggers / multi-inferior from Pedro Alves: In the combined debugger case taking Cell as the practical example that gdb supports currently: In that case, the main target_gdbarch() will be powerpc, but you may have set a tracepoint on _spu_ code, which has a different gdbarch. so for that case, target_gdbarch would be wrong. I think that in that case, we'd need to find __the_ target/tdesc gdbarch that is (bfd) compatible with the objfile's gdbarch. I think cell/spu gdbserver doesn't support tracepoints, so we can ignore this for now. The multi-inferior/process case is somewhat related, but its simpler. each inferior has its own gdbarch. That is, target_gdbarch depends on the current inferior selected. In fact, that just returns inferior->gdbarch nowaways. No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * tracepoint.c (encode_actions_1): Use target_gdbarch () rather than loc->gdbarch.
2016-01-19Limit breakpoint re-set to the current program spacePedro Alves
Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker
gdb/ChangeLog: Update year range in copyright notice of all files.