binutils-gdb/gdb/ChangeLog

5961 lines
226 KiB
Plaintext
Raw Normal View History

2018-05-02 Pedro Alves <palves@redhat.com>
* make-target-delegates (scan_target_h): Don't trim lines here.
Replace sequences of tabs and/or whitespace with a single
whitespace.
(top level, parsing methods): Trim each line before processing it
here.
Convert struct target_ops to C++ I.e., use C++ virtual methods and inheritance instead of tables of function pointers. Unfortunately, there's no way to do a smooth transition. ALL native targets in the tree must be converted at the same time. I've tested all I could with cross compilers and with help from GCC compile farm, but naturally I haven't been able to test many of the ports. Still, I made a best effort to port everything over, and while I expect some build problems due to typos and such, which should be trivial to fix, I don't expect any design problems. * Implementation notes: - The flattened current_target is gone. References to current_target or current_target.beneath are replaced with references to target_stack (the top of the stack) directly. - To keep "set debug target" working, this adds a new debug_stratum layer that sits on top of the stack, prints the debug, and delegates to the target beneath. In addition, this makes the shortname and longname properties of target_ops be virtual methods instead of data fields, and makes the debug target defer those to the target beneath. This is so that debug code sprinkled around that does "if (debugtarget) ..." can transparently print the name of the target beneath. A patch later in the series actually splits out the shortname/longname methods to a separate structure, but I preferred to keep that chance separate as it is associated with changing a bit the design of how targets are registered and open. - Since you can't check whether a C++ virtual method is overridden, the old method of checking whether a target_ops implements a method by comparing the function pointer must be replaced with something else. Some cases are fixed by adding a parallel "can_do_foo" target_ops methods. E.g.,: + for (t = target_stack; t != NULL; t = t->beneath) { - if (t->to_create_inferior != NULL) + if (t->can_create_inferior ()) break; } Others are fixed by changing void return type to bool or int return type, and have the default implementation return false or -1, to indicate lack of support. - make-target-delegates was adjusted to generate C++ classes and methods. It needed tweaks to grok "virtual" in front of the target method name, and for the fact that methods are no longer function pointers. (In particular, the current code parsing the return type was simple because it could simply parse up until the '(' in '(*to_foo)'. It now generates a couple C++ classes that inherit target_ops: dummy_target and debug_target. Since we need to generate the class declarations as well, i.e., we need to emit methods twice, we now generate the code in two passes. - The core_target global is renamed to avoid conflict with the "core_target" class. - ctf/tfile targets init_tracefile_ops is replaced by a base class that is inherited by both ctf and tfile. - bsd-uthread The bsd_uthread_ops_hack hack is gone. It's not needed because nothing was extending a target created by bsd_uthread_target. - remote/extended-remote targets This is a first pass, just enough to C++ify target_ops. A later pass will convert more free functions to methods, and make remote_state be truly per remote instance, allowing multiple simultaneous instances of remote targets. - inf-child/"native" is converted to an actual base class (inf_child_target), that is inherited by all native targets. - GNU/Linux The old weird double-target linux_ops mechanism in linux-nat.c, is gone, replaced by adding a few virtual methods to linux-nat.h's target_ops, called low_XXX, that the concrete linux-nat implementations override. Sort of like gdbserver's linux_target_ops, but simpler, for requiring only one target_ops-like hierarchy, which spares implementing the same method twice when we need to forward the method to a low implementation. The low target simply reimplements the target_ops method directly in that case. There are a few remaining linux-nat.c hooks that would be better converted to low_ methods like above too. E.g.: linux_nat_set_new_thread (t, x86_linux_new_thread); linux_nat_set_new_fork (t, x86_linux_new_fork); linux_nat_set_forget_process That'll be done in a follow up patch. - We can no longer use functions like x86_use_watchpoints to install custom methods on an arbitrary base target. The patch replaces instances of such a pattern with template mixins. For example memory_breakpoint_target defined in target.h, or x86_nat_target in x86-nat.h. - linux_trad_target, MIPS and Alpha GNU/Linux The code in the new linux-nat-trad.h/c files which was split off of inf-ptrace.h/c recently, is converted to a C++ base class, and used by the MIPS and Alpha GNU/Linux ports. - BSD targets The $architecture x NetBSD/OpenBSD/FreeBSD support matrix complicates things a bit. There's common BSD target code, and there's common architecture-specific code shared between the different BSDs. Currently, all that is stiched together to form a final target, via the i386bsd_target, x86bsd_target, fbsd_nat_add_target functions etc. This introduces new fbsd_nat_target, obsd_nat_target and nbsd_nat_target classes that serve as base/prototype target for the corresponding BSD variant. And introduces generic i386/AMD64 BSD targets, to be used as template mixin to build a final target. Similarly, a generic SPARC target is added, used by both BSD and Linux ports. - bsd_kvm_add_target, BSD libkvm target I considered making bsd_kvm_supply_pcb a virtual method, and then have each port inherit bsd_kvm_target and override that method, but that was resulting in lots of unjustified churn, so I left the function pointer mechanism alone. gdb/ChangeLog: 2018-05-02 Pedro Alves <palves@redhat.com> John Baldwin <jhb@freebsd.org> * target.h (enum strata) <debug_stratum>: New. (struct target_ops) <all delegation methods>: Replace by C++ virtual methods, and drop "to_" prefix. All references updated throughout. <to_shortname, to_longname, to_doc, to_data, to_have_steppable_watchpoint, to_have_continuable_watchpoint, to_has_thread_control, to_attach_no_wait>: Delete, replaced by virtual methods. All references updated throughout. <can_attach, supports_terminal_ours, can_create_inferior, get_thread_control_capabilities, attach_no_wait>: New virtual methods. <insert_breakpoint, remove_breakpoint>: Now TARGET_DEFAULT_NORETURN methods. <info_proc>: Now returns bool. <to_magic>: Delete. (OPS_MAGIC): Delete. (current_target): Delete. All references replaced by references to ... (target_stack): ... this. New. (target_shortname, target_longname): Adjust. (target_can_run): Now a function declaration. (default_child_has_all_memory, default_child_has_memory) (default_child_has_stack, default_child_has_registers) (default_child_has_execution): Remove target_ops parameter. (complete_target_initialization): Delete. (memory_breakpoint_target): New template class. (test_target_ops): Refactor as a C++ class with virtual methods. * make-target-delegates (NAME_PART): Tighten. (POINTER_PART, CP_SYMBOL): New. (SIMPLE_RETURN_PART): Reimplement. (VEC_RETURN_PART): Expect less. (RETURN_PART, VIRTUAL_PART): New. (METHOD): Adjust to C++ virtual methods. (scan_target_h): Remove reference to C99. (dname): Output "target_ops::" prefix. (write_function_header): Adjust to output a C++ class method. (write_declaration): New. (write_delegator): Adjust to output a C++ class method. (tdname): Output "dummy_target::" prefix. (write_tdefault, write_debugmethod): Adjust to output a C++ class method. (tdefault_names, debug_names): Delete. (return_types, tdefaults, styles, argtypes_array): New. (top level): All methods are delegators. (print_class): New. (top level): Print dummy_target and debug_target classes. * target-delegates.c: Regenerate. * target-debug.h (target_debug_print_enum_info_proc_what) (target_debug_print_thread_control_capabilities) (target_debug_print_thread_info_p): New. * target.c (dummy_target): Delete. (the_dummy_target, the_debug_target): New. (target_stack): Now extern. (set_targetdebug): Push/unpush debug target. (default_child_has_all_memory, default_child_has_memory) (default_child_has_stack, default_child_has_registers) (default_child_has_execution): Remove target_ops parameter. (complete_target_initialization): Delete. (add_target_with_completer): No longer call complete_target_initialization. (target_supports_terminal_ours): Use regular delegation. (update_current_target): Delete. (push_target): No longer check magic number. Don't call update_current_target. (unpush_target): Don't call update_current_target. (target_is_pushed): No longer check magic number. (target_require_runnable): Skip for all stratums over process_stratum. (target_ops::info_proc): New. (target_info_proc): Use find_target_at and find_default_run_target. (target_supports_disable_randomization): Use regular delegation. (target_get_osdata): Use find_target_at. (target_ops::open, target_ops::close, target_ops::can_attach) (target_ops::attach, target_ops::can_create_inferior) (target_ops::create_inferior, target_ops::can_run) (target_can_run): New. (default_fileio_target): Use regular delegation. (target_ops::fileio_open, target_ops::fileio_pwrite) (target_ops::fileio_pread, target_ops::fileio_fstat) (target_ops::fileio_close, target_ops::fileio_unlink) (target_ops::fileio_readlink): New. (target_fileio_open_1, target_fileio_unlink) (target_fileio_readlink): Always call the target method. Handle FILEIO_ENOSYS. (return_zero, return_zero_has_execution): Delete. (init_dummy_target): Delete. (dummy_target::dummy_target, dummy_target::shortname) (dummy_target::longname, dummy_target::doc) (debug_target::debug_target, debug_target::shortname) (debug_target::longname, debug_target::doc): New. (target_supports_delete_record): Use regular delegation. (setup_target_debug): Delete. (maintenance_print_target_stack): Skip debug_stratum. (initialize_targets): Instantiate the_dummy_target and the_debug_target. * auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to use target_stack. (target_auxv_search, fprint_target_auxv): Adjust. (info_auxv_command): Adjust to use target_stack. * auxv.h (target_auxv_parse): Remove 'ops' parameter. * exceptions.c (print_flush): Handle a NULL target_stack. * regcache.c (target_ops_no_register): Refactor as class with virtual methods. * exec.c (exec_target): New class. (exec_ops): Now an exec_target. (exec_open, exec_close_1, exec_get_section_table) (exec_xfer_partial, exec_files_info, exec_has_memory) (exec_make_note_section): Refactor as exec_target methods. (exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops): Delete. (exec_target::find_memory_regions): New. (_initialize_exec): Don't call init_exec_ops. * gdbcore.h (exec_file_clear): Delete. * corefile.c (core_target): Delete. (core_file_command): Adjust. * corelow.c (core_target): New class. (the_core_target): New. (core_close): Remove target_ops parameter. (core_close_cleanup): Adjust. (core_target::close): New. (core_open, core_detach, get_core_registers, core_files_info) (core_xfer_partial, core_thread_alive, core_read_description) (core_pid_to_str, core_thread_name, core_has_memory) (core_has_stack, core_has_registers, core_info_proc): Rework as core_target methods. (ignore, core_remove_breakpoint, init_core_ops): Delete. (_initialize_corelow): Initialize the_core_target. * gdbcore.h (core_target): Delete. (the_core_target): New. * ctf.c: (ctf_target): New class. (ctf_ops): Now a ctf_target. (ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers) (ctf_xfer_partial, ctf_get_trace_state_variable_value) (ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target methods. (init_ctf_ops): Delete. (_initialize_ctf): Don't call it. * tracefile-tfile.c (tfile_target): New class. (tfile_ops): Now a tfile_target. (tfile_open, tfile_close, tfile_files_info) (tfile_get_tracepoint_status, tfile_trace_find) (tfile_fetch_registers, tfile_xfer_partial) (tfile_get_trace_state_variable_value, tfile_traceframe_info): Refactor as tfile_target methods. (tfile_xfer_partial_features): Remove target_ops parameter. (init_tfile_ops): Delete. (_initialize_tracefile_tfile): Don't call it. * tracefile.c (tracefile_has_all_memory, tracefile_has_memory) (tracefile_has_stack, tracefile_has_registers) (tracefile_thread_alive, tracefile_get_trace_status): Refactor as tracefile_target methods. (init_tracefile_ops): Delete. (tracefile_target::tracefile_target): New. * tracefile.h: Include "target.h". (tracefile_target): New class. (init_tracefile_ops): Delete. * spu-multiarch.c (spu_multiarch_target): New class. (spu_ops): Now a spu_multiarch_target. (spu_thread_architecture, spu_region_ok_for_hw_watchpoint) (spu_fetch_registers, spu_store_registers, spu_xfer_partial) (spu_search_memory, spu_mourn_inferior): Refactor as spu_multiarch_target methods. (init_spu_ops): Delete. (_initialize_spu_multiarch): Remove references to init_spu_ops, complete_target_initialization. * ravenscar-thread.c (ravenscar_thread_target): New class. (ravenscar_ops): Now a ravenscar_thread_target. (ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list) (ravenscar_thread_alive, ravenscar_pid_to_str) (ravenscar_fetch_registers, ravenscar_store_registers) (ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint) (ravenscar_stopped_by_hw_breakpoint) (ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address) (ravenscar_mourn_inferior, ravenscar_core_of_thread) (ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target methods. (init_ravenscar_thread_ops): Delete. (_initialize_ravenscar): Remove references to init_ravenscar_thread_ops and complete_target_initialization. * bsd-uthread.c (bsd_uthread_ops_hack): Delete. (bsd_uthread_target): New class. (bsd_uthread_ops): Now a bsd_uthread_target. (bsd_uthread_activate): Adjust to refer to bsd_uthread_ops. (bsd_uthread_close, bsd_uthread_mourn_inferior) (bsd_uthread_fetch_registers, bsd_uthread_store_registers) (bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive) (bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info) (bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods. (bsd_uthread_target): Delete function. (_initialize_bsd_uthread): Remove reference to complete_target_initialization. * bfd-target.c (target_bfd_data): Delete. Fields folded into ... (target_bfd): ... this new class. (target_bfd_xfer_partial, target_bfd_get_section_table) (target_bfd_close): Refactor as target_bfd methods. (target_bfd::~target_bfd): New. (target_bfd_reopen): Adjust. (target_bfd::close): New. * record-btrace.c (record_btrace_target): New class. (record_btrace_ops): Now a record_btrace_target. (record_btrace_open, record_btrace_stop_recording) (record_btrace_disconnect, record_btrace_close) (record_btrace_async, record_btrace_info) (record_btrace_insn_history, record_btrace_insn_history_range) (record_btrace_insn_history_from, record_btrace_call_history) (record_btrace_call_history_range) (record_btrace_call_history_from, record_btrace_record_method) (record_btrace_is_replaying, record_btrace_will_replay) (record_btrace_xfer_partial, record_btrace_insert_breakpoint) (record_btrace_remove_breakpoint, record_btrace_fetch_registers) (record_btrace_store_registers, record_btrace_prepare_to_store) (record_btrace_to_get_unwinder) (record_btrace_to_get_tailcall_unwinder, record_btrace_resume) (record_btrace_commit_resume, record_btrace_wait) (record_btrace_stop, record_btrace_can_execute_reverse) (record_btrace_stopped_by_sw_breakpoint) (record_btrace_supports_stopped_by_sw_breakpoint) (record_btrace_stopped_by_hw_breakpoint) (record_btrace_supports_stopped_by_hw_breakpoint) (record_btrace_update_thread_list, record_btrace_thread_alive) (record_btrace_goto_begin, record_btrace_goto_end) (record_btrace_goto, record_btrace_stop_replaying_all) (record_btrace_execution_direction) (record_btrace_prepare_to_generate_core) (record_btrace_done_generating_core): Refactor as record_btrace_target methods. (init_record_btrace_ops): Delete. (_initialize_record_btrace): Remove reference to init_record_btrace_ops. * record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to the execution_direction global. (record_full_base_target, record_full_target) (record_full_core_target): New classes. (record_full_ops): Now a record_full_target. (record_full_core_ops): Now a record_full_core_target. (record_full_target::detach, record_full_target::disconnect) (record_full_core_target::disconnect) (record_full_target::mourn_inferior, record_full_target::kill): New. (record_full_open, record_full_close, record_full_async): Refactor as methods of the record_full_base_target class. (record_full_resume, record_full_commit_resume): Refactor as methods of the record_full_target class. (record_full_wait, record_full_stopped_by_watchpoint) (record_full_stopped_data_address) (record_full_stopped_by_sw_breakpoint) (record_full_supports_stopped_by_sw_breakpoint) (record_full_stopped_by_hw_breakpoint) (record_full_supports_stopped_by_hw_breakpoint): Refactor as methods of the record_full_base_target class. (record_full_store_registers, record_full_xfer_partial) (record_full_insert_breakpoint, record_full_remove_breakpoint): Refactor as methods of the record_full_target class. (record_full_can_execute_reverse, record_full_get_bookmark) (record_full_goto_bookmark, record_full_execution_direction) (record_full_record_method, record_full_info, record_full_delete) (record_full_is_replaying, record_full_will_replay) (record_full_goto_begin, record_full_goto_end, record_full_goto) (record_full_stop_replaying): Refactor as methods of the record_full_base_target class. (record_full_core_resume, record_full_core_kill) (record_full_core_fetch_registers) (record_full_core_prepare_to_store) (record_full_core_store_registers, record_full_core_xfer_partial) (record_full_core_insert_breakpoint) (record_full_core_remove_breakpoint) (record_full_core_has_execution): Refactor as methods of the record_full_core_target class. (record_full_base_target::supports_delete_record): New. (init_record_full_ops): Delete. (init_record_full_core_ops): Delete. (record_full_save): Refactor as method of the record_full_base_target class. (_initialize_record_full): Remove references to init_record_full_ops and init_record_full_core_ops. * remote.c (remote_target, extended_remote_target): New classes. (remote_ops): Now a remote_target. (extended_remote_ops): Now an extended_remote_target. (remote_insert_fork_catchpoint, remote_remove_fork_catchpoint) (remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint) (remote_insert_exec_catchpoint, remote_remove_exec_catchpoint) (remote_pass_signals, remote_set_syscall_catchpoint) (remote_program_signals, ) (remote_thread_always_alive): Remove target_ops parameter. (remote_thread_alive, remote_thread_name) (remote_update_thread_list, remote_threads_extra_info) (remote_static_tracepoint_marker_at) (remote_static_tracepoint_markers_by_strid) (remote_get_ada_task_ptid, remote_close, remote_start_remote) (remote_open): Refactor as methods of remote_target. (extended_remote_open, extended_remote_detach) (extended_remote_attach, extended_remote_post_attach): (extended_remote_supports_disable_randomization) (extended_remote_create_inferior): : Refactor as method of extended_remote_target. (remote_set_permissions, remote_open_1, remote_detach) (remote_follow_fork, remote_follow_exec, remote_disconnect) (remote_resume, remote_commit_resume, remote_stop) (remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior) (remote_terminal_ours, remote_wait, remote_fetch_registers) (remote_prepare_to_store, remote_store_registers) (remote_flash_erase, remote_flash_done, remote_files_info) (remote_kill, remote_mourn, remote_insert_breakpoint) (remote_remove_breakpoint, remote_insert_watchpoint) (remote_watchpoint_addr_within_range) (remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint) (remote_check_watch_resources, remote_stopped_by_sw_breakpoint) (remote_supports_stopped_by_sw_breakpoint) (remote_stopped_by_hw_breakpoint) (remote_supports_stopped_by_hw_breakpoint) (remote_stopped_by_watchpoint, remote_stopped_data_address) (remote_insert_hw_breakpoint, remote_remove_hw_breakpoint) (remote_verify_memory): Refactor as methods of remote_target. (remote_write_qxfer, remote_read_qxfer): Remove target_ops parameter. (remote_xfer_partial, remote_get_memory_xfer_limit) (remote_search_memory, remote_rcmd, remote_memory_map) (remote_pid_to_str, remote_get_thread_local_address) (remote_get_tib_address, remote_read_description): Refactor as methods of remote_target. (remote_target::fileio_open, remote_target::fileio_pwrite) (remote_target::fileio_pread, remote_target::fileio_close): New. (remote_hostio_readlink, remote_hostio_fstat) (remote_filesystem_is_local, remote_can_execute_reverse) (remote_supports_non_stop, remote_supports_disable_randomization) (remote_supports_multi_process, remote_supports_cond_breakpoints) (remote_supports_enable_disable_tracepoint) (remote_supports_string_tracing) (remote_can_run_breakpoint_commands, remote_trace_init) (remote_download_tracepoint, remote_can_download_tracepoint) (remote_download_trace_state_variable, remote_enable_tracepoint) (remote_disable_tracepoint, remote_trace_set_readonly_regions) (remote_trace_start, remote_get_trace_status) (remote_get_tracepoint_status, remote_trace_stop) (remote_trace_find, remote_get_trace_state_variable_value) (remote_save_trace_data, remote_get_raw_trace_data) (remote_set_disconnected_tracing, remote_core_of_thread) (remote_set_circular_trace_buffer, remote_traceframe_info) (remote_get_min_fast_tracepoint_insn_len) (remote_set_trace_buffer_size, remote_set_trace_notes) (remote_use_agent, remote_can_use_agent, remote_enable_btrace) (remote_disable_btrace, remote_teardown_btrace) (remote_read_btrace, remote_btrace_conf) (remote_augmented_libraries_svr4_read, remote_load) (remote_pid_to_exec_file, remote_can_do_single_step) (remote_execution_direction, remote_thread_handle_to_thread_info): Refactor as methods of remote_target. (init_remote_ops, init_extended_remote_ops): Delete. (remote_can_async_p, remote_is_async_p, remote_async) (remote_thread_events, remote_upload_tracepoints) (remote_upload_trace_state_variables): Refactor as methods of remote_target. (_initialize_remote): Remove references to init_remote_ops and init_extended_remote_ops. * remote-sim.c (gdbsim_target): New class. (gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill) (gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close) (gdbsim_detach, gdbsim_resume, gdbsim_interrupt) (gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial) (gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive) (gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory): Refactor as methods of gdbsim_target. (gdbsim_ops): Now a gdbsim_target. (init_gdbsim_ops): Delete. (gdbsim_cntrl_c): Adjust. (_initialize_remote_sim): Remove reference to init_gdbsim_ops. * amd64-linux-nat.c (amd64_linux_nat_target): New class. (the_amd64_linux_nat_target): New. (amd64_linux_fetch_inferior_registers) (amd64_linux_store_inferior_registers): Refactor as methods of amd64_linux_nat_target. (_initialize_amd64_linux_nat): Adjust. Set linux_target. * i386-linux-nat.c: Don't include "linux-nat.h". (i386_linux_nat_target): New class. (the_i386_linux_nat_target): New. (i386_linux_fetch_inferior_registers) (i386_linux_store_inferior_registers, i386_linux_resume): Refactor as methods of i386_linux_nat_target. (_initialize_i386_linux_nat): Adjust. Set linux_target. * inf-child.c (inf_child_ops): Delete. (inf_child_fetch_inferior_registers) (inf_child_store_inferior_registers): Delete. (inf_child_post_attach, inf_child_prepare_to_store): Refactor as methods of inf_child_target. (inf_child_target::supports_terminal_ours) (inf_child_target::terminal_init) (inf_child_target::terminal_inferior) (inf_child_target::terminal_ours_for_output) (inf_child_target::terminal_ours, inf_child_target::interrupt) (inf_child_target::pass_ctrlc, inf_child_target::terminal_info): New. (inf_child_open, inf_child_disconnect, inf_child_close) (inf_child_mourn_inferior, inf_child_maybe_unpush_target) (inf_child_post_startup_inferior, inf_child_can_run) (inf_child_pid_to_exec_file): Refactor as methods of inf_child_target. (inf_child_follow_fork): Delete. (inf_child_target::can_create_inferior) (inf_child_target::can_attach): New. (inf_child_target::has_all_memory, inf_child_target::has_memory) (inf_child_target::has_stack, inf_child_target::has_registers) (inf_child_target::has_execution): New. (inf_child_fileio_open, inf_child_fileio_pwrite) (inf_child_fileio_pread, inf_child_fileio_fstat) (inf_child_fileio_close, inf_child_fileio_unlink) (inf_child_fileio_readlink, inf_child_use_agent) (inf_child_can_use_agent): Refactor as methods of inf_child_target. (return_zero, inf_child_target): Delete. (inf_child_target::inf_child_target): New. * inf-child.h: Include "target.h". (inf_child_target): Delete function prototype. (inf_child_target): New class. (inf_child_open_target, inf_child_mourn_inferior) (inf_child_maybe_unpush_target): Delete. * inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New. (inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint) (inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior) (inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior) (inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach) (inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume) (inf_ptrace_wait, inf_ptrace_xfer_partial) (inf_ptrace_thread_alive, inf_ptrace_files_info) (inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as methods of inf_ptrace_target. (inf_ptrace_target): Delete function. * inf-ptrace.h: Include "inf-child.h". (inf_ptrace_target): Delete function declaration. (inf_ptrace_target): New class. (inf_ptrace_trad_target, inf_ptrace_detach_success): Delete. * linux-nat.c (linux_target): New. (linux_ops, linux_ops_saved, super_xfer_partial): Delete. (linux_nat_target::~linux_nat_target): New. (linux_child_post_attach, linux_child_post_startup_inferior) (linux_child_follow_fork, linux_child_insert_fork_catchpoint) (linux_child_remove_fork_catchpoint) (linux_child_insert_vfork_catchpoint) (linux_child_remove_vfork_catchpoint) (linux_child_insert_exec_catchpoint) (linux_child_remove_exec_catchpoint) (linux_child_set_syscall_catchpoint, linux_nat_pass_signals) (linux_nat_create_inferior, linux_nat_attach, linux_nat_detach) (linux_nat_resume, linux_nat_stopped_by_watchpoint) (linux_nat_stopped_data_address) (linux_nat_stopped_by_sw_breakpoint) (linux_nat_supports_stopped_by_sw_breakpoint) (linux_nat_stopped_by_hw_breakpoint) (linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait) (linux_nat_kill, linux_nat_mourn_inferior) (linux_nat_xfer_partial, linux_nat_thread_alive) (linux_nat_update_thread_list, linux_nat_pid_to_str) (linux_nat_thread_name, linux_child_pid_to_exec_file) (linux_child_static_tracepoint_markers_by_strid) (linux_nat_is_async_p, linux_nat_can_async_p) (linux_nat_supports_non_stop, linux_nat_always_non_stop_p) (linux_nat_supports_multi_process) (linux_nat_supports_disable_randomization, linux_nat_async) (linux_nat_stop, linux_nat_close, linux_nat_thread_address_space) (linux_nat_core_of_thread, linux_nat_filesystem_is_local) (linux_nat_fileio_open, linux_nat_fileio_readlink) (linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as methods of linux_nat_target. (linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial) (linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops parameter. (check_stopped_by_watchpoint): Adjust. (linux_xfer_partial): Delete. (linux_target_install_ops, linux_target, linux_nat_add_target): Delete. (linux_nat_target::linux_nat_target): New. * linux-nat.h: Include "inf-ptrace.h". (linux_nat_target): New. (linux_target, linux_target_install_ops, linux_nat_add_target): Delete function declarations. (linux_target): Declare global. * linux-thread-db.c (thread_db_target): New. (thread_db_target::thread_db_target): New. (thread_db_ops): Delete. (the_thread_db_target): New. (thread_db_detach, thread_db_wait, thread_db_mourn_inferior) (thread_db_update_thread_list, thread_db_pid_to_str) (thread_db_extra_thread_info) (thread_db_thread_handle_to_thread_info) (thread_db_get_thread_local_address, thread_db_get_ada_task_ptid) (thread_db_resume): Refactor as methods of thread_db_target. (init_thread_db_ops): Delete. (_initialize_thread_db): Remove reference to init_thread_db_ops. * x86-linux-nat.c: Don't include "linux-nat.h". (super_post_startup_inferior): Delete. (x86_linux_nat_target::~x86_linux_nat_target): New. (x86_linux_child_post_startup_inferior) (x86_linux_read_description, x86_linux_enable_btrace) (x86_linux_disable_btrace, x86_linux_teardown_btrace) (x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as methods of x86_linux_nat_target. (x86_linux_create_target): Delete. Bits folded ... (x86_linux_add_target): ... here. Now takes a linux_nat_target pointer. * x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h". (x86_linux_nat_target): New class. (x86_linux_create_target): Delete. (x86_linux_add_target): Now takes a linux_nat_target pointer. * x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint) (x86_region_ok_for_watchpoint, x86_stopped_data_address) (x86_stopped_by_watchpoint, x86_insert_hw_breakpoint) (x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint) (x86_stopped_by_hw_breakpoint): Remove target_ops parameter and make extern. (x86_use_watchpoints): Delete. * x86-nat.h: Include "breakpoint.h" and "target.h". (x86_use_watchpoints): Delete. (x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint) (x86_stopped_by_watchpoint, x86_stopped_data_address) (x86_insert_watchpoint, x86_remove_watchpoint) (x86_insert_hw_breakpoint, x86_remove_hw_breakpoint) (x86_stopped_by_hw_breakpoint): New declarations. (x86_nat_target): New template class. * ppc-linux-nat.c (ppc_linux_nat_target): New class. (the_ppc_linux_nat_target): New. (ppc_linux_fetch_inferior_registers) (ppc_linux_can_use_hw_breakpoint) (ppc_linux_region_ok_for_hw_watchpoint) (ppc_linux_ranged_break_num_registers) (ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint) (ppc_linux_insert_mask_watchpoint) (ppc_linux_remove_mask_watchpoint) (ppc_linux_can_accel_watchpoint_condition) (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint) (ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint) (ppc_linux_watchpoint_addr_within_range) (ppc_linux_masked_watch_num_registers) (ppc_linux_store_inferior_registers, ppc_linux_auxv_parse) (ppc_linux_read_description): Refactor as methods of ppc_linux_nat_target. (_initialize_ppc_linux_nat): Adjust. Set linux_target. * procfs.c (procfs_xfer_partial): Delete forward declaration. (procfs_target): New class. (the_procfs_target): New. (procfs_target): Delete function. (procfs_auxv_parse, procfs_attach, procfs_detach) (procfs_fetch_registers, procfs_store_registers, procfs_wait) (procfs_xfer_partial, procfs_resume, procfs_pass_signals) (procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior) (procfs_create_inferior, procfs_update_thread_list) (procfs_thread_alive, procfs_pid_to_str) (procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint) (procfs_stopped_data_address, procfs_insert_watchpoint) (procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint) (proc_find_memory_regions, procfs_info_proc) (procfs_make_note_section): Refactor as methods of procfs_target. (_initialize_procfs): Adjust. * sol-thread.c (sol_thread_target): New class. (sol_thread_ops): Now a sol_thread_target. (sol_thread_detach, sol_thread_resume, sol_thread_wait) (sol_thread_fetch_registers, sol_thread_store_registers) (sol_thread_xfer_partial, sol_thread_mourn_inferior) (sol_thread_alive, solaris_pid_to_str, sol_update_thread_list) (sol_get_ada_task_ptid): Refactor as methods of sol_thread_target. (init_sol_thread_ops): Delete. (_initialize_sol_thread): Adjust. Remove references to init_sol_thread_ops and complete_target_initialization. * windows-nat.c (windows_nat_target): New class. (windows_fetch_inferior_registers) (windows_store_inferior_registers, windows_resume, windows_wait) (windows_attach, windows_detach, windows_pid_to_exec_file) (windows_files_info, windows_create_inferior) (windows_mourn_inferior, windows_interrupt, windows_kill_inferior) (windows_close, windows_pid_to_str, windows_xfer_partial) (windows_get_tib_address, windows_get_ada_task_ptid) (windows_thread_name, windows_thread_alive): Refactor as windows_nat_target methods. (do_initial_windows_stuff): Adjust. (windows_target): Delete function. (_initialize_windows_nat): Adjust. * darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt) (darwin_mourn_inferior, darwin_kill_inferior) (darwin_create_inferior, darwin_attach, darwin_detach) (darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial) (darwin_pid_to_exec_file, darwin_get_ada_task_ptid) (darwin_supports_multi_process): Refactor as darwin_nat_target methods. (darwin_resume_to, darwin_files_info): Delete. (_initialize_darwin_inferior): Rename to ... (_initialize_darwin_nat): ... this. Adjust to C++ification. * darwin-nat.h: Include "inf-child.h". (darwin_nat_target): New class. (darwin_complete_target): Delete. * i386-darwin-nat.c (i386_darwin_nat_target): New class. (darwin_target): New. (i386_darwin_fetch_inferior_registers) (i386_darwin_store_inferior_registers): Refactor as methods of darwin_nat_target. (darwin_complete_target): Delete, with ... (_initialize_i386_darwin_nat): ... bits factored out here. * alpha-linux-nat.c (alpha_linux_nat_target): New class. (the_alpha_linux_nat_target): New. (alpha_linux_register_u_offset): Refactor as alpha_linux_nat_target method. (_initialize_alpha_linux_nat): Adjust. * linux-nat-trad.c (inf_ptrace_register_u_offset): Delete. (inf_ptrace_fetch_register, inf_ptrace_fetch_registers) (inf_ptrace_store_register, inf_ptrace_store_registers): Refact as methods of linux_nat_trad_target. (linux_trad_target): Delete. * linux-nat-trad.h (linux_trad_target): Delete function. (linux_nat_trad_target): New class. * mips-linux-nat.c (mips_linux_nat_target): New class. (super_fetch_registers, super_store_registers, super_close): Delete. (the_mips_linux_nat_target): New. (mips64_linux_regsets_fetch_registers) (mips64_linux_regsets_store_registers) (mips64_linux_fetch_registers, mips64_linux_store_registers) (mips_linux_register_u_offset, mips_linux_read_description) (mips_linux_can_use_hw_breakpoint) (mips_linux_stopped_by_watchpoint) (mips_linux_stopped_data_address) (mips_linux_region_ok_for_hw_watchpoint) (mips_linux_insert_watchpoint, mips_linux_remove_watchpoint) (mips_linux_close): Refactor as methods of mips_linux_nat. (_initialize_mips_linux_nat): Adjust to C++ification. * aix-thread.c (aix_thread_target): New class. (aix_thread_ops): Now an aix_thread_target. (aix_thread_detach, aix_thread_resume, aix_thread_wait) (aix_thread_fetch_registers, aix_thread_store_registers) (aix_thread_xfer_partial, aix_thread_mourn_inferior) (aix_thread_thread_alive, aix_thread_pid_to_str) (aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid): Refactor as methods of aix_thread_target. (init_aix_thread_ops): Delete. (_initialize_aix_thread): Remove references to init_aix_thread_ops and complete_target_initialization. * rs6000-nat.c (rs6000_xfer_shared_libraries): Delete. (rs6000_nat_target): New class. (the_rs6000_nat_target): New. (rs6000_fetch_inferior_registers, rs6000_store_inferior_registers) (rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior) (rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods. (super_create_inferior): Delete. (_initialize_rs6000_nat): Adjust to C++ification. * arm-linux-nat.c (arm_linux_nat_target): New class. (the_arm_linux_nat_target): New. (arm_linux_fetch_inferior_registers) (arm_linux_store_inferior_registers, arm_linux_read_description) (arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint) (arm_linux_remove_hw_breakpoint) (arm_linux_region_ok_for_hw_watchpoint) (arm_linux_insert_watchpoint, arm_linux_remove_watchpoint) (arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint) (arm_linux_watchpoint_addr_within_range): Refactor as methods of arm_linux_nat_target. (_initialize_arm_linux_nat): Adjust to C++ification. * aarch64-linux-nat.c (aarch64_linux_nat_target): New class. (the_aarch64_linux_nat_target): New. (aarch64_linux_fetch_inferior_registers) (aarch64_linux_store_inferior_registers) (aarch64_linux_child_post_startup_inferior) (aarch64_linux_read_description) (aarch64_linux_can_use_hw_breakpoint) (aarch64_linux_insert_hw_breakpoint) (aarch64_linux_remove_hw_breakpoint) (aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint) (aarch64_linux_region_ok_for_hw_watchpoint) (aarch64_linux_stopped_data_address) (aarch64_linux_stopped_by_watchpoint) (aarch64_linux_watchpoint_addr_within_range) (aarch64_linux_can_do_single_step): Refactor as methods of aarch64_linux_nat_target. (super_post_startup_inferior): Delete. (_initialize_aarch64_linux_nat): Adjust to C++ification. * hppa-linux-nat.c (hppa_linux_nat_target): New class. (the_hppa_linux_nat_target): New. (hppa_linux_fetch_inferior_registers) (hppa_linux_store_inferior_registers): Refactor as methods of hppa_linux_nat_target. (_initialize_hppa_linux_nat): Adjust to C++ification. * ia64-linux-nat.c (ia64_linux_nat_target): New class. (the_ia64_linux_nat_target): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint) (ia64_linux_stopped_data_address) (ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers) (ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as ia64_linux_nat_target methods. (super_xfer_partial): Delete. (_initialize_ia64_linux_nat): Adjust to C++ification. * m32r-linux-nat.c (m32r_linux_nat_target): New class. (the_m32r_linux_nat_target): New. (m32r_linux_fetch_inferior_registers) (m32r_linux_store_inferior_registers): Refactor as m32r_linux_nat_target methods. (_initialize_m32r_linux_nat): Adjust to C++ification. * m68k-linux-nat.c (m68k_linux_nat_target): New class. (the_m68k_linux_nat_target): New. (m68k_linux_fetch_inferior_registers) (m68k_linux_store_inferior_registers): Refactor as m68k_linux_nat_target methods. (_initialize_m68k_linux_nat): Adjust to C++ification. * s390-linux-nat.c (s390_linux_nat_target): New class. (the_s390_linux_nat_target): New. (s390_linux_fetch_inferior_registers) (s390_linux_store_inferior_registers, s390_stopped_by_watchpoint) (s390_insert_watchpoint, s390_remove_watchpoint) (s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint) (s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint) (s390_auxv_parse, s390_read_description): Refactor as methods of s390_linux_nat_target. (_initialize_s390_nat): Adjust to C++ification. * sparc-linux-nat.c (sparc_linux_nat_target): New class. (the_sparc_linux_nat_target): New. (_initialize_sparc_linux_nat): Adjust to C++ification. * sparc-nat.c (sparc_fetch_inferior_registers) (sparc_store_inferior_registers): Remove target_ops parameter. * sparc-nat.h (sparc_fetch_inferior_registers) (sparc_store_inferior_registers): Remove target_ops parameter. * sparc64-linux-nat.c (sparc64_linux_nat_target): New class. (the_sparc64_linux_nat_target): New. (_initialize_sparc64_linux_nat): Adjust to C++ification. * spu-linux-nat.c (spu_linux_nat_target): New class. (the_spu_linux_nat_target): New. (spu_child_post_startup_inferior, spu_child_post_attach) (spu_child_wait, spu_fetch_inferior_registers) (spu_store_inferior_registers, spu_xfer_partial) (spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target methods. (_initialize_spu_nat): Adjust to C++ification. * tilegx-linux-nat.c (tilegx_linux_nat_target): New class. (the_tilegx_linux_nat_target): New. (fetch_inferior_registers, store_inferior_registers): Refactor as methods. (_initialize_tile_linux_nat): Adjust to C++ification. * xtensa-linux-nat.c (xtensa_linux_nat_target): New class. (the_xtensa_linux_nat_target): New. (xtensa_linux_fetch_inferior_registers) (xtensa_linux_store_inferior_registers): Refactor as xtensa_linux_nat_target methods. (_initialize_xtensa_linux_nat): Adjust to C++ification. * fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete. (fbsd_pid_to_exec_file, fbsd_find_memory_regions) (fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial) (fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name) (fbsd_update_thread_list, fbsd_resume, fbsd_wait) (fbsd_stopped_by_sw_breakpoint) (fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork) (fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint) (fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint) (fbsd_post_startup_inferior, fbsd_post_attach) (fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint) (fbsd_set_syscall_catchpoint) (super_xfer_partial, super_resume, super_wait) (fbsd_supports_stopped_by_hw_breakpoint): Delete. (fbsd_handle_debug_trap): Remove target_ops parameter. (fbsd_nat_add_target): Delete. * fbsd-nat.h: Include "inf-ptrace.h". (fbsd_nat_add_target): Delete. (USE_SIGTRAP_SIGINFO): Define. (fbsd_nat_target): New class. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers) (amd64bsd_store_inferior_registers): Remove target_ops parameter. (amd64bsd_target): Delete. * amd64-bsd-nat.h: New file. * amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of "x86-bsd-nat.h". (amd64_fbsd_nat_target): New class. (the_amd64_fbsd_nat_target): New. (amd64fbsd_read_description): Refactor as method of amd64_fbsd_nat_target. (amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New. (_initialize_amd64fbsd_nat): Adjust to C++ification. * amd64-nat.h (amd64bsd_target): Delete function declaration. * i386-bsd-nat.c (i386bsd_fetch_inferior_registers) (i386bsd_store_inferior_registers): Remove target_ops parameter. (i386bsd_target): Delete. * i386-bsd-nat.h (i386bsd_target): Delete function declaration. (i386bsd_fetch_inferior_registers) (i386bsd_store_inferior_registers): Declare. (i386_bsd_nat_target): New class. * i386-fbsd-nat.c (i386_fbsd_nat_target): New class. (the_i386_fbsd_nat_target): New. (i386fbsd_resume, i386fbsd_read_description): Refactor as i386_fbsd_nat_target methods. (i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New. (_initialize_i386fbsd_nat): Adjust to C++ification. * x86-bsd-nat.c (super_mourn_inferior): Delete. (x86bsd_mourn_inferior, x86bsd_target): Delete. (_initialize_x86_bsd_nat): Adjust to C++ification. * x86-bsd-nat.h: Include "x86-nat.h". (x86bsd_target): Delete declaration. (x86bsd_nat_target): New class. * aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class. (the_aarch64_fbsd_nat_target): New. (aarch64_fbsd_fetch_inferior_registers) (aarch64_fbsd_store_inferior_registers): Refactor as methods of aarch64_fbsd_nat_target. (_initialize_aarch64_fbsd_nat): Adjust to C++ification. * alpha-bsd-nat.c (alpha_bsd_nat_target): New class. (the_alpha_bsd_nat_target): New. (alphabsd_fetch_inferior_registers) (alphabsd_store_inferior_registers): Refactor as alpha_bsd_nat_target methods. (_initialize_alphabsd_nat): Refactor as methods of alpha_bsd_nat_target. * amd64-nbsd-nat.c: Include "amd64-bsd-nat.h". (the_amd64_nbsd_nat_target): New. (_initialize_amd64nbsd_nat): Adjust to C++ification. * amd64-obsd-nat.c: Include "amd64-bsd-nat.h". (the_amd64_obsd_nat_target): New. (_initialize_amd64obsd_nat): Adjust to C++ification. * arm-fbsd-nat.c (arm_fbsd_nat_target): New. (the_arm_fbsd_nat_target): New. (arm_fbsd_fetch_inferior_registers) (arm_fbsd_store_inferior_registers, arm_fbsd_read_description): (_initialize_arm_fbsd_nat): Refactor as methods of arm_fbsd_nat_target. (_initialize_arm_fbsd_nat): Adjust to C++ification. * arm-nbsd-nat.c (arm_netbsd_nat_target): New class. (the_arm_netbsd_nat_target): New. (armnbsd_fetch_registers, armnbsd_store_registers): Refactor as arm_netbsd_nat_target. (_initialize_arm_netbsd_nat): Adjust to C++ification. * hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class. (the_hppa_nbsd_nat_target): New. (hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as hppa_nbsd_nat_target methods. (_initialize_hppanbsd_nat): Adjust to C++ification. * hppa-obsd-nat.c (hppa_obsd_nat_target): New class. (the_hppa_obsd_nat_target): New. (hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as methods of hppa_obsd_nat_target. (_initialize_hppaobsd_nat): Adjust to C++ification. Use add_target. * i386-nbsd-nat.c (the_i386_nbsd_nat_target): New. (_initialize_i386nbsd_nat): Adjust to C++ification. Use add_target. * i386-obsd-nat.c (the_i386_obsd_nat_target): New. (_initialize_i386obsd_nat): Use add_target. * m68k-bsd-nat.c (m68k_bsd_nat_target): New class. (the_m68k_bsd_nat_target): New. (m68kbsd_fetch_inferior_registers) (m68kbsd_store_inferior_registers): Refactor as methods of m68k_bsd_nat_target. (_initialize_m68kbsd_nat): Adjust to C++ification. * mips-fbsd-nat.c (mips_fbsd_nat_target): New class. (the_mips_fbsd_nat_target): New. (mips_fbsd_fetch_inferior_registers) (mips_fbsd_store_inferior_registers): Refactor as methods of mips_fbsd_nat_target. (_initialize_mips_fbsd_nat): Adjust to C++ification. Use add_target. * mips-nbsd-nat.c (mips_nbsd_nat_target): New class. (the_mips_nbsd_nat_target): New. (mipsnbsd_fetch_inferior_registers) (mipsnbsd_store_inferior_registers): Refactor as methods of mips_nbsd_nat_target. (_initialize_mipsnbsd_nat): Adjust to C++ification. * mips64-obsd-nat.c (mips64_obsd_nat_target): New class. (the_mips64_obsd_nat_target): New. (mips64obsd_fetch_inferior_registers) (mips64obsd_store_inferior_registers): Refactor as methods of mips64_obsd_nat_target. (_initialize_mips64obsd_nat): Adjust to C++ification. Use add_target. * nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of nbsd_nat_target. * nbsd-nat.h: Include "inf-ptrace.h". (nbsd_nat_target): New class. * obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list) (obsd_wait): Refactor as methods of obsd_nat_target. (obsd_add_target): Delete. * obsd-nat.h: Include "inf-ptrace.h". (obsd_nat_target): New class. * ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class. (the_ppc_fbsd_nat_target): New. (ppcfbsd_fetch_inferior_registers) (ppcfbsd_store_inferior_registers): Refactor as methods of ppc_fbsd_nat_target. (_initialize_ppcfbsd_nat): Adjust to C++ification. Use add_target. * ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class. (the_ppc_nbsd_nat_target): New. (ppcnbsd_fetch_inferior_registers) (ppcnbsd_store_inferior_registers): Refactor as methods of ppc_nbsd_nat_target. (_initialize_ppcnbsd_nat): Adjust to C++ification. * ppc-obsd-nat.c (ppc_obsd_nat_target): New class. (the_ppc_obsd_nat_target): New. (ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as methods of ppc_obsd_nat_target. (_initialize_ppcobsd_nat): Adjust to C++ification. Use add_target. * sh-nbsd-nat.c (sh_nbsd_nat_target): New class. (the_sh_nbsd_nat_target): New. (shnbsd_fetch_inferior_registers) (shnbsd_store_inferior_registers): Refactor as methods of sh_nbsd_nat_target. (_initialize_shnbsd_nat): Adjust to C++ification. * sparc-nat.c (sparc_xfer_wcookie): Make extern. (inf_ptrace_xfer_partial): Delete. (sparc_xfer_partial, sparc_target): Delete. * sparc-nat.h (sparc_fetch_inferior_registers) (sparc_store_inferior_registers, sparc_xfer_wcookie): Declare. (sparc_target): Delete function declaration. (sparc_target): New template class. * sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New. (_initialize_sparcnbsd_nat): Adjust to C++ification. * sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New. (_initialize_sparc64fbsd_nat): Adjust to C++ification. Use add_target. * sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New. (_initialize_sparc64nbsd_nat): Adjust to C++ification. * sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New. (_initialize_sparc64obsd_nat): Adjust to C++ification. Use add_target. * vax-bsd-nat.c (vax_bsd_nat_target): New class. (the_vax_bsd_nat_target): New. (vaxbsd_fetch_inferior_registers) (vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target methods. (_initialize_vaxbsd_nat): Adjust to C++ification. * bsd-kvm.c (bsd_kvm_target): New class. (bsd_kvm_ops): Now a bsd_kvm_target. (bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial) (bsd_kvm_files_info, bsd_kvm_fetch_registers) (bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of bsd_kvm_target. (bsd_kvm_return_one): Delete. (bsd_kvm_add_target): Adjust to C++ification. * nto-procfs.c (nto_procfs_target, nto_procfs_target_native) (nto_procfs_target_procfs): New classes. (procfs_open_1, procfs_thread_alive, procfs_update_thread_list) (procfs_files_info, procfs_pid_to_exec_file, procfs_attach) (procfs_post_attach, procfs_wait, procfs_fetch_registers) (procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint) (procfs_remove_breakpoint, procfs_insert_hw_breakpoint) (procfs_remove_hw_breakpoint, procfs_resume) (procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt) (procfs_kill_inferior, procfs_store_registers) (procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor as methods of nto_procfs_target. (nto_procfs_ops): Now an nto_procfs_target_procfs. (nto_native_ops): Delete. (procfs_open, procfs_native_open): Delete. (nto_native_ops): Now an nto_procfs_target_native. (init_procfs_targets): Adjust to C++ification. (procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint) (procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint): Refactor as methods of nto_procfs_target. * go32-nat.c (go32_nat_target): New class. (the_go32_nat_target): New. (go32_attach, go32_resume, go32_wait, go32_fetch_registers) (go32_store_registers, go32_xfer_partial, go32_files_info) (go32_kill_inferior, go32_create_inferior, go32_mourn_inferior) (go32_terminal_init, go32_terminal_info, go32_terminal_inferior) (go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive) (go32_pid_to_str): Refactor as methods of go32_nat_target. (go32_target): Delete. (_initialize_go32_nat): Adjust to C++ification. * gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior) (gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach) (gnu_stop, gnu_thread_alive, gnu_xfer_partial) (gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of gnu_nat_target. (gnu_target): Delete. * gnu-nat.h (gnu_target): Delete. (gnu_nat_target): New class. * i386-gnu-nat.c (gnu_base_target): New. (i386_gnu_nat_target): New class. (the_i386_gnu_nat_target): New. (_initialize_i386gnu_nat): Adjust to C++ification. gdb/testsuite/ChangeLog: 2018-05-02 Pedro Alves <palves@redhat.com> * gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and to_log_command renames. * gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
2018-05-02 Pedro Alves <palves@redhat.com>
* bfd-target.c (target_bfd_xclose): Rename to ...
(target_bfd_close): ... this.
(target_bfd_reopen): Adjust.
* target.c (target_close): Remove references to to_xclose.
* target.h (target_ops::to_xclose): Delete.
(target_ops::to_close): Update comments.
2018-05-03 01:37:08 +02:00
2018-05-02 Pedro Alves <palves@redhat.com>
* alpha-linux-nat.c: Include "linux-nat-trad.h" instead of
"linux-nat.h".
* configure.nat (alpha-linux, linux-mips): Add linux-nat-trad.o.
* inf-ptrace.c (inf_ptrace_register_u_offset)
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers)
(inf_ptrace_trad_target): Move to ...
* linux-nat-trad.c: ... this new file.
* linux-nat-trad.h: New file.
* linux-nat.c (linux_target_install_ops): Make extern.
(linux_trad_target): Delete.
* linux-nat.h (linux_trad_target): Delete declaration.
(linux_target_install_ops): Declare.
* mips-linux-nat.c: Include "linux-nat-trad.h" instead of
"linux-nat.h".
2018-05-02 Pedro Alves <palves@redhat.com>
* i386-sol2-nat.c (_initialize_amd64_sol2_nat): Don't call
procfs_target/add_target here.
* procfs.c (procfs_target): Make static.
(_initialize_procfs): Call add_target here.
* procfs.h (struct target_ops): Remove forward declaration.
(procfs_target): Remove declaration.
* sparc-sol2-nat.c (_initialize_sparc_sol2_nat): Delete.
2018-05-02 Pedro Alves <palves@redhat.com>
* procfs.c (procfs_stopped_by_watchpoint)
(procfs_insert_watchpoint, procfs_remove_watchpoint)
(procfs_region_ok_for_hw_watchpoint, procfs_stopped_data_address):
Forward declare.
(procfs_use_watchpoints): Delete, move contents...
(procfs_target): ... here.
* procfs.h (procfs_use_watchpoints): Delete declaration.
* i386-sol2-nat.c (_initialize_amd64_sol2_nat): Don't call
procfs_use_watchpoints.
* sparc-sol2-nat.c (_initialize_sparc_sol2_nat): Don't call
procfs_use_watchpoints.
2018-05-02 Tom Tromey <tom@tromey.com>
PR python/20084:
* python/python.c (gdbpy_parameter_value): Handle var_zuinteger
and var_zuinteger_unlimited.
* python/py-param.c (struct parm_constant): Add PARAM_ZUINTEGER
and PARAM_ZUINTEGER_UNLIMITED.
(set_parameter_value): Handle var_zuinteger and
var_zuinteger_unlimited.
(add_setshow_generic): Likewise.
(parmpy_init): Likewise.
2018-04-28 Dan Robertson <danlrobertson89@gmail.com>
PR rust/23124
* gdb/rust-exp.y (convert_params_to_types): Ensure that the params
pointer is not null before dereferencing it.
2018-04-30 Tom Tromey <tom@tromey.com>
* darwin-nat-info.c (darwin_debug_regions_recurse): Remove use of
is_mi_like_p.
2018-04-30 Tom Tromey <tom@tromey.com>
* breakpoint.c (mention): Remove use of is_mi_like_p.
(print_mention_ranged_breakpoint): Likewise.
* break-catch-throw.c (print_it_exception_catchpoint): Remove use
of is_mi_like_p.
2018-04-30 Tom Tromey <tom@tromey.com>
* tracepoint.c (tvariables_info_1): Remove use of is_mi_like_p.
2018-04-30 Tom Tromey <tom@tromey.com>
* spu-tdep.c (info_spu_mailbox_list, info_spu_dma_cmdlist)
(info_spu_event_command): Remove some uses of is_mi_like_p.
2018-04-30 Tom Tromey <tom@tromey.com>
* python/py-framefilter.c (py_print_single_arg)
(enumerate_locals, py_print_args, py_print_frame): Remove some
uses of is_mi_like_p.
2018-04-30 Tom Tromey <tom@tromey.com>
* ui-out.c: Update.
* cli-out.h (cli_ui_out::do_is_mi_like_p): Update.
* ui-out.h (ui_out::is_mi_like_p): Now const.
(ui_out::do_is_mi_like_p): Now const.
* mi/mi-out.h (mi_ui_out::do_is_mi_like_p): Update.
2018-04-30 Tom Tromey <tom@tromey.com>
* varobj.c (varobj_set_visualizer): Use new_reference.
* python/python.c (gdbpy_decode_line): Use new_reference.
* python/py-cmd.c (cmdpy_function, cmdpy_completer_helper): Use
new_reference.
2018-04-30 Tom Tromey <tom@tromey.com>
* varobj.c (install_new_value): Use new_reference.
* value.h (value_incref): Return void. Swap intro comment with
value_decref.
* value.c (set_value_parent): Use new_reference.
(value_incref): Return void. Update intro comment.
(release_value): Use new_reference.
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Use new_reference.
2018-04-30 Tom Tromey <tom@tromey.com>
* symfile-mem.c (symbol_file_add_from_memory): Use new_reference.
* gdb_bfd.h (new_bfd_ref): Remove.
(gdb_bfd_open): Update comment.
* gdb_bfd.c (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr)
(gdb_bfd_openw, gdb_bfd_openr_iovec, gdb_bfd_record_inclusion)
(gdb_bfd_fdopenr): Use new_reference.
* exec.c (exec_file_attach): Use new_reference.
2018-04-30 Tom Tromey <tom@tromey.com>
* common/gdb_ref_ptr.h (ref_ptr::new_reference): New static
method.
2018-04-30 Tom Tromey <tom@tromey.com>
* jit.c (jit_read_code_entry): Use type_align.
* i386-tdep.c (i386_gdbarch_init): Don't call
set_gdbarch_long_long_align_bit.
* gdbarch.sh: Remove long_long_align_bit.
* gdbarch.c, gdbarch.h: Rebuild.
* arc-tdep.c (arc_type_align): New function.
(arc_gdbarch_init): Use arc_type_align. Don't call
set_gdbarch_long_long_align_bit.
2018-04-30 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_type_alignment): Remove.
(rust_composite_type): Use type_align.
2018-04-30 Tom Tromey <tom@tromey.com>
* NEWS: Mention Type.align.
* python/py-type.c (typy_get_alignof): New function.
(type_object_getset): Add "alignof".
2018-04-30 Tom Tromey <tom@tromey.com>
PR exp/17095:
* NEWS: Update.
* std-operator.def (UNOP_ALIGNOF): New operator.
* expprint.c (dump_subexp_body_standard) <case UNOP_ALIGNOF>:
New.
* eval.c (evaluate_subexp_standard) <case UNOP_ALIGNOF>: New.
* c-lang.c (c_op_print_tab): Add alignof.
* c-exp.y (ALIGNOF): New token.
(exp): Add "ALIGNOF" production.
(ident_tokens): Add _Alignof and alignof.
2018-04-30 Tom Tromey <tom@tromey.com>
* i386-tdep.c (i386_type_align): New function.
(i386_gdbarch_init): Update.
* gdbarch.sh (type_align): New method.
* gdbarch.c, gdbarch.h: Rebuild.
* arch-utils.h (default_type_align): Declare.
* arch-utils.c (default_type_align): New function.
* gdbtypes.h (TYPE_ALIGN_BITS): New define.
(struct type) <align_log2>: New field.
<instance_flags>: Now a bitfield.
(TYPE_RAW_ALIGN): New macro.
(type_align, type_raw_align, set_type_align): Declare.
* gdbtypes.c (type_align, type_raw_align, set_type_align): New
functions.
* dwarf2read.c (quirk_rust_enum): Set type alignment.
(get_alignment, maybe_set_alignment): New functions.
(read_structure_type, read_enumeration_type, read_array_type)
(read_set_type, read_tag_pointer_type, read_tag_reference_type)
(read_subrange_type, read_base_type): Set type alignment.
2018-04-30 Simon Marchi <simon.marchi@ericsson.com>
* dwarf2read.c (read_index_from_section): Use bool.
2018-04-29 Fabian Groffen <grobian@gentoo.org>
PR gdb/22950
* proc-events.c (init_syscall_table): Guard usage os SYS_uuidsys
with #ifdef.
2018-04-29 John Reiser <jreiser@BitWagon.com>
PR build/22873
* gdb/Makefile.in: (.c:.l, .c:.y): Write the target only in the
last step, and do it atomically.
2018-04-27 Alexandre Oliva <aoliva@redhat.com>
* compile/compile-c-types.c (convert_int, convert_float):
Update for C FE v1.
2018-04-27 Tom Tromey <tom@tromey.com>
PR rust/22545:
* rust-lang.c (rust_inclusive_range_type_p): New function.
(rust_range): Handle inclusive ranges.
(rust_compute_range): Likewise.
* rust-exp.y (struct rust_op) <inclusive>: New field.
(DOTDOTEQ): New constant.
(range_expr): Add "..=" productions.
(operator_tokens): Add "..=" token.
(ast_range): Add "inclusive" parameter.
(convert_ast_to_expression) <case OP_RANGE>: Handle inclusive
ranges.
* parse.c (operator_length_standard) <case OP_RANGE>: Handle new
bounds values.
* expression.h (enum range_type) <NONE_BOUND_DEFAULT_EXCLUSIVE,
LOW_BOUND_DEFAULT_EXCLUSIVE>: New constants.
Update comments.
* expprint.c (print_subexp_standard): Handle new bounds values.
(dump_subexp_body_standard): Likewise.
2018-04-27 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* warning.m4 (AM_GDB_WARNINGS): Add -Wsuggest-override.
* dwarf2loc.c (class dwarf_evaluate_loc_desc): Use "override", not
"OVERRIDE".
(class symbol_needs_eval_context): Likewise.
* dwarf2read.c (mock_mapped_index::symbol_name_count)
(mock_mapped_index::symbol_name_at): Use "override". Remove
"virtual".
* dwarf2-frame.c (dwarf_expr_executor::get_addr_index): Use
"override".
(class dwarf_expr_executor): Use "override", not "OVERRIDE".
* aarch64-tdep.c (instruction_reader::read): Use "override".
(instruction_reader_test::read): Likewise.
* arm-tdep.c (instruction_reader::read): Use "override".
(instruction_reader_thumb::read): Likewise.
2018-04-26 Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
PR remote/9665
* remote.c (send_g_packet): Use putpkt/getpkt/packet_check_result
instead of remote_send.
(remote_send): Remove.
Fix resolving GNU ifunc bp locations when inferior runs resolver I noticed that if you set a breakpoint on an ifunc before the ifunc is resolved, and then let the program call the ifunc, thus resolving it, GDB end up with a location for that original breakpoint that is pointing to the ifunc target, but it is left pointing to the first address of the function, instead of after its prologue. After prologue is what you get if you create a new breakpoint at that point. 1) With no debug info for the target function: 1.a) Set before resolving, and then program continued passed resolving: Num Type Disp Enb Address What 1 breakpoint keep y 0x0000000000400753 <final> 1.b) Breakpoint set after inferior resolved ifunc: Num Type Disp Enb Address What 2 breakpoint keep y 0x0000000000400757 <final+4> 2) With debug info for the target function: 1.a) Set before resolving, and then program continued passed resolving: Num Type Disp Enb Address What 1 breakpoint keep y 0x0000000000400753 in final at gdb/testsuite/gdb.base/gnu-ifunc-final.c:20 1.b) Breakpoint set after inferior resolved ifunc: Num Type Disp Enb Address What 2 breakpoint keep y 0x000000000040075a in final at gdb/testsuite/gdb.base/gnu-ifunc-final.c:21 The problem is that elf_gnu_ifunc_resolver_return_stop (called by the internal breakpoint that traps the resolver returning) does not agree with linespec.c:minsym_found. It does not skip to the function's start line (i.e., past the prologue). We can now use the find_function_start_sal overload added by the previous commmit to fix this. New tests included, which fail before the patch, and pass afterwards. gdb/ChangeLog: 2018-04-26 Pedro Alves <palves@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Use find_function_start_sal instead of find_pc_line. gdb/testsuite/ChangeLog: 2018-04-26 Pedro Alves <palves@redhat.com> * gdb.base/gnu-ifunc.exp (set-break): Test that GDB resolves ifunc breakpoint locations correctly of ifunc breakpoints set while the program resolves the ifunc.
2018-04-26 14:01:27 +02:00
2018-04-26 Pedro Alves <palves@redhat.com>
* elfread.c (elf_gnu_ifunc_resolver_return_stop): Use
find_function_start_sal instead of find_pc_line.
For PPC64/ELFv1: Introduce mst_data_gnu_ifunc Running the new tests added later in the series on PPC64 (ELFv1) revealed that the current ifunc support needs a bit of a design rework to work properly on PPC64/ELFv1, as most of the new tests fail. The ifunc support only kind of works today if the ifunc symbol and the resolver have the same name, as is currently tested by the gdb.base/gnu-ifunc.exp testcase, which is unlike how ifuncs are written nowadays. The crux of the problem is that ifunc symbols are really function descriptors, not text symbols: 44: 0000000000020060 104 FUNC GLOBAL DEFAULT 18 gnu_ifunc_resolver 54: 0000000000020060 104 GNU_IFUNC GLOBAL DEFAULT 18 gnu_ifunc But, currently GDB only knows about ifunc symbols that are text symbols. GDB's support happens to work in practice for PPC64 when the ifunc and resolver are one and only, like in the current gdb.base/gnu-ifunc.exp testcase: 15: 0000000000020060 104 GNU_IFUNC GLOBAL DEFAULT 18 gnu_ifunc because in that case, the synthetic ".gnu_ifunc" entry point text symbol that bfd creates from the actual GNU ifunc "gnu_ifunc" function (descriptor) symbol ends up with the the "is a gnu ifunc" flag set / copied over: (gdb) maint print msymbols ... [ 8] i 0x9c4 .gnu_ifunc section .text <<< mst_text_gnu_ifunc ... [29] D 0x20060 gnu_ifunc section .opd crtstuff.c <<< mst_data But, if the resolver gets a distinct symbol/name from the ifunc symbol, then we end up with this: (gdb) maint print msymbols [ 8] T 0x9e4 .gnu_ifunc_resolver section .text <<< mst_text ... [29] D 0x20060 gnu_ifunc section .opd crtstuff.c <<< mst_data [30] D 0x20060 gnu_ifunc_resolver section .opd crtstuff.c <<< mst_data I have a follow up bfd patch that turns that into: (gdb) maint print msymbols + [ 8] i 0x9e4 .gnu_ifunc section .text <<< mst_text_gnu_ifunc [ 8] T 0x9e4 .gnu_ifunc_resolver section .text <<< mst_text ... [29] D 0x20060 gnu_ifunc section .opd crtstuff.c [30] D 0x20060 gnu_ifunc_resolver section .opd crtstuff.c but that won't help everything. We still need this patch. Specifically, when we do a symbol lookup by name, like e.g., to call a function (see c-exp.y hunk), e.g., "p gnu_ifunc()", then we need to know that the found "gnu_ifunc" minimal symbol is an ifunc in order to do some special processing. But, on PPC, that lookup by name finds the function descriptor symbol, which presently is just a mst_data symbol, while at present, we look for mst_text_gnu_ifunc symbols to decide whether to do special GNU ifunc processing. In most of those places, we could try to resolve the function descriptor with gdbarch_convert_from_func_ptr_addr, and then lookup the minimal symbol at the resolved PC, see if that finds a minimal symbol of type mst_text_gnu_ifunc. If so, then we could assume that the original mst_dadta / function descriptor "gnu_ifunc" symbol was an ifunc. I tried it, and it mostly works, even if it's not the most efficient. However, there's one case that can't work with such a design -- it's that of the user calling the ifunc resolver directly to debug it, like "p gnu_ifunc_resolver(0)", expecting that to return the function pointer of the final function (which is exercised by the new tests added later). In this case, with the not-fully-working solution, we'd resolve the function descriptor, find that there's an mst_text_gnu_ifunc symbol for the resolved address, and proceed calling the function as if we tried to call "gnu_ifunc", the user-visible GNU ifunc symbol, instead of the resolver. I.e., it'd be impossible to call the resolver directly as a normal function. Introducing mst_data_gnu_ifunc eliminates the need for several gdbarch_convert_from_func_ptr_addr calls, and, fixes the "call resolver directly" use case mentioned above too. It's the cleanest approach I could think of. In sum, we make GNU ifunc function descriptor symbols get a new "mst_data_gnu_ifunc" minimal symbol type instead of the bare mst_data type. So when symbol lookup by name finds such a minimal symbol, we know we found an ifunc symbol, without resolving the entry/text symbol. If the user calls the the resolver symbol instead, like "p gnu_ifunc_resolver(0)", then we'll find the regular mst_data symbol for "gnu_ifunc_resolver", and we'll call the resolver function as just another regular function. With this, most of the GNU ifunc tests added by a later patch pass on PPC64 too. The following bfd patch fixes the remaining issues. gdb/ChangeLog: 2018-04-26 Pedro Alves <palves@redhat.com> * breakpoint.c (set_breakpoint_location_function): Handle mst_data_gnu_ifunc. * c-exp.y (variable production): Handle mst_data_gnu_ifunc. * elfread.c (elf_symtab_read): Give data symbols with BSF_GNU_INDIRECT_FUNCTION set mst_data_gnu_ifunc type. (elf_rel_plt_read): Update comment. * linespec.c (convert_linespec_to_sals): Handle mst_data_gnu_ifunc. (minsym_found): Handle mst_data_gnu_ifunc. * minsyms.c (msymbol_is_function, minimal_symbol_reader::record) (find_solib_trampoline_target): Handle mst_data_gnu_ifunc. * parse.c (find_minsym_type_and_address): Handle mst_data_gnu_ifunc. * symmisc.c (dump_msymbols): Handle mst_data_gnu_ifunc. * symtab.c (find_gnu_ifunc): Handle mst_data_gnu_ifunc. * symtab.h (minimal_symbol_type) <mst_text_gnu_ifunc>: Update comment. <mst_data_gnu_ifunc>: New enumerator.
2018-04-26 14:01:27 +02:00
2018-04-26 Pedro Alves <palves@redhat.com>
* breakpoint.c (set_breakpoint_location_function): Handle
mst_data_gnu_ifunc.
* c-exp.y (variable production): Handle mst_data_gnu_ifunc.
* elfread.c (elf_symtab_read): Give data symbols with
BSF_GNU_INDIRECT_FUNCTION set mst_data_gnu_ifunc type.
(elf_rel_plt_read): Update comment.
* linespec.c (convert_linespec_to_sals): Handle
mst_data_gnu_ifunc.
(minsym_found): Handle mst_data_gnu_ifunc.
* minsyms.c (msymbol_is_function, minimal_symbol_reader::record)
(find_solib_trampoline_target): Handle mst_data_gnu_ifunc.
* parse.c (find_minsym_type_and_address): Handle
mst_data_gnu_ifunc.
* symmisc.c (dump_msymbols): Handle mst_data_gnu_ifunc.
* symtab.c (find_gnu_ifunc): Handle mst_data_gnu_ifunc.
* symtab.h (minimal_symbol_type) <mst_text_gnu_ifunc>: Update
comment.
<mst_data_gnu_ifunc>: New enumerator.
Fix stepping past GNU ifunc resolvers (introduce lookup_msym_prefer) When we're stepping (with "step"), we want to skip trampoline-like functions automatically, including GNU ifunc resolvers. That is done by infrun.c calling into: in_solib_dynsym_resolve_code -> svr4_in_dynsym_resolve_code -> in_gnu_ifunc_stub A problem here is that if there's a regular text symbol at the same address as the ifunc symbol, the minimal symbol lookup in in_gnu_ifunc_stub may miss the GNU ifunc symbol: (...) 41: 000000000000071a 53 FUNC GLOBAL DEFAULT 11 gnu_ifunc_resolver (...) 50: 000000000000071a 53 IFUNC GLOBAL DEFAULT 11 gnu_ifunc (...) This causes this FAIL in the tests added later in the series: (gdb) PASS: gdb.base/gnu-ifunc.exp: resolver_attr=1: resolver_debug=0: final_debug=0: resolver received HWCAP set step-mode on (gdb) PASS: gdb.base/gnu-ifunc.exp: resolver_attr=1: resolver_debug=0: final_debug=0: set step-mode on step 0x00007ffff7bd371a in gnu_ifunc_resolver () from build/gdb/testsuite/outputs/gdb.base/gnu-ifunc/gnu-ifunc-lib-1-0-0.so (gdb) FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=1: resolver_debug=0: final_debug=0: step Above, GDB simply thought that it stepped into a regular function, so it stopped stepping, while it should have continued stepping past the resolver. The fix is to teach minimal symbol lookup to prefer GNU ifunc symbols if desired. gdb/ChangeLog: 2018-04-26 Pedro Alves <palves@redhat.com> * minsyms.c (lookup_minimal_symbol_by_pc_section_1): Rename to ... (lookup_minimal_symbol_by_pc_section): ... this. Replace 'want_trampoline' parameter by a lookup_msym_prefer parameter. Handle it. (lookup_minimal_symbol_by_pc_section): Delete old implementation. (lookup_minimal_symbol_by_pc): Adjust. (in_gnu_ifunc_stub): Prefer GNU ifunc symbols. (lookup_solib_trampoline_symbol_by_pc): Adjust. * minsyms.h (lookup_msym_prefer): New enum. (lookup_minimal_symbol_by_pc_section): Replace 'want_trampoline' parameter by a lookup_msym_prefer parameter.
2018-04-26 14:01:27 +02:00
2018-04-26 Pedro Alves <palves@redhat.com>
* minsyms.c (lookup_minimal_symbol_by_pc_section_1): Rename to ...
(lookup_minimal_symbol_by_pc_section): ... this. Replace
'want_trampoline' parameter by a lookup_msym_prefer parameter.
Handle it.
(lookup_minimal_symbol_by_pc_section): Delete old implementation.
(lookup_minimal_symbol_by_pc): Adjust.
(in_gnu_ifunc_stub): Prefer GNU ifunc symbols.
(lookup_solib_trampoline_symbol_by_pc): Adjust.
* minsyms.h (lookup_msym_prefer): New enum.
(lookup_minimal_symbol_by_pc_section): Replace 'want_trampoline'
parameter by a lookup_msym_prefer parameter.
2018-04-26 Pedro Alves <palves@redhat.com>
* elfread.c (elf_gnu_ifunc_record_cache): Check if the symbol name
ends in "@plt" instead of looking at the symbol's section.
2018-04-26 Pedro Alves <palves@redhat.com>
* blockframe.c (cache_pc_function_is_gnu_ifunc): Delete. Remove
all references.
(find_pc_partial_function_gnu_ifunc): Rename to ...
(find_pc_partial_function): ... this, and remove references to
'is_gnu_ifunc_p'.
(find_pc_partial_function): Delete old implementation.
* symtab.h (find_pc_partial_function_gnu_ifunc): Delete.
Breakpoints, don't skip prologue of ifunc resolvers with debug info Without this patch, some of the tests added to gdb.base/gnu-ifunc.exp by a following patch fail like so: FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=0: set-break: before resolving: break gnu_ifunc FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=0: set-break: before resolving: info breakpoints FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=0: set-break: after resolving: break gnu_ifunc FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=0: set-break: after resolving: info breakpoints FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=1: set-break: before resolving: break gnu_ifunc FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=1: set-break: before resolving: info breakpoints FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=1: set-break: after resolving: break gnu_ifunc FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=1: set-break: after resolving: info breakpoints All of them trigger iff: - you have debug info for the ifunc resolver. - the resolver and the user-visible symbol have the same name. If you have an ifunc that has a resolver with the same name as the user visible symbol, debug info for the resolver masks out the ifunc minsym. When you set a breakpoint by name on the user visible symbol, GDB finds the DWARF symbol for the resolver, and thinking that it's a regular function, sets a breakpoint location past its prologue. Like so, location 1.2, before the ifunc is resolved by the inferior: (gdb) break gnu_ifunc Breakpoint 2 at 0x7ffff7bd36ea (2 locations) (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y <MULTIPLE> 1.1 y 0x00007ffff7bd36ea <gnu_ifunc> 1.2 y 0x00007ffff7bd36f2 in gnu_ifunc at src/gdb/testsuite/gdb.base/gnu-ifunc-lib.c:34 (gdb) And like so, location 2.2, if you set the breakpoint after the ifunc is resolved by the inferior (to "final"): (gdb) break gnu_ifunc Breakpoint 5 at 0x400757 (2 locations) (gdb) info breakpoints Num Type Disp Enb Address What 2 breakpoint keep y <MULTIPLE> 2.1 y 0x000000000040075a in final at src/gdb/testsuite/gdb.base/gnu-ifunc-resd.c:21 2.2 y 0x00007ffff7bd36f2 in gnu_ifunc at src/gdb/testsuite/gdb.base/gnu-ifunc-lib.c:34 (gdb) I don't think this is right because when users set a breakpoint at an ifunc, they don't care about debugging the resolver. Instead what you should is a single location for the ifunc in the first case, and a single location of the ifunc target in the second case. gdb/ChangeLog: 2018-04-26 Pedro Alves <palves@redhat.com> * linespec.c (struct bound_minimal_symbol_search_key): New. (convert_linespec_to_sals): Sort minimal symbols earlier. Don't skip first line if we found a GNU ifunc minimal symbol by name. (compare_msymbols): Change parameters to work with a destructured lhs minsym. (compare_msymbols_for_qsort, compare_msymbols_for_bsearch): New functions.
2018-04-26 14:01:26 +02:00
2018-04-26 Pedro Alves <palves@redhat.com>
* linespec.c (struct bound_minimal_symbol_search_key): New.
(convert_linespec_to_sals): Sort minimal symbols earlier. Don't
skip first line if we found a GNU ifunc minimal symbol by name.
(compare_msymbols): Change parameters to work with a destructured
lhs minsym.
(compare_msymbols_for_qsort, compare_msymbols_for_bsearch): New
functions.
Fix setting breakpoints on ifunc functions after they're already resolved This fixes setting breakpoints on ifunc functions by name after the ifunc has already been resolved. In that case, if you have debug info for the ifunc resolver, without the fix, then gdb puts a breakpoint past the prologue of the resolver, instead of setting a breakpoint at the ifunc target: break gnu_ifunc Breakpoint 4 at 0x7ffff7bd36f2: file src/gdb/testsuite/gdb.base/gnu-ifunc-lib.c, line 34. (gdb) continue Continuing. [Inferior 1 (process 13300) exited normally] (gdb) above we should have stopped at "final", but didn't because we never resolved the ifunc to the final location. If you don't have debug info for the resolver, GDB manages to resolve the ifunc target, but, it should be setting a breakpoint after the prologue of the final function, and instead what you get is that GDB sets a breakpoint on the first address of the target function. With the gnu-ifunc.exp tests added by a later patch, we get, without the fix: (gdb) break gnu_ifunc Breakpoint 4 at 0x400753 (gdb) continue Continuing. Breakpoint 4, final (arg=1) at src/gdb/testsuite/gdb.base/gnu-ifunc-final.c:20 20 { vs, fixed: (gdb) break gnu_ifunc Breakpoint 4 at 0x40075a: file src/gdb/testsuite/gdb.base/gnu-ifunc-final.c, line 21. (gdb) continue Continuing. Breakpoint 4, final (arg=2) at src/gdb/testsuite/gdb.base/gnu-ifunc-final.c:21 21 return arg + 1; (gdb) Fix the problems above by moving the ifunc target resolving to linespec.c, before we skip a function's prologue. We need to save something in the sal, so that set_breakpoint_location_function knows that it needs to create a bp_gnu_ifunc_resolver bp_location. Might as well just save a pointer to the minsym. gdb/ChangeLog: 2018-04-26 Pedro Alves <palves@redhat.com> * breakpoint.c (set_breakpoint_location_function): Don't resolve ifunc targets here. Instead, if we have an ifunc minsym, use its address/name. (add_location_to_breakpoint): Store the minsym and the objfile in the breakpoint location. * breakpoint.h (bp_location) <msymbol, objfile>: New fields. * linespec.c (minsym_found): Resolve GNU ifunc targets here. Record the minsym in the sal. * symtab.h (symtab_and_line) <msymbol>: New field.
2018-04-26 14:01:26 +02:00
2018-04-26 Pedro Alves <palves@redhat.com>
* breakpoint.c (set_breakpoint_location_function): Don't resolve
ifunc targets here. Instead, if we have an ifunc minsym, use its
address/name.
(add_location_to_breakpoint): Store the minsym and the objfile in
the breakpoint location.
* breakpoint.h (bp_location) <msymbol, objfile>: New fields.
* linespec.c (minsym_found): Resolve GNU ifunc targets here.
Record the minsym in the sal.
* symtab.h (symtab_and_line) <msymbol>: New field.
2018-04-26 Pedro Alves <palves@redhat.com>
* elfread.c (elf_gnu_ifunc_resolve_by_got): Don't write to *ADDR_P
unless we actually resolved the ifunc.
Calling ifunc functions when resolver has debug info, user symbol same name If the GNU ifunc resolver has the same name as the user visible symbol, and the resolver has debug info, then the DWARF info for the resolver masks the ifunc minsym. In that scenario, if you try calling the ifunc from GDB, you call the resolver instead. With the gnu-ifunc.exp testcase added in a following patch, you'd see: (gdb) p gnu_ifunc (3) $1 = (int (*)(int)) 0x400753 <final> (gdb) FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=0: p gnu_ifunc (3) ^^^^^^^^^^^^^^^^ That is, we called the ifunc resolver manually, which returned a pointer to the ifunc target function ("final"). The "final" symbol is the function that GDB should have called automatically, ~~~~~~~~~~~~ int final (int arg) { return arg + 1; } ~~~~~~~~~ which is what happens if you don't have debug info for the resolver: (gdb) p gnu_ifunc (3) $1 = 4 (gdb) PASS: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=0: resolved_debug=1: p gnu_ifunc (3) ^^^^^^^^^^^^^^^^ or if the resolver's symbol has a different name from the ifunc (as is the case with modern uses of ifunc via __attribute__ ifunc, such as glibc uses): (gdb) p gnu_ifunc (3) $1 = 4 (gdb) PASS: gdb.base/gnu-ifunc.exp: resolver_attr=1: resolver_debug=1: resolved_debug=0: p gnu_ifunc (3) ^^^^^^^^^^^^^^^ in which case after this patch, you can still call the resolver directly if you want: (gdb) p gnu_ifunc_resolver (3) $1 = (int (*)(int)) 0x400753 <final> gdb/ChangeLog: 2018-04-26 Pedro Alves <palves@redhat.com> * c-exp.y (variable production): Prefer ifunc minsyms over regular function symbols. * symtab.c (find_gnu_ifunc): New function. * minsyms.h (lookup_msym_prefer): New enum. (lookup_minimal_symbol_by_pc_section): Replace 'want_trampoline' parameter by a lookup_msym_prefer parameter. * symtab.h (find_gnu_ifunc): New declaration.
2018-04-26 14:01:26 +02:00
2018-04-26 Pedro Alves <palves@redhat.com>
* c-exp.y (variable production): Prefer ifunc minsyms over
regular function symbols.
* symtab.c (find_gnu_ifunc): New function.
* minsyms.h (lookup_msym_prefer): New enum.
(lookup_minimal_symbol_by_pc_section): Replace 'want_trampoline'
parameter by a lookup_msym_prefer parameter.
* symtab.h (find_gnu_ifunc): New declaration.
Calling ifunc functions when target has no debug info but resolver has After the previous patch, on Fedora 27 (glibc 2.26), if you try calling strlen in the inferior, you now get: (top-gdb) p strlen ("hello") '__strlen_avx2' has unknown return type; cast the call to its declared return type This is correct, because __strlen_avx2 is written in assembly. We can improve on this though -- if the final ifunc resolved/target function has no debug info, but the ifunc _resolver_ does have debug info, we can try extracting the final function's type from the type that the resolver returns. E.g.,: typedef size_t (*strlen_t) (const char*); size_t my_strlen (const char *) { /* some implementation */ } strlen_t strlen_resolver (unsigned long hwcap) { return my_strlen; } extern size_t strlen (const char *s); __typeof (strlen) strlen __attribute__ ((ifunc ("strlen_resolver"))); In the strlen example above, the resolver returns strlen_t, which is a typedef for pointer to a function that returns size_t. "strlen_t" is the type of both the user-visible "strlen", and of the the target function that implements it. This patch teaches GDB to extract that type. This is done for actual inferior function calls (in infcall.c), and for ptype (in eval_call). By the time we get to either of these places, we've already lost the original symbol/minsym, and only have values and types to work with. Hence the changes to c-exp.y and evaluate_var_msym_value, to ensure that we propagate the ifunc minsymbol's info. The change to make ifunc symbols have no/unknown return type exposes a latent problem -- gdb.compile/compile-ifunc.exp calls a no-debug-info function, but we did not warn about it. The test is fixed by this commit too. gdb/ChangeLog: 2018-04-26 Pedro Alves <palves@redhat.com> * blockframe.c (find_gnu_ifunc_target_type): New function. (find_function_type): New. * eval.c (evaluate_var_msym_value): For GNU ifunc types, always return a value with a memory address. (eval_call): For calls to GNU ifunc functions, try to find the type of the target function from the type that the resolver returns. * gdbtypes.c (objfile_type): Don't install a return type for ifunc symbols. * infcall.c (find_function_return_type): Delete. (find_function_addr): Add 'function_type' parameter. For calls to GNU ifunc functions, try to find the type of the target function from the type that the resolver returns, and return it via FUNCTION_TYPE. (call_function_by_hand_dummy): Adjust to use the function type returned by find_function_addr. (find_function_addr): Add 'function_type' parameter and move description here. * symtab.h (find_function_type, find_gnu_ifunc_target_type): New declarations. gdb/testsuite/ChangeLog: 2018-04-26 Pedro Alves <palves@redhat.com> * gdb.compile/compile-ifunc.exp: Also expect "function has unknown return type" warnings.
2018-04-26 14:01:26 +02:00
2018-04-26 Pedro Alves <palves@redhat.com>
* blockframe.c (find_gnu_ifunc_target_type): New function.
(find_function_type): New.
* eval.c (evaluate_var_msym_value): For GNU ifunc types, always
return a value with a memory address.
(eval_call): For calls to GNU ifunc functions, try to find the
type of the target function from the type that the resolver
returns.
* gdbtypes.c (objfile_type): Don't install a return type for ifunc
symbols.
* infcall.c (find_function_return_type): Delete.
(find_function_addr): Add 'function_type' parameter. For calls to
GNU ifunc functions, try to find the type of the target function
from the type that the resolver returns, and return it via
FUNCTION_TYPE.
(call_function_by_hand_dummy): Adjust to use the function type
returned by find_function_addr.
(find_function_addr): Add 'function_type' parameter and move
description here.
* symtab.h (find_function_type, find_gnu_ifunc_target_type): New
declarations.
2018-04-26 Pedro Alves <palves@redhat.com>
* c-exp.y (variable production): Skip finding an alias for ifunc
symbols.
Fix breakpoints in ifunc after inferior resolved it (@got.plt symbol creation) Setting a breakpoint on an ifunc symbol after the ifunc has already been resolved by the inferior should result in creating a breakpoint location at the ifunc target. However, that's not what happens on current Fedora: (gdb) n 53 i = gnu_ifunc (1); /* break-at-call */ (gdb) 54 assert (i == 2); (gdb) b gnu_ifunc Breakpoint 2 at gnu-indirect-function resolver at 0x7ffff7bd36ee (gdb) info breakpoints Num Type Disp Enb Address What 2 STT_GNU_IFUNC resolver keep y 0x00007ffff7bd36ee <gnu_ifunc+4> The problem is that elf_gnu_ifunc_resolve_by_got never manages to resolve an ifunc target. The reason is that GDB never actually creates the internal got.plt symbols: (gdb) p 'gnu_ifunc@got.plt' No symbol "gnu_ifunc@got.plt" in current context. and this is because GDB expects that rela.plt has relocations for .plt, while it actually has relocations for .got.plt: Relocation section [10] '.rela.plt' for section [22] '.got.plt' at offset 0x570 contains 2 entries: Offset Type Value Addend Name 0x0000000000601018 X86_64_JUMP_SLOT 000000000000000000 +0 __assert_fail 0x0000000000601020 X86_64_JUMP_SLOT 000000000000000000 +0 gnu_ifunc Using an older system on the GCC compile farm (machine gcc15, an x86-64 running Debian 6.0.8, with GNU ld 2.20.1), we see that it used to be that we'd get a .rela.plt section for .plt: Relocation section [ 9] '.rela.plt' for section [11] '.plt' at offset 0x578 contains 3 entries: Offset Type Value Addend Name 0x0000000000600cc0 X86_64_JUMP_SLOT 000000000000000000 +0 __assert_fail 0x0000000000600cc8 X86_64_JUMP_SLOT 000000000000000000 +0 __libc_start_main 0x0000000000600cd0 X86_64_JUMP_SLOT 000000000000000000 +0 gnu_ifunc Those offsets did point into .got.plt, as seen with objdump -h: 20 .got.plt 00000030 0000000000600ca8 0000000000600ca8 00000ca8 2**3 CONTENTS, ALLOC, LOAD, DATA I also tested on gcc110 on the compile farm (PPC64 running CentOS 7.4.1708, with GNU ld 2.25.1), and there we see instead: Relocation section [ 9] '.rela.plt' for section [23] '.plt' at offset 0x5d0 contains 4 entries: Offset Type Value Addend Name 0x0000000010020148 PPC64_JMP_SLOT 000000000000000000 +0 __libc_start_main 0x0000000010020160 PPC64_JMP_SLOT 000000000000000000 +0 __gmon_start__ 0x0000000010020178 PPC64_JMP_SLOT 000000000000000000 +0 __assert_fail 0x0000000010020190 PPC64_JMP_SLOT 000000000000000000 +0 gnu_ifunc But note that those offsets point into .plt, not .got.plt, as seen with objdump -h: 22 .plt 00000078 0000000010020130 0000000010020130 00010130 2**3 ALLOC This commit makes us support all the different combinations above. With that addressed, we now get: (gdb) p 'gnu_ifunc@got.plt' $1 = (<text from jump slot in .got.plt, no debug info>) 0x400753 <final> And setting a breakpoint on the ifunc finds the ifunc target: (gdb) b gnu_ifunc Breakpoint 2 at 0x400753 (gdb) info breakpoints Num Type Disp Enb Address What 2 breakpoint keep y 0x0000000000400753 <final> gdb/ChangeLog: 2018-04-26 Pedro Alves <palves@redhat.com> * elfread.c (elf_rel_plt_read): Look for relocations for .got.plt too.
2018-04-26 14:02:26 +02:00
2018-04-26 Pedro Alves <palves@redhat.com>
* elfread.c (elf_rel_plt_read): Look for relocations for .got.plt too.
Fix new inferior events output Since f67c0c917150 ("Enable 'set print inferior-events' and improve detach/fork/kill/exit messages"), when detaching a remote process, we get, for detach against a remote target: (gdb) detach Detaching from program: ...., process 5388 Ending remote debugging. [Inferior 1 (Thread 5388.5388) detached] ^^^^^^^^^^^^^^^^ That is incorrect, for it is printing a thread id as string while we should be printing the process id instead. I.e., either one of: [Inferior 1 (process 5388) detached] [Inferior 1 (Remote target) detached] depending on remote stub support for the multi-process extensions. Similarly, after killing a process, we're printing thread ids while we should be printing process ids. E.g., on native GNU/Linux: (gdb) k Kill the program being debugged? (y or n) y [Inferior 1 (Thread 0x7ffff7faa8c0 (LWP 30721)) has been killed] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ while it should have been: Kill the program being debugged? (y or n) y [Inferior 1 (process 30721) has been killed] ^^^^^^^^^^^^^ There's a wording inconsistency between detach and kill: [Inferior 1 (process 30721) has been killed] [Inferior 1 (process 30721) detached] Given we were already saying "detached" instead of "has been detached", and we used to say just "exited", and given that the "has been" doesn't really add any information, this commit changes the message to just "killed": [Inferior 1 (process 30721) killed] gdb/ChangeLog: 2018-04-25 Pedro Alves <palves@redhat.com> * infcmd.c (kill_command): Print the pid as string, not the whole thread's ptid. Add comment. s/has been killed/killed/ in output message. * remote.c (remote_detach_1): Print the pid as string, not the whole thread's ptid. gdb/testsuite/ChangeLog: 2018-04-25 Pedro Alves <palves@redhat.com> * gdb.base/hook-stop.exp: Expect "killed" instead of "has been killed". * gdb.base/kill-after-signal.exp: Likewise. * gdb.threads/kill.exp: Likewise.
2018-04-25 18:28:25 +02:00
2018-04-25 Pedro Alves <palves@redhat.com>
* infcmd.c (kill_command): Print the pid as string, not the whole
thread's ptid. Add comment. s/has been killed/killed/ in output
message.
* remote.c (remote_detach_1): Print the pid as string, not the
whole thread's ptid.
Enable 'set print inferior-events' and improve detach/fork/kill/exit messages This patch aims to turn 'set print inferior-events' always on, and do some cleanup on the messages printed by GDB when various inferior events happen (attach, detach, fork, kill, exit). To make sure that the patch is correct, I've tested it with a handful of combinations of 'set follow-fork-mode', 'set detach-on-fork' and 'set print inferior-events'. In the end, I decided to make my hand-made test into an official testcase. More on that below. Using the following program as an example: #include <unistd.h> int main () { fork (); return 0; } We see the following outputs from the patched GDB: - With 'set print inferior-events on': (gdb) r Starting program: a.out [Detaching after fork from child process 27749] [Inferior 1 (process 27745) exited normally] (gdb) - With 'set print inferior-events off': (gdb) r Starting program: a.out [Inferior 1 (process 27823) exited normally] (gdb) Comparing this against an unpatched GDB: - With 'set print inferior-events off' and 'set follow-fork-mode child': (gdb) r Starting program: a.out [Inferior 2 (process 5993) exited normally] (gdb) Compare this against an unpatched GDB: (unpatched-gdb) r Starting program: a.out [New process 5702] [Inferior 2 (process 5702) exited normally] (unpatched-gdb) It is possible to notice that, in this scenario, the patched GDB will lose the '[New process %d]' message. - With 'set print inferior-events on', 'set follow-fork-mode child' and 'set detach-on-fork on': (gdb) r Starting program: a.out [Attaching after process 27905 fork to child process 27909] [New inferior 2 (process 27909)] [Detaching after fork from parent process 27905] [Inferior 1 (process 27905) detached] [Inferior 2 (process 27909) exited normally] (gdb) Compare this output with an unpatched GDB, using the same settings: (unpatched-gdb) r Starting program: a.out [New inferior 28033] [Inferior 28029 detached] [New process 28033] [Inferior 2 (process 28033) exited normally] [Inferior 28033 exited] (unpatched-gdb) As can be seen above, I've also made a few modifications to messages that are printed when 'set print inferior-events' is on. For example, a few of the messages did not contain the '[' and ']' as prefix/suffix, which led to a few inconsistencies like: Attaching after process 22995 fork to child process 22999. [New inferior 22999] Detaching after fork from child process 22999. [Inferior 22995 detached] [Inferior 2 (process 22999) exited normally] So I took the opportunity and included the square brackets where applicable. I have also made the existing messages more uniform, by always printing "Inferior %d (process %d)..." where applicable. This makes it easier to identify the inferior number and the PID number from the messages. As suggested by Pedro, the "[Inferior %d exited]" message from 'exit_inferior' has been removed, because it got duplicated when 'inferior-events' is on. I'm also using the 'add_{thread,inferior}_silent' versions (instead of their verbose counterparts) on some locations, also to avoid duplicated messages. For example, a patched GDB with 'set print inferior-events on', 'set detach-on-fork on' and 'set follow-fork-mode child', but using 'add_thread', would print: (gdb) run Starting program: a.out [Attaching after process 25088 fork to child process 25092.] [New inferior 25092] <--- duplicated [Detaching after fork from child process 25092.] [Inferior 25088 detached] [New process 25092] <--- duplicated [Inferior 2 (process 25092) exited normally] But if we use 'add_thread_silent' (with the same configuration as before): (gdb) run Starting program: a.out [Attaching after process 31606 fork to child process 31610] [New inferior 2 (process 31610)] [Detaching after fork from parent process 31606] [Inferior 1 (process 31606) detached] [Inferior 2 (process 31610) exited normally] As for the tests, the configuration options being exercised are: - follow-fork-mode: child/parent - detach-on-fork: on/off - print inferior-events: on/off It was also necessary to perform adjustments on several testcases, because the expected messages changed considerably. Built and regtested on BuildBot, without regressions. gdb/ChangeLog: 2018-04-24 Jan Kratochvil <jan.kratochvil@redhat.com> Sergio Durigan Junior <sergiodj@redhat.com> Pedro Alves <palves@redhat.com> * infcmd.c (kill_command): Print message when inferior has been killed. * inferior.c (print_inferior_events): Remove 'static'. Set as '1'. (add_inferior): Improve message printed when 'print_inferior_events' is on. (exit_inferior): Remove message printed when 'print_inferior_events' is on. (detach_inferior): Improve message printed when 'print_inferior_events' is on. (initialize_inferiors): Use 'add_inferior_silent' to set 'current_inferior_'. * inferior.h (print_inferior_events): Declare here as 'extern'. * infrun.c (follow_fork_inferior): Print '[Attaching...]' or '[Detaching...]' messages when 'print_inferior_events' is on. Use 'add_thread_silent' instead of 'add_thread'. Add '[' and ']' as prefix/suffix for messages. Remove periods. Fix erroneous 'Detaching after fork from child...', replace it by '... from parent...'. (handle_vfork_child_exec_or_exit): Add '[' and ']' as prefix/suffix when printing 'Detaching...' messages. Print them when 'print_inferior_events' is on. * remote.c (remote_detach_1): Print message when detaching from inferior and '!is_fork_parent'. gdb/testsuite/ChangeLog: 2018-04-24 Jan Kratochvil <jan.kratochvil@redhat.com> Sergio Durigan Junior <sergiodj@redhat.com> Pedro Alves <palves@redhat.com> * gdb.base/attach-non-pgrp-leader.exp: Adjust 'Detaching...' regexps to expect for '[Inferior ... detached]' as well. * gdb.base/attach.exp: Likewise. * gdb.base/catch-syscall.exp (check_for_program_end): Adjust "gdb_continue_to_end". (test_catch_syscall_with_wrong_args): Likewise. * gdb.base/foll-fork.exp: Adjust regexps to match '[' and ']'. Don't set 'verbose' on. * gdb.base/foll-vfork.exp: Likewise. * gdb.base/fork-print-inferior-events.c: New file. * gdb.base/fork-print-inferior-events.exp: New file. * gdb.base/hook-stop.exp: Adjust regexps to expect for new '[Inferior ... has been killed]' message. * gdb.base/kill-after-signal.exp: Likewise. * gdb.base/solib-overlap.exp: Adjust regexps to expect for new detach message. * gdb.threads/kill.exp: Adjust regexps to expect for new kill message. * gdb.threads/clone-attach-detach.exp: Adjust 'Detaching...' regexps to expect for '[Inferior ... detached]' as well. * gdb.threads/process-dies-while-detaching.exp: Likewise.
2018-01-31 01:09:42 +01:00
2018-04-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Sergio Durigan Junior <sergiodj@redhat.com>
Pedro Alves <palves@redhat.com>
* infcmd.c (kill_command): Print message when inferior has
been killed.
* inferior.c (print_inferior_events): Remove 'static'. Set as
'1'.
(add_inferior): Improve message printed when
'print_inferior_events' is on.
(exit_inferior): Remove message printed when
'print_inferior_events' is on.
(detach_inferior): Improve message printed when
'print_inferior_events' is on.
(initialize_inferiors): Use 'add_inferior_silent' to set
'current_inferior_'.
* inferior.h (print_inferior_events): Declare here as
'extern'.
* infrun.c (follow_fork_inferior): Print '[Attaching...]' or
'[Detaching...]' messages when 'print_inferior_events' is on.
Use 'add_thread_silent' instead of 'add_thread'. Add '[' and ']'
as prefix/suffix for messages. Remove periods. Fix erroneous
'Detaching after fork from child...', replace it by '... from
parent...'.
(handle_vfork_child_exec_or_exit): Add '[' and ']' as
prefix/suffix when printing 'Detaching...' messages. Print
them when 'print_inferior_events' is on.
* remote.c (remote_detach_1): Print message when detaching
from inferior and '!is_fork_parent'.
2018-04-24 Tom Tromey <tom@tromey.com>
* cli-out.h: Reindent.
2018-04-24 Tom Tromey <tom@tromey.com>
* cli-out.c (cli_ui_out::out_field_fmt): Remove.
(cli_ui_out::do_field_string): Use fputs_filtered.
* cli-out.h (class cli_ui_out) <out_field_fmt>: Remove.
2018-04-23 Tom Tromey <tom@tromey.com>
* guile/scm-frame.c (gdbscm_frame_read_var): Use
gdb::unique_xmalloc_ptr.
2018-04-23 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
2018-04-22 Rajendra SY <rajendra.sy@gmail.com>
PR gdb/23095
* gdb/testsuite/gdb.base/break-probes.exp: Pass shlib_load to
prepare_for_testing. Set normal_bp to r_debug_state if target
is bsd.
FreeBSD: Fix 'Couldn't get registers: Device busy' error (PR gdb/23077) As Rajendra SY reported at <https://sourceware.org/ml/gdb-patches/2018-04/msg00399.html>, several attach-related tests are failing on FreeBSD. The "attach" command errors with "Couldn't get registers: Device busy". When the "attach" command is executed, it calls target_attach -> inf_ptrace_attach, which just does the ptrace(PT_ATTACH), it does not wait for the child to stop with SIGSTOP. Afterwards, the command is complete and we go back to the event loop. The event loop wakes up and we end up in target_wait -> fbsd_wait, and handle the SIGSTOP stop. At the end of execute_command, though, before going back to the event loop, we check if the frame language changed via check_frame_language_change(). That reads the current PC, which is what leads to the registers read that fails. The problem is that we fail to mark the attached-to thread as executing between the initial attach, and the subsequent target_wait. Until we see the thread stop with SIGSTOP, we shouldn't try to read registers off of it. I guess there may a timing issue here - if you're "lucky", the thread may stop before gdb reads its registers, masking the problem. With that fixed, check_frame_language_change() becomes a nop until the thread is marked not-executing again, after target_wait is called and we go through handle_inferior_event -> normal_stop. We haven't seen the problem on Linux because there, the target_attach implementation waits for the thread to stop before returning. Still, that's supposedly hidden from the core, since the Linux target, like most targets, is a '!to_attach_no_wait' target. This fixes: FAIL: gdb.base/attach.exp: attach1, after setting file FAIL: gdb.base/attach.exp: attach2, with no file FAIL: gdb.base/attach.exp: load file manually, after attach2 (re-read) (got interactive prompt) FAIL: gdb.base/attach.exp: attach when process' a.out not in cwd FAIL: gdb.base/dprintf-detach.exp: bai=on ds=gdb dd=on: re-attach to inferior FAIL: gdb.base/dprintf-detach.exp: bai=on ds=gdb dd=off: re-attach to inferior FAIL: gdb.base/dprintf-detach.exp: bai=on ds=call dd=on: re-attach to inferior FAIL: gdb.base/dprintf-detach.exp: bai=on ds=call dd=off: re-attach to inferior FAIL: gdb.base/dprintf-detach.exp: bai=on ds=agent dd=on: re-attach to inferior FAIL: gdb.base/dprintf-detach.exp: bai=on ds=agent dd=off: re-attach to inferior FAIL: gdb.base/dprintf-detach.exp: bai=off ds=gdb dd=on: re-attach to inferior FAIL: gdb.base/dprintf-detach.exp: bai=off ds=gdb dd=off: re-attach to inferior FAIL: gdb.base/dprintf-detach.exp: bai=off ds=call dd=on: re-attach to inferior FAIL: gdb.base/dprintf-detach.exp: bai=off ds=call dd=off: re-attach to inferior FAIL: gdb.base/dprintf-detach.exp: bai=off ds=agent dd=on: re-attach to inferior FAIL: gdb.base/dprintf-detach.exp: bai=off ds=agent dd=off: re-attach to inferior gdb/ChangeLog: 2018-04-21 Pedro Alves <palves@redhat.com> Rajendra SY <rajendra.sy@gmail.com> * inf-ptrace.c (inf_ptrace_attach): Mark the thread as executing. * remote.c (extended_remote_attach): In all-stop mode, mark the thread as executing.
2018-04-21 19:19:30 +02:00
2018-04-21 Pedro Alves <palves@redhat.com>
Rajendra SY <rajendra.sy@gmail.com>
* inf-ptrace.c (inf_ptrace_attach): Mark the thread as executing.
* remote.c (extended_remote_attach): In all-stop mode, mark the
thread as executing.
2018-04-19 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* thread.c (thread_apply_all_command): Fix comment.
(thread_command): Fix comment.
Remove xml file references from target descriptions gdb/ * common/tdesc.h (tdesc_create_feature): Remove xml filename parameter. * features/aarch64-core.c (create_feature_aarch64_core): Regenerate. * features/aarch64-fpu.c (create_feature_aarch64_fpu): Likewise. * features/i386/32bit-avx.c (create_feature_i386_32bit_avx): Likewise. * features/i386/32bit-avx512.c (create_feature_i386_32bit_avx512): Likewise. * features/i386/32bit-core.c (create_feature_i386_32bit_core): Likewise. * features/i386/32bit-linux.c (create_feature_i386_32bit_linux): Likewise. * features/i386/32bit-mpx.c (create_feature_i386_32bit_mpx): Likewise. * features/i386/32bit-pkeys.c (create_feature_i386_32bit_pkeys): Likewise. * features/i386/32bit-sse.c (create_feature_i386_32bit_sse): Likewise. * features/i386/64bit-avx.c (create_feature_i386_64bit_avx): Likewise. * features/i386/64bit-avx512.c (create_feature_i386_64bit_avx512): Likewise. * features/i386/64bit-core.c (create_feature_i386_64bit_core): Likewise. * features/i386/64bit-linux.c (create_feature_i386_64bit_linux): Likewise. * features/i386/64bit-mpx.c (create_feature_i386_64bit_mpx): Likewise. * features/i386/64bit-pkeys.c (create_feature_i386_64bit_pkeys): Likewise. * features/i386/64bit-segments.c (create_feature_i386_64bit_segments): Likewise. * features/i386/64bit-sse.c (create_feature_i386_64bit_sse): Likewise. * features/i386/x32-core.c (create_feature_i386_x32_core): Likewise. * features/tic6x-c6xp.c (create_feature_tic6x_c6xp): Likewise. * features/tic6x-core.c (create_feature_tic6x_core): Likewise. * features/tic6x-gp.c (create_feature_tic6x_gp): Likewise. * target-descriptions.c: In generated code, don't pass xml filename. gdbserver/ * tdesc.c: Remove xml parameter.
2018-04-18 21:49:37 +02:00
2018-04-10 Alan Hayward <alan.hayward@arm.com>
* common/tdesc.h (tdesc_create_feature): Remove xml filename
parameter.
* features/aarch64-core.c (create_feature_aarch64_core):
Regenerate.
* features/aarch64-fpu.c (create_feature_aarch64_fpu):
Likewise.
* features/i386/32bit-avx.c (create_feature_i386_32bit_avx):
Likewise.
* features/i386/32bit-avx512.c
(create_feature_i386_32bit_avx512): Likewise.
* features/i386/32bit-core.c (create_feature_i386_32bit_core):
Likewise.
* features/i386/32bit-linux.c (create_feature_i386_32bit_linux):
Likewise.
* features/i386/32bit-mpx.c (create_feature_i386_32bit_mpx):
Likewise.
* features/i386/32bit-pkeys.c (create_feature_i386_32bit_pkeys):
Likewise.
* features/i386/32bit-sse.c (create_feature_i386_32bit_sse):
Likewise.
* features/i386/64bit-avx.c (create_feature_i386_64bit_avx):
Likewise.
* features/i386/64bit-avx512.c
(create_feature_i386_64bit_avx512): Likewise.
* features/i386/64bit-core.c (create_feature_i386_64bit_core):
Likewise.
* features/i386/64bit-linux.c (create_feature_i386_64bit_linux):
Likewise.
* features/i386/64bit-mpx.c (create_feature_i386_64bit_mpx):
Likewise.
* features/i386/64bit-pkeys.c (create_feature_i386_64bit_pkeys):
Likewise.
* features/i386/64bit-segments.c
(create_feature_i386_64bit_segments): Likewise.
* features/i386/64bit-sse.c (create_feature_i386_64bit_sse):
Likewise.
* features/i386/x32-core.c
(create_feature_i386_x32_core): Likewise.
* features/tic6x-c6xp.c (create_feature_tic6x_c6xp): Likewise.
* features/tic6x-core.c (create_feature_tic6x_core): Likewise.
* features/tic6x-gp.c (create_feature_tic6x_gp): Likewise.
* target-descriptions.c: In generated code, don't pass xml
filename.
2018-04-18 Alan Hayward <alan.hayward@arm.com>
* common/tdesc.c (print_xml_feature::visit_pre): Add xml parsing.
(print_xml_feature::visit_post): Likewise.
(print_xml_feature::visit): Likewise.
* common/tdesc.h (tdesc_get_features_xml): Use const tdesc.
(print_xml_feature): Add new class.
* regformats/regdat.sh: Null xmltarget on feature targets.
* target-descriptions.c (struct target_desc): Add xmltarget.
(maintenance_check_tdesc_xml_convert): Add unittest function.
(tdesc_get_features_xml): Add function to get xml.
(maintenance_check_xml_descriptions): Test xml generation.
* xml-tdesc.c (string_read_description_xml): Add function.
* xml-tdesc.h (string_read_description_xml): Add declaration.
2018-04-18 Alan Hayward <alan.hayward@arm.com>
* features/Makefile: Add feature marker to targets with new style
target descriptions.
* regformats/aarch64.dat: Regenerate.
* regformats/i386/amd64-avx-avx512-linux.dat: Likewise.
* regformats/i386/amd64-avx-linux.dat: Likewise.
* regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat: Likewise.
* regformats/i386/amd64-avx-mpx-linux.dat: Likewise.
* regformats/i386/amd64-linux.dat: Likewise.
* regformats/i386/amd64-mpx-linux.dat: Likewise.
* regformats/i386/amd64.dat: Likewise.
* regformats/i386/i386-avx-avx512-linux.dat: Likewise.
* regformats/i386/i386-avx-linux.dat: Likewise.
* regformats/i386/i386-avx-mpx-avx512-pku-linux.dat: Likewise.
* regformats/i386/i386-avx-mpx-linux.dat: Likewise.
* regformats/i386/i386-linux.dat: Likewise.
* regformats/i386/i386-mmx-linux.dat: Likewise.
* regformats/i386/i386-mpx-linux.dat: Likewise.
* regformats/i386/i386.dat: Likewise.
* regformats/i386/x32-avx-avx512-linux.dat: Likewise.
* regformats/i386/x32-avx-linux.dat: Likewise.
* regformats/i386/x32-linux.dat: Likewise.
* regformats/tic6x-c62x-linux.dat: Likewise.
* regformats/tic6x-c64x-linux.dat: Likewise.
* regformats/tic6x-c64xp-linux.dat: Likewise.
* regformats/regdat.sh: Parse feature marker.
2018-04-18 Alan Hayward <alan.hayward@arm.com>
* common/tdesc.h (tdesc_architecture_name): Add new declaration.
(tdesc_osabi_name): Likewise.
* target-descriptions.c (tdesc_architecture_name): Add new
function.
(tdesc_osabi_name): Likewise.
Commonise tdesc types and makes use of them in gdbserver tdesc gdb/ * common/tdesc.c (tdesc_predefined_type): Move to here. (tdesc_named_type): Likewise. (tdesc_create_vector): Likewise. (tdesc_create_struct): Likewise. (tdesc_set_struct_size): Likewise. (tdesc_create_union): Likewise. (tdesc_create_flags): Likewise. (tdesc_create_enum): Likewise. (tdesc_add_field): Likewise. (tdesc_add_typed_bitfield): Likewise. (tdesc_add_bitfield): Likewise. (tdesc_add_flag): Likewise. (tdesc_add_enum_value): Likewise. * common/tdesc.h (struct tdesc_type_builtin): Likewise. (struct tdesc_type_vector): Likewise. (struct tdesc_type_field): Likewise. (struct tdesc_type_with_fields): Likewise. (tdesc_create_enum): Add declaration. (tdesc_add_typed_bitfield): Likewise. (tdesc_add_enum_value): Likewise. * target-descriptions.c (tdesc_type_field): Move from here. (tdesc_type_builtin): Likewise. (tdesc_type_vector): Likewise. (tdesc_type_with_fields): Likewise. (tdesc_predefined_types): Likewise. (tdesc_named_type): Likewise. (tdesc_create_vector): Likewise. (tdesc_create_struct): Likewise. (tdesc_set_struct_size): Likewise. (tdesc_create_union): Likewise. (tdesc_create_flags): Likewise. (tdesc_create_enum): Likewise. (tdesc_add_field): Likewise. (tdesc_add_typed_bitfield): Likewise. (tdesc_add_bitfield): Likewise. (tdesc_add_flag): Likewise. (tdesc_add_enum_value): Likewise. * gdb/target-descriptions.h (tdesc_create_enum): Likewise. (tdesc_add_typed_bitfield): Likewise. (tdesc_add_enum_value): Likewise. gdbserver/ * tdesc.c (tdesc_create_flags): Remove. (tdesc_add_flag): Likewise. (tdesc_named_type): Likewise. (tdesc_create_union): Likewise. (tdesc_create_struct): Likewise. (tdesc_create_vector): Likewise. (tdesc_add_bitfield): Likewise. (tdesc_add_field): Likewise. (tdesc_set_struct_size): Likewise.
2018-04-18 12:47:55 +02:00
2018-04-18 Alan Hayward <alan.hayward@arm.com>
* common/tdesc.c (tdesc_predefined_type): Move to here.
(tdesc_named_type): Likewise.
(tdesc_create_vector): Likewise.
(tdesc_create_struct): Likewise.
(tdesc_set_struct_size): Likewise.
(tdesc_create_union): Likewise.
(tdesc_create_flags): Likewise.
(tdesc_create_enum): Likewise.
(tdesc_add_field): Likewise.
(tdesc_add_typed_bitfield): Likewise.
(tdesc_add_bitfield): Likewise.
(tdesc_add_flag): Likewise.
(tdesc_add_enum_value): Likewise.
* common/tdesc.h (struct tdesc_type_builtin): Likewise.
(struct tdesc_type_vector): Likewise.
(struct tdesc_type_field): Likewise.
(struct tdesc_type_with_fields): Likewise.
(tdesc_create_enum): Add declaration.
(tdesc_add_typed_bitfield): Likewise.
(tdesc_add_enum_value): Likewise.
* target-descriptions.c (tdesc_type_field): Move from here.
(tdesc_type_builtin): Likewise.
(tdesc_type_vector): Likewise.
(tdesc_type_with_fields): Likewise.
(tdesc_predefined_types): Likewise.
(tdesc_named_type): Likewise.
(tdesc_create_vector): Likewise.
(tdesc_create_struct): Likewise.
(tdesc_set_struct_size): Likewise.
(tdesc_create_union): Likewise.
(tdesc_create_flags): Likewise.
(tdesc_create_enum): Likewise.
(tdesc_add_field): Likewise.
(tdesc_add_typed_bitfield): Likewise.
(tdesc_add_bitfield): Likewise.
(tdesc_add_flag): Likewise.
(tdesc_add_enum_value): Likewise.
* gdb/target-descriptions.h (tdesc_create_enum): Likewise.
(tdesc_add_typed_bitfield): Likewise.
(tdesc_add_enum_value): Likewise.
2018-04-18 Alan Hayward <alan.hayward@arm.com>
* common/tdesc.c (tdesc_feature::accept): Move to here.
(tdesc_feature::operator==): Likewise.
(tdesc_create_reg): Likewise.
* common/tdesc.h (tdesc_type_kind): Likewise.
(struct tdesc_type): Likewise.
(struct tdesc_feature): Likewise.
* regformats/regdat.sh: Create a feature.
* target-descriptions.c (tdesc_type_kind): Move from here.
(tdesc_type): Likewise.
(tdesc_type_up): Likewise.
(tdesc_feature): Likewise.
(tdesc_create_reg): Likewise.
2018-04-18 Alan Hayward <alan.hayward@arm.com>
* Makefile.in: Add arch/tdesc.c
* common/tdesc.c: New file.
* common/tdesc.h (tdesc_element_visitor): Move to here.
(tdesc_element): Likewise.
(tdesc_reg): Likewise.
(tdesc_reg_up): Likewise.
* regformats/regdef.h (reg): Add offset to constructors.
* target-descriptions.c (tdesc_element_visitor): Move from here.
(tdesc_element): Likewise.
(tdesc_reg): Likewise.
(tdesc_reg_up): Likewise.
2018-04-17 Tom Tromey <tom@tromey.com>
* dwarf2read.c (quirk_rust_enum): Conditionally drop the
discriminant field.
2018-04-17 Tom Tromey <tom@tromey.com>
* dwarf2read.c (quirk_rust_enum): Handle unions correctly.
Don't print symbol declaration's line number in rbreak output This commit: b744723f57 -- Show line numbers in output for "info var/func/type" adds the symbol declaration's line number to the output of certain GDB commands. It also (inadvertently) changes the `rbreak' command's output, like this: (gdb) rbreak foo Breakpoint 1 at 0x40049b: file rbreak.c, line 6. 4: static int foo1(void); Breakpoint 2 at 0x4004b1: file rbreak.c, line 12. 10: static int foo2(void); (gdb) where the function declaration is now prefixed by its source line number, followed by a colon. But without showing the declaration's file name, the line number is useless and can possibly cause severe confusion. No declaration line number was shown before. Instead, the function declaration started at the first column: (gdb) rbreak foo Breakpoint 1 at 0x40049b: file rbreak.c, line 6. static int foo1(void); Breakpoint 2 at 0x4004b1: file rbreak.c, line 12. static int foo2(void); (gdb) This old behavior is restored, fixing some FAILs in fullpath-expand.exp, realname-expand.exp, and pr10179.exp. In order to distinguish when to print location information, the meaning of print_symbol_info()'s parameter `last' is changed. Now NULL means to skip any filename or line number information. Previously NULL meant to always print the filename. gdb/ChangeLog: * symtab.c (print_symbol_info): Skip printing filename and line number when `last' is NULL. (symtab_symbol_info): Use empty string instead of NULL for first invocation of print_symbol_info. (rbreak_command): Pass NULL to `last' parameter of print_symbol_info.
2018-04-17 19:31:58 +02:00
2018-04-17 Andreas Arnez <arnez@linux.vnet.ibm.com>
* symtab.c (print_symbol_info): Skip printing filename and line
number when `last' is NULL.
(symtab_symbol_info): Use empty string instead of NULL for first
invocation of print_symbol_info.
(rbreak_command): Pass NULL to `last' parameter of
print_symbol_info.
2018-04-16 Simon Marchi <simon.marchi@ericsson.com>
* linux-tdep.c (linux_spu_make_corefile_notes): Return note_data
instead of nullptr.
2018-04-16 Pedro Alves <palves@redhat.com>
* MAINTAINERS (sh): Remove.
* Makefile.in (ALL_TARGET_OBS): Remove sh64-tdep.o.
(HFILES_NO_SRCDIR): Remove sh64-tdep.h.
(ALLDEPFILES): Remove sh64-tdep.c.
* NEWS: Mentions that support for SH-5/SH64 is removed.
* configure.tgt (sh*-*-linux*): Remove reference to sh64-tdep.o.
(sh*-*-openbsd*): Ditto.
(sh64-*-elf*): Remove.
(sh*): Remove.
* regcache.c (cooked_write_test): Remove bfd_mach_sh5 case.
* sh-linux-tdep.c: Remove reference to bfd_mach_sh5.
* sh-tdep.c: No longer include "sh64-tdep.h".
(sh_gdbarch_init): Remove reference to bfd_mach_sh5.
* sh64-tdep.c, sh64-tdep.h: Remove files.
2018-04-16 Pedro Alves <palves@redhat.com>
* MAINTAINERS: Remove m88k.
* Makefile.in (ALL_TARGET_OBS): Remove m88k-tdep.o.
(HFILES_NO_SRCDIR): Remove m88k-tdep.h.
(ALLDEPFILES): Remove m88k-bsd-nat.c and m88k-tdep.c.
* NEWS: Mention that support for m88k was removed.
* configure.host (m88*-*-*): Remove support.
* configure.nat (m88k-*-*): Remove support.
* configure.tgt (m88*-*-openbsd*): Remove.
* m88k-bsd-nat.c, m88k-tdep.c, m88k-tdep.h: Delete.
2018-04-15 Simon Marchi <simon.marchi@polymtl.ca>
* configure.tgt (x86_tobjs): New variable.
(amd64_tobjs, i386_tobjs): Use it.
Show line numbers in output for "info var/func/type" The GDB commands "info variables", "info functions", and "info types" show the appropriate list of definitions matching the given pattern. They also group them by source files. But no line numbers within these source files are shown. The line number information is particularly useful to the user when a simple "grep" doesn't readily point to a definition. This is often the case when the definition involves a macro, occurs within a namespace, or when the identifier appears very frequently in the source file. This patch enriches the printout of these commands by the line numbers and adjusts affected test cases to the changed output where necessary. The new output looks like this: (gdb) i variables All defined variables: File foo.c: 3: const char * const foo; 1: int x; The line number is followed by a colon and a tab character, which is then followed by the symbol definition. If no line number is available, the tab is printed out anyhow, so definitions line up. gdb/ChangeLog: * symtab.c (print_symbol_info): Precede the symbol definition by the line number when available. * NEWS: Advertise this enhancement. gdb/doc/ChangeLog: * gdb.texinfo (Symbols): Mention the fact that "info variables/functions/types" show source files and line numbers. gdb/testsuite/ChangeLog: * gdb.ada/info_types.exp: Adjust expected output to the line numbers now printed by "info var/func/type". * gdb.base/completion.exp: Likewise. * gdb.base/included.exp: Likewise. * gdb.cp/cp-relocate.exp: Likewise. * gdb.cp/cplusfuncs.exp: Likewise. * gdb.cp/namespace.exp: Likewise. * gdb.dwarf2/dw2-case-insensitive.exp: Likewise.
2018-04-13 19:26:05 +02:00
2018-04-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
* symtab.c (print_symbol_info): Precede the symbol definition by
the line number when available.
* NEWS: Advertise this enhancement.
btrace: set/show record btrace cpu Add new set/show commands to set the processor that is used for enabling errata workarounds when decoding branch trace. The general format is "<vendor>:<identifier>" but we also allow two special values "auto" and "none". The default is "auto", which is the current behaviour of having GDB determine the processor on which the trace was recorded. If that cpu is not known to the trace decoder, e.g. when using an old decoder on a new system, decode may fail with "unknown cpu". In most cases it should suffice to 'downgrade' decode to assume an older cpu. Unfortunately, we can't do this automatically. The other special value, "none", disables errata workarounds. gdb/ * NEWS (New options): announce set/show record btrace cpu. * btrace.c: Include record-btrace.h. (btrace_compute_ftrace_pt): Skip enabling errata workarounds if the vendor is unknown. (btrace_compute_ftrace_1): Add cpu parameter. Update callers. Maybe overwrite the btrace configuration's cpu. (btrace_compute_ftrace): Add cpu parameter. Update callers. (btrace_fetch): Add cpu parameter. Update callers. (btrace_maint_update_pt_packets): Call record_btrace_get_cpu. Maybe overwrite the btrace configuration's cpu. Skip enabling errata workarounds if the vendor is unknown. * python/py-record-btrace.c: Include record-btrace.h. (recpy_bt_begin, recpy_bt_end, recpy_bt_instruction_history) (recpy_bt_function_call_history): Call record_btrace_get_cpu. * record-btrace.c (record_btrace_cpu_state_kind): New. (record_btrace_cpu): New. (set_record_btrace_cpu_cmdlist): New. (record_btrace_get_cpu): New. (require_btrace_thread, record_btrace_info) (record_btrace_resume_thread): Call record_btrace_get_cpu. (cmd_set_record_btrace_cpu_none): New. (cmd_set_record_btrace_cpu_auto): New. (cmd_set_record_btrace_cpu): New. (cmd_show_record_btrace_cpu): New. (_initialize_record_btrace): Initialize set/show record btrace cpu commands. * record-btrace.h (record_btrace_get_cpu): New. testsuite/ * gdb.btrace/cpu.exp: New. doc/ * gdb.texinfo: Document set/show record btrace cpu.
2018-02-02 12:29:48 +01:00
2018-04-13 Markus Metzger <markus.t.metzger@intel.com>
* NEWS (New options): announce set/show record btrace cpu.
* btrace.c: Include record-btrace.h.
(btrace_compute_ftrace_pt): Skip enabling errata workarounds if
the vendor is unknown.
(btrace_compute_ftrace_1): Add cpu parameter. Update callers.
Maybe overwrite the btrace configuration's cpu.
(btrace_compute_ftrace): Add cpu parameter. Update callers.
(btrace_fetch): Add cpu parameter. Update callers.
(btrace_maint_update_pt_packets): Call record_btrace_get_cpu.
Maybe overwrite the btrace configuration's cpu. Skip enabling
errata workarounds if the vendor is unknown.
* python/py-record-btrace.c: Include record-btrace.h.
(recpy_bt_begin, recpy_bt_end, recpy_bt_instruction_history)
(recpy_bt_function_call_history): Call record_btrace_get_cpu.
* record-btrace.c (record_btrace_cpu_state_kind): New.
(record_btrace_cpu): New.
(set_record_btrace_cpu_cmdlist): New.
(record_btrace_get_cpu): New.
(require_btrace_thread, record_btrace_info)
(record_btrace_resume_thread): Call record_btrace_get_cpu.
(cmd_set_record_btrace_cpu_none): New.
(cmd_set_record_btrace_cpu_auto): New.
(cmd_set_record_btrace_cpu): New.
(cmd_show_record_btrace_cpu): New.
(_initialize_record_btrace): Initialize set/show record btrace cpu
commands.
* record-btrace.h (record_btrace_get_cpu): New.
2018-04-13 Markus Metzger <markus.t.metzger@intel.com>
* record.c (set_record_command): Fix typo in message.
2018-04-13 Markus Metzger <markus.t.metzger@intel.com>
* record-btrace.c (cmd_set_record_btrace): Print sub-commands.
infrun: step through indirect branch thunks With version 7.3 GCC supports new options -mindirect-branch=<choice> -mfunction-return=<choice> The choices are: keep behaves as before thunk jumps through a thunk thunk-external jumps through an external thunk thunk-inline jumps through an inlined thunk For thunk and thunk-external, GDB would, on a call to the thunk, step into the thunk and then resume to its caller assuming that this is an undebuggable function. On a return thunk, GDB would stop inside the thunk. Make GDB step through such thunks instead. Before: Temporary breakpoint 1, main () at gdb.base/step-indirect-call-thunk.c:37 37 x = apply (inc, 41); (gdb) s apply (op=0x80483e6 <inc>, x=41) at gdb.base/step-indirect-call-thunk.c:29 29 return op (x); (gdb) 30 } After: Temporary breakpoint 1, main () at gdb.base/step-indirect-call-thunk.c:37 37 x = apply (inc, 41); (gdb) s apply (op=0x80483e6 <inc>, x=41) at gdb.base/step-indirect-call-thunk.c:29 29 return op (x); (gdb) inc (x=41) at gdb.base/step-indirect-call-thunk.c:23 23 return x + 1; This is independent of the step-mode. In order to step into the thunk, you would need to use stepi. When stepping over an indirect call thunk, GDB would first step through the thunk, then recognize that it stepped into a sub-routine and resume to the caller (of the thunk). Not sure whether this is worth optimizing. Thunk detection is implemented via gdbarch. I implemented the methods for IA. Other architectures may run into unexpected fails. The tests assume a fixed number of instruction steps to reach a thunk. This depends on the compiler as well as the architecture. They may need adjustments when we add support for more architectures. Or we can simply drop those tests that cover being able to step into thunks using instruction stepping. When using an older GCC, the tests will fail to build and will be reported as untested: Running .../gdb.base/step-indirect-call-thunk.exp ... gdb compile failed, \ gcc: error: unrecognized command line option '-mindirect-branch=thunk' gcc: error: unrecognized command line option '-mfunction-return=thunk' === gdb Summary === # of untested testcases 1 gdb/ * infrun.c (process_event_stop_test): Call gdbarch_in_indirect_branch_thunk. * gdbarch.sh (in_indirect_branch_thunk): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * x86-tdep.h: New. * x86-tdep.c: New. * Makefile.in (ALL_TARGET_OBS): Add x86-tdep.o. (HFILES_NO_SRCDIR): Add x86-tdep.h. (ALLDEPFILES): Add x86-tdep.c. * arch-utils.h (default_in_indirect_branch_thunk): New. * arch-utils.c (default_in_indirect_branch_thunk): New. * i386-tdep: Include x86-tdep.h. (i386_in_indirect_branch_thunk): New. (i386_elf_init_abi): Set in_indirect_branch_thunk gdbarch function. * amd64-tdep: Include x86-tdep.h. (amd64_in_indirect_branch_thunk): New. (amd64_init_abi): Set in_indirect_branch_thunk gdbarch function. testsuite/ * gdb.base/step-indirect-call-thunk.exp: New. * gdb.base/step-indirect-call-thunk.c: New. * gdb.reverse/step-indirect-call-thunk.exp: New. * gdb.reverse/step-indirect-call-thunk.c: New.
2018-02-14 14:30:57 +01:00
2018-04-13 Markus Metzger <markus.t.metzger@intel.com>
* infrun.c (process_event_stop_test): Call
gdbarch_in_indirect_branch_thunk.
* gdbarch.sh (in_indirect_branch_thunk): New.
* gdbarch.c: Regenerated.
* gdbarch.h: Regenerated.
* x86-tdep.h: New.
* x86-tdep.c: New.
* Makefile.in (ALL_TARGET_OBS): Add x86-tdep.o.
(HFILES_NO_SRCDIR): Add x86-tdep.h.
(ALLDEPFILES): Add x86-tdep.c.
* arch-utils.h (default_in_indirect_branch_thunk): New.
* arch-utils.c (default_in_indirect_branch_thunk): New.
* i386-tdep: Include x86-tdep.h.
(i386_in_indirect_branch_thunk): New.
(i386_elf_init_abi): Set in_indirect_branch_thunk gdbarch
function.
* amd64-tdep: Include x86-tdep.h.
(amd64_in_indirect_branch_thunk): New.
(amd64_init_abi): Set in_indirect_branch_thunk gdbarch function.
Fix -D_GLIBCXX_DEBUG gdb-add-index regression Fedora Rawhide started to use -D_GLIBCXX_DEBUG which made gdb-add-index failing: gdb: Out-of-bounds vector access while running gdb-add-index https://bugzilla.redhat.com/show_bug.cgi?id=1540559 /usr/include/c++/7/debug/safe_iterator.h:270: Error: attempt to dereference a past-the-end iterator. Objects involved in the operation: iterator "this" @ 0x0x7fffffffcb90 { type = __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<unsigned char*, std::__cxx1998::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > >, std::__debug::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > > (mutable iterator); state = past-the-end; references sequence with type 'std::__debug::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > >' @ 0x0x7fffffffcc50 } /usr/include/c++/7/debug/vector:417: Error: attempt to subscript container with out-of-bounds index 556, but container only holds 556 elements. Objects involved in the operation: sequence "this" @ 0x0x2e87af8 { type = std::__debug::vector<partial_symbol*, std::allocator<partial_symbol*> >; } The two -D_GLIBCXX_DEBUG regressions were made by: commit bc8f2430e08cc2a520db49a42686e0529be4a3bc Author: Jan Kratochvil <jan.kratochvil@redhat.com> Date: Mon Jun 12 16:29:53 2017 +0100 Code cleanup: C++ify .gdb_index producer commit af5bf4ada48ff65b6658be1fab8f9c8f8ab5f319 Author: Simon Marchi <simon.marchi@ericsson.com> Date: Sat Oct 14 08:06:29 2017 -0400 Replace psymbol_allocation_list with std::vector gdb/ChangeLog 2018-04-12 Jan Kratochvil <jan.kratochvil@redhat.com> PR gdb/23053 * dwarf-index-write.c (data_buf::grow) (write_one_signatured_type) (recursively_write_psymbols) (debug_names::recursively_write_psymbols) (debug_names::write_one_signatured_type): Fix -D_GLIBCXX_DEBUG regression.
2018-04-12 22:31:39 +02:00
2018-04-12 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/23053
* dwarf-index-write.c (data_buf::grow) (write_one_signatured_type)
(recursively_write_psymbols) (debug_names::recursively_write_psymbols)
(debug_names::write_one_signatured_type): Fix -D_GLIBCXX_DEBUG
regression.
2018-04-12 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_print_struct_def): Remove univariant code.
(rust_evaluate_subexp): Likewise.
2018-04-12 Pedro Alves <palves@redhat.com>
* procfs.c (procfs_detach): Make forward declaration's prototype
match definition's protototype.
(proc_get_LDT_entry): Remove stale do_cleanups call.
2018-04-12 Pedro Alves <palves@redhat.com>
* target.h (target_ops::to_has_exited): Delete.
(target_has_exited): Delete.
* target-delegates.c: Regenerate.
File I/O file handles after target closes A future patch will propose making the remote target's target_ops be heap-allocated (to make it possible to have multiple instances of remote targets, for multiple simultaneous connections), and will delete/destroy the remote target at target_close time. That change trips on a latent problem, though. File I/O handles remain open even after the target is gone, with a dangling pointer to a target that no longer exists. This results in GDB crashing when it calls the target_ops backend associated with the file handle: (gdb) Disconnect Ending remote debugging. * GDB crashes deferencing a dangling pointer Backtrace: #0 0x00007f79338570a0 in main_arena () at /lib64/libc.so.6 #1 0x0000000000858bfe in target_fileio_close(int, int*) (fd=1, target_errno=0x7ffe0499a4c8) at src/gdb/target.c:2980 #2 0x00000000007088bd in gdb_bfd_iovec_fileio_close(bfd*, void*) (abfd=0x1a631b0, stream=0x223c9d0) at src/gdb/gdb_bfd.c:353 #3 0x0000000000930906 in opncls_bclose (abfd=0x1a631b0) at src/bfd/opncls.c:528 #4 0x0000000000930cf9 in bfd_close_all_done (abfd=0x1a631b0) at src/bfd/opncls.c:768 #5 0x0000000000930cb3 in bfd_close (abfd=0x1a631b0) at src/bfd/opncls.c:735 #6 0x0000000000708dc5 in gdb_bfd_close_or_warn(bfd*) (abfd=0x1a631b0) at src/gdb/gdb_bfd.c:511 #7 0x00000000007091a2 in gdb_bfd_unref(bfd*) (abfd=0x1a631b0) at src/gdb/gdb_bfd.c:615 #8 0x000000000079ed8e in objfile::~objfile() (this=0x2154730, __in_chrg=<optimized out>) at src/gdb/objfiles.c:682 #9 0x000000000079fd1a in objfile_purge_solibs() () at src/gdb/objfiles.c:1065 #10 0x00000000008162ca in no_shared_libraries(char const*, int) (ignored=0x0, from_tty=1) at src/gdb/solib.c:1251 #11 0x000000000073b89b in disconnect_command(char const*, int) (args=0x0, from_tty=1) at src/gdb/infcmd.c:3035 This goes unnoticed in current master, because the current remote target's target_ops is never destroyed nowadays, so we end up calling: remote_hostio_close -> remote_hostio_send_command which gracefully fails with FILEIO_ENOSYS if remote_desc is NULL (because the target is closed). Fix this by invalidating a target's file I/O handles when the target is closed. With this change, remote_hostio_send_command no longer needs to handle the case of being called with a closed remote target, originally added here: <https://sourceware.org/ml/gdb-patches/2008-08/msg00359.html>. gdb/ChangeLog: 2018-04-11 Pedro Alves <palves@redhat.com> * target.c (fileio_fh_t::t): Add comment. (target_fileio_pwrite, target_fileio_pread, target_fileio_fstat) (target_fileio_close): Handle a NULL target. (invalidate_fileio_fh): New. (target_close): Call it. * remote.c (remote_hostio_send_command): No longer check whether remote_desc is open.
2018-04-11 12:35:58 +02:00
2018-04-11 Pedro Alves <palves@redhat.com>
* target.c (fileio_fh_t::t): Add comment.
(target_fileio_pwrite, target_fileio_pread, target_fileio_fstat)
(target_fileio_close): Handle a NULL target.
(invalidate_fileio_fh): New.
(target_close): Call it.
* remote.c (remote_hostio_send_command): No longer check whether
remote_desc is open.
2018-04-11 Pedro Alves <palves@redhat.com>
* target.c (fileio_fh_t): Make it a named struct instead of a
typedef.
(fileio_fh_t::is_closed): New method.
(DEF_VEC_O (fileio_fh_t)): Remove.
(fileio_fhandles): Now a std::vector.
(is_closed_fileio_fh): Delete.
(acquire_fileio_fd): Adjust. Rename parameters.
(release_fileio_fd): Adjust.
(fileio_fd_to_fh): Reimplement as a function instead of a macro.
(target_fileio_pwrite, target_fileio_pread, target_fileio_fstat)
(target_fileio_close): Adjust.
2018-04-10 Simon Marchi <simon.marchi@ericsson.com>
* auto-load.c (auto_load_safe_path_vec_update): Iterate by
index.
2018-04-10 Pedro Alves <palves@redhat.com>
* gdbthread.h (finish_thread_state_cleanup): Delete declaration.
(scoped_finish_thread_state): New class.
* infcmd.c (run_command_1): Use it instead of finish_thread_state
cleanup.
* infrun.c (proceed, prepare_for_detach, wait_for_inferior)
(fetch_inferior_event, normal_stop): Likewise.
* thread.c (finish_thread_state_cleanup): Delete.
2018-04-09 Simon Marchi <simon.marchi@polymtl.ca>
Pedro Alves <palves@redhat.com>
* value.c: Include "selftest.h" and "common/array-view.h".
(struct range) <operator ==>: New.
(test_ranges_contain): New.
(check_ranges_vector): New.
(test_insert_into_bit_range_vector): New.
(_initialize_values): Register selftests.
* common/array-view.h (operator==, operator!=): New.
2018-04-09 Simon Marchi <simon.marchi@polymtl.ca>
* common/gdb_vecs.h (unordered_remove): Add overload that takes
an iterator.
* inline-frame.c: Include <algorithm>.
(struct inline_state): Add constructor.
(inline_state_s): Remove.
(DEF_VEC_O(inline_state_s)): Remove.
(inline_states): Change type to std::vector.
(find_inline_frame_state): Adjust to std::vector.
(allocate_inline_frame_state): Remove.
(clear_inline_frame_state): Adjust to std::vector.
(skip_inline_frames): Adjust to std::vector.
Remove VEC(tsv_s), use std::vector instead This patch removes VEC(tsv_s), using an std::vector instead. I C++ified trace_state_variable a bit in the process, using std::string for the name. I also thought it would be nicer to pass a const reference to target_download_trace_state_variable, since we know it will never be NULL. This highlighted that the make-target-delegates script didn't handle references well, so I adjusted this as well. It will surely be useful in the future. gdb/ChangeLog: * tracepoint.h (struct trace_state_variable): Add constructor. <name>: Change type to std::string. * tracepoint.c (tsv_s): Remove. (DEF_VEC_O(tsv_s)): Remove. (tvariables): Change to std::vector. (create_trace_state_variable): Adjust to std::vector. (find_trace_state_variable): Likewise. (find_trace_state_variable_by_number): Likewise. (delete_trace_state_variable): Likewise. (trace_variable_command): Adjust to std::string. (delete_trace_variable_command): Likewise. (tvariables_info_1): Adjust to std::vector. (save_trace_state_variables): Likewise. (start_tracing): Likewise. (merge_uploaded_trace_state_variables): Adjust to std::vector and std::string. * target.h (struct target_ops) <to_download_trace_state_variable>: Pass reference to trace_state_variable. * target-debug.h (target_debug_print_const_trace_state_variable_r): New. * target-delegates.c: Re-generate. * mi/mi-interp.c (mi_tsv_created): Adjust to std::string. (mi_tsv_deleted): Likewise. * mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise. * remote.c (remote_download_trace_state_variable): Change pointer to reference and adjust. * make-target-delegates (parse_argtypes): Handle references. (write_function_header): Likewise. (munge_type): Likewise.
2018-04-09 21:16:19 +02:00
2018-04-09 Simon Marchi <simon.marchi@polymtl.ca>
* tracepoint.h (struct trace_state_variable): Add constructor.
<name>: Change type to std::string.
* tracepoint.c (tsv_s): Remove.
(DEF_VEC_O(tsv_s)): Remove.
(tvariables): Change to std::vector.
(create_trace_state_variable): Adjust to std::vector.
(find_trace_state_variable): Likewise.
(find_trace_state_variable_by_number): Likewise.
(delete_trace_state_variable): Likewise.
(trace_variable_command): Adjust to std::string.
(delete_trace_variable_command): Likewise.
(tvariables_info_1): Adjust to std::vector.
(save_trace_state_variables): Likewise.
(start_tracing): Likewise.
(merge_uploaded_trace_state_variables): Adjust to std::vector
and std::string.
* target.h (struct target_ops)
<to_download_trace_state_variable>: Pass reference to
trace_state_variable.
* target-debug.h (target_debug_print_const_trace_state_variable_r): New.
* target-delegates.c: Re-generate.
* mi/mi-interp.c (mi_tsv_created): Adjust to std::string.
(mi_tsv_deleted): Likewise.
* mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise.
* remote.c (remote_download_trace_state_variable): Change
pointer to reference and adjust.
* make-target-delegates (parse_argtypes): Handle references.
(write_function_header): Likewise.
(munge_type): Likewise.
Adapt and integrate string_view tests The previous patch copied the string_view tests from libstdc++. This patch adjusts them in a similar way that the libstdc++ optional tests are integrated in our unit test suite. Not all tests are used, some of them require language features not present in c++11. For example, we can't use a string_view constructor where the length is not explicit in a constexpr, because std::char_traits::length is not a constexpr itself (it is in c++17 though). Nevertheless, a good number of tests are integrated, which covers pretty well the string_view features. gdb/ChangeLog: * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add string_view-selftests.c. * unittests/basic_string_view/capacity/1.cc: Adapt to GDB testsuite. * unittests/basic_string_view/cons/char/1.cc: Likewise. * unittests/basic_string_view/cons/char/2.cc: Likewise. * unittests/basic_string_view/cons/char/3.cc: Likewise. * unittests/basic_string_view/element_access/char/1.cc: Likewise. * unittests/basic_string_view/element_access/char/empty.cc: Likewise. * unittests/basic_string_view/element_access/char/front_back.cc: Likewise. * unittests/basic_string_view/inserters/char/2.cc: Likewise. * unittests/basic_string_view/modifiers/remove_prefix/char/1.cc: Likewise. * unittests/basic_string_view/modifiers/remove_suffix/char/1.cc: Likewise. * unittests/basic_string_view/modifiers/swap/char/1.cc: Likewise. * unittests/basic_string_view/operations/compare/char/1.cc: Likewise. * unittests/basic_string_view/operations/compare/char/13650.cc: Likewise. * unittests/basic_string_view/operations/copy/char/1.cc: Likewise. * unittests/basic_string_view/operations/data/char/1.cc: Likewise. * unittests/basic_string_view/operations/find/char/1.cc: Likewise. * unittests/basic_string_view/operations/find/char/2.cc: Likewise. * unittests/basic_string_view/operations/find/char/3.cc: Likewise. * unittests/basic_string_view/operations/find/char/4.cc: Likewise. * unittests/basic_string_view/operations/rfind/char/1.cc: Likewise. * unittests/basic_string_view/operations/rfind/char/2.cc: Likewise. * unittests/basic_string_view/operations/rfind/char/3.cc: Likewise. * unittests/basic_string_view/operations/substr/char/1.cc: Likewise. * unittests/basic_string_view/operators/char/2.cc: Likewise. * unittests/string_view-selftests.c: New file.
2018-04-09 19:31:06 +02:00
2018-04-09 Simon Marchi <simon.marchi@polymtl.ca>
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
string_view-selftests.c.
* unittests/basic_string_view/capacity/1.cc: Adapt to GDB
testsuite.
* unittests/basic_string_view/cons/char/1.cc: Likewise.
* unittests/basic_string_view/cons/char/2.cc: Likewise.
* unittests/basic_string_view/cons/char/3.cc: Likewise.
* unittests/basic_string_view/element_access/char/1.cc:
Likewise.
* unittests/basic_string_view/element_access/char/empty.cc:
Likewise.
* unittests/basic_string_view/element_access/char/front_back.cc:
Likewise.
* unittests/basic_string_view/inserters/char/2.cc: Likewise.
* unittests/basic_string_view/modifiers/remove_prefix/char/1.cc:
Likewise.
* unittests/basic_string_view/modifiers/remove_suffix/char/1.cc:
Likewise.
* unittests/basic_string_view/modifiers/swap/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/compare/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/compare/char/13650.cc:
Likewise.
* unittests/basic_string_view/operations/copy/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/data/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/find/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/find/char/2.cc:
Likewise.
* unittests/basic_string_view/operations/find/char/3.cc:
Likewise.
* unittests/basic_string_view/operations/find/char/4.cc:
Likewise.
* unittests/basic_string_view/operations/rfind/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/rfind/char/2.cc:
Likewise.
* unittests/basic_string_view/operations/rfind/char/3.cc:
Likewise.
* unittests/basic_string_view/operations/substr/char/1.cc:
Likewise.
* unittests/basic_string_view/operators/char/2.cc: Likewise.
* unittests/string_view-selftests.c: New file.
Copy string_view tests from libstdc++ This patch copies the string_view tests from the gcc repository (commit 02a4441f002c). ${gcc}/libstdc++-v3/testsuite/21_strings/basic_string_view -> ${binutils-gdb}/gdb/unittests/basic_string_view The local modifications are done in the following patch, so that it's easier to review them. gdb/ChangeLog: * unittests/basic_string_view/capacity/1.cc: New file. * unittests/basic_string_view/capacity/empty_neg.cc: New file. * unittests/basic_string_view/cons/char/1.cc: New file. * unittests/basic_string_view/cons/char/2.cc: New file. * unittests/basic_string_view/cons/char/3.cc: New file. * unittests/basic_string_view/cons/wchar_t/1.cc: New file. * unittests/basic_string_view/cons/wchar_t/2.cc: New file. * unittests/basic_string_view/cons/wchar_t/3.cc: New file. * unittests/basic_string_view/element_access/char/1.cc: New file. * unittests/basic_string_view/element_access/char/2.cc: New file. * unittests/basic_string_view/element_access/char/empty.cc: New file. * unittests/basic_string_view/element_access/char/front_back.cc: New file. * unittests/basic_string_view/element_access/wchar_t/1.cc: New file. * unittests/basic_string_view/element_access/wchar_t/2.cc: New file. * unittests/basic_string_view/element_access/wchar_t/empty.cc: New file. * unittests/basic_string_view/element_access/wchar_t/front_back.cc: New file. * unittests/basic_string_view/include.cc: New file. * unittests/basic_string_view/inserters/char/1.cc: New file. * unittests/basic_string_view/inserters/char/2.cc: New file. * unittests/basic_string_view/inserters/char/3.cc: New file. * unittests/basic_string_view/inserters/pod/10081-out.cc: New file. * unittests/basic_string_view/inserters/wchar_t/1.cc: New file. * unittests/basic_string_view/inserters/wchar_t/2.cc: New file. * unittests/basic_string_view/inserters/wchar_t/3.cc: New file. * unittests/basic_string_view/literals/types.cc: New file. * unittests/basic_string_view/literals/values.cc: New file. * unittests/basic_string_view/modifiers/remove_prefix/char/1.cc: New file. * unittests/basic_string_view/modifiers/remove_prefix/wchar_t/1.cc: New file. * unittests/basic_string_view/modifiers/remove_suffix/char/1.cc: New file. * unittests/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc: New file. * unittests/basic_string_view/modifiers/swap/char/1.cc: New file. * unittests/basic_string_view/modifiers/swap/wchar_t/1.cc: New file. * unittests/basic_string_view/operations/compare/char/1.cc: New file. * unittests/basic_string_view/operations/compare/char/13650.cc: New file. * unittests/basic_string_view/operations/compare/char/2.cc: New file. * unittests/basic_string_view/operations/compare/char/70483.cc: New file. * unittests/basic_string_view/operations/compare/wchar_t/1.cc: New file. * unittests/basic_string_view/operations/compare/wchar_t/13650.cc: New file. * unittests/basic_string_view/operations/compare/wchar_t/2.cc: New file. * unittests/basic_string_view/operations/copy/char/1.cc: New file. * unittests/basic_string_view/operations/copy/wchar_t/1.cc: New file. * unittests/basic_string_view/operations/data/char/1.cc: New file. * unittests/basic_string_view/operations/data/wchar_t/1.cc: New file. * unittests/basic_string_view/operations/find/char/1.cc: New file. * unittests/basic_string_view/operations/find/char/2.cc: New file. * unittests/basic_string_view/operations/find/char/3.cc: New file. * unittests/basic_string_view/operations/find/char/4.cc: New file. * unittests/basic_string_view/operations/find/wchar_t/1.cc: New file. * unittests/basic_string_view/operations/find/wchar_t/2.cc: New file. * unittests/basic_string_view/operations/find/wchar_t/3.cc: New file. * unittests/basic_string_view/operations/find/wchar_t/4.cc: New file. * unittests/basic_string_view/operations/rfind/char/1.cc: New file. * unittests/basic_string_view/operations/rfind/char/2.cc: New file. * unittests/basic_string_view/operations/rfind/char/3.cc: New file. * unittests/basic_string_view/operations/rfind/wchar_t/1.cc: New file. * unittests/basic_string_view/operations/rfind/wchar_t/2.cc: New file. * unittests/basic_string_view/operations/rfind/wchar_t/3.cc: New file. * unittests/basic_string_view/operations/string_conversion/1.cc: New file. * unittests/basic_string_view/operations/substr/char/1.cc: New file. * unittests/basic_string_view/operations/substr/wchar_t/1.cc: New file. * unittests/basic_string_view/operators/char/2.cc: New file. * unittests/basic_string_view/operators/wchar_t/2.cc: New file. * unittests/basic_string_view/range_access/char/1.cc: New file. * unittests/basic_string_view/range_access/wchar_t/1.cc: New file. * unittests/basic_string_view/requirements/explicit_instantiation/1.cc: New file. * unittests/basic_string_view/requirements/explicit_instantiation/char/1.cc: New file. * unittests/basic_string_view/requirements/explicit_instantiation/char16_t/1.cc: New file. * unittests/basic_string_view/requirements/explicit_instantiation/char32_t/1.cc: New file. * unittests/basic_string_view/requirements/explicit_instantiation/wchar_t/1.cc: New file. * unittests/basic_string_view/requirements/typedefs.cc: New file. * unittests/basic_string_view/typedefs.cc: New file. * unittests/basic_string_view/types/1.cc: New file.
2018-04-09 19:31:05 +02:00
2018-04-09 Simon Marchi <simon.marchi@polymtl.ca>
* unittests/basic_string_view/capacity/1.cc: New file.
* unittests/basic_string_view/capacity/empty_neg.cc: New file.
* unittests/basic_string_view/cons/char/1.cc: New file.
* unittests/basic_string_view/cons/char/2.cc: New file.
* unittests/basic_string_view/cons/char/3.cc: New file.
* unittests/basic_string_view/cons/wchar_t/1.cc: New file.
* unittests/basic_string_view/cons/wchar_t/2.cc: New file.
* unittests/basic_string_view/cons/wchar_t/3.cc: New file.
* unittests/basic_string_view/element_access/char/1.cc: New file.
* unittests/basic_string_view/element_access/char/2.cc: New file.
* unittests/basic_string_view/element_access/char/empty.cc: New file.
* unittests/basic_string_view/element_access/char/front_back.cc: New file.
* unittests/basic_string_view/element_access/wchar_t/1.cc: New file.
* unittests/basic_string_view/element_access/wchar_t/2.cc: New file.
* unittests/basic_string_view/element_access/wchar_t/empty.cc: New file.
* unittests/basic_string_view/element_access/wchar_t/front_back.cc: New file.
* unittests/basic_string_view/include.cc: New file.
* unittests/basic_string_view/inserters/char/1.cc: New file.
* unittests/basic_string_view/inserters/char/2.cc: New file.
* unittests/basic_string_view/inserters/char/3.cc: New file.
* unittests/basic_string_view/inserters/pod/10081-out.cc: New file.
* unittests/basic_string_view/inserters/wchar_t/1.cc: New file.
* unittests/basic_string_view/inserters/wchar_t/2.cc: New file.
* unittests/basic_string_view/inserters/wchar_t/3.cc: New file.
* unittests/basic_string_view/literals/types.cc: New file.
* unittests/basic_string_view/literals/values.cc: New file.
* unittests/basic_string_view/modifiers/remove_prefix/char/1.cc: New file.
* unittests/basic_string_view/modifiers/remove_prefix/wchar_t/1.cc: New file.
* unittests/basic_string_view/modifiers/remove_suffix/char/1.cc: New file.
* unittests/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc: New file.
* unittests/basic_string_view/modifiers/swap/char/1.cc: New file.
* unittests/basic_string_view/modifiers/swap/wchar_t/1.cc: New file.
* unittests/basic_string_view/operations/compare/char/1.cc: New file.
* unittests/basic_string_view/operations/compare/char/13650.cc: New file.
* unittests/basic_string_view/operations/compare/char/2.cc: New file.
* unittests/basic_string_view/operations/compare/char/70483.cc: New file.
* unittests/basic_string_view/operations/compare/wchar_t/1.cc: New file.
* unittests/basic_string_view/operations/compare/wchar_t/13650.cc: New file.
* unittests/basic_string_view/operations/compare/wchar_t/2.cc: New file.
* unittests/basic_string_view/operations/copy/char/1.cc: New file.
* unittests/basic_string_view/operations/copy/wchar_t/1.cc: New file.
* unittests/basic_string_view/operations/data/char/1.cc: New file.
* unittests/basic_string_view/operations/data/wchar_t/1.cc: New file.
* unittests/basic_string_view/operations/find/char/1.cc: New file.
* unittests/basic_string_view/operations/find/char/2.cc: New file.
* unittests/basic_string_view/operations/find/char/3.cc: New file.
* unittests/basic_string_view/operations/find/char/4.cc: New file.
* unittests/basic_string_view/operations/find/wchar_t/1.cc: New file.
* unittests/basic_string_view/operations/find/wchar_t/2.cc: New file.
* unittests/basic_string_view/operations/find/wchar_t/3.cc: New file.
* unittests/basic_string_view/operations/find/wchar_t/4.cc: New file.
* unittests/basic_string_view/operations/rfind/char/1.cc: New file.
* unittests/basic_string_view/operations/rfind/char/2.cc: New file.
* unittests/basic_string_view/operations/rfind/char/3.cc: New file.
* unittests/basic_string_view/operations/rfind/wchar_t/1.cc: New file.
* unittests/basic_string_view/operations/rfind/wchar_t/2.cc: New file.
* unittests/basic_string_view/operations/rfind/wchar_t/3.cc: New file.
* unittests/basic_string_view/operations/string_conversion/1.cc: New file.
* unittests/basic_string_view/operations/substr/char/1.cc: New file.
* unittests/basic_string_view/operations/substr/wchar_t/1.cc: New file.
* unittests/basic_string_view/operators/char/2.cc: New file.
* unittests/basic_string_view/operators/wchar_t/2.cc: New file.
* unittests/basic_string_view/range_access/char/1.cc: New file.
* unittests/basic_string_view/range_access/wchar_t/1.cc: New file.
* unittests/basic_string_view/requirements/explicit_instantiation/1.cc: New file.
* unittests/basic_string_view/requirements/explicit_instantiation/char/1.cc: New file.
* unittests/basic_string_view/requirements/explicit_instantiation/char16_t/1.cc: New file.
* unittests/basic_string_view/requirements/explicit_instantiation/char32_t/1.cc: New file.
* unittests/basic_string_view/requirements/explicit_instantiation/wchar_t/1.cc: New file.
* unittests/basic_string_view/requirements/typedefs.cc: New file.
* unittests/basic_string_view/typedefs.cc: New file.
* unittests/basic_string_view/types/1.cc: New file.
Add gdb::string_view We had a few times the need for a data structure that does essentially what C++17's std::string_view does, which is to give an std::string-like interface (only the read-only operations) to an arbitrary character buffer. This patch adapts the files copied from libstdc++ by the previous patch to integrate them with GDB. Here's a summary of the changes: * Remove things related to wstring_view, u16string_view and u32string_view (I don't think we need them, but we can always add them later). * Remove usages of _GLIBCXX_BEGIN_NAMESPACE_VERSION and _GLIBCXX_END_NAMESPACE_VERSION. * Put the code in the gdb namespace. I had to add a few "std::" in front of std type usages. * Change __throw_out_of_range_fmt() for error(). * Make gdb::string_view an alias of std::string_view when building with >= c++17. * Remove a bunch of constexpr, because they are not valid in c++11 (e.g. they are not a single return line). * Use std::common_type<_Tp>::type instead of std::common_type_t<_Tp>, because c++11 doesn't have the later. * Remove the #pragma GCC system_header, since that silences some warnings that we might want to have if we're doing something not correctly. * Remove operator ""sv. It would need a lot of work to make all supported compilers happy, and we can easily live without it. * Remove operator<<. It is implemented using __ostream_insert (a libstdc++ internal). Bringing it in might be possible, but I don't think that would be worth the effort, since we don't really use streams at the moment. * Replace internal libstdc++ asserts ( __glibcxx_assert and __glibcxx_requires_string_len) with gdb_assert. * Remove hash helpers, because they use libstdc++ internal functions. If we need them we always import them later. The string_view class in cli/cli-script.c is removed and its usage replaced with the new gdb::string_view. gdb/ChangeLog: * common/gdb_string_view.h: Remove libstdc++ implementation details, adjust to gdb reality. * common/gdb_string_view.tcc: Likewise. * cli/cli-script.c (struct string_view): Remove. (user_args) <m_args>: Change element type to gdb::string_view. (user_args::insert_args): Adjust.
2018-04-09 19:31:04 +02:00
2018-04-09 Simon Marchi <simon.marchi@polymtl.ca>
* common/gdb_string_view.h: Remove libstdc++ implementation
details, adjust to gdb reality.
* common/gdb_string_view.tcc: Likewise.
* cli/cli-script.c (struct string_view): Remove.
(user_args) <m_args>: Change element type to gdb::string_view.
(user_args::insert_args): Adjust.
2018-04-09 Simon Marchi <simon.marchi@polymtl.ca>
* common/gdb_string_view.h: New file.
* common/gdb_string_view.tcc: New file.
2018-04-09 Simon Marchi <simon.marchi@polymtl.ca>
* ax_cxx_compile_stdcxx.m4: Sync with upstream.
* configure: Re-generate.
2018-04-09 Pedro Alves <palves@redhat.com>
* gdbarch.sh: Include "observable.h" instead of "observer.h".
(set_target_gdbarch): Call
gdb::observers::architecture_changed.notify instead of
observer_notify_architecture_changed.
2018-04-07 Simon Marchi <simon.marchi@polymtl.ca>
* tracepoint.c (struct current_traceframe_cleanup): Remove.
(do_restore_current_traceframe_cleanup): Remove.
(restore_current_traceframe_cleanup_dtor): Remove.
(make_cleanup_restore_current_traceframe): Remove.
(scoped_restore_current_traceframe::scoped_restore_current_traceframe):
New.
* tracepoint.h (struct scoped_restore_current_traceframe): New.
* infrun.c (fetch_inferior_event): Use
scoped_restore_current_traceframe.
2018-04-07 Simon Marchi <simon.marchi@polymtl.ca>
* dwarf2read.h (struct dwarf2_per_objfile) <n_type_units>:
Remove.
<n_allocated_type_units>: Remove.
<all_type_units>: Change to std::vector.
* dwarf2read.c (dwarf2_per_objfile::~dwarf2_per_objfile): Adjust
to std::vector change.
(dwarf2_per_objfile::get_cutu): Likewise.
(dwarf2_per_objfile::get_tu): Likewise.
(create_signatured_type_table_from_index): Likewise.
(create_signatured_type_table_from_debug_names): Likewise.
(dw2_symtab_iter_next): Likewise.
(dw2_print_stats): Likewise.
(dw2_expand_all_symtabs): Likewise.
(dw2_expand_marked_cus): Likewise.
(dw2_debug_names_iterator::next): Likewise.
(dwarf2_initialize_objfile): Likewise.
(add_signatured_type_cu_to_table): Likewise.
(create_all_type_units): Likewise.
(add_type_unit): Likewise.
(struct tu_abbrev_offset): Add constructor.
(build_type_psymtabs_1): Adjust to std::vector change.
(print_tu_stats): Likewise.
* dwarf-index-write.c (check_dwarf64_offsets): Likewise.
(write_debug_names): Likewise.
Make dwarf2_per_objfile::all_comp_units an std::vector Make all_comp_units an std::vector, remove n_comp_units and some manual memory management. gdb/ChangeLog: * dwarf2read.h (struct dwarf2_per_objfile) <all_comp_units>: Likewise. Make an std::vector. <n_comp_units>: Remove. * dwarf2read.c (dwarf2_per_objfile::~dwarf2_per_objfile): Adjust to std::vector change. (dwarf2_per_objfile::get_cutu): Likewise. (dwarf2_per_objfile::get_cu): Likewise. (create_cus_from_index): Likewise. (create_addrmap_from_index): Likewise. (create_addrmap_from_aranges): Likewise. (dwarf2_read_index): Likewise. (dw2_find_last_source_symtab): Likewise. (dw2_map_symtabs_matching_filename): Likewise. (dw2_symtab_iter_next): Likewise. (dw2_print_stats): Likewise. (dw2_expand_all_symtabs): Likewise. (dw2_expand_symtabs_with_fullname): Likewise. (dw2_expand_marked_cus): Likewise. (dw2_map_symbol_filenames): Likewise. (create_cus_from_debug_names): Likewise. (dwarf2_read_debug_names): Likewise. (dw2_debug_names_iterator::next): Likewise. (dwarf2_initialize_objfile): Likewise. (set_partial_user): Likewise. (dwarf2_build_psymtabs_hard): Likewise. (read_comp_units_from_section): Remove arguments, adjust to std::vector change. (create_all_comp_units): Adjust to std::vector and read_comp_units_from_section changes. (dwarf2_find_containing_comp_unit): Adjust to std::vector change. * dwarf-index-write.c (check_dwarf64_offsets): Likewise. (psyms_seen_size): Likewise. (write_gdbindex): Likewise. (write_debug_names): Likewise.
2018-04-07 19:53:43 +02:00
2018-04-07 Simon Marchi <simon.marchi@polymtl.ca>
* dwarf2read.h (struct dwarf2_per_objfile) <all_comp_units>: Likewise.
Make an std::vector.
<n_comp_units>: Remove.
* dwarf2read.c (dwarf2_per_objfile::~dwarf2_per_objfile): Adjust
to std::vector change.
(dwarf2_per_objfile::get_cutu): Likewise.
(dwarf2_per_objfile::get_cu): Likewise.
(create_cus_from_index): Likewise.
(create_addrmap_from_index): Likewise.
(create_addrmap_from_aranges): Likewise.
(dwarf2_read_index): Likewise.
(dw2_find_last_source_symtab): Likewise.
(dw2_map_symtabs_matching_filename): Likewise.
(dw2_symtab_iter_next): Likewise.
(dw2_print_stats): Likewise.
(dw2_expand_all_symtabs): Likewise.
(dw2_expand_symtabs_with_fullname): Likewise.
(dw2_expand_marked_cus): Likewise.
(dw2_map_symbol_filenames): Likewise.
(create_cus_from_debug_names): Likewise.
(dwarf2_read_debug_names): Likewise.
(dw2_debug_names_iterator::next): Likewise.
(dwarf2_initialize_objfile): Likewise.
(set_partial_user): Likewise.
(dwarf2_build_psymtabs_hard): Likewise.
(read_comp_units_from_section): Remove arguments, adjust to
std::vector change.
(create_all_comp_units): Adjust to std::vector and
read_comp_units_from_section changes.
(dwarf2_find_containing_comp_unit): Adjust to std::vector
change.
* dwarf-index-write.c (check_dwarf64_offsets): Likewise.
(psyms_seen_size): Likewise.
(write_gdbindex): Likewise.
(write_debug_names): Likewise.
2018-04-07 Simon Marchi <simon.marchi@polymtl.ca>
* dwarf2read.c (create_cus_from_index_list): Replace objfile arg
with dwarf2_per_objfile.
(create_cus_from_index): Likewise.
(create_signatured_type_table_from_index): Likewise.
(dwarf2_read_index): Likewise.
(dwarf2_initialize_objfile): Likewise.
(dwarf2_fetch_die_loc_sect_off): Get dwarf2_per_objfile from
per_cu rather than get_dwarf2_per_objfile.
2018-04-07 Simon Marchi <simon.marchi@polymtl.ca>
* dwarf2read.h (struct signatured_type): Forward declare.
(struct dwarf2_per_objfile) <get_cutu, get_cu, get_tu>:
New methods.
* dwarf2read.c (dwarf2_per_objfile::get_cutu): Rename from...
(dw2_get_cutu): ...this.
(dwarf2_per_objfile::get_cu): Rename from...
(dw2_get_cu): ...this.
(dwarf2_per_objfile::get_tu): New.
(create_addrmap_from_index): Adjust.
(create_addrmap_from_aranges): Adjust.
(dw2_find_last_source_symtab): Adjust.
(dw2_map_symtabs_matching_filename): Adjust.
(dw2_symtab_iter_next): Adjust.
(dw2_print_stats): Adjust.
(dw2_expand_all_symtabs): Adjust.
(dw2_expand_symtabs_with_fullname): Adjust.
(dw2_expand_marked_cus): Adjust.
(dw_expand_symtabs_matching_file_matcher): Adjust.
(dw2_map_symbol_filenames): Adjust.
(dw2_debug_names_iterator::next): Adjust.
(dwarf2_initialize_objfile): Adjust.
(set_partial_user): Adjust.
(dwarf2_build_psymtabs_hard): Adjust.
2018-04-07 Simon Marchi <simon.marchi@polymtl.ca>
* dwarf2read.c (create_signatured_type_table_from_debug_names):
Remove unused variables.
(dw2_map_symtabs_matching_filename): Likewise.
(dwarf2_record_block_ranges): Likewise.
(dwarf2_read_addr_index): Likewise.
(follow_die_offset): Likewise.
Defer breakpoint reset when cloning progspace for fork child Using this simple test: static void break_here () { } int main (int argc, char *argv[]) { fork (); break_here(); return 0; } compiled as a PIE: $ gcc test.c -g3 -O0 -o test -pie and running this: $ ./gdb -nx -q --data-directory=data-directory ./test -ex "b break_here" -ex "set detach-on-fork off" -ex r gives: Warning: Cannot insert breakpoint 1. Cannot access memory at address 0x64a Note that GDB might get stopped by SIGTTOU because of this issue: https://sourceware.org/bugzilla/show_bug.cgi?id=23020 In that case, just use "fg" to continue. This issue happens only with position-independent executables. Adding the main objfile for the new inferior (the fork child) causes GDB to try to reset the breakpoints. However, that new objfile has not been relocated yet. So the breakpoint on "break_here" resolves to an unrelocated address, from which we are trying to read/write to set a breakpoint. Passing SYMFILE_DEFER_BP_RESET avoids that problem. The executable is relocated just after, in the follow_fork_inferior function. The buildbot seems happy with this patch. I don't think it's necessary to add a new test. Just changing this made many tests go from FAIL to PASS on my machine, where gcc produces PIE executables by default. If anything, I think we would need to add a board file that produces position-independent executables, so that we can run all the tests with PIE, even on machines where that is not the default. gdb/ChangeLog: * progspace.c (clone_program_space): Pass SYMFILE_DEFER_BP_RESET to symbol_file_add_main.
2018-04-07 19:51:59 +02:00
2018-04-07 Simon Marchi <simon.marchi@polymtl.ca>
* progspace.c (clone_program_space): Pass SYMFILE_DEFER_BP_RESET
to symbol_file_add_main.
Implement write_async_safe for mi_console_file (PR 22299) Enabling "set debug lin-lwp 1" with the MI interpreter doesn't work. When the sigchld_handler function wants to print a debug output ("sigchld\n"), it uses ui_file_write_async_safe. This ends up in the default implementation of ui_file::write_async_safe, which aborts GDB. This patch implements the write_async_safe method for mi_console_file. The "normal" MI output is line buffered, which means the output accumulates in m_buffer until a \n is written, at which point it's flushed in m_raw. The implementation of write_async_safe provided by this patch bypasses this buffer and writes directly to m_raw. There are two reasons for this: (1) Appending to m_buffer (therefore to an std::string) is probably not async-safe, as it may allocate memory. (2) We may have a partial output already in m_buffer, so that would lead to some nested MI output, not so great. There is probably still a chance to have bad MI output, if sigchld_handler is invoked in the middle of mi_console_file's flush, and the line being flushed is only partially sent to m_raw. The solution would probably be to block signals during flushing. Since this is only used for debug output, I don't know if it's worth the effort to do that. To implement write_async_safe, I needed to use the fputstrn_unfiltered, which does the necessary escaping (e.g. replace \n with \\n). I started by adding printchar's callback parameters to fputstrn_unfiltered, to be able to pass async-safe versions of them. It's not easy to provide an async-safe version of do_fprintf, but it turns out that we can easily replace printchar's callbacks with a single do_fputc quite easily. The async-safe version of do_fputc simply calls the underlying ui_file's write_async_safe method. gdb/ChangeLog: PR mi/22299 * mi/mi-console.c (do_fputc_async_safe): New. (mi_console_file::write_async_safe): New. (mi_console_file::flush): Adjust calls to fputstrn_unfiltered. * mi/mi-console.h (class mi_console_file) <write_async_safe>: New. * ui-file.c (ui_file::putstrn): Adjust call to fputstrn_unfiltered. * utils.c (printchar): Replace do_fputs and do_fprintf parameters by do_fputc. (fputstr_filtered): Adjust call to printchar. (fputstr_unfiltered): Likewise. (fputstrn_filtered): Likewise. (fputstrn_unfiltered): Add do_fputc parameter, pass to printchar. * utils.h (do_fputc_ftype): New typedef. (fputstrn_unfiltered): Add do_fputc parameter.
2018-04-07 19:48:05 +02:00
2018-04-07 Simon Marchi <simon.marchi@polymtl.ca>
PR mi/22299
* mi/mi-console.c (do_fputc_async_safe): New.
(mi_console_file::write_async_safe): New.
(mi_console_file::flush): Adjust calls to fputstrn_unfiltered.
* mi/mi-console.h (class mi_console_file) <write_async_safe>:
New.
* ui-file.c (ui_file::putstrn): Adjust call to
fputstrn_unfiltered.
* utils.c (printchar): Replace do_fputs and do_fprintf
parameters by do_fputc.
(fputstr_filtered): Adjust call to printchar.
(fputstr_unfiltered): Likewise.
(fputstrn_filtered): Likewise.
(fputstrn_unfiltered): Add do_fputc parameter, pass to
printchar.
* utils.h (do_fputc_ftype): New typedef.
(fputstrn_unfiltered): Add do_fputc parameter.
2018-04-07 Simon Marchi <simon.marchi@polymtl.ca>
* regformats/i386/i386-avx.dat: Remove.
Fix generation of x86-64 gdbarch with osabi none (PR 22979) When a 64-bits (x86-64) gdbarch is created, it is first born as a 32-bits gdbarch in i386_gdbarch_init. The call gdbarch_init_osabi will call the handler register for the selected (arch, osabi) pair, such as amd64_linux_init_abi. The various amd64 handlers call amd64_init_abi, which turns the gdbarch into a 64-bits one. When selecting the i386:x86-64 architecture with no osabi, no such handler is ever called, so the gdbarch stays (wrongfully) a 32-bits one. My first idea was to manually call amd64_init_abi & al in i386_gdbarch_init when the osabi is GDB_OSABI_NONE. However, this doesn't work in a build of GDB where i386 is included as a target but not amd64. My next option (implemented in this patch), is to allow registering handlers for GDB_OSABI_NONE. I added two such handlers in amd64-tdep.c, so now it works the same as for the "normal" osabis. It required re-ordering things in gdbarch_init_osabi to allow running handlers for GDB_OSABI_NONE. Without this patch applied (but with the previous one*) : (gdb) set osabi none (gdb) set architecture i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) p sizeof(void*) $1 = 4 and now: (gdb) set osabi none (gdb) set architecture i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) p sizeof(void*) $1 = 8 * Before the previous patch, which fixed "set osabi none", this bug was hidden because we didn't actually try to generate a gdbarch for no osabi, it would always fall back on Linux. Generating the gdbarch for amd64/linux did work. gdb/ChangeLog: PR gdb/22979 * amd64-tdep.c (amd64_none_init_abi): New function. (amd64_x32_none_init_abi): New function. (_initialize_amd64_tdep): Register handlers for x86-64 and x64_32 with GDB_OSABI_NONE. * osabi.c (gdbarch_init_osabi): Allow running handlers for the GDB_OSABI_NONE osabi. gdb/testsuite/ChangeLog: PR gdb/22979 * gdb.arch/amd64-osabi.exp: New file.
2018-04-07 19:24:58 +02:00
2018-04-07 Simon Marchi <simon.marchi@ericsson.com>
PR gdb/22979
* amd64-tdep.c (amd64_none_init_abi): New function.
(amd64_x32_none_init_abi): New function.
(_initialize_amd64_tdep): Register handlers for x86-64 and
x64_32 with GDB_OSABI_NONE.
* osabi.c (gdbarch_init_osabi): Allow running handlers for the
GDB_OSABI_NONE osabi.
Make "set osabi none" really work (PR 22980) I was looking for a way to reproduce easily PR 22979 by doing this: (gdb) set architecture i386:x86-64 (gdb) set osabi none However, I noticed that even though I did "set osabi none", the gdbarch gdb created was for Linux: (gdb) set debug arch 1 (gdb) set architecture i386:x86-64 ... (gdb) set osabi none gdbarch_find_by_info: info.bfd_arch_info i386:x86-64 gdbarch_find_by_info: info.byte_order 1 (little) gdbarch_find_by_info: info.osabi 4 (GNU/Linux) <--- Wrong? gdbarch_find_by_info: info.abfd 0x0 gdbarch_find_by_info: info.tdep_info 0x0 gdbarch_find_by_info: Previous architecture 0x1e6fd30 (i386:x86-64) selected gdbarch_update_p: Architecture 0x1e6fd30 (i386:x86-64) unchanged This is because the value GDB_OSABI_UNKNOWN has an unclear role, sometimes meaning "no osabi" and sometimes "please selected automatically". Doing "set osabi none" sets the requested osabi to GDB_OSABI_UNKNOWN, in which case gdbarch_info_fill overrides it with a value from the target description, or the built-in default osabi. This means that it's impossible to force GDB not to use an osabi with "set osabi". Since my GDB's built-in default osabi is Linux, it always falls back to GDB_OSABI_LINUX. To fix it, I introduced GDB_OSABI_NONE, which really means "I don't want any osabi". GDB_OSABI_UNKNOWN can then be used only for "not set yet, please auto-detect". GDB_OSABI_UNINITIALIZED now seems unnecessary since it overlaps with GDB_OSABI_UNKNOWN, so I think it can be removed and gdbarch_info::osabi can be initialized to GDB_OSABI_UNKNOWN. gdb/ChangeLog: PR gdb/22980 * defs.h (enum gdb_osabi): Remove GDB_OSABI_UNINITIALIZED, add GDB_OSABI_NONE. * arch-utils.c (gdbarch_info_init): Don't set info->osabi. * osabi.c (gdb_osabi_names): Add "unknown" entry. gdb/testsuite/ChangeLog: PR gdb/22980 * gdb.base/osabi.exp: New file.
2018-04-07 19:23:28 +02:00
2018-04-07 Simon Marchi <simon.marchi@ericsson.com>
PR gdb/22980
* defs.h (enum gdb_osabi): Remove GDB_OSABI_UNINITIALIZED, add
GDB_OSABI_NONE.
* arch-utils.c (gdbarch_info_init): Don't set info->osabi.
* osabi.c (gdb_osabi_names): Add "unknown" entry.
Make target_read_alloc & al return vectors This patch started by changing target_read_alloc_1 to return a byte_vector, to avoid manual memory management (in target_read_alloc_1 and in the callers). To communicate failures to the callers, it actually returns a gdb::optional<gdb::byte_vector>. Adjusting target_read_stralloc was a bit more tricky, since it wants to return a buffer of char, and not gdb_byte. Since you can't just cast a gdb::byte_vector into a gdb::def_vector<char>, I made target_read_alloc_1 templated, so both versions (that return vectors of gdb_byte and char) are generated. Since target_read_stralloc now returns a gdb::char_vector instead of a gdb::unique_xmalloc_ptr<char>, a few callers need to be adjusted. gdb/ChangeLog: * common/byte-vector.h (char_vector): New type. * target.h (target_read_alloc): Return gdb::optional<byte_vector>. (target_read_stralloc): Return gdb::optional<char_vector>. (target_get_osdata): Return gdb::optional<char_vector>. * target.c (target_read_alloc_1): Templatize. Replacement manual memory management with vector. (target_read_alloc): Change return type, adjust. (target_read_stralloc): Change return type, adjust. (target_get_osdata): Change return type, adjust. * auxv.c (struct auxv_info) <length>: Remove. <data>: Change type to gdb::optional<byte_vector>. (auxv_inferior_data_cleanup): Free auxv_info with delete. (get_auxv_inferior_data): Allocate auxv_info with new, adjust. (target_auxv_search): Adjust. (fprint_target_auxv): Adjust. * avr-tdep.c (avr_io_reg_read_command): Adjust. * linux-tdep.c (linux_spu_make_corefile_notes): Adjust. (linux_make_corefile_notes): Adjust. * osdata.c (get_osdata): Adjust. * remote.c (remote_get_threads_with_qxfer): Adjust. (remote_memory_map): Adjust. (remote_traceframe_info): Adjust. (btrace_read_config): Adjust. (remote_read_btrace): Adjust. (remote_pid_to_exec_file): Adjust. * solib-aix.c (solib_aix_get_library_list): Adjust. * solib-dsbt.c (decode_loadmap): Don't free buf. (dsbt_get_initial_loadmaps): Adjust. * solib-svr4.c (svr4_current_sos_via_xfer_libraries): Adjust. * solib-target.c (solib_target_current_sos): Adjust. * tracepoint.c (sdata_make_value): Adjust. * xml-support.c (xinclude_start_include): Adjust. (xml_fetch_content_from_file): Adjust. * xml-support.h (xml_fetch_another): Change return type. (xml_fetch_content_from_file): Change return type. * xml-syscall.c (xml_init_syscalls_info): Adjust. * xml-tdesc.c (file_read_description_xml): Adjust. (fetch_available_features_from_target): Change return type. (target_fetch_description_xml): Adjust. (target_read_description_xml): Adjust.
2018-04-07 19:19:12 +02:00
2018-04-07 Simon Marchi <simon.marchi@ericsson.com>
* common/byte-vector.h (char_vector): New type.
* target.h (target_read_alloc): Return
gdb::optional<byte_vector>.
(target_read_stralloc): Return gdb::optional<char_vector>.
(target_get_osdata): Return gdb::optional<char_vector>.
* target.c (target_read_alloc_1): Templatize. Replacement
manual memory management with vector.
(target_read_alloc): Change return type, adjust.
(target_read_stralloc): Change return type, adjust.
(target_get_osdata): Change return type, adjust.
* auxv.c (struct auxv_info) <length>: Remove.
<data>: Change type to gdb::optional<byte_vector>.
(auxv_inferior_data_cleanup): Free auxv_info with delete.
(get_auxv_inferior_data): Allocate auxv_info with new, adjust.
(target_auxv_search): Adjust.
(fprint_target_auxv): Adjust.
* avr-tdep.c (avr_io_reg_read_command): Adjust.
* linux-tdep.c (linux_spu_make_corefile_notes): Adjust.
(linux_make_corefile_notes): Adjust.
* osdata.c (get_osdata): Adjust.
* remote.c (remote_get_threads_with_qxfer): Adjust.
(remote_memory_map): Adjust.
(remote_traceframe_info): Adjust.
(btrace_read_config): Adjust.
(remote_read_btrace): Adjust.
(remote_pid_to_exec_file): Adjust.
* solib-aix.c (solib_aix_get_library_list): Adjust.
* solib-dsbt.c (decode_loadmap): Don't free buf.
(dsbt_get_initial_loadmaps): Adjust.
* solib-svr4.c (svr4_current_sos_via_xfer_libraries): Adjust.
* solib-target.c (solib_target_current_sos): Adjust.
* tracepoint.c (sdata_make_value): Adjust.
* xml-support.c (xinclude_start_include): Adjust.
(xml_fetch_content_from_file): Adjust.
* xml-support.h (xml_fetch_another): Change return type.
(xml_fetch_content_from_file): Change return type.
* xml-syscall.c (xml_init_syscalls_info): Adjust.
* xml-tdesc.c (file_read_description_xml): Adjust.
(fetch_available_features_from_target): Change return type.
(target_fetch_description_xml): Adjust.
(target_read_description_xml): Adjust.
2018-04-06 Tom Tromey <tom@tromey.com>
* value.c (~value): Update.
(struct value) <contents>: Now unique_xmalloc_ptr.
(value_contents_bits_eq, allocate_value_contents)
(value_contents_raw, value_contents_all_raw)
(value_contents_for_printing, value_contents_for_printing_const)
(set_value_enclosing_type): Update.
2018-04-06 Tom Tromey <tom@tromey.com>
* value.c (range_s): Remove typedef, VEC.
(struct range): Add operator<.
(range_lessthan): Remove.
(ranges_contain): Change type.
(~value): Update.
(struct value) <unavailable, optimized_out>: Now std::vector.
(value_entirely_available)
(value_entirely_covered_by_range_vector)
(value_entirely_unavailable, value_entirely_optimized_out):
Update.
(insert_into_bit_range_vector): Change argument type.
(find_first_range_overlap): Likewise.
(struct ranges_and_idx, value_contents_bits_eq)
(require_not_optimized_out, require_available): Update.
(ranges_copy_adjusted): Change argument types.
(value_optimized_out, value_copy, value_fetch_lazy): Update.
2018-04-06 Tom Tromey <tom@tromey.com>
* value.c (~value): Update.
(struct value) <parent>: Now a value_ref_ptr.
(value_parent, set_value_parent, value_address, value_copy):
Update.
2018-04-06 Tom Tromey <tom@tromey.com>
* value.c (struct value): Add constructor, destructor, and member
initializers.
(allocate_value_lazy, value_decref): Update.
2018-04-06 Tom Tromey <tom@tromey.com>
* value.c (struct value) <released, next>: Remove.
(all_values): Now a std::vector.
(allocate_value_lazy): Update.
(value_next): Remove.
(value_mark, value_free_to_mark, release_value)
(value_release_to_mark): Update.
2018-04-06 Tom Tromey <tom@tromey.com>
* value.h (fetch_subexp_value, value_release_to_mark): Update.
(free_value_chain): Remove.
* value.c (free_value_chain): Remove.
(value_release_to_mark): Return a std::vector.
* ppc-linux-nat.c (num_memory_accesses): Change "chain" to a
std::vector.
(check_condition): Update.
* eval.c (fetch_subexp_value): Change "val_chain" to a
std::vector.
* breakpoint.c (update_watchpoint): Update.
(can_use_hardware_watchpoint): Change "vals" to a std::vector.
2018-04-06 Tom Tromey <tom@tromey.com>
* value.h (free_all_values): Remove.
* value.c (free_all_values): Remove.
2018-04-06 Tom Tromey <tom@tromey.com>
* value.c (VALUE_HISTORY_CHUNK, struct value_history_chunk)
(value_history_chain, value_history_count): Remove.
(value_history): New global.
(record_latest_value, access_value_history, show_values)
(preserve_values): Update.
2018-04-06 Tom Tromey <tom@tromey.com>
* varobj.h (struct varobj) <value>: Now a value_ref_ptr.
* varobj.c (varobj_set_display_format, varobj_set_value)
(install_default_visualizer, construct_visualizer)
(install_new_value, ~varobj, varobj_get_value_type)
(my_value_of_variable, varobj_editable_p): Update.
* c-varobj.c (c_describe_child, c_value_of_variable)
(cplus_number_of_children, cplus_describe_child): Update.
* ada-varobj.c (ada_number_of_children, ada_name_of_child)
(ada_path_expr_of_child, ada_value_of_child, ada_type_of_child)
(ada_value_of_variable, ada_value_is_changeable_p): Update.
2018-04-06 Tom Tromey <tom@tromey.com>
* printcmd.c (last_examine_address): Change type to
value_ref_ptr.
(do_examine, x_command): Update.
2018-04-06 Tom Tromey <tom@tromey.com>
* value.c (release_value): Update.
* breakpoint.h (struct watchpoint) <val>: Now a value_ref_ptr.
(struct bpstats) <val>: Now a value_ref_ptr.
* breakpoint.c (update_watchpoint, breakpoint_init_inferior)
(~bpstats, bpstats, bpstat_clear_actions, watchpoint_check)
(~watchpoint, print_it_watchpoint, watch_command_1)
(invalidate_bp_value_on_memory_change): Update.
Introduce a gdb_ref_ptr specialization for struct value struct value is internally reference counted and so, while it also has some ownership rules unique to it, it makes sense to use a gdb_ref_ptr when managing it automatically. This patch removes the existing unique_ptr specialization in favor of a reference-counted pointer. It also introduces two other clarifications: 1. Rename value_free to value_decref, which I think is more in line with what the function actually does; and 2. Change release_value to return a gdb_ref_ptr. This change allows us to remove the confusing release_value_or_incref function, primarily by making it much simpler to reason about the result of release_value. gdb/ChangeLog 2018-04-06 Tom Tromey <tom@tromey.com> * varobj.c (varobj_clear_saved_item) (update_dynamic_varobj_children, install_new_value, ~varobj): Update. * value.h (value_incref): Move declaration earlier. (value_decref): Rename from value_free. (struct value_ref_policy): New. (value_ref_ptr): New typedef. (struct value_deleter): Remove. (gdb_value_up): Remove typedef. (release_value): Change return type. (release_value_or_incref): Remove. * value.c (set_value_parent): Update. (value_incref): Change return type. (value_decref): Rename from value_free. (value_free_to_mark, free_all_values, free_value_chain): Update. (release_value): Return value_ref_ptr. (release_value_or_incref): Remove. (record_latest_value, set_internalvar, clear_internalvar): Update. * stack.c (info_frame_command): Don't call value_free. * python/py-value.c (valpy_dealloc, valpy_new) (value_to_value_object): Update. * printcmd.c (do_examine): Update. * opencl-lang.c (lval_func_free_closure): Update. * mi/mi-main.c (register_changed_p): Don't call value_free. * mep-tdep.c (mep_frame_prev_register): Don't call value_free. * m88k-tdep.c (m88k_frame_prev_register): Don't call value_free. * m68hc11-tdep.c (m68hc11_frame_prev_register): Don't call value_free. * guile/scm-value.c (vlscm_free_value_smob) (vlscm_scm_from_value): Update. * frame.c (frame_register_unwind, frame_unwind_register_signed) (frame_unwind_register_unsigned, get_frame_register_bytes) (put_frame_register_bytes): Don't call value_free. * findvar.c (address_from_register): Don't call value_free. * dwarf2read.c (dwarf2_compute_name): Don't call value_free. * dwarf2loc.c (entry_data_value_free_closure) (value_of_dwarf_reg_entry, free_pieced_value_closure) (dwarf2_evaluate_loc_desc_full): Update. * breakpoint.c (update_watchpoint, breakpoint_init_inferior) (~bpstats, bpstats, bpstat_clear_actions, watchpoint_check) (~watchpoint, watch_command_1) (invalidate_bp_value_on_memory_change): Update. * alpha-tdep.c (alpha_register_to_value): Don't call value_free.
2018-04-04 01:45:21 +02:00
2018-04-06 Tom Tromey <tom@tromey.com>
* varobj.c (varobj_clear_saved_item)
(update_dynamic_varobj_children, install_new_value, ~varobj):
Update.
* value.h (value_incref): Move declaration earlier.
(value_decref): Rename from value_free.
(struct value_ref_policy): New.
(value_ref_ptr): New typedef.
(struct value_deleter): Remove.
(gdb_value_up): Remove typedef.
(release_value): Change return type.
(release_value_or_incref): Remove.
* value.c (set_value_parent): Update.
(value_incref): Change return type.
(value_decref): Rename from value_free.
(value_free_to_mark, free_all_values, free_value_chain): Update.
(release_value): Return value_ref_ptr.
(release_value_or_incref): Remove.
(record_latest_value, set_internalvar, clear_internalvar):
Update.
* stack.c (info_frame_command): Don't call value_free.
* python/py-value.c (valpy_dealloc, valpy_new)
(value_to_value_object): Update.
* printcmd.c (do_examine): Update.
* opencl-lang.c (lval_func_free_closure): Update.
* mi/mi-main.c (register_changed_p): Don't call value_free.
* mep-tdep.c (mep_frame_prev_register): Don't call value_free.
* m88k-tdep.c (m88k_frame_prev_register): Don't call value_free.
* m68hc11-tdep.c (m68hc11_frame_prev_register): Don't call
value_free.
* guile/scm-value.c (vlscm_free_value_smob)
(vlscm_scm_from_value): Update.
* frame.c (frame_register_unwind, frame_unwind_register_signed)
(frame_unwind_register_unsigned, get_frame_register_bytes)
(put_frame_register_bytes): Don't call value_free.
* findvar.c (address_from_register): Don't call value_free.
* dwarf2read.c (dwarf2_compute_name): Don't call value_free.
* dwarf2loc.c (entry_data_value_free_closure)
(value_of_dwarf_reg_entry, free_pieced_value_closure)
(dwarf2_evaluate_loc_desc_full): Update.
* breakpoint.c (update_watchpoint, breakpoint_init_inferior)
(~bpstats, bpstats, bpstat_clear_actions, watchpoint_check)
(~watchpoint, watch_command_1)
(invalidate_bp_value_on_memory_change): Update.
* alpha-tdep.c (alpha_register_to_value): Don't call value_free.
2018-04-06 Simon Marchi <simon.marchi@polymtl.ca>
PR gdb/23022
* warning.m4: Add -Wno-error=deprecated-register.
* configure: Re-generate.
2018-04-05 Tom Tromey <tom@tromey.com>
* linespec.h: Remove include of "vec.h".
2018-04-05 Tom Tromey <tom@tromey.com>
* linespec.c (typep): Remove typedef.
(find_methods, find_superclass_methods): Take a std::vector.
(find_method): Use std::vector.
2018-04-05 Tom Tromey <tom@tromey.com>
* utils.c (compare_strings): Remove.
* utils.h (compare_strings): Remove.
* objc-lang.h (find_imps): Update.
* objc-lang.c (find_methods): Take a std::vector.
(uniquify_strings, find_imps): Likewise.
* linespec.c (find_methods): Take a std::vector.
(decode_objc): Use std::vector.
(add_all_symbol_names_from_pspace, find_superclass_methods): Take
a std::vector.
(find_method, find_function_symbols): Use std::vector.
2018-04-05 Tom Tromey <tom@tromey.com>
* completer.c (completion_tracker::completion_tracker): Remove
cast.
(completion_tracker::discard_completions): Likewise.
* breakpoint.c (ambiguous_names_p): Remove cast.
* ada-lang.c (_initialize_ada_language): Remove cast.
* utils.h (streq): Update.
(streq_hash): Add new declaration.
* utils.c (streq): Return bool.
(streq_hash): New function.
2018-04-05 Tom Tromey <tom@tromey.com>
* linespec.c (event_location_to_sals) <case ADDRESS_LOCATION>:
Remove a string copy.
2018-04-05 Tom Tromey <tom@tromey.com>
* linespec.c (filter_results): Use std::vector.
(decode_line_2, decode_line_full): Update.
2018-04-05 Tom Tromey <tom@tromey.com>
* linespec.c (canonical_to_fullform): Return std::string.
(filter_results): Update.
(struct decode_line_2_item): Add constructor.
<fullform, displayform>: Now std::string.
(decode_line_2_compare_items): Now a std::sort comparator.
(decode_line_2): Update.
2018-04-05 Tom Tromey <tom@tromey.com>
* linespec.c (copy_token_string): Return a unique_xmalloc_ptr.
(unexpected_linespec_error): Update.
(linespec_parse_basic, parse_linespec): Update.
2018-04-05 Tom Tromey <tom@tromey.com>
* linespec.c (linespec_parse_basic): Reindent.
2018-04-05 Tom Tromey <tom@tromey.com>
* minsyms.h (iterate_over_minimal_symbols): Update.
* minsyms.c (iterate_over_minimal_symbols): Take a
gdb::function_view.
* linespec.c (struct collect_minsyms): Remove.
(compare_msyms): Now a std::sort comparator.
(add_minsym): Add parameters.
(search_minsyms_for_name): Update. Use std::vector.
2018-04-03 Tom Tromey <tom@tromey.com>
* mipsread.c (read_alphacoff_dynamic_symtab): Use
gdb::byte_vector.
2018-04-02 Weimin Pan <weimin.pan@oracle.com>
* MAINTAINERS (Write After Approval): Add Weimin Pan.
2018-04-02 Weimin Pan <weimin.pan@oracle.com>
PR gdb/16959
* cp-valprint.c: (cp_print_static_field) Fix infinite recursion when
printing static type.
2018-04-01 Tom Tromey <tom@tromey.com>
* rs6000-nat.c (rs6000_ptrace_ldinfo): Return a byte_vector.
(rs6000_xfer_shared_libraries): Update.
2018-04-01 Simon Marchi <simon.marchi@polymtl.ca>
* common/gdb_vecs.h (char_ptr): Remove.
* tracepoint.c (encode_actions_1): Remove usage of char_ptr.
2018-03-30 Simon Marchi <simon.marchi@polymtl.ca>
* guile/scm-utils.c (gdbscm_parse_function_args): Replace VEC
with std::vector.
* common/gdb_vecs.h (DEF_VEC_P (char_ptr)): Remove.
2018-03-30 Simon Marchi <simon.marchi@polymtl.ca>
* tracepoint.h (struct uploaded_tp): Initialize fields.
<actions, step_actions, cmd_strings>: Change type to
std::vector<char *>.
* tracepoint.c (get_uploaded_tp): Allocate with new.
(free_uploaded_tps): Free with delete.
(parse_tracepoint_definition): Adjust to std::vector change.
* breakpoint.c (read_uploaded_action): Likewise.
(create_tracepoint_from_upload): Likewise.
* ctf.c (ctf_write_uploaded_tp): Likewise.
(SET_ARRAY_FIELD): Likewise.
* tracefile-tfile.c (tfile_write_uploaded_tp): Likewise.
2018-03-30 Tom Tromey <tom@tromey.com>
* solib-svr4.c (lm_info_read): Use gdb::byte_vector. Return
std::unique_ptr.
(svr4_keep_data_in_core): Update.
(svr4_read_so_list): Update.
2018-03-30 Tom Tromey <tom@tromey.com>
* windows-nat.c (handle_output_debug_string, handle_exception):
Update.
* target.h (target_read_string): Update.
* target.c (target_read_string): Change "string" to
unique_xmalloc_ptr.
* solib-svr4.c (open_symbol_file_object, svr4_read_so_list):
Update.
* solib-frv.c (frv_current_sos): Update.
* solib-dsbt.c (dsbt_current_sos): Update.
* solib-darwin.c (darwin_current_sos): Update.
* linux-thread-db.c (inferior_has_bug): Update.
* expprint.c (print_subexp_standard) <case OP_OBJC_MSGCALL>:
Update. Remove alloca.
* ada-lang.c (ada_main_name): Update.
2018-03-30 Tom Tromey <tom@tromey.com>
* dwarf2read.c (struct free_dwo_file_cleanup_data): Remove.
(struct dwo_file_deleter): New.
(dwo_file_up): New typedef.
(open_and_init_dwo_file): Use dwo_file_up.
(free_dwo_file_cleanup): Remove.
2018-03-30 Tom Tromey <tom@tromey.com>
* dwarf2read.c (free_dwo_file): Remove "objfile" parameter.
(free_dwo_file_cleanup, free_dwo_file_from_slot): Update.
2018-03-30 Tom Tromey <tom@tromey.com>
* dwarf2read.c (class free_cached_comp_units): New class.
(dw2_instantiate_symtab, dwarf2_build_psymtabs_hard): Use it.
(free_cached_comp_units): Remove function.
2018-03-30 Tom Tromey <tom@tromey.com>
* utils.h (make_cleanup_unpush_target): Remove.
* inf-ptrace.c (struct target_unpusher): New.
(target_unpush_up) New typedef.
(inf_ptrace_create_inferior, inf_ptrace_attach): Use
target_unpush_up.
* utils.c (do_unpush_target, make_cleanup_unpush_target): Remove.
2018-03-27 Tom Tromey <tom@tromey.com>
* utils.c (prompt_for_continue): Use unique_xmalloc_ptr.
2018-03-27 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
* top.c (class gdb_readline_wrapper_cleanup): Add constructor,
destructor. Now a class.
(gdb_readline_wrapper_cleanup): Remove function.
(gdb_readline_wrapper): Remove cleanups.
C++-ify typedef hash This changes the typedef_hash_table structure to be a C++ class. It adds constructors and destructors and changes some functions to be methods of the class. Then it changes the various users of this class to adapt. This allows for the removal of some cleanups. Regression tested by the buildbot. gdb/ChangeLog 2018-03-27 Tom Tromey <tom@tromey.com> * typeprint.h (struct type_print_options) <local_typedefs, global_typedefs>: Remove "struct" keyword. (class typedef_hash_table): New class. (recursively_update_typedef_hash, add_template_parameters) (create_typedef_hash, free_typedef_hash, copy_typedef_hash) (find_typedef_in_hash): Don't declare. * typeprint.c (struct typedef_hash_table): Move to typeprint.h. (typedef_hash_table::recursively_update): Rename from recursively_update_typedef_hash. Now a member. (typedef_hash_table::add_template_parameters): Rename from add_template_parameters. Now a member. (typedef_hash_table::typedef_hash_table): Now a constructor; rename from create_typedef_hash. (typedef_hash_table::~typedef_hash_table): Now a destructor; rename from free_typedef_hash. (do_free_typedef_hash, make_cleanup_free_typedef_hash) (do_free_global_table): Remove. (typedef_hash_table::typedef_hash_table): New constructor; renamed from copy_type_recursive. (create_global_typedef_table): Remove. (typedef_hash_table::find_global_typedef): Now a member of typedef_hash_table. (typedef_hash_table::find_typedef): Rename from find_typedef_in_hash; now a member. (whatis_exp): Update. * extension.h (struct ext_lang_type_printers): Add constructor and destructor. (start_ext_lang_type_printers, free_ext_lang_type_printers): Don't declare. * extension.c (ext_lang_type_printers::ext_lang_type_printers): Now a constructor; rename from start_ext_lang_type_printers. (ext_lang_type_printers): Now a destructor; rename from free_ext_lang_type_printers. * c-typeprint.c (find_typedef_for_canonicalize, c_print_type_1): Update. (c_type_print_base_struct_union): Update. Remove cleanups.
2018-03-14 23:38:02 +01:00
2018-03-27 Tom Tromey <tom@tromey.com>
* typeprint.h (struct type_print_options) <local_typedefs,
global_typedefs>: Remove "struct" keyword.
(class typedef_hash_table): New class.
(recursively_update_typedef_hash, add_template_parameters)
(create_typedef_hash, free_typedef_hash, copy_typedef_hash)
(find_typedef_in_hash): Don't declare.
* typeprint.c (struct typedef_hash_table): Move to typeprint.h.
(typedef_hash_table::recursively_update): Rename from
recursively_update_typedef_hash. Now a member.
(typedef_hash_table::add_template_parameters): Rename from
add_template_parameters. Now a member.
(typedef_hash_table::typedef_hash_table): Now a constructor;
rename from create_typedef_hash.
(typedef_hash_table::~typedef_hash_table): Now a destructor;
rename from free_typedef_hash.
(do_free_typedef_hash, make_cleanup_free_typedef_hash)
(do_free_global_table): Remove.
(typedef_hash_table::typedef_hash_table): New constructor; renamed
from copy_type_recursive.
(create_global_typedef_table): Remove.
(typedef_hash_table::find_global_typedef): Now a member of
typedef_hash_table.
(typedef_hash_table::find_typedef): Rename from
find_typedef_in_hash; now a member.
(whatis_exp): Update.
* extension.h (struct ext_lang_type_printers): Add constructor and
destructor.
(start_ext_lang_type_printers, free_ext_lang_type_printers): Don't
declare.
* extension.c (ext_lang_type_printers::ext_lang_type_printers):
Now a constructor; rename from start_ext_lang_type_printers.
(ext_lang_type_printers): Now a destructor; rename from
free_ext_lang_type_printers.
* c-typeprint.c (find_typedef_for_canonicalize, c_print_type_1):
Update.
(c_type_print_base_struct_union): Update. Remove cleanups.
2018-03-27 Tom Tromey <tom@tromey.com>
* dwarf-index-write.c: Include <cmath>.
2018-03-27 Joel Brobecker <brobecker@adacore.com>
* NEWS: Add entry describing new "set|show varsize-limit" command.
* ada-lang.c (_initialize_ada_language): Add "set/show varsize-limit"
command.
* printcmd.c (_initialize_printcmd): Add "set var" alias of
"set variable".
Move DWARF index-related things to a separate file I want to add a DWARF index-related feature (automatically produce index files when loading objfiles in GDB), but I don't want to add many hundred lines to the already too big dwarf2read.c. I thought it would be a logical split to move everything related to the DWARF index to its own file. I first tried to move everything that reads and writes DWARF indices to a separate file, but found that the "read" part is a little bit entangled with the rest of dwarf2read.c, so the line is hard to draw about where to split. The write part is quite isolated though, so I moved this part to a new file, dwarf-index-write.c. Some things are necessary to both reading and writing indices, so I placed them in dwarf-index-common.{c,h}. The idea would be to have a dwarf-index-read.c eventually that would use it too (for now that code is still in dwarf2read.c). This required moving some things to a new dwarf2read.h header, so they can be read by the code that writes the index. The patch is big in number of lines, but it's all existing code being moved around. The only changes are that some functions are not static anymore, a declaration is added in a .h file, and therefore the comment is moved there. I built-tested it with a little and big endian target. This patch is also available on the users/simark/split-dwarf2read branch. gdb/ChangeLog: * Makefile.in (COMMON_SFILES): Add dwarf-index-common.c and dwarf-index-write.c (HFILES_NO_SRCDIR): Add dwarf-index-common.h and dwarf2read.h. * dwarf-index-common.c: New file. * dwarf-index-common.h: New file. * dwarf-index-write.c: New file. * dwarf2read.c: Include dwarf2read.h and dwarf-index-common.h. (struct dwarf2_section_info): Move from here. (dwarf2_section_info_def): Likewise. (DEF_VEC_O (dwarf2_section_info_def)): Likewise. (offset_type): Likewise. (DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE): Likewise. (DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE): Likewise. (DW2_GDB_INDEX_CU_SET_VALUE): Likewise. (byte_swap): Likewise. (MAYBE_SWAP): Likewise. (dwarf2_per_cu_ptr): Likewise. (DEF_VEC_P (dwarf2_per_cu_ptr)): Likewise. (struct tu_stats): Likewise. (struct dwarf2_per_objfile): Likewise. (struct dwarf2_per_cu_data): Likewise. (struct signatured_type): Likewise. (sig_type_ptr): Likewise. (DEF_VEC_P (sig_type_ptr)): Likewise. (INDEX4_SUFFIX): Likewise. (INDEX5_SUFFIX): Likewise. (DEBUG_STR_SUFFIX): Likewise. (dwarf2_read_section): Make non-static. (mapped_index_string_hash): Move from here. (dwarf5_djb_hash): Likewise. (file_write): Likewise. (class data_buf): Likewise. (struct symtab_index_entry): Likewise. (struct mapped_symtab): Likewise. (find_slot): Likewise. (hash_expand): Likewise. (add_index_entry): Likewise. (uniquify_cu_indices): Likewise. (class c_str_view): Likewise. (class c_str_view_hasher): Likewise. (class vector_hasher): Likewise. (write_hash_table): Likewise. (psym_index_map): Likewise. (struct addrmap_index_data): Likewise. (add_address_entry): Likewise. (add_address_entry_worker): Likewise. (write_address_map): Likewise. (symbol_kind): Likewise. (write_psymbols): Likewise. (struct signatured_type_index_data): Likewise. (write_one_signatured_type): Likewise. (recursively_count_psymbols): Likewise. (recursively_write_psymbols): Likewise. (class debug_names): Likewise. (check_dwarf64_offsets): Likewise. (psyms_seen_size): Likewise. (write_gdbindex): Likewise. (write_debug_names): Likewise. (assert_file_size): Likewise. (write_psymtabs_to_index): Likewise. (save_gdb_index_command): Likewise. (_initialize_dwarf2_read): Don't register the "save gdb-index" command. * dwarf2read.h: New file.
2018-03-27 16:07:44 +02:00
2018-03-27 Simon Marchi <simon.marchi@ericsson.com>
* Makefile.in (COMMON_SFILES): Add dwarf-index-common.c and
dwarf-index-write.c
(HFILES_NO_SRCDIR): Add dwarf-index-common.h and dwarf2read.h.
* dwarf-index-common.c: New file.
* dwarf-index-common.h: New file.
* dwarf-index-write.c: New file.
* dwarf2read.c: Include dwarf2read.h and dwarf-index-common.h.
(struct dwarf2_section_info): Move from here.
(dwarf2_section_info_def): Likewise.
(DEF_VEC_O (dwarf2_section_info_def)): Likewise.
(offset_type): Likewise.
(DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE): Likewise.
(DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE): Likewise.
(DW2_GDB_INDEX_CU_SET_VALUE): Likewise.
(byte_swap): Likewise.
(MAYBE_SWAP): Likewise.
(dwarf2_per_cu_ptr): Likewise.
(DEF_VEC_P (dwarf2_per_cu_ptr)): Likewise.
(struct tu_stats): Likewise.
(struct dwarf2_per_objfile): Likewise.
(struct dwarf2_per_cu_data): Likewise.
(struct signatured_type): Likewise.
(sig_type_ptr): Likewise.
(DEF_VEC_P (sig_type_ptr)): Likewise.
(INDEX4_SUFFIX): Likewise.
(INDEX5_SUFFIX): Likewise.
(DEBUG_STR_SUFFIX): Likewise.
(dwarf2_read_section): Make non-static.
(mapped_index_string_hash): Move from here.
(dwarf5_djb_hash): Likewise.
(file_write): Likewise.
(class data_buf): Likewise.
(struct symtab_index_entry): Likewise.
(struct mapped_symtab): Likewise.
(find_slot): Likewise.
(hash_expand): Likewise.
(add_index_entry): Likewise.
(uniquify_cu_indices): Likewise.
(class c_str_view): Likewise.
(class c_str_view_hasher): Likewise.
(class vector_hasher): Likewise.
(write_hash_table): Likewise.
(psym_index_map): Likewise.
(struct addrmap_index_data): Likewise.
(add_address_entry): Likewise.
(add_address_entry_worker): Likewise.
(write_address_map): Likewise.
(symbol_kind): Likewise.
(write_psymbols): Likewise.
(struct signatured_type_index_data): Likewise.
(write_one_signatured_type): Likewise.
(recursively_count_psymbols): Likewise.
(recursively_write_psymbols): Likewise.
(class debug_names): Likewise.
(check_dwarf64_offsets): Likewise.
(psyms_seen_size): Likewise.
(write_gdbindex): Likewise.
(write_debug_names): Likewise.
(assert_file_size): Likewise.
(write_psymtabs_to_index): Likewise.
(save_gdb_index_command): Likewise.
(_initialize_dwarf2_read): Don't register the "save gdb-index"
command.
* dwarf2read.h: New file.
problem looking up some symbols when they have a linkage name This patch fixes a known failure in gdb.ada/maint_with_ada.exp (maintenance check-psymtabs). Another way to witness the same issue is by considering the following Ada declarations... type Wrapper is record A : Integer; end record; u00045 : constant Wrapper := (A => 16#060287af#); pragma Export (C, u00045, "symada__cS"); ... which declares a variable name "u00045" but with a linkage name which is "symada__cS". This variable is a record with one component, the Ada equivalent of a struct with one field in C. Trying to print that variable's value currently yields: (gdb) p /x <symada__cS> 'symada(char, signed)' has unknown type; cast it to its declared type This indicates that GDB was only able to find the minimal symbol, but not the full symbol. The expected output is: (gdb) print /x <symada__cS> $1 = (a => 0x60287af) The error message gives a hint about what's happening: We processed the symbol through gdb_demangle, which in the case of this particular symbol name, ends up matching the C++ naming scheme. As a result, the demangler transforms our symbol name into 'symada(char, signed)', thus breaking Ada lookups. This patch fixes the issue by first introducing a new language_defn attribute called la_store_sym_names_in_linkage_form_p, which is a boolean to be set to true for the few languages that do not want their symbols to have their names stored in demangled form, and false otherwise. We then use this language attribute to skip the call to gdb_demangle for all languages whose la_store_sym_names_in_linkage_form_p is true. In terms of the selection of languages for which the new attribute is set to true, the selection errs on the side of preserving the existing behavior, and only changes the behavior for the languages where we are certain storing symbol names in demangling form is not needed. It is conceivable that other languages might be in the same situation, but I not knowing in detail the symbol name enconding strategy, I decided to play it safe and let other language maintainers potentially adjust their language if it makes sense to do so. gdb/ChangeLog: PR gdb/22670 * dwarf2read.c (dwarf2_physname): Do not return the demangled symbol name if the CU's language stores symbol names in linkage format. * language.h (struct language_defn) <la_store_sym_names_in_linkage_form_p>: New field. Adjust all instances of this struct. gdb/testsuite/ChangeLog: * gdb.ada/maint_with_ada.exp: Remove PR gdb/22670 setup_kfail. * gdb.ada/notcplusplus: New testcase. * gdb.base/c-linkage-name.c: New file. * gdb.base/c-linkage-name.exp: New testcase. Tested on x86_64-linux. This also passes AdaCore's internal GDB testsuite.
2018-03-27 15:57:16 +02:00
2018-03-27 Joel Brobecker <brobecker@adacore.com>
PR gdb/22670
* dwarf2read.c (dwarf2_physname): Do not return the demangled
symbol name if the CU's language stores symbol names in linkage
format.
* language.h (struct language_defn)
<la_store_sym_names_in_linkage_form_p>: New field. Adjust
all instances of this struct.
2018-03-26 Tom Tromey <tom@tromey.com>
* stack.c (backtrace_command_1): Remove verbose code.
2018-03-26 Tom Tromey <tom@tromey.com>
* python/py-framefilter.c (py_print_type): Don't catch
exceptions. Return void.
(py_print_value): Likewise.
(py_print_single_arg): Likewise.
(enumerate_args): Don't catch exceptions.
(py_print_args): Likewise.
(py_print_frame): Likewise.
(gdbpy_apply_frame_filter): Catch exceptions here.
2018-03-26 Tom Tromey <tom@tromey.com>
* stack.c (_initialize_stack): Remove trailing newlines from help
text. Add "Usage" line to "backtrace" help.
2018-03-26 Tom Tromey <tom@tromey.com>
PR python/16486:
* python/py-framefilter.c (py_print_args): Call wrap_hint.
2018-03-26 Tom Tromey <tom@tromey.com>
* python/py-framefilter.c (py_print_single_arg): Return
EXT_LANG_BT_ERROR from catch.
2018-03-26 Tom Tromey <tom@tromey.com>
PR backtrace/15584:
* stack.c (backtrace_command_1): Move some code into no-filters
"if".
2018-03-26 Tom Tromey <tom@tromey.com>
* python/py-framefilter.c (throw_quit_or_print_exception): New
function.
(gdbpy_apply_frame_filter): Use it.
2018-03-26 Tom Tromey <tom@tromey.com>
PR cli/17716:
* python/py-framefilter.c (py_print_type, py_print_value)
(enumerate_args, py_print_args, gdbpy_apply_frame_filter): Use
RETURN_MASK_ERROR.
2018-03-26 Tom Tromey <tom@tromey.com>
* python/py-framefilter.c (enumerate_args): Use
gdb::unique_xmalloc_ptr.
2018-03-26 Tom Tromey <tom@tromey.com>
* python/py-framefilter.c (py_print_frame): Return
EXT_LANG_BT_OK.
(gdbpy_apply_frame_filter): Update comment.
* extension.h (enum ext_lang_bt_status) <EXT_LANG_BT_COMPLETED>:
Remove.
<EXT_LANG_BT_NO_FILTERS>: Change value.
2018-03-26 Tom Tromey <tom@tromey.com>
PR backtrace/15582:
* stack.c (backtrace_command): Parse "hide" argument.
* python/py-framefilter.c (py_print_frame): Handle PRINT_HIDE.
* extension.h (enum frame_filter_flags) <PRINT_HIDE>: New
constant.
2018-03-26 Tom Tromey <tom@tromey.com>
* stack.c (backtrace_command_1): Remove "show_locals" parameter,
add "flags".
(backtrace_command): Remove "fulltrace", add "flags".
2018-03-26 Tom Tromey <tom@tromey.com>
* stack.c (backtrace_command): Rewrite command line parsing.
2018-03-26 Simon Marchi <simon.marchi@ericsson.com>
* dwarf2read.c (DEF_VEC_I(offset_type)): Remove.
2018-03-26 Simon Marchi <simon.marchi@ericsson.com>
* filename-seen-cache.h: Add include guard.
2018-03-26 Keith Seitz <keiths@redhat.com>
* symfile.c (place_section): Remove "struct" from section_addr_info
in comment.
* windows-nat.c (struct safe_symbol_file_add_args) <addrs>: Remove
"struct" keyword from section_addr_info.
2018-03-26 Alan Hayward <alan.hayward@arm.com>
* regformats/regdef.h (reg): Add constructors.
2018-03-25 Pedro Alves <palves@redhat.com>
* eval.c (evaluate_funcall): Swap OP_VAR_MSYM_VALUE/OP_VAR_VALUE
if then/else bodies in var_func_name extraction.
2018-03-25 19:54:44 +02:00
2018-03-23 Weimin Pan <weimin.pan@oracle.com>
* minsyms.c (lookup_minimal_symbol_and_objfile): Use
lookup_minimal_symbol() to find symbol entry.
* minsyms.h (lookup_minimal_symbol_and_objfile): Update comment.
2018-03-23 Keith Seitz <keiths@redhat.com>
PR c++/22968
* dwarf2read.c (scan_partial_symbols): Scan structs/classes for
nested type definitions for C++, too.
2018-03-23 Tom Tromey <tom@tromey.com>
* machoread.c (struct oso_el): Add a constructor. Don't define as
a typedef.
(macho_register_oso): Remove.
(macho_symtab_read): Take a std::vector.
(oso_el_compare_name): Now a std::sort comparator.
(macho_symfile_read_all_oso): Take a std::vector.
(macho_symfile_read): Use std::vector. Remove cleanups.
2018-03-22 Tom Tromey <tom@tromey.com>
* record-full.c (record_full_exec_insn): Use gdb::byte_vector.
(record_full_goto_bookmark): Use std::string.
2018-03-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
PR tdep/18295
* rs6000-tdep.c (skip_prologue): Match both stwux and stdux
a single mask.
2018-03-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* rs6000-tdep.c (store_insn_p): New function.
(skip_prologue): New variable alloca_reg_offset. Set lr_reg
and cr_reg to their unshifted values. Use store_insn_p to
match LR saves using either R1 or fdata->alloca_reg. Use
store_insn_p to match CR saves. Set alloca_reg_offset
when alloca_reg and framep are set. Remove lr_reg shift
when assigning to fdata->lr_register.
2018-03-22 Andreas Arnez <arnez@linux.vnet.ibm.com>
* linux-tdep.c (linux_info_proc): For "info proc cmdline", print
command line args instead of emitting a warning.
Get rid of VEC(static_tracepoint_marker_p) This patch replaces VEC(static_tracepoint_marker_p) with std::vector, and does some c++ification around that. I thought a new overload of hex2str was useful, so I added it as well as corresponding unit tests. I also added an overload of ui_out::field_string that takes an std::string directly. gdb/ChangeLog: * tracepoint.h (struct static_tracepoint_marker): Initialize fields, define default constructor, move constructor and move assignment, disable the rest. <str_id, extra>: Make std::string. (release_static_tracepoint_marker): Remove. (free_current_marker): Remove. * tracepoint.c (free_current_marker): Remove. (parse_static_tracepoint_marker_definition): Adjust to std::string, use new hex2str overload. (release_static_tracepoint_marker): Remove. (print_one_static_tracepoint_marker): Get marker by reference and adjust to std::string. (info_static_tracepoint_markers_command): Adjust to std::vector changes * target.h (static_tracepoint_marker_p): Remove typedef. (DEF_VEC_P(static_tracepoint_marker_p)): Remove. (struct target_ops) <to_static_tracepoint_marker_at>: Return bool. <to_static_tracepoint_markers_by_strid>: Return std::vector. * target-debug.h (target_debug_print_VEC_static_tracepoint_marker_p_p): Remove. (target_debug_print_std_vector_static_tracepoint_marker): New. (target_debug_print_struct_static_tracepoint_marker_p): Rename to... (target_debug_print_static_tracepoint_marker_p): ... this. * target-delegates.c: Re-generate. * breakpoint.h (struct tracepoint) <static_trace_marker_id>: Make std::string. * breakpoint.c (init_breakpoint_sal): Adjust to std::string. (decode_static_tracepoint_spec): Adjust to std::vector. (tracepoint_print_one_detail): Adjust to std::string. (strace_marker_decode_location): Adjust to std::string. (update_static_tracepoint): Adjust to std::string, remove call to release_static_tracepoint_marker. * linux-nat.c (linux_child_static_tracepoint_markers_by_strid): Adjust to std::vector. * remote.c (remote_static_tracepoint_marker_at): Return bool. (remote_static_tracepoint_markers_by_strid): Adjust to std::vector. * common/rsp-low.h (hex2str): New overload with explicit count of bytes. * common/rsp-low.c (hex2str): New overload with explicit count of bytes. * unittests/rsp-low-selftests.c (test_hex2str): New function. (_initialize_rsp_low_selftests): Add test_hex2str test. * unittests/tracepoint-selftests.c (test_parse_static_tracepoint_marker_definition): Adjust to std::string.
2018-03-22 05:27:19 +01:00
2018-03-22 Simon Marchi <simon.marchi@polymtl.ca>
* tracepoint.h (struct static_tracepoint_marker): Initialize
fields, define default constructor, move constructor and move
assignment, disable the rest.
<str_id, extra>: Make std::string.
(release_static_tracepoint_marker): Remove.
(free_current_marker): Remove.
* tracepoint.c (free_current_marker): Remove.
(parse_static_tracepoint_marker_definition): Adjust to
std::string, use new hex2str overload.
(release_static_tracepoint_marker): Remove.
(print_one_static_tracepoint_marker): Get marker by reference
and adjust to std::string.
(info_static_tracepoint_markers_command): Adjust to std::vector
changes
* target.h (static_tracepoint_marker_p): Remove typedef.
(DEF_VEC_P(static_tracepoint_marker_p)): Remove.
(struct target_ops) <to_static_tracepoint_marker_at>: Return
bool.
<to_static_tracepoint_markers_by_strid>: Return std::vector.
* target-debug.h
(target_debug_print_VEC_static_tracepoint_marker_p_p): Remove.
(target_debug_print_std_vector_static_tracepoint_marker): New.
(target_debug_print_struct_static_tracepoint_marker_p): Rename
to...
(target_debug_print_static_tracepoint_marker_p): ... this.
* target-delegates.c: Re-generate.
* breakpoint.h (struct tracepoint) <static_trace_marker_id>:
Make std::string.
* breakpoint.c (init_breakpoint_sal): Adjust to std::string.
(decode_static_tracepoint_spec): Adjust to std::vector.
(tracepoint_print_one_detail): Adjust to std::string.
(strace_marker_decode_location): Adjust to std::string.
(update_static_tracepoint): Adjust to std::string, remove call
to release_static_tracepoint_marker.
* linux-nat.c (linux_child_static_tracepoint_markers_by_strid):
Adjust to std::vector.
* remote.c (remote_static_tracepoint_marker_at): Return bool.
(remote_static_tracepoint_markers_by_strid): Adjust to
std::vector.
* common/rsp-low.h (hex2str): New overload with explicit count
of bytes.
* common/rsp-low.c (hex2str): New overload with explicit count
of bytes.
* unittests/rsp-low-selftests.c (test_hex2str): New function.
(_initialize_rsp_low_selftests): Add test_hex2str test.
* unittests/tracepoint-selftests.c
(test_parse_static_tracepoint_marker_definition): Adjust to
std::string.
Make parse_static_tracepoint_marker_definition work with multiple static tracepoint definitions Since I modify the parse_static_tracepoint_marker_definition function in the next patch, I wanted to write a unit test for it. Doing so showed that it doesn't handle multiple consecutive static tracepoint definitions separated by commas. However, the RSP documentation [1] states that servers may return multiple definitions, like: 1234:6d61726b657231:6578747261207374756666,abba:6d61726b657232: The problem is that the function uses strlen to compute the length of the last field (the extra field). If there are additional definitions in addition to the one we are currently parsing, the returned length will include those definitions, and we'll try to hex-decode past the extra field. This patch changes parse_static_tracepoint_marker_definition to consider the case where the current definition is followed by a comma and more definitions. It also adds the unit test that found the issue in the first place. I don't think this causes any backwards compatibility issues, because the previous code only handled single static tracepoint definitions, and the new code handles that correctly. gdb/ChangeLog: * tracepoint.c (parse_static_tracepoint_marker_definition): Consider case where the definition is followed by more definitions. * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add tracepoint-selftests.c. * unittests/tracepoint-selftests.c: New. [1] https://sourceware.org/gdb/onlinedocs/gdb/Tracepoint-Packets.html#qTfSTM
2018-03-22 05:26:37 +01:00
2018-03-22 Simon Marchi <simon.marchi@polymtl.ca>
* tracepoint.c (parse_static_tracepoint_marker_definition):
Consider case where the definition is followed by more
definitions.
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
tracepoint-selftests.c.
* unittests/tracepoint-selftests.c: New.
2018-03-21 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* MAINTAINERS (Write After Approval): Add Pedro Franco de
Carvalho.
2018-03-20 Stephen Roberts <stephen.roberts@arm.com>
* symtab.c (find_pc_sect_line): fixed indentation.
2018-03-20 Stephen Roberts <stephen.roberts@arm.com>
* symtab.c (find_pc_sect_line): now uses binary search.
2018-03-19 Tom Tromey <tom@tromey.com>
* rust-exp.y (struct_expr_tail, struct_expr_list): Add plain
"IDENT" production.
Convert observers to C++ This converts observers from using a special source-generating script to be plain C++. This version of the patch takes advantage of C++11 by using std::function and variadic templates; incorporates Pedro's patches; and renames the header file to "observable.h" (this change eliminates the need for a clean rebuild). Note that Pedro's patches used a template lambda in tui-hooks.c, but this failed to compile on some buildbot instances (presumably due to differing C++ versions); I replaced this with an ordinary template function. Regression tested on the buildbot. gdb/ChangeLog 2018-03-19 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * unittests/observable-selftests.c: New file. * common/observable.h: New file. * observable.h: New file. * ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c, arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c, breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c, corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c, extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c, infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c, linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c, mi/mi-cmd-break.c, mi/mi-interp.c, mi/mi-main.c, objfiles.c, ppc-linux-nat.c, ppc-linux-tdep.c, printcmd.c, procfs.c, python/py-breakpoint.c, python/py-finishbreakpoint.c, python/py-inferior.c, python/py-unwind.c, ravenscar-thread.c, record-btrace.c, record-full.c, record.c, regcache.c, remote.c, riscv-tdep.c, sol-thread.c, solib-aix.c, solib-spu.c, solib.c, spu-multiarch.c, spu-tdep.c, stack.c, symfile-mem.c, symfile.c, symtab.c, thread.c, top.c, tracepoint.c, tui/tui-hooks.c, tui/tui-interp.c, valops.c: Update all users. * tui/tui-hooks.c (tui_bp_created_observer) (tui_bp_deleted_observer, tui_bp_modified_observer) (tui_inferior_exit_observer, tui_before_prompt_observer) (tui_normal_stop_observer, tui_register_changed_observer): Remove. (tui_observers_token): New global. (attach_or_detach, tui_attach_detach_observers): New functions. (tui_install_hooks, tui_remove_hooks): Use tui_attach_detach_observers. * record-btrace.c (record_btrace_thread_observer): Remove. (record_btrace_thread_observer_token): New global. * observer.sh: Remove. * observer.c: Rename to observable.c. * observable.c (namespace gdb_observers): Define new objects. (observer_debug): Move into gdb_observers namespace. (struct observer, struct observer_list, xalloc_observer_list_node) (xfree_observer_list_node, generic_observer_attach) (generic_observer_detach, generic_observer_notify): Remove. (_initialize_observer): Update. Don't include observer.inc. * Makefile.in (generated_files): Remove observer.h, observer.inc. (clean mostlyclean): Likewise. (observer.h, observer.inc): Remove targets. (SUBDIR_UNITTESTS_SRCS): Add observable-selftests.c. (COMMON_SFILES): Use observable.c, not observer.c. * .gitignore: Remove observer.h. gdb/doc/ChangeLog 2018-03-19 Tom Tromey <tom@tromey.com> * observer.texi: Remove. gdb/testsuite/ChangeLog 2018-03-19 Tom Tromey <tom@tromey.com> * gdb.gdb/observer.exp: Remove.
2016-10-02 18:50:20 +02:00
2018-03-19 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
* unittests/observable-selftests.c: New file.
* common/observable.h: New file.
* observable.h: New file.
* ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c,
arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c,
breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c,
corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c,
extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c,
infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c,
linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c,
mi/mi-cmd-break.c, mi/mi-interp.c, mi/mi-main.c, objfiles.c,
ppc-linux-nat.c, ppc-linux-tdep.c, printcmd.c, procfs.c,
python/py-breakpoint.c, python/py-finishbreakpoint.c,
python/py-inferior.c, python/py-unwind.c, ravenscar-thread.c,
record-btrace.c, record-full.c, record.c, regcache.c, remote.c,
riscv-tdep.c, sol-thread.c, solib-aix.c, solib-spu.c, solib.c,
spu-multiarch.c, spu-tdep.c, stack.c, symfile-mem.c, symfile.c,
symtab.c, thread.c, top.c, tracepoint.c, tui/tui-hooks.c,
tui/tui-interp.c, valops.c: Update all users.
* tui/tui-hooks.c (tui_bp_created_observer)
(tui_bp_deleted_observer, tui_bp_modified_observer)
(tui_inferior_exit_observer, tui_before_prompt_observer)
(tui_normal_stop_observer, tui_register_changed_observer):
Remove.
(tui_observers_token): New global.
(attach_or_detach, tui_attach_detach_observers): New functions.
(tui_install_hooks, tui_remove_hooks): Use
tui_attach_detach_observers.
* record-btrace.c (record_btrace_thread_observer): Remove.
(record_btrace_thread_observer_token): New global.
* observer.sh: Remove.
* observer.c: Rename to observable.c.
* observable.c (namespace gdb_observers): Define new objects.
(observer_debug): Move into gdb_observers namespace.
(struct observer, struct observer_list, xalloc_observer_list_node)
(xfree_observer_list_node, generic_observer_attach)
(generic_observer_detach, generic_observer_notify): Remove.
(_initialize_observer): Update.
Don't include observer.inc.
* Makefile.in (generated_files): Remove observer.h, observer.inc.
(clean mostlyclean): Likewise.
(observer.h, observer.inc): Remove targets.
(SUBDIR_UNITTESTS_SRCS): Add observable-selftests.c.
(COMMON_SFILES): Use observable.c, not observer.c.
* .gitignore: Remove observer.h.
2018-03-18 Tom Tromey <tom@tromey.com>
* solib.c (gdb_bfd_lookup_symbol_from_symtab): Use
gdb::def_vector.
(bfd_lookup_symbol_from_dyn_symtab): Likewise.
2018-03-17 Tom Tromey <tom@tromey.com>
* auto-load.c (auto_load_objfile_script_1): Use std::string.
2018-03-17 Tom Tromey <tom@tromey.com>
* target.c (class scoped_target_fd): New.
(target_fileio_close_cleanup): Remove.
(target_fileio_read_alloc_1): Use scoped_target_fd.
Add silent Makefile rules Many projects (e.g. the Linux kernel) and build systems use "silent" rules, which means that they'll only print a summary of what's being done instead of printing all the detailed command lines. While chatting on the #gdb IRC channel, I realized a few people (including me) thought it would be nice to have it in GDB too. The idea is that too much text is not useful, the important information gets lost. If there's only the essential information, it's more likely to be useful. Most of the time, when I look at the build output, it's to see how it's progressing. By just printing a brief summary of each operation, I can easily spot what's currently being compiled and therefore how the build progresses (with time you know the order in which files are compiled almost by heart). As with other projects (Linux, automake-based things, probably others), it's possible to print the complete command lines by passing V=1 to make (or any other non-zero value). I had one hesitation about this: when people report build failures, we are more likely to miss the full compile command line. We'll probably sometimes need to ask people to include the build log with "make V=1". I don't think it's a big downside, if other projects the size of the Linux kernel can live with it, I'm sure we can too. gdb/ChangeLog: * silent-rules.mk: New. * Makefile.in: Include silent-rules.mk (srcdir, VPATH, top_srcdir): Move up. (COMPILE): Add ECHO_CXX. (test-cp-name-parser$(EXEEXT)): Add ECHO_CXXLD. (init.c): Add ECHO_INIT_C. (gdb$(EXEEXT)): Add SILENCE and ECHO_CXXLD. (version.c): Add ECHO_GEN. (printcmd.o): Add ECHO_CXX. (target-float.o): Add ECHO_CXX. (ada-exp.o): Add ECHO_CXX. (stamp-xml): Add SILENCE and ECHO_GEN_XML_BUILTIN. (insight$(EXEEXT)): Add ECHO_CXXLD. * gnulib/configure.ac: Add AM_SILENT_RULES. * gnulib/aclocal.m4: Re-generate. * gnulib/configure: Re-generate. * gnulib/import/Makefile.in: Re-generate. gdb/gdbserver/ChangeLog: * Makefile.in: Include silent-rules.mk. (srcdir, abs_top_srcdir, abs_srcdir, VPATH): Move up. (COMPILE): Add ECHO_CXX. (gdbserver$(EXEEXT)): Add SILENCE and ECHO_CXXLD. (gdbreplay$(EXEEXT)): Add SILENCE and ECHO_CXXLD. ($(IPA_LIB)): Add SILENCE and ECHO_CXXLD. (version-generated.c): Add ECHO_GEN. (stamp-xml): Add SILENCE and ECHO_GEN_XML_BUILTIN_GENERATED. (IPAGENT_COMPILE): Add ECHO_CXX. (%-generated.c): Add ECHO_REGDAT.
2018-03-16 21:06:23 +01:00
2018-03-16 Simon Marchi <simon.marchi@polymtl.ca>
* silent-rules.mk: New.
* Makefile.in: Include silent-rules.mk
(srcdir, VPATH, top_srcdir): Move up.
(COMPILE): Add ECHO_CXX.
(test-cp-name-parser$(EXEEXT)): Add ECHO_CXXLD.
(init.c): Add ECHO_INIT_C.
(gdb$(EXEEXT)): Add SILENCE and ECHO_CXXLD.
(version.c): Add ECHO_GEN.
(printcmd.o): Add ECHO_CXX.
(target-float.o): Add ECHO_CXX.
(ada-exp.o): Add ECHO_CXX.
(stamp-xml): Add SILENCE and ECHO_GEN_XML_BUILTIN.
(insight$(EXEEXT)): Add ECHO_CXXLD.
* gnulib/configure.ac: Add AM_SILENT_RULES.
* gnulib/aclocal.m4: Re-generate.
* gnulib/configure: Re-generate.
* gnulib/import/Makefile.in: Re-generate.
Remove make_cleanup_free_section_addr_info This removes make_cleanup_free_section_addr_info. Instead -- per Simon's suggestion -- this changes section_addr_info to be a std::vector. Regression tested by the buildbot. gdb/ChangeLog 2018-03-16 Tom Tromey <tom@tromey.com> * xcoffread.c (xcoff_symfile_offsets): Change type of "addrs". * utils.h (make_cleanup_free_section_addr_info): Don't declare. * utils.c (do_free_section_addr_info) (make_cleanup_free_section_addr_info): Remove. * symfile.h (struct other_sections): Add constructor. (struct section_addr_info): Remove. (section_addr_info): New typedef. (struct sym_fns) <sym_offsets>: Change type of parameter. (build_section_addr_info_from_objfile) (relative_addr_info_to_section_offsets, addr_info_make_relative) (default_symfile_offsets, symbol_file_add) (symbol_file_add_from_bfd) (build_section_addr_info_from_section_table): Update. (alloc_section_addr_info, free_section_addr_info): Don't declare. * symfile.c (alloc_section_addr_info): Remove. (build_section_addr_info_from_section_table): Change return type. Update. (build_section_addr_info_from_bfd) (build_section_addr_info_from_objfile): Likewise. (free_section_addr_info): Remove. (relative_addr_info_to_section_offsets): Change type of "addrs". (addrs_section_compar): Now a std::sort comparator. (addrs_section_sort): Change return type. (addr_info_make_relative): Change type of "addrs". Update. (default_symfile_offsets, syms_from_objfile_1) (syms_from_objfile, symbol_file_add_with_addrs): Likewise. (symbol_file_add_separate): Update. (symbol_file_add): Change type of "addrs". Update. (add_symbol_file_command): Update. Remove cleanups. * symfile-mem.c (symbol_file_add_from_memory): Update. Remove cleanups. * symfile-debug.c (debug_sym_offsets): Change type of "info". * solib.c (solib_read_symbols): Update. * objfiles.c (objfile_relocate): Update. Remove cleanups. * machoread.c (macho_symfile_offsets): Update. * jit.c (jit_bfd_try_read_symtab): Update.
2018-03-13 04:50:33 +01:00
2018-03-16 Tom Tromey <tom@tromey.com>
* xcoffread.c (xcoff_symfile_offsets): Change type of "addrs".
* utils.h (make_cleanup_free_section_addr_info): Don't declare.
* utils.c (do_free_section_addr_info)
(make_cleanup_free_section_addr_info): Remove.
* symfile.h (struct other_sections): Add constructor.
(struct section_addr_info): Remove.
(section_addr_info): New typedef.
(struct sym_fns) <sym_offsets>: Change type of parameter.
(build_section_addr_info_from_objfile)
(relative_addr_info_to_section_offsets, addr_info_make_relative)
(default_symfile_offsets, symbol_file_add)
(symbol_file_add_from_bfd)
(build_section_addr_info_from_section_table): Update.
(alloc_section_addr_info, free_section_addr_info): Don't declare.
* symfile.c (alloc_section_addr_info): Remove.
(build_section_addr_info_from_section_table): Change return type.
Update.
(build_section_addr_info_from_bfd)
(build_section_addr_info_from_objfile): Likewise.
(free_section_addr_info): Remove.
(relative_addr_info_to_section_offsets): Change type of "addrs".
(addrs_section_compar): Now a std::sort comparator.
(addrs_section_sort): Change return type.
(addr_info_make_relative): Change type of "addrs". Update.
(default_symfile_offsets, syms_from_objfile_1)
(syms_from_objfile, symbol_file_add_with_addrs): Likewise.
(symbol_file_add_separate): Update.
(symbol_file_add): Change type of "addrs". Update.
(add_symbol_file_command): Update. Remove cleanups.
* symfile-mem.c (symbol_file_add_from_memory): Update. Remove
cleanups.
* symfile-debug.c (debug_sym_offsets): Change type of "info".
* solib.c (solib_read_symbols): Update.
* objfiles.c (objfile_relocate): Update. Remove cleanups.
* machoread.c (macho_symfile_offsets): Update.
* jit.c (jit_bfd_try_read_symtab): Update.
2018-03-15 Simon Marchi <simon.marchi@polymtl.ca>
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/utils-selftests.c.
* unittests/utils-selftests.c: New file.
2018-03-14 Tom Tromey <tom@tromey.com>
PR cli/14977:
* printcmd.c (printf_c_string, printf_wide_c_string): Special case
for NULL.
2018-03-14 Tom Tromey <tom@tromey.com>
PR cli/19918:
* printcmd.c (printf_pointer): Allow "-" in format.
2018-03-14 Tom Tromey <tom@tromey.com>
* printcmd.c (_initialize_printcmd): Add usage to printf.
2018-03-14 Yao Qi <qiyao@sourceware.org>
* MAINTAINERS: Update my email address.
2018-03-13 Tom Tromey <tom@tromey.com>
* machoread.c (macho_check_dsym): Change filenamep to a
std::string*.
(macho_symfile_read): Update.
* symfile.c (load_command): Use std::string.
2018-03-12 Andrew Burgess <andrew.burgess@embecosm.com>
* riscv-tdep.c (riscv_sw_breakpoint_from_kind): Add localization
to error message string.
(riscv_register_name): Use xsnprintf instead of sprintf.
(riscv_insn::fetch_instruction): Use gdb_assert instead of
internal_error.
(riscv_print_arg_location): Use gdb_assert_not_reached instead of
error.
(riscv_push_dummy_call): Likewise.
2018-03-12 Tom Tromey <tom@tromey.com>
* rs6000-aix-tdep.c (rs6000_aix_core_xfer_shared_libraries_aix):
Use gdb::byte_vector.
* arm-tdep.c (arm_exidx_new_objfile): Use gdb::byte_vector.
2018-03-12 Yao Qi <yao.qi@linaro.org>
* ia64-libunwind-tdep.c (libunwind_get_reg_special): Change
parameter type to readable_regcache.
* ia64-libunwind-tdep.h (libunwind_get_reg_special): Update
the declaration.
2018-03-11 Tom Tromey <tom@tromey.com>
* dwarf2read.c (struct nextfield): Add initializers.
(struct nextfnfield): Remove.
(struct fnfieldlist): Add initializers. Remove "length" and
"head", use std::vector.
(struct decl_field_list): Remove.
(struct field_info): Add initializers.
<fields, baseclasses>: Now std::vector.
<nbaseclasses, nfnfields, typedef_field_list_count,
nested_types_list_count>: Remove.
(dwarf2_add_field, dwarf2_add_type_defn)
(dwarf2_attach_fields_to_type, dwarf2_add_member_fn)
(dwarf2_attach_fn_fields_to_type, handle_struct_member_die)
(process_structure_scope): Update.
2018-03-11 Tom Tromey <tom@tromey.com>
* dwarf2read.c (sort_tu_by_abbrev_offset): Change to be suitable
for use by std::sort.
(build_type_psymtabs_1): Use std::vector.
2018-03-09 Eli Zaretskii <eliz@gnu.org>
* top.c (print_gdb_configuration): Reflect LIBIPT, LIBMEMCHECK,
and LIBMPFR in the printed configuration.
2018-03-08 Tom Tromey <tom@tromey.com>
* source.c (get_filename_and_charpos): Use scoped_fd.
* nto-procfs.c (procfs_open_1): Use scoped_fd.
(procfs_pidlist): Likewise.
* procfs.c (proc_get_LDT_entry): Use scoped_fd.
(iterate_over_mappings): Likewise.
2018-03-08 Tom Tromey <tom@tromey.com>
* infcall.c (struct call_return_meta_info)
<stack_temporaries_enabled>: Remove.
(get_call_return_value, call_function_by_hand_dummy): Update.
* thread.c (disable_thread_stack_temporaries): Remove.
(enable_thread_stack_temporaries): Remove.
(thread_stack_temporaries_enabled_p): Return bool.
(push_thread_stack_temporary, value_in_thread_stack_temporaries)
(get_last_thread_stack_temporary): Update.
* eval.c (evaluate_subexp): Update.
* gdbthread.h (class enable_thread_stack_temporaries): Now a
class, not a function.
(value_ptr, value_vec): Remove typedefs.
(class thread_info) <stack_temporaries_enabled>: Now bool.
<stack_temporaries>: Now a std::vector.
(thread_stack_temporaries_enabled_p)
(value_in_thread_stack_temporaries): Return bool.
2018-03-08 Simon Marchi <simon.marchi@ericsson.com>
* remote.c (putpkt_binary): Fix omitted bytes reporting.
(getpkt_or_notif_sane_1): Likewise.
2018-03-08 Simon Marchi <simon.marchi@polymtl.ca>
* build-id.c (build_id_to_debug_bfd): Use std::string.
2018-03-08 Simon Marchi <simon.marchi@polymtl.ca>
* build-id.c (find_separate_debug_file_by_buildid): Return
std::string.
* build-id.h (find_separate_debug_file_by_buildid): Return
std::string.
* coffread.c (coff_symfile_read): Adjust to std::string.
* elfread.c (elf_symfile_read): Adjust to std::string.
* symfile.c (separate_debug_file_exists): Change parameter to
std::string.
(find_separate_debug_file): Return std::string.
(find_separate_debug_file_by_debuglink): Return std::string.
* symfile.h (find_separate_debug_file_by_debuglink): Return
std::string.
2018-03-08 Simon Marchi <simon.marchi@polymtl.ca>
* common/xml-utils.c (xml_escape_text): Move code to...
(xml_escape_text_append): ... this new function.
* common/xml-utils.h (xml_escape_text_append): New declaration.
* unittests/xml-utils-selftests.c (test_xml_escape_text_append):
New function.
(_initialize_xml_utils): register test_xml_escape_text_append as
a selftest.
2018-03-07 Alan Hayward <alan.hayward@arm.com>
* defs.h: Remove MAX_REGISTER_SIZE.
* regcache.c (init_regcache_descr): Remove MAX_REGISTER_SIZE
asserts.
* python/py-unwind.c (pyuw_sniffer): Likewise.
2018-03-07 Tom Tromey <tom@tromey.com>
* linux-tdep.c (linux_info_proc): Update.
* target.h (struct target_ops) <to_fileio_readlink>: Return
optional<string>.
(target_fileio_readlink): Return optional<string>.
* remote.c (remote_hostio_readlink): Return optional<string>.
* inf-child.c (inf_child_fileio_readlink): Return
optional<string>.
* target.c (target_fileio_readlink): Return optional<string>.
2018-03-07 Andrew Burgess <andrew.burgess@embecosm.com>
* regcache.c (cooked_read_test): Add riscv to the list of
architectures that have a save_reggroup.
2018-03-07 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gnu-v3-abi.c (gnuv3_rtti_type): Add early exit if the given
value is not a dynamic class object.
2018-03-06 Tom Tromey <tom@tromey.com>
* rust-exp.y: Formatting fixes.
2018-03-06 Andrew Burgess <andrew.burgess@embecosm.com>
* riscv-tdep.c (riscv_register_name): Remove target description
support.
(riscv_gdbarch_init): Remove target description check.
2018-03-06 Andrew Burgess <andrew.burgess@embecosm.com>
* riscv-tdep.c: Remove 'Contributed by ...' lines from header
comment.
* riscv-tdep.h: Likewise.
2018-03-06 Andrew Burgess <andrew.burgess@embecosm.com>
* riscv-tdep.c (riscv_pseudo_register_read): Delete.
(riscv_pseudo_register_write): Delete.
(riscv_gdbarch_init): Remove all use of pseudo registers.
2018-03-06 Simon Marchi <simon.marchi@polymtl.ca>
* record-btrace.c (btrace_print_lines): Replace cleanup
parameter with RAII equivalents.
(btrace_insn_history): Replace cleanup with RAII equivalents.
* ui-out.h (make_cleanup_ui_out_list_begin_end,
make_cleanup_ui_out_tuple_begin_end): Remove.
* ui-out.c (struct ui_out_end_cleanup_data, do_cleanup_end,
make_cleanup_ui_out_end, make_cleanup_ui_out_tuple_begin_end,
make_cleanup_ui_out_list_begin_end): Remove.
2018-03-06 Simon Marchi <simon.marchi@polymtl.ca>
* record-btrace.c (record_btrace_maybe_mark_async_event): Change
parameter types to std::vector. Use bool.
(record_btrace_wait): Replace VEC(tp_t) with
std::vector<thread_info *>.
* common/gdb_vecs.h (unordered_remove, ordered_remove): New.
2018-03-06 Simon Marchi <simon.marchi@polymtl.ca>
* record-btrace.c (record_btrace_disable_callback): Remove.
(struct scoped_btrace_disable): New.
(record_btrace_open): Use scoped_btrace_disable.
2018-03-06 Andrew Burgess <andrew.burgess@embecosm.com>
* riscv-tdep.c (riscv_return_value): Change type to ULONGEST for
reading values from registers.
2018-03-06 Andrew Burgess <andrew.burgess@embecosm.com>
* riscv-tdep.c (riscv_push_dummy_call): Use core_addr_to_string_nz
where appropriate.
2018-03-06 Andrew Burgess <andrew.burgess@embecosm.com>
* riscv-tdep.c (riscv_print_arg_location): Add header comment,
change parameter type. Use GDB's print functions, and use
core_addr_to_string where appropriate.
(riscv_push_dummy_call): Use core_addr_to_string where
appropriate, update call to riscv_print_arg_location, and reindent
a few lines.
(riscv_return_value): Update call to riscv_print_arg_location.
2018-03-06 Andrew Burgess <andrew.burgess@embecosm.com>
Tim Newsome <tim@sifive.com>
Albert Ou <a0u@eecs.berkeley.edu>
Darius Rad <darius@bluespec.com>
* Makefile.in (ALL_TARGET_OBS): Add riscv-tdep.o
(HFILES_NO_SRCDIR): Add riscv-tdep.h.
(ALLDEPFILES): Add riscv-tdep.c
* configure.tgt: Add riscv support.
* riscv-tdep.c: New file.
* riscv-tdep.h: New file.
* NEWS: Mention new target.
* MAINTAINERS: Add entry for riscv.
2018-03-06 Andrew Burgess <andrew.burgess@embecosm.com>
* amd64-tdep.c (amd64_classify_aggregate): Ignore zero sized
fields within aggregates.
2018-03-04 Simon Marchi <simon.marchi@polymtl.ca>
* record-btrace.c (btrace_print_lines): Change type of flags to
gdb_disassembly_flags.
2018-03-04 John Baldwin <jhb@FreeBSD.org>
* fbsd-nat.c: Include "inf-ptrace.h".
(USE_SIGTRAP_SIGINFO): Conditionally define.
[USE_SIGTRAP_SIGINFO] (fbsd_handle_debug_trap): New function.
(fbsd_wait) [USE_SIGTRAP_SIGINFO]: Call "fbsd_handle_debug_trap".
[USE_SIGTRAP_SIGINFO] (fbsd_stopped_by_sw_breakpoint): New
function.
[USE_SIGTRAP_SIGINFO] (fbsd_supports_stopped_by_sw_breakpoint):
Likewise.
[USE_SIGTRAP_SIGINFO] (fbsd_supports_stopped_by_hw_breakpoint):
Likewise.
(fbsd_nat_add_target) [USE_SIGTRAP_SIGINFO]: Set
"stopped_by_sw_breakpoint", "supports_stopped_by_sw_breakpoint",
"supports_stopped_by_hw_breakpoint" target methods.
2018-03-04 John Baldwin <jhb@FreeBSD.org>
* NEWS (Changes since GDB 8.1): Add "set/show debug fbsd-nat".
* fbsd-nat.c (debug_fbsd_nat): New variable.
(show_fbsd_nat_debug): New function.
(fbsd_wait): Log LWP info if "debug_fbsd_nat" is enabled.
(_initialize_fbsd_nat): Add "fbsd-nat" debug boolean command.
2018-03-04 John Baldwin <jhb@FreeBSD.org>
* nat/x86-dregs.c (x86_dr_stopped_by_hw_breakpoint): New function.
* nat/x86-dregs.h (x86_dr_stopped_by_hw_breakpoint): New
prototype.
* x86-nat.c (x86_stopped_by_hw_breakpoint): New function.
(x86_use_watchpoints): Set "stopped_by_hw_breakpoint" target
method.
2018-03-02 Simon Marchi <simon.marchi@polymtl.ca>
* common/gdb_vecs.c (free_char_ptr_vec): Remove.
* common/gdb_vecs.h (free_char_ptr_vec): Remove.
2018-03-02 Simon Marchi <simon.marchi@polymtl.ca>
* charset.c (struct charset_vector): New.
(charsets): Change type to charset_vector.
(find_charset_names): Adjust.
(add_one): Adjust.
(_initialize_charset): Adjust.
2018-03-02 Simon Marchi <simon.marchi@polymtl.ca>
* progspace.h (struct program_space) <deleted_solibs>: Change
type to std::vector<std::string>.
* progspace.c (clear_program_space_solib_cache): Adjust.
* breakpoint.c (print_solib_event): Adjust.
(check_status_catch_solib): Adjust.
* solib.c (update_solib_list): Adjust.
* ui-out.h (class ui_out) <field_string>: New overload.
* ui-out.c (ui_out::field_string): New overload.
2018-03-02 Simon Marchi <simon.marchi@polymtl.ca>
* progspace.h (struct program_space): Add constructor and
destructor, initialize fields.
(add_program_space): Remove.
* progspace.c (add_program_space): Rename to...
(program_space::program_space): ... this.
(release_program_space): Rename to...
(program_space::~program_space): ... this.
(delete_program_space): Use delete to delete program_space.
(initialize_progspace): Use new to allocate program_space.
* inferior.c (add_inferior_with_spaces): Likewise.
(clone_inferior_command): Likewise.
* infrun.c (follow_fork_inferior): Likewise.
(handle_vfork_child_exec_or_exit): Likewise.
Make delim_string_to_char_ptr_vec return an std::vector This patch makes delim_string_to_char_ptr_vec and all related functions use std::vector of gdb::unique_xmalloc_ptr. This allows getting rid of make_cleanup_free_char_ptr_vec. Returning a vector of unique_xmalloc_ptr instead of std::string allows to minimize the impacts on the calling code. We can evaluate later whether we could/should return a vector of std::strings instead. gdb/ChangeLog: * common/gdb_vecs.h (make_cleanup_free_char_ptr_vec): Remove. (delim_string_to_char_ptr_vec): Return std::vector of gdb::unique_xmalloc_ptr. (dirnames_to_char_ptr_vec_append): Take std::vector of gdb::unique_xmalloc_ptr. (dirnames_to_char_ptr_vec): Return std::vector of gdb::unique_xmalloc_ptr. * common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Take std::vector of gdb::unique_xmalloc_ptr, adjust the code. (delim_string_to_char_ptr_vec): Return an std::vector of gdb::unique_xmalloc_ptr, adjust the code. (dirnames_to_char_ptr_vec_append): Take an std::vector of gdb::unique_xmalloc_ptr, adjust the code. (dirnames_to_char_ptr_vec): Return an std::vector of gdb::unique_xmalloc_ptr, adjust the code. * auto-load.c (auto_load_safe_path_vec): Change type to std::vector of gdb::unique_xmalloc_ptr. (auto_load_expand_dir_vars): Return an std::vector of gdb::unique_xmalloc_ptr, adjust the code. (auto_load_safe_path_vec_update): Adjust. (filename_is_in_auto_load_safe_path_vec): Adjust. (auto_load_objfile_script_1): Adjust. * build-id.c (build_id_to_debug_bfd): Adjust. * linux-thread-db.c (thread_db_load_search): Adjust. * source.c (add_path): Adjust. (openp): Adjust. * symfile.c (find_separate_debug_file): Adjust. * utils.c (do_free_char_ptr_vec): Remove. (make_cleanup_free_char_ptr_vec): Remove. gdb/gdbserver/ChangeLog: * server.c (parse_debug_format_options): Adjust to delim_string_to_char_ptr_vec changes. * thread-db.c (thread_db_load_search): Adjust to dirnames_to_char_ptr_vec changes.
2018-03-03 05:22:06 +01:00
2018-03-02 Simon Marchi <simon.marchi@polymtl.ca>
* common/gdb_vecs.h (make_cleanup_free_char_ptr_vec): Remove.
(delim_string_to_char_ptr_vec): Return std::vector of
gdb::unique_xmalloc_ptr.
(dirnames_to_char_ptr_vec_append): Take std::vector of
gdb::unique_xmalloc_ptr.
(dirnames_to_char_ptr_vec): Return std::vector of
gdb::unique_xmalloc_ptr.
* common/gdb_vecs.c (delim_string_to_char_ptr_vec_append):
Take std::vector of gdb::unique_xmalloc_ptr, adjust the code.
(delim_string_to_char_ptr_vec): Return an std::vector of
gdb::unique_xmalloc_ptr, adjust the code.
(dirnames_to_char_ptr_vec_append): Take an std::vector of
gdb::unique_xmalloc_ptr, adjust the code.
(dirnames_to_char_ptr_vec): Return an std::vector of
gdb::unique_xmalloc_ptr, adjust the code.
* auto-load.c (auto_load_safe_path_vec): Change type to
std::vector of gdb::unique_xmalloc_ptr.
(auto_load_expand_dir_vars): Return an std::vector of
gdb::unique_xmalloc_ptr, adjust the code.
(auto_load_safe_path_vec_update): Adjust.
(filename_is_in_auto_load_safe_path_vec): Adjust.
(auto_load_objfile_script_1): Adjust.
* build-id.c (build_id_to_debug_bfd): Adjust.
* linux-thread-db.c (thread_db_load_search): Adjust.
* source.c (add_path): Adjust.
(openp): Adjust.
* symfile.c (find_separate_debug_file): Adjust.
* utils.c (do_free_char_ptr_vec): Remove.
(make_cleanup_free_char_ptr_vec): Remove.
2018-03-01 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/22907
* common/pathstuff.c: Conditionally include "<windows.h>".
2018-03-01 Georg Sauthoff <mail@georg.so>
PR gdb/22888
* gcore.in: Quote variables and switch interpreter to bash.
2018-03-01 Tom Tromey <tom@tromey.com>
* dwarf2read.c (alloc_discriminant_info): Fix default_index
assertion. Add assertion for discriminant_index.
(quirk_rust_enum): Use correct base type name in univariant case.
2018-03-01 Simon Marchi <simon.marchi@ericsson.com>
* record.c (get_call_history_modifiers): Return a
record_print_flags.
(cmd_record_call_history): Adjust.
* record-btrace.c (record_btrace_call_history): Adjust.
(record_btrace_call_history_range): Adjust.
(record_btrace_call_history_from): Adjust.
* target-debug.h (target_debug_print_record_print_flags): New.
* target-delegates.c: Re-generate.
* target.c (target_call_history): Change flags type.
(target_call_history_from): Likewise.
(target_call_history_range): Likewise.
* target.h (struct target_ops) <target_call_history>: Likewise.
(target_call_history_from): Likewise.
(target_call_history_range): Likewise.
Make gdbserver work with filename-only binaries Simon mentioned on IRC that, after the startup-with-shell feature has been implemented on gdbserver, it is not possible to specify a filename-only binary, like: $ gdbserver :1234 a.out /bin/bash: line 0: exec: a.out: not found During startup program exited with code 127. Exiting This happens on systems where the current directory "." is not listed in the PATH environment variable. Although including "." in the PATH variable is a possible workaround, this can be considered a regression because before startup-with-shell it was possible to use only the filename (due to reason that gdbserver used "exec*" directly). The idea of the patch is to verify if the program path provided by the user (or by the remote protocol) contains a directory separator character. If it doesn't, it means we're dealing with a filename-only binary, so we call "gdb_abspath" to properly expand it and transform it into a full path. Otherwise, we leave the program path untouched. This mimicks the behaviour seen on GDB (look at "openp" and "attach_inferior", for example). I am also submitting a testcase which exercises the scenario described above. This test requires gdbserver to be executed in a different CWD than the original, so I also created a helper function, "with_cwd" (on testsuite/lib/gdb.exp), which takes care of cd'ing into and out of the specified dir. Built and regtested on BuildBot, without regressions. gdb/ChangeLog: 2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com> Simon Marchi <simon.marchi@polymtl.ca> * common/common-utils.c: Include "sys/stat.h". (is_regular_file): Move here from "source.c"; change return type to "bool". * common/common-utils.h (is_regular_file): New prototype. * common/pathstuff.c (contains_dir_separator): New function. * common/pathstuff.h (contains_dir_separator): New prototype. * source.c: Don't include "sys/stat.h". (is_regular_file): Move to "common/common-utils.c". gdb/gdbserver/ChangeLog: 2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com> * server.c: Include "filenames.h" and "pathstuff.h". (program_name): Delete variable. (program_path): New anonymous class. (get_exec_wrapper): Use "program_path" instead of "program_name". (handle_v_run): Likewise. (captured_main): Likewise. (process_serial_event): Likewise. gdb/testsuite/ChangeLog: 2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.server/abspath.exp: New file. * lib/gdb.exp (with_cwd): New procedure.
2018-02-10 00:54:41 +01:00
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
Simon Marchi <simon.marchi@polymtl.ca>
* common/common-utils.c: Include "sys/stat.h".
(is_regular_file): Move here from "source.c"; change return
type to "bool".
* common/common-utils.h (is_regular_file): New prototype.
* common/pathstuff.c (contains_dir_separator): New function.
* common/pathstuff.h (contains_dir_separator): New prototype.
* source.c: Don't include "sys/stat.h".
(is_regular_file): Move to "common/common-utils.c".
Create new common/pathstuff.[ch] This commit moves the path manipulation routines found on utils.c to a new common/pathstuff.c, and updates the Makefile.in's accordingly. The routines moved are "gdb_realpath", "gdb_realpath_keepfile" and "gdb_abspath". This will be needed because gdbserver will have to call "gdb_abspath" on my next patch, which implements a way to expand the path of the inferior provided by the user in order to allow specifying just the binary name when starting gdbserver, like: $ gdbserver :1234 a.out With the recent addition of the startup-with-shell feature on gdbserver, this scenario doesn't work anymore if the user doesn't have the current directory listed in the PATH variable. I had to do a minor adjustment on "gdb_abspath" because we don't have access to "tilde_expand" on gdbserver, so now the function is using "gdb_tilde_expand" instead. Otherwise, the code is the same. Regression tested on the BuildBot, without regressions. gdb/ChangeLog: 2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (COMMON_SFILES): Add "common/pathstuff.c". (HFILES_NO_SRCDIR): Add "common/pathstuff.h". * auto-load.c: Include "common/pathstuff.h". * common/common-def.h (current_directory): Move here. * common/gdb_tilde_expand.c (gdb_tilde_expand_up): New function. * common/gdb_tilde_expand.h (gdb_tilde_expand_up): New prototype. * common/pathstuff.c: New file. * common/pathstuff.h: New file. * compile/compile.c: Include "common/pathstuff.h". * defs.h (current_directory): Move to "common/common-defs.h". * dwarf2read.c: Include "common/pathstuff.h". * exec.c: Likewise. * guile/scm-safe-call.c: Likewise. * linux-thread-db.c: Likewise. * main.c: Likewise. * nto-tdep.c: Likewise. * objfiles.c: Likewise. * source.c: Likewise. * symtab.c: Likewise. * utils.c: Include "common/pathstuff.h". (gdb_realpath): Move to "common/pathstuff.c". (gdb_realpath_keepfile): Likewise. (gdb_abspath): Likewise. * utils.h (gdb_realpath): Move to "common/pathstuff.h". (gdb_realpath_keepfile): Likewise. (gdb_abspath): Likewise. gdb/gdbserver/ChangeLog: 2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (SFILES): Add "$(srcdir)/common/pathstuff.c". (OBJS): Add "pathstuff.o". * server.c (current_directory): New global variable. (captured_main): Initialize "current_directory".
2018-02-10 00:44:59 +01:00
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (COMMON_SFILES): Add "common/pathstuff.c".
(HFILES_NO_SRCDIR): Add "common/pathstuff.h".
* auto-load.c: Include "common/pathstuff.h".
* common/common-def.h (current_directory): Move here.
* common/gdb_tilde_expand.c (gdb_tilde_expand_up): New
function.
* common/gdb_tilde_expand.h (gdb_tilde_expand_up): New
prototype.
* common/pathstuff.c: New file.
* common/pathstuff.h: New file.
* compile/compile.c: Include "common/pathstuff.h".
* defs.h (current_directory): Move to "common/common-defs.h".
* dwarf2read.c: Include "common/pathstuff.h".
* exec.c: Likewise.
* guile/scm-safe-call.c: Likewise.
* linux-thread-db.c: Likewise.
* main.c: Likewise.
* nto-tdep.c: Likewise.
* objfiles.c: Likewise.
* source.c: Likewise.
* symtab.c: Likewise.
* utils.c: Include "common/pathstuff.h".
(gdb_realpath): Move to "common/pathstuff.c".
(gdb_realpath_keepfile): Likewise.
(gdb_abspath): Likewise.
* utils.h (gdb_realpath): Move to "common/pathstuff.h".
(gdb_realpath_keepfile): Likewise.
(gdb_abspath): Likewise.
Workaround a FreeBSD ptrace() bug with clearing thread events. When multiple threads within a process wish to report STOPPED events from wait(), the kernel picks one thread event as the thread event to report. The chosen thread event is retrieved via PT_LWPINFO by passing the process ID as the request pid. If multiple events are pending, then the subsequent wait() after resuming a process will report another STOPPED event after resuming the process to handle the next thread event and so on. A single thread event is cleared as a side effect of resuming the process with PT_CONTINUE, PT_STEP, etc. In older kernels, however, the request pid was used to select which thread's event was cleared rather than always clearing the event that was just reported. To avoid clearing the event of the wrong LWP, always pass the process ID instead of an LWP ID to PT_CONTINUE or PT_SYSCALL. In the case of stepping, the process ID cannot be used with PT_STEP since it would step the thread that reported an event which may not be the thread indicated by PTID. For stepping, use PT_SETSTEP to enable stepping on the desired thread before resuming the process via PT_CONTINUE instead of using PT_STEP. This manifested as a failure in the gdb.threads/continue-pending-status.exp test. Specifically, if thread 2 reported a breakpoint and the test thus switched to thread 3 before continuing, thread 3's event (if any) was discarded and thread 2's breakpoint remained pending and was reported a second time as a duplicate event. As a result, the PC was decremented twice for the same breakpoint resulting in an illegal instruction fault on x86. gdb/ChangeLog: * fbsd-nat.c (fbsd_resume): Use PT_SETSTEP for stepping and a wildcard process pid for super_resume for kernels with a specific bug.
2017-10-25 06:06:00 +02:00
2018-02-28 John Baldwin <jhb@FreeBSD.org>
* fbsd-nat.c (fbsd_resume): Use PT_SETSTEP for stepping and a
wildcard process pid for super_resume for kernels with a
specific bug.
2018-02-27 Phil Muldoon <pmuldoon@redhat.com>
* compile/compile.c (get_args): Add additional comments
explaining function.
2018-02-27 Simon Marchi <simon.marchi@polymtl.ca>
Tom Tromey <tom@tromey.com>
* target.h (memory_write_request_s): Remove typedef. Don't define
VEC.
(target_write_memory_blocks): Change argument to std::vector.
(struct memory_write_request): Add constructor.
* target-memory.c (compare_block_starting_address): Return bool.
Change argument types.
(claim_memory): Change arguments to use std::vector.
(split_regular_and_flash_blocks, blocks_to_erase)
(compute_garbled_blocks): Likewise.
(cleanup_request_data, cleanup_write_requests_vector): Remove.
(target_write_memory_blocks): Change argument to std::vector.
* symfile.c (struct load_section_data): Add constructor and
destructor. Use std::vector for "requests".
(struct load_progress_data): Add initializers.
(load_section_callback): Update. Use "new".
(clear_memory_write_data): Remove.
(generic_load): Update.
2018-02-27 Alan Hayward <alan.hayward@arm.com>
* arch/aarch64.h: Use common/tdesc.h.
MIPS: Don't use a 32-bit BFD architecture with a 64-bit ABI Select `bfd_mach_mips4000', which corresponds to the MIPS III ISA, the earlies with 64-bit support, whenever a 32-bit BFD architecture has been chosen to use with a 64-bit ABI. The situation can happen in a few cases: 1. When the user has used `set architecture' or `set mips abi' commands to override automatic selection and then starts a debug session by requesting to run, attach or connect to a target. 2. In native debugging when reattaching to a previously debugged process where the program to be debugged has been since discarded, as observed with: FAIL: gdb.base/attach.exp: attach2, with no file (GDB internal error) in n32 and n64 regression testing. 3. In remote debugging with a non-XML debug stub when discarding the program to be debugged while connected to the remote target, as observed with: FAIL: gdb.base/break-unload-file.exp: cmdline: always-inserted on: break: file (GDB internal error) in n32 and n64 regression testing. In the latter two cases the ABI, quite rightfully, is retained while the program to be debugged is discarded. This is because in that case the ABI previously determined is carried over along with `gdbarch' in use, which is retained. The BFD architecture is however discarded and the default then applies, because it is not attached to `gdbarch'. In all these cases we trip with an internal error message as follows: .../gdb/mips-tdep.c:766: internal-error: bad register size A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) n This is a bug, please report it. For instructions, see: <http://www.gnu.org/software/gdb/bugs/>. coming from `mips_pseudo_register_read', because the raw register width inferred from the BFD architecture turns out to be 4 for the general registers while the cooked register width inferred from the ABI in effect is 8. We do not hit this internal error in remote debugging with an XML debug stub, because in that case raw register width information is passed by the stub along with the XML target description. Ultimately I think we ought to make the BFD architecture sticky like the ABI, however in the interim this simple fix will do, removing the error across all three cases. The case where the user has used `set mips abi' or `set architecture' commands has to be handled anyway, and although a more sophisticated solution could be envisaged, such as reporting an error with the respective `set' command, I think this is too much of a corner case to bother. gdb/ * mips-tdep.c (mips_gdbarch_init): Don't use a 32-bit BFD architecture with a 64-bit ABI.
2018-02-26 20:43:17 +01:00
2018-02-26 Maciej W. Rozycki <macro@mips.com>
* mips-tdep.c (mips_gdbarch_init): Don't use a 32-bit BFD
architecture with a 64-bit ABI.
2018-02-26 Maciej W. Rozycki <macro@mips.com>
* gdb/mips-tdep.c (mips_gdbarch_init): Reorder ABI determination
ahead of target description loading.
2018-02-26 Tom Tromey <tom@tromey.com>
* stack.c (backtrace_command_1): Update.
* python/python-internal.h (gdbpy_apply_frame_filter): Change type
of "flags".
* python/py-framefilter.c (py_print_frame)
(gdbpy_apply_frame_filter): Change type of "flags".
* mi/mi-cmd-stack.c (mi_apply_ext_lang_frame_filter): Change type
of "flags".
(mi_cmd_stack_list_frames, mi_cmd_stack_list_locals)
(mi_cmd_stack_list_args, mi_cmd_stack_list_variables): Update.
* extension.h (enum frame_filter_flag): Rename from
frame_filter_flags.
(frame_filter_flags): Define using DEF_ENUM_FLAGS_TYPE.
(apply_ext_lang_frame_filter): Change type of "flags".
* extension.c (apply_ext_lang_frame_filter): Change type of
"flags".
* extension-priv.h (struct extension_language_ops)
<apply_frame_filter>: Change type of "flags".
2018-02-26 Tom Tromey <tom@tromey.com>
PR python/16497:
* stack.c (backtrace_command_1): Set PRINT_MORE_FRAMES flag. Fix
off-by-one in py_end computation.
* python/py-framefilter.c (gdbpy_apply_frame_filter): Handle
PRINT_MORE_FRAMES.
* extension.h (enum frame_filter_flags) <PRINT_MORE_FRAMES>: New
constant.
Handle DW_TAG_variant_part and DW_TAG_variant This changes dwarf2read to understand DW_TAG_variant_part and DW_TAG_variant. Note that DW_AT_discr_list is not handled. I did not need this for Rust. I imagine this should not be too hard to add later, should someone need it. Meanwhile I have gdb emit a complaint if it is seen. There is a lurking issue concerning the placement of the discriminant in the DWARF. For Rust, I ended up following the letter of the standard and having the discriminant be a child of the DW_TAG_variant_part. However, GCC's Ada support does not do this. Pierre-Marie filed this with the DWARF committee: http://dwarfstd.org/ShowIssue.php?issue=180123.1 However as that is read-only, if you have comments you might consider adding them to the GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83935 Finally, there is a DWARF extension lurking in here. In Rust, a univariant enum will not have a discriminant. However, in order to unify the representation of all data-carrying enums, I've made LLVM (and my forthcoming rustc patch) emit a univariant enum using a DW_TAG_variant with a single variant part and without DW_AT_discr. The lack of this DW_AT_discr is the extension. I will submit an issue on dwarfstd.org about this. 2018-02-26 Tom Tromey <tom@tromey.com> * dwarf2read.c (struct variant_field): New. (struct nextfield) <variant>: New field. (dwarf2_add_field): Handle DW_TAG_variant_part. (dwarf2_attach_fields_to_type): Attach a discriminant_info to a discriminated union. (read_structure_type): Handle DW_TAG_variant_part. (handle_struct_member_die): New function, extracted from process_structure_scope. Handle DW_TAG_variant. (process_structure_scope): Handle discriminated unions. Call handle_struct_member_die. 2018-02-26 Tom Tromey <tom@tromey.com> * gdb.dwarf2/variant.c: New file. * gdb.dwarf2/variant.exp: New file.
2018-01-10 21:53:18 +01:00
2018-02-26 Tom Tromey <tom@tromey.com>
* dwarf2read.c (struct variant_field): New.
(struct nextfield) <variant>: New field.
(dwarf2_add_field): Handle DW_TAG_variant_part.
(dwarf2_attach_fields_to_type): Attach a discriminant_info to a
discriminated union.
(read_structure_type): Handle DW_TAG_variant_part.
(handle_struct_member_die): New function, extracted from
process_structure_scope. Handle DW_TAG_variant.
(process_structure_scope): Handle discriminated unions. Call
handle_struct_member_die.
Convert Rust to use discriminated unions A Rust enum is, essentially, a discriminated union. Currently the Rust language support handles Rust enums locally, in rust-lang.c. However, because I am changing the Rust compiler to use DW_TAG_variant* to represent enums, it seemed better to have a single internal representation for Rust enums in gdb. This patch implements this idea by moving the current Rust enum handling code to dwarf2read. This allows the simplification of some parts of rust-lang.c as well. 2018-02-26 Tom Tromey <tom@tromey.com> * rust-lang.h (rust_last_path_segment): Declare. * rust-lang.c (rust_last_path_segment): Now public. Change contract. (struct disr_info): Remove. (RUST_ENUM_PREFIX, RUST_ENCODED_ENUM_REAL) (RUST_ENCODED_ENUM_HIDDEN, rust_union_is_untagged) (rust_get_disr_info, rust_tuple_variant_type_p): Remove. (rust_enum_p, rust_enum_variant): New function. (rust_underscore_fields): Remove "offset" parameter. (rust_print_enum): New function. (rust_val_print) <TYPE_CODE_UNION>: Remove enum code. <TYPE_CODE_STRUCT>: Call rust_print_enum when appropriate. (rust_print_struct_def): Add "for_rust_enum" parameter. Handle enums. (rust_internal_print_type): New function, from rust_print_type. Remove enum code. (rust_print_type): Call rust_internal_print_type. (rust_evaluate_subexp) <STRUCTOP_ANONYMOUS, STRUCTOP_STRUCT>: Update enum handling. * dwarf2read.c (struct dwarf2_cu) <rust_unions>: New field. (rust_fully_qualify, alloc_discriminant_info, quirk_rust_enum) (rust_union_quirks): New functions. (process_full_comp_unit, process_full_type_unit): Call rust_union_quirks. (process_structure_scope): Update rust_unions if necessary. 2018-02-26 Tom Tromey <tom@tromey.com> * gdb.rust/simple.exp: Accept more possible results in enum test.
2018-02-09 21:31:51 +01:00
2018-02-26 Tom Tromey <tom@tromey.com>
* rust-lang.h (rust_last_path_segment): Declare.
* rust-lang.c (rust_last_path_segment): Now public. Change
contract.
(struct disr_info): Remove.
(RUST_ENUM_PREFIX, RUST_ENCODED_ENUM_REAL)
(RUST_ENCODED_ENUM_HIDDEN, rust_union_is_untagged)
(rust_get_disr_info, rust_tuple_variant_type_p): Remove.
(rust_enum_p, rust_enum_variant): New function.
(rust_underscore_fields): Remove "offset" parameter.
(rust_print_enum): New function.
(rust_val_print) <TYPE_CODE_UNION>: Remove enum code.
<TYPE_CODE_STRUCT>: Call rust_print_enum when appropriate.
(rust_print_struct_def): Add "for_rust_enum" parameter. Handle
enums.
(rust_internal_print_type): New function, from rust_print_type.
Remove enum code.
(rust_print_type): Call rust_internal_print_type.
(rust_evaluate_subexp) <STRUCTOP_ANONYMOUS, STRUCTOP_STRUCT>:
Update enum handling.
* dwarf2read.c (struct dwarf2_cu) <rust_unions>: New field.
(rust_fully_qualify, alloc_discriminant_info, quirk_rust_enum)
(rust_union_quirks): New functions.
(process_full_comp_unit, process_full_type_unit): Call
rust_union_quirks.
(process_structure_scope): Update rust_unions if necessary.
2018-02-26 Tom Tromey <tom@tromey.com>
* value.h (value_union_variant): Declare.
* valops.c (value_union_variant): New function.
* gdbtypes.h (TYPE_FLAG_DISCRIMINATED_UNION): New macro.
(struct discriminant_info): New.
(enum dynamic_prop_node_kind) <DYN_PROP_DISCRIMINATED>: New
enumerator.
(struct main_type) <flag_discriminated_union>: New field.
2018-02-26 Tom Tromey <tom@tromey.com>
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/unpack-selftests.c.
* unittests/unpack-selftests.c: New file.
* value.c (unpack_bits_as_long): Fix bugs in non-bitfield cases.
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct partial_die_info) <read>: New method.
(read_partial_die): Remove the declaration.
(load_partial_dies): Update.
(partial_die_info::partial_die_info):
(read_partial_die): Change it to partial_die_info::read.
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct partial_die_info) <fixup>: New method.
(fixup_partial_die): Remove declaration.
(scan_partial_symbols): Update.
(partial_die_parent_scope): Likewise.
(partial_die_full_name): Likewise.
(fixup_partial_die): Change it to partial_die_info::fixup.
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (read_partial_die): Update the declaration.
(load_partial_dies): Caller update.
(read_partial_die): Remove one argument abbrev_len.
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct partial_die_info): Add ctor, delete
assignment operator.
(load_partial_dies): Use ctor and copy ctor.
(read_partial_die): Update.
(dwarf2_cu::find_partial_die): Use ctor.
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct dwarf2_cu) <find_partial_die>: New method.
(find_partial_die_in_comp_unit): Change it to
dwarf2_cu::find_partial_die.
(find_partial_die): Update.
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (read_partial_die): Remove the code checking abbrev
is NULL.
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (load_partial_dies): Move the location of XOBNEW.
2018-02-26 Alan Hayward <alan.hayward@arm.com>
* arch/amd64.h: Use common/tdesc.h.
* arch/i386.c: Likewise.
* arch/i386.h: Likewise.
* arch/tic6x.c: Likewise.
* arch/tdesc.h: Move file from here...
* common/tdesc.h: ...to here.
* features/aarch64-core.c: Regenerate.
* features/aarch64-fpu.c: Regenerate.
* features/i386/32bit-avx.c: Regenerate.
* features/i386/32bit-avx512.c: Regenerate.
* features/i386/32bit-core.c: Regenerate.
* features/i386/32bit-linux.c: Regenerate.
* features/i386/32bit-mpx.c: Regenerate.
* features/i386/32bit-pkeys.c: Regenerate.
* features/i386/32bit-sse.c: Regenerate.
* features/i386/64bit-avx.c: Regenerate.
* features/i386/64bit-avx512.c: Regenerate.
* features/i386/64bit-core.c: Regenerate.
* features/i386/64bit-linux.c: Regenerate.
* features/i386/64bit-mpx.c: Regenerate.
* features/i386/64bit-pkeys.c: Regenerate.
* features/i386/64bit-segments.c: Regenerate.
* features/i386/64bit-sse.c: Regenerate.
* features/i386/x32-core.c: Regenerate.
* features/tic6x-c6xp.c: Regenerate.
* features/tic6x-core.c: Regenerate.
* features/tic6x-gp.c: Regenerate.
* target-descriptions.c: Use common/tdesc.h.
* target-descriptions.h: Likewise.
2018-02-24 Tom Tromey <tom@tromey.com>
* linux-thread-db.c (try_thread_db_load_from_pdir_1)
(try_thread_db_load_from_dir, thread_db_load_search): Use
std::string.
(info_auto_load_libthread_db_compare): Return bool. Change
argument types.
(info_auto_load_libthread_db): Use std::vector, std::string.
Remove cleanups.
2018-02-24 Tom Tromey <tom@tromey.com>
* i386-tdep.c (i386_fast_tracepoint_valid_at): "msg" now a
std::string.
* gdbarch.sh (fast_tracepoint_valid_at): Change "msg" to a
std::string*.
* gdbarch.c: Rebuild.
* gdbarch.h: Rebuild.
* breakpoint.c (check_fast_tracepoint_sals): Use std::string.
* arch-utils.h (default_fast_tracepoint_valid_at): Update.
* arch-utils.c (default_fast_tracepoint_valid_at): "msg" now a
std::string*.
dwarf: Make sect_offset 64-bits Does anybody have an opinion about this? It would be nice to unbreak the "default" build with clang (i.e. without passing special -Wno-error= flags). Here's a version rebased on today's master. From 47d28075117fa2ddb93584ec50881e33777a85e5 Mon Sep 17 00:00:00 2001 From: Simon Marchi <simon.marchi@ericsson.com> Date: Sat, 30 Dec 2017 22:48:18 -0500 Subject: [PATCH] dwarf: Make sect_offset 64-bits Compiling with Clang 6 shows these errors: /home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:26610:43: error: result of comparison of constant 4294967296 with expression of type 'typename std::underlying_type<sect_offset>::type' (a ka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare] if (to_underlying (per_cu.sect_off) >= (static_cast<uint64_t> (1) << 32)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:26618:43: error: result of comparison of constant 4294967296 with expression of type 'typename std::underlying_type<sect_offset>::type' (a ka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare] if (to_underlying (per_cu.sect_off) >= (static_cast<uint64_t> (1) << 32)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The code in question checks if there is any offset exceeding 32 bits, and therefore if we need to use the 64-bit DWARF format when writing the .debug_names section. The type we use currently to represent section offsets is an unsigned int (32-bits), which means a value of this type will never exceed 32 bits, hence the errors above. There are many signs that we want to support 64-bits DWARF (although I haven't tested), such as: - We correctly read initial length fields (read_initial_length) - We take that into account when reading offsets (read_offset_1) - The check_dwarf64_offsets function However, I don't see how it can work if sect_offset is a 32-bits type. Every time we record a section offset, we risk truncating the value. And if a file uses the 64-bit DWARF format, it's most likely because there are such offset values that overflow 32 bits. Because of this, I think the way forward is to change sect_offset to be a uint64_t. It will be able to represent any offset, regardless of the bitness of the DWARF info. This patch was regtested on the buildbot. gdb/ChangeLog: * gdbtypes.h (sect_offset): Change type to uint64_t. (sect_offset_str): New function. * dwarf2read.c (create_addrmap_from_aranges): Use sect_offset_str. (error_check_comp_unit_head): Likewise. (create_debug_type_hash_table): Likewise. (read_cutu_die_from_dwo): Likewise. (init_cutu_and_read_dies): Likewise. (init_cutu_and_read_dies_no_follow): Likewise. (process_psymtab_comp_unit_reader): Likewise. (partial_die_parent_scope): Likewise. (peek_die_abbrev): Likewise. (process_queue): Likewise. (dwarf2_physname): Likewise. (read_namespace_alias): Likewise. (read_import_statement): Likewise. (create_dwo_cu_reader): Likewise. (create_cus_hash_table): Likewise. (lookup_dwo_cutu): Likewise. (inherit_abstract_dies): Likewise. (read_func_scope): Likewise. (read_call_site_scope): Likewise. (dwarf2_add_member_fn): Likewise. (read_common_block): Likewise. (read_module_type): Likewise. (read_typedef): Likewise. (read_subrange_type): Likewise. (load_partial_dies): Likewise. (read_partial_die): Likewise. (find_partial_die): Likewise. (read_str_index): Likewise. (dwarf2_string_attr): Likewise. (build_error_marker_type): Likewise. (lookup_die_type): Likewise. (dump_die_shallow): Likewise. (follow_die_ref): Likewise. (dwarf2_fetch_die_loc_sect_off): Likewise. (dwarf2_fetch_constant_bytes): Likewise. (follow_die_sig): Likewise. (get_signatured_type): Likewise. (get_DW_AT_signature_type): Likewise. (dwarf2_find_containing_comp_unit): Likewise. (set_die_type): Likewise.
2018-02-23 19:03:33 +01:00
2018-02-23 Simon Marchi <simon.marchi@polymtl.ca>
* gdbtypes.h (sect_offset): Change type to uint64_t.
(sect_offset_str): New function.
* dwarf2read.c (create_addrmap_from_aranges): Use
sect_offset_str.
(error_check_comp_unit_head): Likewise.
(create_debug_type_hash_table): Likewise.
(read_cutu_die_from_dwo): Likewise.
(init_cutu_and_read_dies): Likewise.
(init_cutu_and_read_dies_no_follow): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(partial_die_parent_scope): Likewise.
(peek_die_abbrev): Likewise.
(process_queue): Likewise.
(dwarf2_physname): Likewise.
(read_namespace_alias): Likewise.
(read_import_statement): Likewise.
(create_dwo_cu_reader): Likewise.
(create_cus_hash_table): Likewise.
(lookup_dwo_cutu): Likewise.
(inherit_abstract_dies): Likewise.
(read_func_scope): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_add_member_fn): Likewise.
(read_common_block): Likewise.
(read_module_type): Likewise.
(read_typedef): Likewise.
(read_subrange_type): Likewise.
(load_partial_dies): Likewise.
(read_partial_die): Likewise.
(find_partial_die): Likewise.
(read_str_index): Likewise.
(dwarf2_string_attr): Likewise.
(build_error_marker_type): Likewise.
(lookup_die_type): Likewise.
(dump_die_shallow): Likewise.
(follow_die_ref): Likewise.
(dwarf2_fetch_die_loc_sect_off): Likewise.
(dwarf2_fetch_constant_bytes): Likewise.
(follow_die_sig): Likewise.
(get_signatured_type): Likewise.
(get_DW_AT_signature_type): Likewise.
(dwarf2_find_containing_comp_unit): Likewise.
(set_die_type): Likewise.
2018-02-21 John Baldwin <jhb@FreeBSD.org>
* arch/aarch64.c: Include "common-defs.h".
* arch/amd64.c: Likewise.
* arch/i386.c: Likewise.
2018-02-21 Tom Tromey <tom@tromey.com>
* value.h: (extract_field_op): Update.
* eval.c (extract_field_op): Return a const char *.
* expression.h (parse_expression_for_completion): Update.
* completer.c (complete_expression): Update.
(add_struct_fields): Make fieldname const.
* parse.c (expout_completion_name): Now a unique_xmalloc_ptr.
(mark_completion_tag, parse_exp_in_context_1): Update.
(parse_expression_for_completion): Change "name" to
unique_xmalloc_ptr*.
2018-02-21 Tom Tromey <tom@tromey.com>
* infcall.c (call_function_by_hand_dummy): Use std::vector.
2018-02-21 Yao Qi <yao.qi@linaro.org>
* avr-tdep.c (avr_read_pc): Change parameter type to
readable_regcache.
* gdbarch.sh (read_pc): Likewise.
* gdbarch.c: Re-generated.
* gdbarch.h: Re-generated.
* hppa-tdep.c (hppa_read_pc): Change parameter type to
readable_regcache.
* ia64-tdep.c (ia64_read_pc): Likewise.
* mips-tdep.c (mips_read_pc): Likewise.
* spu-tdep.c (spu_read_pc): Likewise.
2018-02-21 Yao Qi <yao.qi@linaro.org>
* Makefile.in (COMMON_SFILES): Add regcache-dump.c
* regcache-dump.c: New file.
* regcache.c: Move register_dump to regcache-dump.c.
(maintenance_print_registers): Likewise.
(maintenance_print_raw_registers): Likewise.
(maintenance_print_cooked_registers): Likewise.
(maintenance_print_register_groups): Likewise.
(maintenance_print_remote_registers): Likewise.
(_initialize_regcache): Likewise.
* regcache.h (register_dump): Moved from regcache.c.
2018-02-21 Yao Qi <yao.qi@linaro.org>
* regcache.c (regcache::regcache): Update.
(regcache::invalidate): Move it to detached_regcache::invalidate.
(get_thread_arch_aspace_regcache): Update.
(regcache::raw_update): Update.
(regcache::cooked_read): Remove some code.
(regcache::cooked_read_value): Likewise.
(regcache::raw_write): Remove assert on m_readonly_p.
(regcache::raw_supply_integer): Move it to
detached_regcache::raw_supply_integer.
(regcache::raw_supply_zeroed): Likewise.
* regcache.h (detached_regcache) <raw_supply_integer>: New
declaration.
<raw_supply_zeroed, invalidate>: Likewise.
(regcache) <raw_supply_integer, raw_supply_zeroed>: Removed.
<invalidate>: Likewise.
<m_readonly_p>: Removed.
2018-02-21 Yao Qi <yao.qi@linaro.org>
* infcmd.c (get_return_value): Let stop_regs point to
get_current_regcache.
* regcache.c (regcache::regcache): Remove.
(register_dump_reg_buffer): New class.
(regcache_print): Adjust.
* regcache.h (regcache): Remove constructors.
2018-02-21 Yao Qi <yao.qi@linaro.org>
* regcache.c (class register_dump): New class.
(register_dump_regcache, register_dump_none): New class.
(register_dump_remote, register_dump_groups): New class.
(regcache_print): Update.
* regcache.h (regcache_dump_what): Move it to regcache.c.
(regcache) <dump>: Remove.
Class detached_regcache jit.c uses the regcache in a slightly different way, the regcache dosen't write through to target, but it has read and write methods. If I apply regcache in record-full.c, it has the similar use pattern. This patch adds a new class detached_regcache, a register buffer, but can be read and written. Since jit.c doesn't want to write registers through to target, it uses regcache as a readonly regcache (because only readonly regcache disconnects from the target), but it adds a hole in regcache (raw_set_cached_value) in order to modify a readonly regcache. This patch fixes this hole completely. regcache inherits detached_regcache, and detached_regcache inherits readable_regcache. The ideal design is that both detached_regcache and readable_regcache inherit reg_buffer, and regcache inherit detached_regcache and regcache_read (virtual inheritance). I concern about the performance overhead of virtual inheritance, so I don't do it in the patch. gdb: 2018-02-21 Yao Qi <yao.qi@linaro.org> * jit.c (struct jit_unwind_private) <regcache>: Change its type to reg_buffer_rw *. (jit_unwind_reg_set_impl): Call raw_supply. (jit_frame_sniffer): Use reg_buffer_rw. * record-full.c (record_full_core_regbuf): Change its type. (record_full_core_open_1): Use reg_buffer_rw. (record_full_close): Likewise. (record_full_core_fetch_registers): Use regcache->raw_supply. (record_full_core_store_registers): Likewise. * regcache.c (regcache::get_register_status): Move it to reg_buffer. (regcache_raw_set_cached_value): Remove. (regcache::raw_set_cached_value): Remove. (regcache::raw_write): Call raw_supply. (regcache::raw_supply): Move it to reg_buffer_rw. * regcache.h (regcache_raw_set_cached_value): Remove. (reg_buffer_rw): New class.
2018-02-21 12:20:03 +01:00
2018-02-21 Yao Qi <yao.qi@linaro.org>
* jit.c (struct jit_unwind_private) <regcache>: Change its type to
reg_buffer_rw *.
(jit_unwind_reg_set_impl): Call raw_supply.
(jit_frame_sniffer): Use reg_buffer_rw.
* record-full.c (record_full_core_regbuf): Change its type.
(record_full_core_open_1): Use reg_buffer_rw.
(record_full_close): Likewise.
(record_full_core_fetch_registers): Use regcache->raw_supply.
(record_full_core_store_registers): Likewise.
* regcache.c (regcache::get_register_status): Move it to
reg_buffer.
(regcache_raw_set_cached_value): Remove.
(regcache::raw_set_cached_value): Remove.
(regcache::raw_write): Call raw_supply.
(regcache::raw_supply): Move it to reg_buffer_rw.
* regcache.h (regcache_raw_set_cached_value): Remove.
(reg_buffer_rw): New class.
Class readonly_detached_regcache This patch adds a new class (type) for readonly regcache, which is created via regcache::save. readonly_detached_regcache inherits readable_regcache. gdb: 2018-02-21 Yao Qi <yao.qi@linaro.org> * dummy-frame.c (dummy_frame_cache) <prev_regcache>: Use readonly_detached_regcache. (dummy_frame_prev_register): Use regcache->cooked_read. * frame.c (frame_save_as_regcache): Change return type. (frame_pop): Update. * frame.h (frame_save_as_regcache): Update declaration. * inferior.h (get_infcall_suspend_state_regcache): Update declaration. * infrun.c (infcall_suspend_state) <registers>: use readonly_detached_regcache. (save_infcall_suspend_state): Don't use regcache_dup. (get_infcall_suspend_state_regcache): Change return type. * linux-fork.c (struct fork_info) <savedregs>: Change to readonly_detached_regcache. <pc>: New field. (fork_save_infrun_state): Don't use regcache_dup. (info_checkpoints_command): Adjust. * mi/mi-main.c (register_changed_p): Update declaration. (mi_cmd_data_list_changed_registers): Use readonly_detached_regcache. (register_changed_p): Change parameter type to readonly_detached_regcache. * ppc-linux-tdep.c (ppu2spu_cache) <regcache>: Use readonly_detached_regcache. (ppu2spu_sniffer): Construct a new readonly_detached_regcache. * regcache.c (readonly_detached_regcache::readonly_detached_regcache): New. (regcache::save): Move it to reg_buffer. (regcache::restore): Change parameter type. (regcache_dup): Remove. * regcache.h (reg_buffer) <save>: New method. (readonly_detached_regcache): New class. * spu-tdep.c (spu2ppu_cache) <regcache>: Use readonly_detached_regcache. (spu2ppu_sniffer): Construct a new readonly_detached_regcache.
2018-02-21 12:20:03 +01:00
2018-02-21 Yao Qi <yao.qi@linaro.org>
* dummy-frame.c (dummy_frame_cache) <prev_regcache>: Use
readonly_detached_regcache.
(dummy_frame_prev_register): Use regcache->cooked_read.
* frame.c (frame_save_as_regcache): Change return type.
(frame_pop): Update.
* frame.h (frame_save_as_regcache): Update declaration.
* inferior.h (get_infcall_suspend_state_regcache): Update
declaration.
* infrun.c (infcall_suspend_state) <registers>: use
readonly_detached_regcache.
(save_infcall_suspend_state): Don't use regcache_dup.
(get_infcall_suspend_state_regcache): Change return type.
* linux-fork.c (struct fork_info) <savedregs>: Change to
readonly_detached_regcache.
<pc>: New field.
(fork_save_infrun_state): Don't use regcache_dup.
(info_checkpoints_command): Adjust.
* mi/mi-main.c (register_changed_p): Update declaration.
(mi_cmd_data_list_changed_registers): Use
readonly_detached_regcache.
(register_changed_p): Change parameter type to
readonly_detached_regcache.
* ppc-linux-tdep.c (ppu2spu_cache) <regcache>: Use
readonly_detached_regcache.
(ppu2spu_sniffer): Construct a new readonly_detached_regcache.
* regcache.c (readonly_detached_regcache::readonly_detached_regcache):
New.
(regcache::save): Move it to reg_buffer.
(regcache::restore): Change parameter type.
(regcache_dup): Remove.
* regcache.h (reg_buffer) <save>: New method.
(readonly_detached_regcache): New class.
* spu-tdep.c (spu2ppu_cache) <regcache>: Use
readonly_detached_regcache.
(spu2ppu_sniffer): Construct a new readonly_detached_regcache.
2018-02-21 Yao Qi <yao.qi@linaro.org>
* frame.c (frame_save_as_regcache): Use regcache method save.
(frame_pop): Use regcache method restore.
* infrun.c (restore_infcall_suspend_state): Likewise.
* linux-fork.c (fork_load_infrun_state): Likewise.
* ppc-linux-tdep.c (ppu2spu_sniffer): User regcache method
save.
* regcache.c (regcache_save): Remove.
(regcache::restore): More asserts.
(regcache_cpy): Remove.
* regcache.h (regcache_save): Remove the declaration.
(regcache::restore): Move from private to public.
Remove the friend declaration of regcache_cpy.
(regcache_cpy): Remove declaration.
class readable_regcache and pass readable_regcache to gdbarch pseudo_register_read and pseudo_register_read_value pseudo registers are either from raw registers or memory, so gdbarch methods pseudo_register_read and pseudo_register_read_value should have regcache object which only have read methods. In other words, we should disallow writing to regcache in these two gdbarch methods. In order to apply this restriction, this patch adds a new class readable_regcache, derived from reg_buffer, and it only has raw_read and cooked_read methods. regcache is derived from readable_regcache. This patch also passes readable_regcache instead of regcache to gdbarch methods pseudo_register_read and pseudo_register_read_value. This patch moves raw_read* and cooked_read* methods to readable_regcache, which is straightforward. One thing not straightforward is that I split regcache::xfer_part to readable_regcache::read_part and regcache::write_part, because readable_regcache can only have methods to read. readable_regcache is an abstract base class, and it has a pure virtual function raw_update, because I don't want readable_regcache know where these raw registers are from. They can be from either the target (readwrite regcache) or the regcache itself (readonly regcache). gdb: 2018-02-21 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_pseudo_register_read_value): Change parameter type to 'readable_regcache *'. * amd64-tdep.c (amd64_pseudo_register_read_value): Likewise. * arm-tdep.c (arm_neon_quad_read): Likewise. (arm_pseudo_read): Likewise. * avr-tdep.c (avr_pseudo_register_read): Likewise. * bfin-tdep.c (bfin_pseudo_register_read): Likewise. * frv-tdep.c (frv_pseudo_register_read): Likewise. * gdbarch.c: Re-generated. * gdbarch.h: Re-generated. * gdbarch.sh (pseudo_register_read): Change parameter type to 'readable_regcache *'. (pseudo_register_read_value): Likewise. * h8300-tdep.c (pseudo_from_raw_register): Likewise. (h8300_pseudo_register_read): Likewise. * hppa-tdep.c (hppa_pseudo_register_read): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_pseudo_register_read_into_value): Likewise. (i386_pseudo_register_read_value): Likewise. * i386-tdep.h (i386_pseudo_register_read_into_value): Update declaration. * ia64-tdep.c (ia64_pseudo_register_read): Likewise. * m32c-tdep.c (m32c_raw_read): Likewise. (m32c_read_flg): Likewise. (m32c_banked_register): Likewise. (m32c_banked_read): Likewise. (m32c_sb_read): Likewise. (m32c_part_read): Likewise. (m32c_cat_read): Likewise. (m32c_r3r2r1r0_read): Likewise. (m32c_pseudo_register_read): Likewise. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Likewise. * mep-tdep.c (mep_pseudo_cr32_read): Likewise. (mep_pseudo_cr64_read): Likewise. (mep_pseudo_register_read): Likewise. * mips-tdep.c (mips_pseudo_register_read): Likewise. * msp430-tdep.c (msp430_pseudo_register_read): Likewise. * nds32-tdep.c (nds32_pseudo_register_read): Likewise. * regcache.c (regcache::raw_read): Move it to readable_regcache. (regcache::cooked_read): Likewise. (regcache::cooked_read_value): Likewise. (regcache_cooked_read_signed): (regcache::cooked_read): Likewise. * regcache.h (readable_regcache): New class. (regcache): Inherit readable_regcache. Move some methods to readable_regcache. * rl78-tdep.c (rl78_pseudo_register_read): Change parameter type to 'readable_regcache *'. * rs6000-tdep.c (do_regcache_raw_read): Remove. (e500_pseudo_register_read): Change parameter type to 'readable_regcache *'. (dfp_pseudo_register_read): Likewise. (vsx_pseudo_register_read): Likewise. (efpr_pseudo_register_read): Likewise. * s390-tdep.c (s390_pseudo_register_read): Likewise. * sh-tdep.c (sh_pseudo_register_read): Likewise. * sh64-tdep.c (pseudo_register_read_portions): Likewise. (sh64_pseudo_register_read): Likewise. * sparc-tdep.c (sparc32_pseudo_register_read): Likewise. * sparc64-tdep.c (sparc64_pseudo_register_read): Likewise. * spu-tdep.c (spu_pseudo_register_read_spu): Likewise. (spu_pseudo_register_read): Likewise. * xtensa-tdep.c (xtensa_register_read_masked): Likewise. (xtensa_pseudo_register_read): Likewise.
2018-02-21 12:20:03 +01:00
2018-02-21 Yao Qi <yao.qi@linaro.org>
* aarch64-tdep.c (aarch64_pseudo_register_read_value): Change
parameter type to 'readable_regcache *'.
* amd64-tdep.c (amd64_pseudo_register_read_value): Likewise.
* arm-tdep.c (arm_neon_quad_read): Likewise.
(arm_pseudo_read): Likewise.
* avr-tdep.c (avr_pseudo_register_read): Likewise.
* bfin-tdep.c (bfin_pseudo_register_read): Likewise.
* frv-tdep.c (frv_pseudo_register_read): Likewise.
* gdbarch.c: Re-generated.
* gdbarch.h: Re-generated.
* gdbarch.sh (pseudo_register_read): Change parameter type to
'readable_regcache *'.
(pseudo_register_read_value): Likewise.
* h8300-tdep.c (pseudo_from_raw_register): Likewise.
(h8300_pseudo_register_read): Likewise.
* hppa-tdep.c (hppa_pseudo_register_read): Likewise.
* i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise.
(i386_pseudo_register_read_into_value): Likewise.
(i386_pseudo_register_read_value): Likewise.
* i386-tdep.h (i386_pseudo_register_read_into_value): Update
declaration.
* ia64-tdep.c (ia64_pseudo_register_read): Likewise.
* m32c-tdep.c (m32c_raw_read): Likewise.
(m32c_read_flg): Likewise.
(m32c_banked_register): Likewise.
(m32c_banked_read): Likewise.
(m32c_sb_read): Likewise.
(m32c_part_read): Likewise.
(m32c_cat_read): Likewise.
(m32c_r3r2r1r0_read): Likewise.
(m32c_pseudo_register_read): Likewise.
* m68hc11-tdep.c (m68hc11_pseudo_register_read): Likewise.
* mep-tdep.c (mep_pseudo_cr32_read): Likewise.
(mep_pseudo_cr64_read): Likewise.
(mep_pseudo_register_read): Likewise.
* mips-tdep.c (mips_pseudo_register_read): Likewise.
* msp430-tdep.c (msp430_pseudo_register_read): Likewise.
* nds32-tdep.c (nds32_pseudo_register_read): Likewise.
* regcache.c (regcache::raw_read): Move it to readable_regcache.
(regcache::cooked_read): Likewise.
(regcache::cooked_read_value): Likewise.
(regcache_cooked_read_signed):
(regcache::cooked_read): Likewise.
* regcache.h (readable_regcache): New class.
(regcache): Inherit readable_regcache. Move some methods to
readable_regcache.
* rl78-tdep.c (rl78_pseudo_register_read): Change
parameter type to 'readable_regcache *'.
* rs6000-tdep.c (do_regcache_raw_read): Remove.
(e500_pseudo_register_read): Change parameter type to
'readable_regcache *'.
(dfp_pseudo_register_read): Likewise.
(vsx_pseudo_register_read): Likewise.
(efpr_pseudo_register_read): Likewise.
* s390-tdep.c (s390_pseudo_register_read): Likewise.
* sh-tdep.c (sh_pseudo_register_read): Likewise.
* sh64-tdep.c (pseudo_register_read_portions): Likewise.
(sh64_pseudo_register_read): Likewise.
* sparc-tdep.c (sparc32_pseudo_register_read): Likewise.
* sparc64-tdep.c (sparc64_pseudo_register_read): Likewise.
* spu-tdep.c (spu_pseudo_register_read_spu): Likewise.
(spu_pseudo_register_read): Likewise.
* xtensa-tdep.c (xtensa_register_read_masked): Likewise.
(xtensa_pseudo_register_read): Likewise.
2018-02-21 Yao Qi <yao.qi@linaro.org>
* regcache.c (regcache::regcache): Call reg_buffer ctor.
(regcache::arch): Move it to reg_buffer::arch.
(regcache::register_buffer): Likewise.
(regcache::assert_regnum): Likewise.
(regcache::num_raw_registers): Likewise.
* regcache.h (reg_buffer): New class.
(regcache): Inherit reg_buffer.
2018-02-20 Simon Marchi <simon.marchi@ericsson.com>
* remote-sim.c (gdb_os_printf_filtered, gdb_os_vprintf_filtered,
gdb_os_evprintf_filtered, gdb_os_error): Add ATTRIBUTE_PRINTF.
2018-02-20 Markus Metzger <markus.t.metzger@intel.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add mkstemp.
2018-02-19 Alan Hayward <alan.hayward@arm.com>
* Makefile.in: (COMMON_SFILES): Add common/*.c files.
(SFILES): Remove common/*.c files.
(COMMON_OBS): Remove some *.o files built from common/*.c files.
* common/common.host: Add common reference.
* configure.ac: Likewise.
* configure: Regenerate.
2018-02-16 Yao Qi <yao.qi@linaro.org>
* block.c (block_namespace_info): Inherit allocate_on_obstack.
(block_initialize_namespace): Use new.
* dwarf2read.c (dwarf2_per_objfile): Inherit allocate_on_obstack.
(dwarf2_free_objfile): Use delete.
* gdbtypes.c (type_pair): Inherit allocate_on_obstack.
(copy_type_recursive): Use new.
* gdb_obstack.h (allocate_on_obstack): New.
2018-02-15 Yao Qi <yao.qi@linaro.org>
PR gdb/22849
* inferior.c (exit_inferior_1): Reset inf->control.
2018-02-15 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (ada_to_fixed_value_create): Delete advance
declaration.
Fix GDB crash after Quit thrown from unwinder sniffer I ran into a GDB crash in gdb.base/bp-cmds-continue-ctrl-c.exp in my multi-target branch, which turns out exposed a bug that exists in master too. That testcase has a breakpoint with a "continue" command associated. Then the breakpoint is constantly being hit. At the same time, the testcase is continualy interrupting the program with Ctrl-C, and re-resuming it, in a loop. Running that testcase manually under Valgrind, after a few sequences of 'Ctrl-C' + 'continue', I got: Breakpoint 1, Quit (gdb) ==21270== Invalid read of size 8 ==21270== at 0x4D8185: pyuw_this_id(frame_info*, void**, frame_id*) (py-unwind.c:461) ==21270== by 0x6D426A: compute_frame_id(frame_info*) (frame.c:505) ==21270== by 0x6D43B7: get_frame_id(frame_info*) (frame.c:537) ==21270== by 0x84F3B8: scoped_restore_current_thread::scoped_restore_current_thread() (thread.c:1678) ==21270== by 0x718E3D: fetch_inferior_event(void*) (infrun.c:4076) ==21270== by 0x7067C9: inferior_event_handler(inferior_event_type, void*) (inf-loop.c:43) ==21270== by 0x45BEF9: handle_target_event(int, void*) (linux-nat.c:4419) ==21270== by 0x6C4255: handle_file_event(file_handler*, int) (event-loop.c:733) ==21270== by 0x6C47F8: gdb_wait_for_event(int) (event-loop.c:859) ==21270== by 0x6C3666: gdb_do_one_event() (event-loop.c:322) ==21270== by 0x6C3712: start_event_loop() (event-loop.c:371) ==21270== by 0x746801: captured_command_loop() (main.c:329) ==21270== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==21270== ==21270== ==21270== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==21270== Access not within mapped region at address 0x0 ==21270== at 0x4D8185: pyuw_this_id(frame_info*, void**, frame_id*) (py-unwind.c:461) ==21270== by 0x6D426A: compute_frame_id(frame_info*) (frame.c:505) ==21270== by 0x6D43B7: get_frame_id(frame_info*) (frame.c:537) ==21270== by 0x84F3B8: scoped_restore_current_thread::scoped_restore_current_thread() (thread.c:1678) ==21270== by 0x718E3D: fetch_inferior_event(void*) (infrun.c:4076) ==21270== by 0x7067C9: inferior_event_handler(inferior_event_type, void*) (inf-loop.c:43) ==21270== by 0x45BEF9: handle_target_event(int, void*) (linux-nat.c:4419) ==21270== by 0x6C4255: handle_file_event(file_handler*, int) (event-loop.c:733) ==21270== by 0x6C47F8: gdb_wait_for_event(int) (event-loop.c:859) ==21270== by 0x6C3666: gdb_do_one_event() (event-loop.c:322) ==21270== by 0x6C3712: start_event_loop() (event-loop.c:371) ==21270== by 0x746801: captured_command_loop() (main.c:329) ==21270== If you believe this happened as a result of a stack ==21270== overflow in your program's main thread (unlikely but ==21270== possible), you can try to increase the size of the ==21270== main thread stack using the --main-stacksize= flag. ==21270== The main thread stack size used in this run was 8388608. ==21270== Above, when we get to compute_frame_id, fi->unwind is non-NULL, meaning, we found an unwinder, in this case the Python unwinder, but somehow, fi->prologue_cache is left NULL. pyuw_this_id then crashes because it assumes fi->prologue_cache is non-NULL: static void pyuw_this_id (struct frame_info *this_frame, void **cache_ptr, struct frame_id *this_id) { *this_id = ((cached_frame_info *) *cache_ptr)->frame_id; ^^^^^^^^^^ '*cache_ptr' here is 'fi->prologue_cache'. There's a quit() call in pyuw_sniffer that I believe is the one that sometimes triggers the crash above. The crash can be reproduced easily with this hack to force a quit out of the python unwinder: --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -497,6 +497,8 @@ pyuw_sniffer (const struct frame_unwind *self, struct frame_info *this_frame, struct gdbarch *gdbarch = (struct gdbarch *) (self->unwind_data); cached_frame_info *cached_frame; + quit (); + gdbpy_enter enter_py (gdbarch, current_language); TRACE_PY_UNWIND (3, "%s (SP=%s, PC=%s)\n", __FUNCTION__, After that quit is thrown, any subsequent operation that involves unwinding results in GDB crashing with SIGSEGV like above. The problem is that this commit: commit 30a9c02feff56bd58a276c2a7262f364baa558ac CommitDate: Sun Oct 8 23:16:42 2017 -0600 Subject: Remove cleanup from frame_prepare_for_sniffer missed that we need to call frame_cleanup_after_sniffer before rethrowing the exception too. Without the fix, the "bt" added to gdb.base/bp-cmds-continue-ctrl-c.exp in this commit makes GDB crash: Running src/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.exp ... ERROR: Process no longer exists gdb/ChangeLog: 2018-02-14 Pedro Alves <palves@redhat.com> * frame-unwind.c (frame_unwind_try_unwinder): Always call frame_cleanup_after_sniffer on exception. gdb/testsuite/ChangeLog: 2018-02-14 Pedro Alves <palves@redhat.com> * gdb.base/bp-cmds-continue-ctrl-c.exp (do_test): Test "bt" after getting a "Quit".
2018-02-14 19:59:00 +01:00
2018-02-14 Pedro Alves <palves@redhat.com>
* frame-unwind.c (frame_unwind_try_unwinder): Always call
frame_cleanup_after_sniffer on exception.
2018-02-14 Tom Tromey <tom@tromey.com>
* solist.h (struct target_so_ops) <bfd_open>: Make pathname
const.
(solib_bfd_open): Make pathname const.
* solib.c (solib_bfd_open): Make pathname const.
* solib-spu.c (spu_bfd_fopen): Make name const.
(spu_bfd_open): Make pathname const.
* solib-darwin.c (darwin_bfd_open): Make pathname const.
* solib-aix.c (solib_aix_bfd_open): Make pathname const.
2018-02-14 Tom Tromey <tom@tromey.com>
* symfile.c (symfile_bfd_open): Update.
* source.h (openp, source_full_path_of, find_and_open_source):
Change argument type to unique_xmalloc_ptr.
* source.c (openp): Take a unique_xmalloc_ptr.
(source_full_path_of, find_and_open_source): Likewise.
(open_source_file, symtab_to_fullname): Update.
* solist.h (struct target_so_ops) <find_and_open_solib>: Take a
unique_xmalloc_ptr.
* solib.c (solib_find_1): Use unique_xmalloc_ptr.
(exec_file_find): Update.
* psymtab.c (psymtab_to_fullname): Update.
* nto-tdep.h (nto_find_and_open_solib): Update.
* nto-tdep.c (nto_find_and_open_solib): Change temp_path to a
unique_xmalloc_ptr.
* exec.c (exec_file_attach): Update.
* dwarf2read.c (try_open_dwop_file): Use unique_xmalloc_ptr.
* cli/cli-cmds.c (find_and_open_script): Use unique_xmalloc_ptr.
2018-02-14 Tom Tromey <tom@tromey.com>
* solib.c: Include source.h.
* nto-tdep.c: Include source.h.
* mi/mi-cmd-env.c: Include source.h.
* infcmd.c: Include source.h.
* exec.c: Include source.h.
* defs.h (enum openp_flag, openp, source_full_path_of, mod_path)
(add_path, directory_switch, source_path, init_source_path): Move
declarations...
* source.h (enum openp_flag, openp, source_full_path_of, mod_path)
(add_path, directory_switch, source_path, init_source_path):
...here.
2018-02-14 Tom Tromey <tom@tromey.com>
* solist.h (exec_file_find, solib_find): Return
unique_xmalloc_ptr.
(solib_bfd_fopen): Take a const char *.
* solib.c (solib_find_1): Return unique_xmalloc_ptr.
(exec_file_find, solib_find): Likewise.
(solib_bfd_fopen): Do not take ownership of "pathname".
(solib_bfd_open): Use unique_xmalloc_ptr.
* solib-darwin.c (darwin_bfd_open): Use unique_xmalloc_ptr.
* solib-aix.c (solib_aix_bfd_open): Use unique_xmalloc_ptr.
* infrun.c (follow_exec): Use unique_xmalloc_ptr.
* exec.c (exec_file_locate_attach): Use unique_xmalloc_ptr.
2018-02-14 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (name_match_type_from_name): Remove reference to
ada_name_for_lookup in function's documentation.
* ada-lang.h (ada_name_for_lookup): Delete declaration.
2018-02-13 Simon Marchi <simon.marchi@polymtl.ca>
* defs.h (enum openp_flags): New enum.
(OPF_TRY_CWD_FIRST, OPF_SEARCH_IN_PATH, OPF_RETURN_REALPATH):
Move to enum openp_flags.
(openp_flags): New enum flags.
(openp): Change parameter type to openp_flags.
* source.c (openp): Change parameter type to openp_flags.
* cli/cli-cmds.c (find_and_open_script): Use openp_flags.
* dwarf2read.c (try_open_dwop_file): Use openp_flags.
2018-02-13 Simon Marchi <simon.marchi@polymtl.ca>
* maint.c (_initialize_maint_cmds): Fix prefix of maint set/show
per-command.
gdb: Remove cleanup from dw2_do_instantiate_symtab When running the test gdb.dwarf2/dw2-bad-parameter-type.exp under valgrind, I see the following issue reported (on x86-64 Fedora): (gdb) ptype f ==5203== Invalid read of size 1 ==5203== at 0x6931FE: process_die_scope::~process_die_scope() (dwarf2read.c:10642) ==5203== by 0x66818F: process_die(die_info*, dwarf2_cu*) (dwarf2read.c:10664) ==5203== by 0x66A01F: read_file_scope(die_info*, dwarf2_cu*) (dwarf2read.c:11650) ==5203== by 0x667F2D: process_die(die_info*, dwarf2_cu*) (dwarf2read.c:10672) ==5203== by 0x6677B6: process_full_comp_unit(dwarf2_per_cu_data*, language) (dwarf2read.c:10445) ==5203== by 0x66657A: process_queue(dwarf2_per_objfile*) (dwarf2read.c:9945) ==5203== by 0x6559B4: dw2_do_instantiate_symtab(dwarf2_per_cu_data*) (dwarf2read.c:3163) ==5203== by 0x66683D: psymtab_to_symtab_1(partial_symtab*) (dwarf2read.c:10034) ==5203== by 0x66622A: dwarf2_read_symtab(partial_symtab*, objfile*) (dwarf2read.c:9811) ==5203== by 0x787984: psymtab_to_symtab(objfile*, partial_symtab*) (psymtab.c:792) ==5203== by 0x786E3E: psym_lookup_symbol(objfile*, int, char const*, domain_enum_tag) (psymtab.c:522) ==5203== by 0x804BD0: lookup_symbol_via_quick_fns(objfile*, int, char const*, domain_enum_tag) (symtab.c:2383) ==5203== Address 0x147ed063 is 291 bytes inside a block of size 4,064 free'd ==5203== at 0x4C2CD5A: free (vg_replace_malloc.c:530) ==5203== by 0x444415: void xfree<void>(void*) (common-utils.h:60) ==5203== by 0x9DA8C2: call_freefun (obstack.c:103) ==5203== by 0x9DAD35: _obstack_free (obstack.c:280) ==5203== by 0x44464C: auto_obstack::~auto_obstack() (gdb_obstack.h:73) ==5203== by 0x68AFB0: dwarf2_cu::~dwarf2_cu() (dwarf2read.c:25080) ==5203== by 0x68B204: free_one_cached_comp_unit(dwarf2_per_cu_data*) (dwarf2read.c:25174) ==5203== by 0x66668C: dwarf2_release_queue(void*) (dwarf2read.c:9982) ==5203== by 0x563A4C: do_my_cleanups(cleanup**, cleanup*) (cleanups.c:154) ==5203== by 0x563AA7: do_cleanups(cleanup*) (cleanups.c:176) ==5203== by 0x5646CE: throw_exception_cxx(gdb_exception) (common-exceptions.c:289) ==5203== by 0x5647B7: throw_exception(gdb_exception) (common-exceptions.c:317) ==5203== Block was alloc'd at ==5203== at 0x4C2BBAD: malloc (vg_replace_malloc.c:299) ==5203== by 0x564BE8: xmalloc (common-utils.c:44) ==5203== by 0x9DA872: call_chunkfun (obstack.c:94) ==5203== by 0x9DA935: _obstack_begin_worker (obstack.c:141) ==5203== by 0x9DAA3C: _obstack_begin (obstack.c:164) ==5203== by 0x4445E0: auto_obstack::auto_obstack() (gdb_obstack.h:70) ==5203== by 0x68AE07: dwarf2_cu::dwarf2_cu(dwarf2_per_cu_data*) (dwarf2read.c:25073) ==5203== by 0x661A8A: init_cutu_and_read_dies(dwarf2_per_cu_data*, abbrev_table*, int, int, void (*)(die_reader_specs const*, unsigned char const*, die_info*, int, void*), void*) (dwarf2read.c:7869) ==5203== by 0x666A29: load_full_comp_unit(dwarf2_per_cu_data*, language) (dwarf2read.c:10108) ==5203== by 0x655847: load_cu(dwarf2_per_cu_data*) (dwarf2read.c:3120) ==5203== by 0x655928: dw2_do_instantiate_symtab(dwarf2_per_cu_data*) (dwarf2read.c:3148) ==5203== by 0x66683D: psymtab_to_symtab_1(partial_symtab*) (dwarf2read.c:10034) There's actually a series of three issues reported, but it turns out they're all related, so we can consider on the first one. The invalid read is triggered from a destructor which is being invoked as part of a stack unwind after throwing an error. At the time the error is thrown, the stack looks like this: #0 0x00000000009f4ecd in __cxa_throw () #1 0x0000000000564761 in throw_exception_cxx (exception=...) at ../../src/gdb/common/common-exceptions.c:303 #2 0x00000000005647b8 in throw_exception (exception=...) at ../../src/gdb/common/common-exceptions.c:317 #3 0x00000000005648ff in throw_it(return_reason, errors, const char *, typedef __va_list_tag __va_list_tag *) (reason=RETURN_ERROR, error=GENERIC_ERROR, fmt=0xb33020 "Dwarf Error: Cannot find DIE at 0x%x referenced from DIE at 0x%x [in module %s]", ap=0x7fff387f2d68) at ../../src/gdb/common/common-exceptions.c:373 #4 0x0000000000564929 in throw_verror (error=GENERIC_ERROR, fmt=0xb33020 "Dwarf Error: Cannot find DIE at 0x%x referenced from DIE at 0x%x [in module %s]", ap=0x7fff387f2d68) at ../../src/gdb/common/common-exceptions.c:379 #5 0x0000000000867be4 in verror (string=0xb33020 "Dwarf Error: Cannot find DIE at 0x%x referenced from DIE at 0x%x [in module %s]", args=0x7fff387f2d68) at ../../src/gdb/utils.c:251 #6 0x000000000056879d in error (fmt=0xb33020 "Dwarf Error: Cannot find DIE at 0x%x referenced from DIE at 0x%x [in module %s]") at ../../src/gdb/common/errors.c:43 #7 0x0000000000686875 in follow_die_ref (src_die=0x30bc8a0, attr=0x30bc8c8, ref_cu=0x7fff387f2ed0) at ../../src/gdb/dwarf2read.c:22969 #8 0x00000000006844cd in lookup_die_type (die=0x30bc8a0, attr=0x30bc8c8, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:21976 #9 0x0000000000683f27 in die_type (die=0x30bc8a0, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:21832 #10 0x0000000000679b39 in read_subroutine_type (die=0x30bc830, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:17343 #11 0x00000000006845fb in read_type_die_1 (die=0x30bc830, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:22035 #12 0x0000000000684576 in read_type_die (die=0x30bc830, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:22010 #13 0x000000000067003f in read_func_scope (die=0x30bc830, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:13822 #14 0x0000000000667f5e in process_die (die=0x30bc830, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:10679 #15 0x000000000066a020 in read_file_scope (die=0x30bc720, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:11650 #16 0x0000000000667f2e in process_die (die=0x30bc720, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:10672 #17 0x00000000006677b7 in process_full_comp_unit (per_cu=0x3089b80, pretend_language=language_minimal) at ../../src/gdb/dwarf2read.c:10445 #18 0x000000000066657b in process_queue (dwarf2_per_objfile=0x30897d0) at ../../src/gdb/dwarf2read.c:9945 #19 0x00000000006559b5 in dw2_do_instantiate_symtab (per_cu=0x3089b80) at ../../src/gdb/dwarf2read.c:3163 #20 0x000000000066683e in psymtab_to_symtab_1 (pst=0x3089bd0) at ../../src/gdb/dwarf2read.c:10034 #21 0x000000000066622b in dwarf2_read_symtab (self=0x3089bd0, objfile=0x3073f40) at ../../src/gdb/dwarf2read.c:9811 #22 0x0000000000787985 in psymtab_to_symtab (objfile=0x3073f40, pst=0x3089bd0) at ../../src/gdb/psymtab.c:792 #23 0x0000000000786e3f in psym_lookup_symbol (objfile=0x3073f40, block_index=1, name=0x30b2e30 "f", domain=VAR_DOMAIN) at ../../src/gdb/psymtab.c:522 #24 0x0000000000804bd1 in lookup_symbol_via_quick_fns (objfile=0x3073f40, block_index=1, name=0x30b2e30 "f", domain=VAR_DOMAIN) at ../../src/gdb/symtab.c:2383 #25 0x0000000000804fe4 in lookup_symbol_in_objfile (objfile=0x3073f40, block_index=1, name=0x30b2e30 "f", domain=VAR_DOMAIN) at ../../src/gdb/symtab.c:2558 #26 0x0000000000805125 in lookup_static_symbol (name=0x30b2e30 "f", domain=VAR_DOMAIN) at ../../src/gdb/symtab.c:2595 #27 0x0000000000804357 in lookup_symbol_aux (name=0x30b2e30 "f", match_type=symbol_name_match_type::FULL, block=0x0, domain=VAR_DOMAIN, language=language_c, is_a_field_of_this=0x0) at ../../src/gdb/symtab.c:2105 #28 0x0000000000803ad9 in lookup_symbol_in_language (name=0x30b2e30 "f", block=0x0, domain=VAR_DOMAIN, lang=language_c, is_a_field_of_this=0x0) at ../../src/gdb/symtab.c:1887 #29 0x0000000000803b53 in lookup_symbol (name=0x30b2e30 "f", block=0x0, domain=VAR_DOMAIN, is_a_field_of_this=0x0) at ../../src/gdb/symtab.c:1899 #30 0x000000000053b246 in classify_name (par_state=0x7fff387f6090, block=0x0, is_quoted_name=false, is_after_structop=false) at ../../src/gdb/c-exp.y:2879 #31 0x000000000053b7e9 in c_yylex () at ../../src/gdb/c-exp.y:3083 #32 0x000000000053414a in c_yyparse () at c-exp.c:1903 #33 0x000000000053c2e7 in c_parse (par_state=0x7fff387f6090) at ../../src/gdb/c-exp.y:3255 #34 0x0000000000774a02 in parse_exp_in_context_1 (stringptr=0x7fff387f61c0, pc=0, block=0x0, comma=0, void_context_p=0, out_subexp=0x0) at ../../src/gdb/parse.c:1213 #35 0x000000000077476a in parse_exp_in_context (stringptr=0x7fff387f61c0, pc=0, block=0x0, comma=0, void_context_p=0, out_subexp=0x0) at ../../src/gdb/parse.c:1115 #36 0x0000000000774714 in parse_exp_1 (stringptr=0x7fff387f61c0, pc=0, block=0x0, comma=0) at ../../src/gdb/parse.c:1106 #37 0x0000000000774c53 in parse_expression (string=0x27ff996 "f") at ../../src/gdb/parse.c:1253 #38 0x0000000000861dc4 in whatis_exp (exp=0x27ff996 "f", show=1) at ../../src/gdb/typeprint.c:472 #39 0x00000000008620d8 in ptype_command (type_name=0x27ff996 "f", from_tty=1) at ../../src/gdb/typeprint.c:561 #40 0x000000000047430b in do_const_cfunc (c=0x3012010, args=0x27ff996 "f", from_tty=1) at ../../src/gdb/cli/cli-decode.c:106 #41 0x000000000047715e in cmd_func (cmd=0x3012010, args=0x27ff996 "f", from_tty=1) at ../../src/gdb/cli/cli-decode.c:1886 #42 0x00000000008431bb in execute_command (p=0x27ff996 "f", from_tty=1) at ../../src/gdb/top.c:630 #43 0x00000000006bf946 in command_handler (command=0x27ff990 "ptype f") at ../../src/gdb/event-top.c:583 #44 0x00000000006bfd12 in command_line_handler (rl=0x30bb3a0 "\240\305\v\003") at ../../src/gdb/event-top.c:774 The problem is that in `process_die` (frames 14 and 16) we create a `process_die_scope` object, that takes a copy of the `struct dwarf2_cu *` passed into the frame. The destructor of the `process_die_scope` dereferences the stored pointer. This wouldn't be an issue, except... ... in dw2_do_instantiate_symtab (frame 19) a clean up was registered that clears the dwarf2_queue in case of an error. Part of this clean up involves deleting the `struct dwarf2_cu`s referenced from the queue.. The problem then, is that cleanups are processed at the site of the throw, while, class destructors are invoked as we unwind their frame. The result is that we process the frame 19 cleanup (and delete the struct dwarf2_cu) before we process the destructors in frames 14 and 16. When we do get back to frames 14 and 16 the objects being references have already been deleted. The solution is to remove the cleanup from dw2_do_instantiate_symtab, and instead use a destructor to release the dwarf2_queue instead. With this patch in place, the valgrind errors are now resolved. gdb/ChangeLog: * dwarf2read.c (dwarf2_release_queue): Delete function, move body into... (class dwarf2_queue_guard): ...the destructor of this new class. (dw2_do_instantiate_symtab): Create instance of the new class dwarf2_queue_guard, remove cleanup.
2018-02-05 18:13:17 +01:00
2018-02-12 Andrew Burgess <andrew.burgess@embecosm.com>
* dwarf2read.c (dwarf2_release_queue): Delete function, move body
into...
(class dwarf2_queue_guard): ...the destructor of this new class.
(dw2_do_instantiate_symtab): Create instance of the new class
dwarf2_queue_guard, remove cleanup.
2018-02-09 Tom Tromey <tom@tromey.com>
* source.c (find_source_lines): Don't reference past the end of
the vector.
2018-02-09 Markus Metzger <markus.t.metzger@intel.com>
* remote.c (remote_btrace_maybe_reopen): Change error message.
* btrace.c (btrace_enable): Likewise.
(parse_xml_btrace): Likewise.
(parse_xml_btrace_conf): Likewise.
2018-02-09 Markus Metzger <markus.t.metzger@intel.com>
* nat/linux-btrace.c (diagnose_perf_event_open_fail): New.
(linux_enable_pt, linux_enable_bts): Call
diagnose_perf_event_open_fail.
2018-02-09 Markus Metzger <markus.t.metzger@intel.com>
* nat/linux-btrace.c (perf_event_pt_event_type): Improve error message.
Remove parameter and change return type. Update callers. Move it.
(linux_enable_bts, linux_enable_pt): Improve error message.
(linux_enable_pt): Remove zero buffer size check.
(linux_enable_btrace): Improve error messages. Remove NULL return
check.
btrace, gdbserver: remove the to_supports_btrace target method Remove the to_supports_btrace target method and instead rely on detecting errors when trying to enable recording. This will also provide a suitable error message explaining why recording is not possible. For remote debugging, gdbserver will now always advertise branch tracing related packets. When talking to an older GDB, this will cause GDB to try to enable branch tracing and gdbserver to report a suitable error message every time. An older gdbserver will not advertise branch tracing related packets if the one-time check failed, so a newer GDB with this patch will fail to enable branch tracing at remote_enable_btrace() rather than at btrace_enable(). The error message is the same in both cases so there should be no user-visible change. gdb/ * btrace.c (btrace_enable): Remove target_supports_btrace call. * nat/linux-btrace.c (perf_event_pt_event_type): Move. (kernel_supports_bts, kernel_supports_pt, linux_supports_bts) (linux_supports_pt, linux_supports_btrace): Remove. (linux_enable_bts): Call cpu_supports_bts. * nat/linux-btrace.h (linux_supports_btrace): Remove. * remote.c (remote_supports_btrace): Remove. (init_remote_ops): Remove remote_supports_btrace. * target-delegates.c: Regenerated. * target.c (target_supports_btrace): Remove. * target.h (target_ops) <to_supports_btrace>: Remove (target_supports_btrace): Remove. * x86-linux-nat.c (x86_linux_create_target): Remove linux_supports_btrace. gdbserver/ * linux-low.c (linux_target_ops): Remove linux_supports_btrace. * nto-low.c (nto_target_ops): Remove NULL for supports_btrace. * spu-low.c (spu_target_ops): Likewise. * win32-low.c (win32_target_ops): Likewise. * server.c (supported_btrace_packets): Report packets unconditionally. * target.h (target_ops) <supports_btrace>: Remove. (target_supports_btrace): Remove.
2018-01-19 14:32:09 +01:00
2018-02-09 Markus Metzger <markus.t.metzger@intel.com>
* btrace.c (btrace_enable): Remove target_supports_btrace call.
* nat/linux-btrace.c (perf_event_pt_event_type): Move.
(kernel_supports_bts, kernel_supports_pt, linux_supports_bts)
(linux_supports_pt, linux_supports_btrace): Remove.
(linux_enable_bts): Call cpu_supports_bts.
* nat/linux-btrace.h (linux_supports_btrace): Remove.
* remote.c (remote_supports_btrace): Remove.
(init_remote_ops): Remove remote_supports_btrace.
* target-delegates.c: Regenerated.
* target.c (target_supports_btrace): Remove.
* target.h (target_ops) <to_supports_btrace>: Remove
(target_supports_btrace): Remove.
* x86-linux-nat.c (x86_linux_create_target): Remove
linux_supports_btrace.
2018-02-09 Markus Metzger <markus.t.metzger@intel.com>
* nat/linux-btrace.c (linux_enable_btrace): Throw exception if enabling
btrace failed.
* x86-linux-nat.c (x86_linux_enable_btrace): Catch btrace enabling
exception and use message in own exception.
2018-02-09 Markus Metzger <markus.t.metzger@intel.com>
* nat/linux-btrace.c: Include scoped_fd.h and scoped_mmap.h.
(perf_event_pt_event_type): Use gdb_file_up.
(linux_enable_bts, linux_enable_pt): Use gdb::unique_xmalloc_ptr,
scoped_fd, and scoped_mmap.
2018-02-09 Markus Metzger <markus.t.metzger@intel.com>
* common/scoped_mmap.h: New.
* unittests/scoped_mmap-selftest.c: New.
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/scoped_mmap-selftest.c.
2018-02-09 Markus Metzger <markus.t.metzger@intel.com>
* common/scoped_fd.h: New.
* unittests/scoped_fd-selftest.c: New.
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/scoped_fd-selftest.c.
2018-02-09 Tom Tromey <tom@tromey.com>
* auto-load.c (auto_load_section_scripts): Use
gdb::unique_xmalloc_ptr.
2018-02-09 Tom Tromey <tom@tromey.com>
* auto-load.c (execute_script_contents): Use std::string.
2018-02-09 Joel Brobecker <brobecker@adacore.com>
* NEWS <Changes in GDB 8.1>: Clarify that "rbreak" is a new
Python function, rather than a new command.
2018-02-08 Tom Tromey <tom@tromey.com>
* solib.c (solib_find_1): Use std::string.
(solib_bfd_fopen): Use unique_xmalloc_ptr.
2018-02-08 Tom Tromey <tom@tromey.com>
* build-id.c (build_id_to_debug_bfd): Use unique_xmalloc_ptr.
2018-02-08 Tom Tromey <tom@tromey.com>
* source.c (find_source_lines): Use gdb::def_vector.
2018-02-08 Tom Tromey <tom@tromey.com>
* macrocmd.c (struct temporary_macro_definition): New.
(macro_define_command): Use temporary_macro_definition. Remove
cleanups.
(free_macro_definition_ptr): Remove.
2018-02-08 Tom Tromey <tom@tromey.com>
* macroexp.c (maybe_expand): Use std::string.
2018-02-08 Tom Tromey <tom@tromey.com>
* macroexp.c (struct macro_buffer): Add initializers for some
members.
(init_buffer, init_shared_buffer, free_buffer)
(free_buffer_return_text): Remove.
(macro_buffer): New constructors.
(~macro_buffer): New destructor.
(macro_buffer::set_shared): New method.
(macro_buffer::resize_buffer, macro_buffer::appendc)
(macro_buffer::appendmem): Now methods, not free functions.
(set_token, append_tokens_without_splicing, stringify)
(macro_stringify): Update.
(gather_arguments): Change return type. Remove argc_p argument,
add args_ptr argument. Use std::vector.
(substitute_args): Remove argc argument. Accept std::vector.
(expand): Update. Use std::vector.
(scan, macro_expand, macro_expand_next): Update.
2018-02-08 Tom Tromey <tom@tromey.com>
* symtab.c (default_collect_symbol_completion_matches_break_on):
Use unique_xmalloc_ptr.
* macroscope.h: (sal_macro_scope, user_macro_scope)
(default_macro_scope): Return unique_xmalloc_ptr.
* macroscope.c (sal_macro_scope, user_macro_scope)
(default_macro_scope): Return unique_xmalloc_ptr.
* macroexp.h (macro_expand, macro_expand_once): Return
unique_xmalloc_ptr.
* macroexp.c (macro_expand, macro_expand_once): Return
unique_xmalloc_ptr.
* macrocmd.c (macro_expand_command, macro_expand_once_command)
(info_macro_command, info_macros_command): Use
unique_xmalloc_ptr.
* compile/compile-c-support.c (write_macro_definitions): Use
unique_xmalloc_ptr.
* c-exp.y (c_parse): Use unique_xmalloc_ptr.
2018-02-07 Simon Marchi <simon.marchi@ericsson.com>
* value.c (value_static_field): Assign field type instead of
containing type when returning an optimized out value.
2018-02-06 Yao Qi <yao.qi@linaro.org>
* ft32-tdep.c (ft32_read_pc): Remove.
(ft32_write_pc): Remove.
(ft32_gdbarch_init): Update.
* m32r-tdep.c (m32r_read_pc): Remove.
(m32r_gdbarch_init): Update.
* mep-tdep.c (mep_read_pc): Remove.
(mep_gdbarch_init): Update.
* microblaze-tdep.c (microblaze_write_pc): Remove.
(microblaze_gdbarch_init): Update.
* mn10300-tdep.c (mn10300_read_pc): Remove.
(mn10300_write_pc): Remove.
(mn10300_gdbarch_init): Update.
* moxie-tdep.c (moxie_read_pc): Remove.
(moxie_write_pc): Remove.
(moxie_gdbarch_init): Update.
Treat OP_F77_UNDETERMINED_ARGLIST as OP_FUNCALL When I debug some fortran expression parsing, I got (gdb) set debug expression 1 (gdb) p intvla(5,5,5) Dump of expression @ 0x205fa80, before conversion to prefix form: Language fortran, 19 elements, 16 bytes each. Index Opcode Hex Value String Value 0 OP_VAR_VALUE 40 (............... 1 <unknown 31863232> 31863232 .1.............. .... 14 BINOP_REM 5 ................ 15 OP_LONG 38 &............... 16 OP_F77_UNDETERMINED_ARGLIST 48 0............... 17 BINOP_MUL 3 ................ 18 OP_F77_UNDETERMINED_ARGLIST 48 0............... Dump of expression @ 0x205fa80, after conversion to prefix form: Expression: `Invalid expression ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This patch fixes this problem by handling OP_F77_UNDETERMINED_ARGLIST in the same way as handling OP_FUNCALL. With this patch applied, the output looks better, (gdb) p intvla (5,5,5) Dump of expression @ 0x2d75590, before conversion to prefix form: Language fortran, 19 elements, 16 bytes each. Index Opcode Hex Value String Value 0 OP_VAR_VALUE 40 (............... .... 16 OP_F77_UNDETERMINED_ARGLIST 48 0............... 17 BINOP_MUL 3 ................ 18 OP_F77_UNDETERMINED_ARGLIST 48 0............... Dump of expression @ 0x2d75590, after conversion to prefix form: Expression: `vla_primitives::intvla (5, 5, 5)' Language fortran, 19 elements, 16 bytes each. 0 OP_F77_UNDETERMINED_ARGLIST Number of args: 3 3 OP_VAR_VALUE Block @0x297e1c0, symbol @0x297cd50 (intvla) 7 OP_LONG Type @0x2976900 (int), value 5 (0x5) 11 OP_LONG Type @0x2976900 (int), value 5 (0x5) 15 OP_LONG Type @0x2976900 (int), value 5 (0x5) gdb: 2018-02-06 Yao Qi <yao.qi@linaro.org> * expprint.c (print_subexp_standard): Handle OP_F77_UNDETERMINED_ARGLIST. (dump_subexp_body_standard): Likewise.
2018-02-06 18:12:12 +01:00
2018-02-06 Yao Qi <yao.qi@linaro.org>
* expprint.c (print_subexp_standard): Handle
OP_F77_UNDETERMINED_ARGLIST.
(dump_subexp_body_standard): Likewise.
2018-02-05 Alan Hayward <alan.hayward@arm.com>
* target-descriptions.c (tdesc_element_visitor) Add empty
implementations.
(tdesc_type): Move make_gdb_type from here.
(tdesc_type_builtin): Likewise.
(tdesc_type_vector): Likewise.
(tdesc_type_with_fields): Move make_gdb_type_ functions from here.
(make_gdb_type_struct): Move from tdesc_type_with_fields.
(make_gdb_type_union): Likewise.
(make_gdb_type_flags): Likewise.
(make_gdb_type_enum): Likewise.
(make_gdb_type): New function.
(tdesc_register_type): Use static make_gdb_type.
2018-02-05 Ruslan Kabatsayev <b7.10110111@gmail.com>
* infcmd.c (default_print_one_register_info): Align natural-format
column values consistently one under another.
(pad_to_column): New function.
2018-02-05 Joel Brobecker <brobecker@adacore.com>
* dwarf2read.c (dwarf2_physname): Move commment.
MI: Allow non-raw varobj evaluation Make the MI variable object expression evaluation, with the -var-evaluate-expression command, recursively call pretty printers, to match the output of normal expression printing. Consider the following code: struct Foo { int val; }; struct Wrapper { Foo foo; }; int main() { Wrapper w; w.foo.val = 23; } and this pretty printer file: import gdb.printing class FooPrinter: def __init__(self, val): self.val = val def to_string(self): return "Foo" + str(self.val["val"]) class WrapperPrinter: def __init__(self, val): self.val = val def to_string(self): return self.val["foo"] test_printer = gdb.printing.RegexpCollectionPrettyPrinter("test") test_printer.add_printer('Foo', '^Foo$', FooPrinter) test_printer.add_printer('Wrapper', '^Wrapper$', WrapperPrinter) gdb.printing.register_pretty_printer(None, test_printer) Setting a breakpoint at the end of the function, we call the following commands: -enable-pretty-printing ^done -var-create var_w @ w ^done,name="var_w",numchild="0",value="{val = 23}",type="Wrapper",dynamic="1",has_more="0" -var-create var_w_foo @ w.foo ^done,name="var_w_foo",numchild="0",value="Foo23",type="Foo",dynamic="1",has_more="0" -var-evaluate-expression var_w ^done,value="{val = 23}" -var-evaluate-expression var_w_foo ^done,value="Foo23" -data-evaluate-expression w ^done,value="Foo23" -data-evaluate-expression w.foo ^done,value="Foo23" So, in the -var-evaluate-expression var_w case, we print the "raw" value of w.foo, while in the -data-evaluate-expression w case, we print the pretty printed w.foo value. After this patch, all of the above print "Foo23". gdb/ChangeLog: * varobj.c (varobj_formatted_print_options): Allow recursive pretty printing if pretty printing is enabled. gdb/testsuite/ChangeLog: * gdb.python/py-prettyprint.c (struct to_string_returns_value_inner, struct to_string_returns_value_wrapper): New. (main): Add tsrvw variable. * gdb.python/py-prettyprint.py (ToStringReturnsValueInner, ToStringReturnsValueWrapper): New classes. (register_pretty_printers): Register new pretty-printers. * gdb.python/py-prettyprint.exp (run_lang_tests): Test printing recursive pretty printer. * gdb.python/py-mi.exp: Likewise.
2018-02-02 05:23:28 +01:00
2018-02-01 Leszek Swirski <leszeks@google.com>
* varobj.c (varobj_formatted_print_options): Allow recursive
pretty printing if pretty printing is enabled.
2018-02-01 Leszek Swirski <leszeks@google.com>
* c-exp.y (lex_one_token, classify_name, yylex): Don't classify
names after a structop as a filename.
2018-02-01 Yao Qi <yao.qi@linaro.org>
* arm-tdep.c (arm_record_data_proc_misc_ld_str): Rewrite it.
(arm_record_coproc_data_proc): Likewise.
2018-02-01 Yao Qi <yao.qi@linaro.org>
* arm-tdep.c (arm_record_extension_space): Change ret to signed.
2018-01-31 Nikola Prica <nikola.prica@rt-rk.com>
* rs6000-tdep.c (skip_prologue): Remove shifting for lr_reg and
assign shifted lr_reg to fdata->lr_register when lr_reg is set.
2018-01-31 Pedro Alves <palves@redhat.com>
* darwin-nat.c (darwin_interrupt): Remove ptid_t parameter.
* inflow.c (child_terminal_save_inferior): Wrap reference to
tcgetpgrp in HAVE_TERMIOS_H.
(child_interrupt, child_pass_ctrlc): Wrap references to signal in
_WIN32.
* remote-sim.c (gdbsim_interrupt): Remove ptid_t parameter and
always iterate over all inferiors.
(gdbsim_cntrl_c): Adjust.
* windows-nat.c (windows_interrupt): Remove 'ptid_t' parameter.
internal-error using '@' (repeat) operator on array of dynamic objects Using the following Ada declarations (the same as in gdb.ada/dyn_stride.exp)... subtype Small_Type is Integer range L .. U; type Record_Type (I : Small_Type := L) is record S : String (1 .. I); end record; type Array_Type is array (Integer range <>) of Record_Type; A1 : Array_Type := (1 => (I => U, S => (others => ASCII.NUL)), 2 => (I => 1, S => "A"), 3 => (I => 2, S => "AB")); ... where "L" and "U" are variables, trying to apply the repeat operator to "A1(1)" yields to an internal error: | (gdb) print a1(1)@3 | $5 = /[...]/gdbtypes.c:4883: internal-error: type* copy_type(const type*): | Assertion `TYPE_OBJFILE_OWNED (type)' failed. What happens first is that the ada-lang module evaluated the "A1(1)" sub-expression returning a structure where "I" (one of the fields in that structure) has a type which is dynamic, because it is a range type whose bounds are not statically known. Next, we apply the repeat ('@') operator, which is done via allocate_repeat_value, which creates an array type with the correct bounds to associate to our value, by calling lookup_array_range_type: | struct type * | lookup_array_range_type (struct type *element_type, | LONGEST low_bound, LONGEST high_bound) | { | struct gdbarch *gdbarch = get_type_arch (element_type); | struct type *index_type = builtin_type (gdbarch)->builtin_int; | struct type *range_type | = create_static_range_type (NULL, index_type, low_bound, high_bound); | | return create_array_type (NULL, element_type, range_type); | } As we can see, this creates an array type whose index type is always owned by the gdbarch. This is where the problem lies. Next, we use that type to construct a struct value. That value then gets passed to the valprint module, which then checks whether our object is dynamic or not. And because field "I" above had a dynamic range type, we end up determining by association that the artificial repeat array itself is also dynamic. So we attempt to resolve the type, which leads to trying to copying that type. And because the artifical array created by lookup_array_range_type has an index which is not objfile-owned, we trip the assertion. This patch fixes the issue by enhancing lookup_array_range_type to create an index type which has the same owner as the element type. gdb/ChangeLog: * gdbtypes.c (lookup_array_range_type): Make sure the array's index type is objfile-owned if the element type is as well. gdb/testsuite/ChangeLog: * testsuite/gdb.ada/dyn_stride.exp: Add "print a1(1)@3" test.
2018-01-31 08:18:56 +01:00
2018-01-31 Joel Brobecker <brobecker@adacore.com>
* gdbtypes.c (lookup_array_range_type): Make sure the array's
index type is objfile-owned if the element type is as well.
2018-01-31 Joel Brobecker <brobecker@adacore.com>
GDB 8.1 released.
2018-01-30 Philipp Rudo <prudo@linux.vnet.ibm.com>
* s390-linux-tdep.c: Remove includes "features/s390-linux32.c" and
"features/s390x-linux64.c".
(_initialize_s390_linux_tdep): Remove initialization of tdescs
s390_linux32 and s390x_linux64.
(s390_linux_init_abi_31, s390_linux_init_abi_64): Don't set
default tdesc.
* s390-tdep.c: Include "features/s390-linux32.c" and
"features/s390x-linux64.c".
(s390_tdesc_valid): Add check for tdesc_has_registers.
(s390_gdbarch_init): Make sure there is always a valid tdesc.
(_initialize_s390_tdep): Initialize tdesc_s390_linux32 and
tdesc_s390x_linux64.
* s390-linux-tdep.h: Move export of tdesc_s390_linux32 and
tdesc_s390x_linux64 to...
* s390-tdep.h: ...here.
Per-inferior target_terminal state, fix PR gdb/13211, more In my multi-target branch I ran into problems with GDB's terminal handling that exist in master as well, with multi-inferior debugging. This patch adds a testcase for said problems (gdb.multi/multi-term-settings.exp), fixes the problems, fixes PR gdb/13211 as well (and adds a testcase for that too, gdb.base/interrupt-daemon.exp). The basis of the problem I ran into is the following. Consider a scenario where you have: - inferior 1 - started with "attach", process is running on some other terminal. - inferior 2 - started with "run", process is sharing gdb's terminal. In this scenario, when you stop/resume both inferiors, you want GDB to save/restore the terminal settings of inferior 2, the one that is sharing GDB's terminal. I.e., you want inferior 2 to "own" the terminal (in target_terminal::is_ours/target_terminal::is_inferior sense). Unfortunately, that's not what you get currently. Because GDB doesn't know whether an attached inferior is actually sharing GDB's terminal, it tries to save/restore its settings anyway, ignoring errors. In this case, this is pointless, because inferior 1 is running on a different terminal, but GDB doesn't know better. And then, because it is only possible to have the terminal settings of a single inferior be in effect at a time, or make one inferior/pgrp be the terminal's foreground pgrp (aka, only one inferior can "own" the terminal, ignoring fork children here), if GDB happens to try to restore the terminal settings of inferior 1 first, then GDB never restores the terminal settings of inferior 2. This patch fixes that and a few things more along the way: - Moves enum target_terminal::terminal_state out of the target_terminal class (it's currently private) and makes it a scoped enum so that it can be easily used elsewhere. - Replaces the inflow.c:terminal_is_ours boolean with a target_terminal_state variable. This allows distinguishing is_ours and is_ours_for_output states. This allows finally making child_terminal_ours_1 do something with its "output_only" parameter. - Makes each inferior have its own copy of the is_ours/is_ours_for_output/is_inferior state. - Adds a way for GDB to tell whether the inferior is sharing GDB's terminal. Works best on Linux and Solaris; the fallback works just as well as currently. - With that, we can remove the inf->attach_flag tests from child_terminal_inferior/child_terminal_ours. - Currently target_ops.to_ours is responsible for both saving the current inferior's terminal state, and restoring gdb's state. Because each inferior has its own terminal state (possibly handled by different targets in a multi-target world, even), we need to split the inferior-saving part from the gdb-restoring part. The patch adds a new target_ops.to_save_inferior target method for that. - Adds a new target_terminal::save_inferior() function, so that sequences like: scoped_restore_terminal_state save_state; target_terminal::ours_for_output (); ... restore back inferiors that were target_terminal_state::is_inferior before back to is_inferior, and leaves inferiors that were is_ours alone. - Along the way, this adds a default implementation of target_pass_ctrlc to inflow.c (for inf-child.c), that handles passing the Ctrl-C to a process running on GDB's terminal or to some other process otherwise. - Similarly, adds a new target default implementation of target_interrupt, for the "interrupt" command. The current implementation of this hook in inf-ptrace.c kills the whole process group, but that's incorrect/undesirable because we may not be attached to all processes in the process group. And also, it's incorrect because inferior_process_group() doesn't really return the inferior's real process group id if the inferior is not a process group leader... This is the cause of PR gdb/13211 [1], which this patch fixes. While at it, that target method's "ptid" parameter is eliminated, because it's not really used. - A new test is included that exercises and fixes PR gdb/13211, and also fixes a GDB issue reported on stackoverflow that I ran into while working on this [2]. The problem is similar to PR gdb/13211, except that it also triggers with Ctrl-C. When debugging a daemon (i.e., a process that disconnects from the controlling terminal and is not a process group leader, then Ctrl-C doesn't work, you just can't interrupt the inferior at all, resulting in a hung debug session. The problem is that since the inferior is no longer associated with gdb's session / controlling terminal, then trying to put the inferior in the foreground fails. And so Ctrl-C never reaches the inferior directly. pass_signal is only used when the inferior is attached, but that is not the case here. This is fixed by the new child_pass_ctrlc. Without the fix, the new interrupt-daemon.exp testcase fails with timeout waiting for a SIGINT that never arrives. [1] PR gdb/13211 - Async / Process group and interrupt not working https://sourceware.org/bugzilla/show_bug.cgi?id=13211 [2] GDB not reacting Ctrl-C when after fork() and setsid() https://stackoverflow.com/questions/46101292/gdb-not-reacting-ctrl-c-when-after-fork-and-setsid Note this patch does _not_ fix: - PR gdb/14559 - The 'interrupt' command does not work if sigwait is in use https://sourceware.org/bugzilla/show_bug.cgi?id=14559 - PR gdb/9425 - When using "sigwait" GDB doesn't trap SIGINT. Ctrl+C terminates program when should break gdb. https://sourceware.org/bugzilla/show_bug.cgi?id=9425 The only way to fix that that I know of (without changing the kernel) is to make GDB put inferiors in a separate session (create a pseudo-tty master/slave pair, make the inferior run with the slave as its terminal, and have gdb pump output/input on the master end). gdb/ChangeLog: 2018-01-30 Pedro Alves <palves@redhat.com> PR gdb/13211 * config.in, configure: Regenerate. * configure.ac: Check for getpgid. * go32-nat.c (go32_pass_ctrlc): New. (go32_target): Install it. * inf-child.c (inf_child_target): Install child_terminal_save_inferior, child_pass_ctrlc and child_interrupt. * inf-ptrace.c (inf_ptrace_interrupt): Delete. (inf_ptrace_target): No longer install it. * infcmd.c (interrupt_target_1): Adjust. * inferior.h (child_terminal_save_inferior, child_pass_ctrlc) (child_interrupt): Declare. (inferior::terminal_state): New. * inflow.c (struct terminal_info): Update comments. (inferior_process_group): Delete. (terminal_is_ours): Delete. (gdb_tty_state): New. (child_terminal_init): Adjust. (is_gdb_terminal, sharing_input_terminal_1) (sharing_input_terminal): New functions. (child_terminal_inferior): Adjust. Use sharing_input_terminal. Set the process's actual process group in the foreground if possible. Handle is_ours_for_output/is_ours distinction. Don't mark terminal as the inferior's if not sharing GDB's terminal. Don't check attach_flag. (child_terminal_ours_for_output, child_terminal_ours): Adjust to pass down a target_terminal_state. (child_terminal_save_inferior): New, factored out from ... (child_terminal_ours_1): ... this. Handle target_terminal_state::is_ours_for_output. (child_interrupt, child_pass_ctrlc): New. (inflow_inferior_exit): Clear the inferior's terminal_state. (copy_terminal_info): Copy the inferior's terminal state. (_initialize_inflow): Remove reference to terminal_is_ours. * inflow.h (inferior_process_group): Delete. * nto-procfs.c (nto_handle_sigint, procfs_interrupt): Adjust. * procfs.c (procfs_target): Don't install procfs_interrupt. (procfs_interrupt): Delete. * remote.c (remote_serial_quit_handler): Adjust. (remote_interrupt): Remove ptid parameter. Adjust. * target-delegates.c: Regenerate. * target.c: Include "terminal.h". (target_terminal::terminal_state): Rename to ... (target_terminal::m_terminal_state): ... this. (target_terminal::init): Adjust. (target_terminal::inferior): Adjust to per-inferior terminal_state. (target_terminal::restore_inferior, target_terminal_is_ours_kind): New. (target_terminal::ours, target_terminal::ours_for_output): Use target_terminal_is_ours_kind. (target_interrupt): Remove ptid parameter. Adjust. (default_target_pass_ctrlc): Adjust. * target.h (target_ops::to_terminal_save_inferior): New field. (target_ops::to_interrupt): Remove ptid_t parameter. (target_interrupt): Remove ptid_t parameter. Update comment. (target_pass_ctrlc): Update comment. * target/target.h (target_terminal_state): New scoped enum, factored out of ... (target_terminal::terminal_state): ... here. (target_terminal::inferior): Update comments. (target_terminal::restore_inferior): New. (target_terminal::is_inferior, target_terminal::is_ours) (target_terminal::is_ours_for_output): Adjust. (target_terminal::scoped_restore_terminal_state): Adjust to rename, and call restore_inferior() instead of inferior(). (target_terminal::scoped_restore_terminal_state::m_state): Change type. (target_terminal::terminal_state): Rename to ... (target_terminal::m_terminal_state): ... this and change type. gdb/gdbserver/ChangeLog: 2018-01-30 Pedro Alves <palves@redhat.com> PR gdb/13211 * target.c (target_terminal::terminal_state): Rename to ... (target_terminal::m_terminal_state): ... this. gdb/testsuite/ChangeLog: 2018-01-30 Pedro Alves <palves@redhat.com> PR gdb/13211 * gdb.base/interrupt-daemon.c: New. * gdb.base/interrupt-daemon.exp: New. * gdb.multi/multi-term-settings.c: New. * gdb.multi/multi-term-settings.exp: New.
2018-01-30 15:23:51 +01:00
2018-01-30 Pedro Alves <palves@redhat.com>
PR gdb/13211
* config.in, configure: Regenerate.
* configure.ac: Check for getpgid.
* go32-nat.c (go32_pass_ctrlc): New.
(go32_target): Install it.
* inf-child.c (inf_child_target): Install
child_terminal_save_inferior, child_pass_ctrlc and
child_interrupt.
* inf-ptrace.c (inf_ptrace_interrupt): Delete.
(inf_ptrace_target): No longer install it.
* infcmd.c (interrupt_target_1): Adjust.
* inferior.h (child_terminal_save_inferior, child_pass_ctrlc)
(child_interrupt): Declare.
(inferior::terminal_state): New.
* inflow.c (struct terminal_info): Update comments.
(inferior_process_group): Delete.
(terminal_is_ours): Delete.
(gdb_tty_state): New.
(child_terminal_init): Adjust.
(is_gdb_terminal, sharing_input_terminal_1)
(sharing_input_terminal): New functions.
(child_terminal_inferior): Adjust. Use sharing_input_terminal.
Set the process's actual process group in the foreground if
possible. Handle is_ours_for_output/is_ours distinction. Don't
mark terminal as the inferior's if not sharing GDB's terminal.
Don't check attach_flag.
(child_terminal_ours_for_output, child_terminal_ours): Adjust to
pass down a target_terminal_state.
(child_terminal_save_inferior): New, factored out from ...
(child_terminal_ours_1): ... this. Handle
target_terminal_state::is_ours_for_output.
(child_interrupt, child_pass_ctrlc): New.
(inflow_inferior_exit): Clear the inferior's terminal_state.
(copy_terminal_info): Copy the inferior's terminal state.
(_initialize_inflow): Remove reference to terminal_is_ours.
* inflow.h (inferior_process_group): Delete.
* nto-procfs.c (nto_handle_sigint, procfs_interrupt): Adjust.
* procfs.c (procfs_target): Don't install procfs_interrupt.
(procfs_interrupt): Delete.
* remote.c (remote_serial_quit_handler): Adjust.
(remote_interrupt): Remove ptid parameter. Adjust.
* target-delegates.c: Regenerate.
* target.c: Include "terminal.h".
(target_terminal::terminal_state): Rename to ...
(target_terminal::m_terminal_state): ... this.
(target_terminal::init): Adjust.
(target_terminal::inferior): Adjust to per-inferior
terminal_state.
(target_terminal::restore_inferior, target_terminal_is_ours_kind): New.
(target_terminal::ours, target_terminal::ours_for_output): Use
target_terminal_is_ours_kind.
(target_interrupt): Remove ptid parameter. Adjust.
(default_target_pass_ctrlc): Adjust.
* target.h (target_ops::to_terminal_save_inferior): New field.
(target_ops::to_interrupt): Remove ptid_t parameter.
(target_interrupt): Remove ptid_t parameter. Update comment.
(target_pass_ctrlc): Update comment.
* target/target.h (target_terminal_state): New scoped enum,
factored out of ...
(target_terminal::terminal_state): ... here.
(target_terminal::inferior): Update comments.
(target_terminal::restore_inferior): New.
(target_terminal::is_inferior, target_terminal::is_ours)
(target_terminal::is_ours_for_output): Adjust.
(target_terminal::scoped_restore_terminal_state): Adjust to
rename, and call restore_inferior() instead of inferior().
(target_terminal::scoped_restore_terminal_state::m_state): Change
type.
(target_terminal::terminal_state): Rename to ...
(target_terminal::m_terminal_state): ... this and change type.
2018-01-30 Pedro Alves <palves@redhat.com>
* linux-nat.c (wait_for_signal): New function.
(wait_lwp, linux_nat_wait_1): Use it instead of calling sigsuspend
directly.
(async_terminal_is_ours)
(linux_nat_terminal_inferior, linux_nat_terminal_ours): Delete.
(linux_nat_add_target): Don't override
to_terminal_inferior/to_terminal_ours.
Don't call "detach_inferior" on "remote_follow_fork" This patch fixes a regression that has been introduced by: commit bc09b0c14fb713a9aec25e09b78499f3bc2441b5 Date: Fri Jan 19 11:48:11 2018 -0500 Make linux_nat_detach/thread_db_detach use the inferior parameter It is possible to trigger this failure with gdb.base/foll-fork.exp (in which case a bunch of ERROR's will be printed), but one can also use the test below. Consider the following example program: #include <unistd.h> int main (int argc, char *argv[]) { fork (); return 0; } When running it under gdbserver: # ./gdb/gdbserver/gdbserver --multi --once :2345 And debugging it under GDB, we see a segmentation fault: # ./gdb/gdb -q -batch -ex 'set remote exec-file ./a.out' -ex 'tar extended-remote :2345' -ex r ./a.out Starting program: ... [Detaching after fork from child process 16102.] Segmentation fault (core dumped) The problem happens on inferior.c:detach_inferior: void detach_inferior (inferior *inf) { /* Save the pid, since exit_inferior_1 will reset it. */ int pid = inf->pid; ^^^^^^^^^ exit_inferior_1 (inf, 0); if (print_inferior_events) printf_unfiltered (_("[Inferior %d detached]\n"), pid); } When this code is called from remote.c:remote_follow_fork, the PID is valid but there is no 'inferior' associated with it, which means that 'inf == NULL'. The proper fix here is to not call "detach_inferior" when doing remote follow-fork, because we don't have an inferior to detach on the host side. Before bc09b0c1, that call was already a nop (exit_inferior_1 bails out early if you pass it a NULL inferior), except that it printed "Inferior PID detached" when "set print inferior-events" is on. Since native debugging doesn't call detach_inferior in this case, removing the call from remote aligns remote debugging output with native debugging output further. This has been regtested using BuildBot and no regressions were found. gdb/ChangeLog: 2018-01-29 Sergio Durigan Junior <sergiodj@redhat.com> * remote.c (remote_follow_fork): Don't call "detach_inferior".
2018-01-29 18:29:21 +01:00
2018-01-29 Sergio Durigan Junior <sergiodj@redhat.com>
* remote.c (remote_follow_fork): Don't call "detach_inferior".
Remove dwarf2_per_objfile_free and use after free of dwarf2_per_objfile I got some crashes while doing some work with dwarf2_per_objfile. It turns out that dwarf2_per_objfile_free is using the dwarf2_per_objfile objects after their destructor has ran. The easiest way to reproduce this is to run the inferior twice (do "start" twice). Currently, it goes unnoticed, but when I tried to change all_comp_units and all_type_units to std::vectors, things started crashing. The dwarf2_per_objfile objects get destroyed here: #0 dwarf2_per_objfile::~dwarf2_per_objfile (this=0x35afe70, __in_chrg=<optimized out>) at /home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:2422 #1 0x0000000000833282 in dwarf2_free_objfile (objfile=0x356cff0) at /home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:25363 #2 0x0000000000699255 in elf_symfile_finish (objfile=0x356cff0) at /home/emaisin/src/binutils-gdb/gdb/elfread.c:1309 #3 0x0000000000911ed3 in objfile::~objfile (this=0x356cff0, __in_chrg=<optimized out>) at /home/emaisin/src/binutils-gdb/gdb/objfiles.c:674 and just after that the dwarf2read per-objfile registry cleanup function gets called: #0 dwarf2_per_objfile_free (objfile=0x356cff0, d=0x35afe70) at /home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:25667 ... registry boilerplate ... #4 0x00000000009103ea in objfile_free_data (container=0x356cff0) at /home/emaisin/src/binutils-gdb/gdb/objfiles.c:61 #5 0x0000000000911ee2 in objfile::~objfile (this=0x356cff0, __in_chrg=<optimized out>) at /home/emaisin/src/binutils-gdb/gdb/objfiles.c:678 In dwarf2_per_objfile_free, we access fields of the dwarf2_per_objfile object, which is invalid since its destructor has been executed. This patch moves the content of dwarf2_per_objfile_free to the destructor of dwarf2_per_objfile. The call to register_objfile_data_with_cleanup in _initialize_dwarf2_read can be changed to the simpler register_objfile_data. gdb/ChangeLog: * dwarf2read.c (free_dwo_files): Add forward-declaration. (dwarf2_per_objfile::~dwarf2_per_objfile): Move content from dwarf2_per_objfile_free here. (dwarf2_per_objfile_free): Remove. (_initialize_dwarf2_read): Don't register dwarf2_per_objfile_free as a registry cleanup.
2018-01-28 18:07:30 +01:00
2018-01-28 Simon Marchi <simon.marchi@ericsson.com>
* dwarf2read.c (free_dwo_files): Add forward-declaration.
(dwarf2_per_objfile::~dwarf2_per_objfile): Move content from
dwarf2_per_objfile_free here.
(dwarf2_per_objfile_free): Remove.
(_initialize_dwarf2_read): Don't register
dwarf2_per_objfile_free as a registry cleanup.
2018-01-27 Eli Zaretskii <eliz@gnu.org>
Avoid compilation errors in MinGW native builds
The error is triggered by including python-internal.h, and the
error message is:
In file included from d:\usr\lib\gcc\mingw32\6.3.0\include\c++\math.h:36:0,
from build-gnulib/import/math.h:27,
from d:/usr/Python26/include/pyport.h:235,
from d:/usr/Python26/include/Python.h:58,
from python/python-internal.h:94,
from python/py-arch.c:24:
d:\usr\lib\gcc\mingw32\6.3.0\include\c++\cmath:1157:11: error: '::hypot' has not been declared
using ::hypot;
^~~~~
This happens because Python headers define 'hypot' to expand t
'_hypot' in the Windows builds.
* python/python-internal.h (_hypot) [__MINGW32__]: Define back to
'hypoth'. This avoids a compilation error.
2018-01-26 Alan Hayward <alan.hayward@arm.com>
* MAINTAINERS (Write After Approval): Fix ordering.
2018-01-26 Alan Hayward <alan.hayward@arm.com>
* MAINTAINERS (Write After Approval): Add Alan Hayward.
2018-01-26 Alan Modra <amodra@gmail.com>
* ppc-linux-tdep.c (powerpc32_plt_stub): Make const.
(powerpc32_plt_stub_so_1): Rename from powerpc32_plt_stub_so.
Remove nop. Make const. Comment.
(powerpc32_plt_stub_so_2): New.
(POWERPC32_PLT_CHECK_LEN): Rename from POWERPC32_PLT_STUB_LEN.
Correct count. Update uses.
(ppc_skip_trampoline_code): Match powerpc32_plt_stub_so_2 too.
Move common code reading PLT entry word. Correct
powerpc32_plt_stub PLT address calculation.
* ppc64-tdep.c (ppc64_standard_linkage1): Make const.
(ppc64_standard_linkage2, ppc64_standard_linkage3): Likewise.
(ppc64_standard_linkage4, ppc64_standard_linkage5): Likewise.
(ppc64_standard_linkage6, ppc64_standard_linkage7): Likewise.
(ppc64_standard_linkage8): Likewise.
* rs6000-tdep.c (ppc_insns_match_pattern): Make pattern const.
Correct insns description.
* ppc-tdep.h (ppc_insns_match_pattern): Update prototype.
Fix GCC PR83906 - [8 Regression] Random FAIL: libstdc++-prettyprinters/80276.cc whatis p4 GCC PR83906 [1] is about a GCC/libstdc++ GDB/Python type printer testcase failing randomly, as shown by running (in libstdc++'s testsuite): make check RUNTESTFLAGS=prettyprinters.exp=80276.cc in a loop. Sometimes you get this: FAIL: libstdc++-prettyprinters/80276.cc whatis p4 I.e., this: type = std::unique_ptr<std::vector<std::unique_ptr<std::list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >>[]>>[99]> instead of this: type = std::unique_ptr<std::vector<std::unique_ptr<std::list<std::string>[]>>[99]> Jonathan Wakely tracked it on the printer side to this bit in libstdc++'s type printer: if self.type_obj == type_obj: return strip_inline_namespaces(self.name) This assumes the two types resolve to the same gdb.Type but some times the comparison unexpectedly fails. Running the testcase manually under Valgrind finds the problem in GDB: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ==6118== Conditional jump or move depends on uninitialised value(s) ==6118== at 0x4C35CB0: bcmp (vg_replace_strmem.c:1100) ==6118== by 0x6F773A: check_types_equal(type*, type*, VEC_type_equality_entry_d**) (gdbtypes.c:3515) ==6118== by 0x6F7B00: check_types_worklist(VEC_type_equality_entry_d**, bcache*) (gdbtypes.c:3618) ==6118== by 0x6F7C03: types_deeply_equal(type*, type*) (gdbtypes.c:3655) ==6118== by 0x4D5B06: typy_richcompare(_object*, _object*, int) (py-type.c:1007) ==6118== by 0x63D7E6C: PyObject_RichCompare (object.c:961) ==6118== by 0x646EAEC: PyEval_EvalFrameEx (ceval.c:4960) ==6118== by 0x646DC08: PyEval_EvalFrameEx (ceval.c:4519) ==6118== by 0x646DC08: PyEval_EvalFrameEx (ceval.c:4519) ==6118== by 0x646DC08: PyEval_EvalFrameEx (ceval.c:4519) ==6118== by 0x646DC08: PyEval_EvalFrameEx (ceval.c:4519) ==6118== by 0x646DC08: PyEval_EvalFrameEx (ceval.c:4519) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ That "bcmp" call is really a memcmp call in check_types_equal. The problem is that gdb is memcmp'ing two objects that are equal in value: (top-gdb) p *TYPE_RANGE_DATA (type1) $1 = {low = {kind = PROP_CONST, data = {const_val = 0, baton = 0x0}}, high = {kind = PROP_CONST, data = {const_val = 15, baton = 0xf}}, flag_upper_bound_is_count = 0, flag_bound_evaluated = 0} (top-gdb) p *TYPE_RANGE_DATA (type2) $2 = {low = {kind = PROP_CONST, data = {const_val = 0, baton = 0x0}}, high = {kind = PROP_CONST, data = {const_val = 15, baton = 0xf}}, flag_upper_bound_is_count = 0, flag_bound_evaluated = 0} but differ in padding. Notice the 4-byte hole: (top-gdb) ptype /o range_bounds /* offset | size */ type = struct range_bounds { /* 0 | 16 */ struct dynamic_prop { /* 0 | 4 */ dynamic_prop_kind kind; /* XXX 4-byte hole */ /* 8 | 8 */ union dynamic_prop_data { /* 8 */ LONGEST const_val; /* 8 */ void *baton; /* total size (bytes): 8 */ } data; which is filled with garbage: (top-gdb) x /40bx TYPE_RANGE_DATA (type1) 0x2fa7ea0: 0x01 0x00 0x00 0x00 0x43 0x01 0x00 0x00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0x2fa7ea8: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x2fa7eb0: 0x01 0x00 0x00 0x00 0xfe 0x7f 0x00 0x00 0x2fa7eb8: 0x0f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x2fa7ec0: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 (top-gdb) x /40bx TYPE_RANGE_DATA (type2) 0x20379b0: 0x01 0x00 0x00 0x00 0xfe 0x7f 0x00 0x00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0x20379b8: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x20379c0: 0x01 0x00 0x00 0x00 0xfe 0x7f 0x00 0x00 0x20379c8: 0x0f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x20379d0: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 (top-gdb) p memcmp (TYPE_RANGE_DATA (type1), TYPE_RANGE_DATA (type2), sizeof (*TYPE_RANGE_DATA (type1))) $3 = -187 In some cases objects of type range_bounds are memset when allocated, but then their dynamic_prop low/high fields are copied over from some template dynamic_prop object that wasn't memset. E.g., create_static_range_type's low/high locals are left with garbage in the padding, and then that padding is copied over to the range_bounds object's low/high fields. At first, I considered making sure to always memset range_bounds objects, thinking that maybe type objects are being put in some bcache instance somewhere. But then I hacked bcache/bcache_full to poison non-pod types, and made dynamic_prop a non-pod, and GDB still compiled. So given that, it seems safest to not assume padding will always be memset, and instead treat them as regular value types, implementing (in)equality operators and using those instead of memcmp. This fixes the random FAILs in GCC's testcase. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83906 gdb/ChangeLog: 2018-01-24 Pedro Alves <palves@redhat.com> GCC PR libstdc++/83906 * gdbtypes.c (operator==(const dynamic_prop &, const dynamic_prop &)): New. (operator==(const range_bounds &, const range_bounds &)): New. (check_types_equal): Use them instead of memcmp. * gdbtypes.h (operator==(const dynamic_prop &, const dynamic_prop &)): Declare. (operator!=(const dynamic_prop &, const dynamic_prop &)): Declare. (operator==(const range_bounds &, const range_bounds &)): Declare. (operator!=(const range_bounds &, const range_bounds &)): Declare.
2018-01-24 18:22:05 +01:00
2018-01-24 Pedro Alves <palves@redhat.com>
GCC PR libstdc++/83906
* gdbtypes.c (operator==(const dynamic_prop &,
const dynamic_prop &)): New.
(operator==(const range_bounds &, const range_bounds &)): New.
(check_types_equal): Use them instead of memcmp.
* gdbtypes.h (operator==(const dynamic_prop &,
const dynamic_prop &)): Declare.
(operator!=(const dynamic_prop &, const dynamic_prop &)): Declare.
(operator==(const range_bounds &, const range_bounds &)): Declare.
(operator!=(const range_bounds &, const range_bounds &)): Declare.
2018-01-23 Philipp Rudo <prudo@linux.vnet.ibm.com>
* s390-linux-tdep.c (s390_record_address_mask)
(s390_record_calc_disp_common, s390_record_calc_disp)
(s390_record_calc_disp_vsce, s390_record_calc_rl, s390_popcnt)
(s390_record_gpr_g, s390_record_gpr_h, s390_record_vr)
(s390_process_record): Move to s390-tdep.c.
(s390_linux_init_abi_any): Adjust.
* s390-tdep.c (s390_record_address_mask)
(s390_record_calc_disp_common, s390_record_calc_disp)
(s390_record_calc_disp_vsce, s390_record_calc_rl, s390_popcnt)
(s390_record_gpr_g, s390_record_gpr_h, s390_record_vr)
(s390_process_record): Moved from s390-linux-tdep.c
(s390_gdbarch_init): Adjust.
s390: Split up s390-linux-tdep.c into two files Currently all target dependent code for s390 is in one file, s390-linux-tdep.c. This includes code general for the architecture as well as code specific for uses in GNU/Linux (user space). Up until now this was OK as GNU/Linux was the only supported OS. In preparation to support the new Linux kernel 'OS' split up the existing s390 code into a general s390-tdep and a GNU/Linux-specific s390-linux-tdep. Note: The record-replay feature will be moved in a separate patch. This is simply due to the fact that the combined patch would be too large for the mailing list. This requires setting the process_record hook during OSABI init to keep the code bisectable. The patch moving record-replay cleans up this hack. gdb/ChangeLog: * s390-linux-nat.c (s390-tdep.h): New include. * Makefile.in (ALL_TARGET_OBS): Add s390-tdep.o. (HFILES_NO_SRCDIR): Add s390-tdep.h. (ALLDEPFILES): Add s390-tdep.c. * configure.tgt (s390*-*-linux*): Add s390-tdep.o. * s390-linux-tdep.h (HWCAP_S390_*, S390_*_REGNUM): Move to... * s390-tdep.h: ...this. New file. * s390-linux-tdep.c (s390-tdep.h): New include. (_initialize_s390_tdep): Rename to... (_initialize_s390_linux_tdep): ...this and adjust. (s390_abi_kind, s390_vector_abi_kind, gdbarch_tdep) (enum named opcodes, S390_NUM_GPRS, S390_NUM_FPRS): Move to s390-tdep.h. (s390_break_insn, s390_breakpoint, s390_readinstruction, is_ri) (is_ril, is_rr, is_rre, is_rs, is_rsy, is_rx, is_rxy) (s390_is_partial_instruction, s390_software_single_step) (is_non_branch_ril, s390_displaced_step_copy_insn) (s390_displaced_step_fixup, s390_displaced_step_hw_singlestep) (s390_prologue_data, s390_addr, s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue, s390_skip_prologue) (s390_register_call_saved, s390_guess_tracepoint_registers) (s390_register_name, s390_dwarf_regmap, s390_dwarf_reg_to_regnum) (regnum_is_gpr_full, regnum_is_vxr_full, s390_value_from_register) (s390_pseudo_register_name, s390_pseudo_register_type) (s390_pseudo_register_read, s390_pseudo_register_write) (s390_pseudo_register_reggroup_p, s390_ax_pseudo_register_collect) (s390_ax_pseudo_register_push_stack, s390_gen_return_address) (s390_addr_bits_remove, s390_address_class_type_flags) (s390_address_class_type_flags_to_name) (s390_address_class_name_to_type_flags, s390_effective_inner_type) (s390_function_arg_float, s390_function_arg_vector) (is_power_of_two, s390_function_arg_integer, s390_arg_state) (s390_handle_arg, s390_push_dummy_call, s390_dummy_id) (s390_frame_align, s390_register_return_value, s390_return_value) (s390_stack_frame_destroyed_p, s390_unwind_pc, s390_unwind_sp) (s390_unwind_pseudo_register, s390_adjust_frame_regnum) (s390_dwarf2_prev_register, s390_dwarf2_frame_init_reg) (s390_trad_frame_prev_register, s390_unwind_cache) (s390_prologue_frame_unwind_cache) (s390_backchain_frame_unwind_cache, s390_frame_unwind_cache) (s390_frame_this_id, s390_frame_prev_register, s390_frame_unwind) (s390_stub_unwind_cache, s390_stub_frame_unwind_cache) (s390_stub_frame_this_id, s390_stub_frame_prev_register) (s390_stub_frame_sniffer, s390_stub_frame_unwind) (s390_frame_base_address, s390_local_base_address) (s390_frame_base, s390_gcc_target_options) (s390_gnu_triplet_regexp, s390_stap_is_single_operand) (s390_validate_reg_range, s390_tdesc_valid) (s390_gdbarch_tdep_alloc, s390_gdbarch_init): Move to... * s390-tdep.c: ...this. New file.
2018-01-23 13:37:43 +01:00
2018-01-23 Philipp Rudo <prudo@linux.vnet.ibm.com>
* s390-linux-nat.c (s390-tdep.h): New include.
* Makefile.in (ALL_TARGET_OBS): Add s390-tdep.o.
(HFILES_NO_SRCDIR): Add s390-tdep.h.
(ALLDEPFILES): Add s390-tdep.c.
* configure.tgt (s390*-*-linux*): Add s390-tdep.o.
* s390-linux-tdep.h (HWCAP_S390_*, S390_*_REGNUM): Move to...
* s390-tdep.h: ...this. New file.
* s390-linux-tdep.c (s390-tdep.h): New include.
(_initialize_s390_tdep): Rename to...
(_initialize_s390_linux_tdep): ...this and adjust.
(s390_abi_kind, s390_vector_abi_kind, gdbarch_tdep)
(enum named opcodes, S390_NUM_GPRS, S390_NUM_FPRS): Move to
s390-tdep.h.
(s390_break_insn, s390_breakpoint, s390_readinstruction, is_ri)
(is_ril, is_rr, is_rre, is_rs, is_rsy, is_rx, is_rxy)
(s390_is_partial_instruction, s390_software_single_step)
(is_non_branch_ril, s390_displaced_step_copy_insn)
(s390_displaced_step_fixup, s390_displaced_step_hw_singlestep)
(s390_prologue_data, s390_addr, s390_store, s390_load)
(s390_check_for_saved, s390_analyze_prologue, s390_skip_prologue)
(s390_register_call_saved, s390_guess_tracepoint_registers)
(s390_register_name, s390_dwarf_regmap, s390_dwarf_reg_to_regnum)
(regnum_is_gpr_full, regnum_is_vxr_full, s390_value_from_register)
(s390_pseudo_register_name, s390_pseudo_register_type)
(s390_pseudo_register_read, s390_pseudo_register_write)
(s390_pseudo_register_reggroup_p, s390_ax_pseudo_register_collect)
(s390_ax_pseudo_register_push_stack, s390_gen_return_address)
(s390_addr_bits_remove, s390_address_class_type_flags)
(s390_address_class_type_flags_to_name)
(s390_address_class_name_to_type_flags, s390_effective_inner_type)
(s390_function_arg_float, s390_function_arg_vector)
(is_power_of_two, s390_function_arg_integer, s390_arg_state)
(s390_handle_arg, s390_push_dummy_call, s390_dummy_id)
(s390_frame_align, s390_register_return_value, s390_return_value)
(s390_stack_frame_destroyed_p, s390_unwind_pc, s390_unwind_sp)
(s390_unwind_pseudo_register, s390_adjust_frame_regnum)
(s390_dwarf2_prev_register, s390_dwarf2_frame_init_reg)
(s390_trad_frame_prev_register, s390_unwind_cache)
(s390_prologue_frame_unwind_cache)
(s390_backchain_frame_unwind_cache, s390_frame_unwind_cache)
(s390_frame_this_id, s390_frame_prev_register, s390_frame_unwind)
(s390_stub_unwind_cache, s390_stub_frame_unwind_cache)
(s390_stub_frame_this_id, s390_stub_frame_prev_register)
(s390_stub_frame_sniffer, s390_stub_frame_unwind)
(s390_frame_base_address, s390_local_base_address)
(s390_frame_base, s390_gcc_target_options)
(s390_gnu_triplet_regexp, s390_stap_is_single_operand)
(s390_validate_reg_range, s390_tdesc_valid)
(s390_gdbarch_tdep_alloc, s390_gdbarch_init): Move to...
* s390-tdep.c: ...this. New file.
2018-01-23 Philipp Rudo <prudo@linux.vnet.ibm.com>
* s390-linux-tdep.c (gdbarch_tdep.s390_syscall_record): New hook.
(s390_process_record, s390_gdbarch_tdep_alloc)
(s390_linux_init_abi_any): Use/set new hook.
2018-01-23 Philipp Rudo <prudo@linux.vnet.ibm.com>
* s390-linux-tdep.c (osabi.h): New include.
(s390_linux_init_abi_31, s390_linux_init_abi_64)
(s390_linux_init_abi_any): New functions.
(s390_gdbarch_init, _initialize_s390_tdep): Adjust.
2018-01-23 Philipp Rudo <prudo@linux.vnet.ibm.com>
* s390-linux-tdep.c (s390_gdbarch_init): Use gdb_assert for
tdesc_has_registers check
2018-01-23 Philipp Rudo <prudo@linux.vnet.ibm.com>
* s390-linux-tdep.c (s390_tdesc_valid): New function.
(s390_validate_reg_range): New macro.
(s390_gdbarch_init): Adjust.
2018-01-23 Philipp Rudo <prudo@linux.vnet.ibm.com>
* s390-linux-tdep.c (gdbarch_tdep) <tdesc>: New field.
(s390_gdbarch_tdep_alloc): Adjust.
(s390_gdbarch_init): Adjust.
2018-01-23 Philipp Rudo <prudo@linux.vnet.ibm.com>
* s390-linux-tdep.c (gdbarch_tdep) <have_linux_v1, have_linux_v2>
<have_tdb>: Change type to bool.
(s390_gdbarch_tdep_alloc): Adjust.
(s390_gdbarch_init): Adjust.
2018-01-23 Philipp Rudo <prudo@linux.vnet.ibm.com>
* s390-linux-tdep (s390_abi_kind) <ABI_NONE>: New default field.
(gdbarch_tdep) <have_upper, have_vx>: New fields.
(s390_gdbarch_tdep_alloc): New function.
(s390_gdbarch_init): Allocate tdep at start and use its fields
instead of separate variables.
2018-01-23 Philipp Rudo <prudo@linux.vnet.ibm.com>
* s390-linux-tdep.c (s390_gdbarch_init): Remove duplicate checks
when looking for cached gdbarch and add comment for remaining.
Fix segfault with 'set print object on' + 'whatis <struct>' & co Compiling GDB with a recent GCC exposes a problem: ../../gdb/typeprint.c: In function 'void whatis_exp(const char*, int)': ../../gdb/typeprint.c:515:12: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized] real_type = value_rtti_type (val, &full, &top, &using_enc); ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The warning is correct. There are indeed code paths that use uninitialized 'val', leading to crashes. Inside the value_rtti_indirect_type/value_rtti_type calls here in whatis_exp: if (opts.objectprint) { if (((TYPE_CODE (type) == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type)) && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT)) real_type = value_rtti_indirect_type (val, &full, &top, &using_enc); else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) real_type = value_rtti_type (val, &full, &top, &using_enc); } We reach those calls above with "set print object on", and then with any of: (gdb) whatis struct some_structure_type (gdb) whatis struct some_structure_type * (gdb) whatis struct some_structure_type & because "whatis" with a type argument enters this branch: /* The behavior of "whatis" depends on whether the user expression names a type directly, or a language expression (including variable names). If the former, then "whatis" strips one level of typedefs, only. If an expression, "whatis" prints the type of the expression without stripping any typedef level. "ptype" always strips all levels of typedefs. */ if (show == -1 && expr->elts[0].opcode == OP_TYPE) { which does not initialize VAL. Trying the above triggers crashes like this: (gdb) set print object on (gdb) whatis some_structure_type Thread 1 "gdb" received signal SIGSEGV, Segmentation fault. 0x00000000005dda90 in check_typedef (type=0x6120736573756170) at src/gdb/gdbtypes.c:2388 2388 int instance_flags = TYPE_INSTANCE_FLAGS (type); ... This is a regression caused by a recent-ish refactoring of the code on 'whatis_exp', introduced by: commit c973d0aa4a2c737ab527ae44a617f1c357e07364 Date: Mon Aug 21 11:34:32 2017 +0100 Fix type casts losing typedefs and reimplement "whatis" typedef stripping Fix this by setting VAL to NULL in the "whatis TYPE" case, and skipping fetching the dynamic type if there's no value to fetch it from. New tests included. gdb/ChangeLog: 2018-01-22 Pedro Alves <palves@redhat.com> Sergio Durigan Junior <sergiodj@redhat.com> * typeprint.c (whatis_exp): Initialize "val" in the "whatis type" case. gdb/testsuite/ChangeLog: 2018-01-22 Pedro Alves <palves@redhat.com> Sergio Durigan Junior <sergiodj@redhat.com> * gdb.base/whatis.exp: Add tests for 'set print object on' + 'whatis <struct>' 'whatis <struct> *' and 'whatis <struct> &'.
2018-01-22 18:33:13 +01:00
2018-01-22 Pedro Alves <palves@redhat.com>
Sergio Durigan Junior <sergiodj@redhat.com>
* typeprint.c (whatis_exp): Initialize "val" in the "whatis type"
case.
2018-01-22 Maciej W. Rozycki <macro@mips.com>
* MAINTAINERS: Update my company e-mail address.
2018-01-22 Yao Qi <yao.qi@linaro.org>
* regcache.c (cooked_write_test): New function.
(_initialize_regcache): Register the test.
2018-01-22 Yao Qi <yao.qi@linaro.org>
* ia64-tdep.c (ia64_pseudo_register_read): Call
regcache->cooked_read instead of regcache_cooked_read_unsigned.
* m32c-tdep.c (m32c_cat_read): Likewise.
(m32c_r3r2r1r0_read): Likewise.
* m68hc11-tdep.c (m68hc11_pseudo_register_read): Likewise.
* xtensa-tdep.c (xtensa_register_read_masked): Likewise.
Replace regcache_raw_read with regcache->raw_read The patch later in this series will move regcache's raw_read and cooked_read methods to a new class regcache_read, and regcache is dervied from it. Also pass regcache_read instead of regcache to gdbarch methods pseudo_register_read and pseudo_register_read_value. In order to prepare for this change, this patch changes regcache_raw_read to regcache->raw_read. On the other hand, since we are in C++, I prefer using class method (regcache->raw_read). gdb: 2018-01-22 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_pseudo_read_value): Call regcache method raw_read instead of regcache_raw_read. * amd64-tdep.c (amd64_pseudo_register_read_value): Likewise. * arm-tdep.c (arm_neon_quad_read): Likewise. * avr-tdep.c (avr_pseudo_register_read): Likewise. * bfin-tdep.c (bfin_pseudo_register_read): Likewise. * frv-tdep.c (frv_pseudo_register_read): Likewise. * h8300-tdep.c (h8300_pseudo_register_read): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_pseudo_register_read_into_value): Likewise. * mep-tdep.c (mep_pseudo_cr32_read): Likewise. * msp430-tdep.c (msp430_pseudo_register_read): Likewise. * nds32-tdep.c (nds32_pseudo_register_read): Likewise. * rl78-tdep.c (rl78_pseudo_register_read): Likewise. * s390-linux-tdep.c (s390_pseudo_register_read): Likewise. * sparc-tdep.c (sparc32_pseudo_register_read): Likewise. * sparc64-tdep.c (sparc64_pseudo_register_read): Likewise. * spu-tdep.c (spu_pseudo_register_read_spu): Likewise. * xtensa-tdep.c (xtensa_pseudo_register_read): Likewise.
2018-01-22 12:02:49 +01:00
2018-01-22 Yao Qi <yao.qi@linaro.org>
* aarch64-tdep.c (aarch64_pseudo_read_value): Call regcache
method raw_read instead of regcache_raw_read.
* amd64-tdep.c (amd64_pseudo_register_read_value): Likewise.
* arm-tdep.c (arm_neon_quad_read): Likewise.
* avr-tdep.c (avr_pseudo_register_read): Likewise.
* bfin-tdep.c (bfin_pseudo_register_read): Likewise.
* frv-tdep.c (frv_pseudo_register_read): Likewise.
* h8300-tdep.c (h8300_pseudo_register_read): Likewise.
* i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise.
(i386_pseudo_register_read_into_value): Likewise.
* mep-tdep.c (mep_pseudo_cr32_read): Likewise.
* msp430-tdep.c (msp430_pseudo_register_read): Likewise.
* nds32-tdep.c (nds32_pseudo_register_read): Likewise.
* rl78-tdep.c (rl78_pseudo_register_read): Likewise.
* s390-linux-tdep.c (s390_pseudo_register_read): Likewise.
* sparc-tdep.c (sparc32_pseudo_register_read): Likewise.
* sparc64-tdep.c (sparc64_pseudo_register_read): Likewise.
* spu-tdep.c (spu_pseudo_register_read_spu): Likewise.
* xtensa-tdep.c (xtensa_pseudo_register_read): Likewise.
2018-01-22 Yao Qi <yao.qi@linaro.org>
* Makefile.in (ALL_TARGET_OBS): Remove mt-tdep.o.
* configure.tgt: Remove target mt.
* mt-tdep.c: Remove.
* regcache.c (cooked_read_test): Remove the check for mt.
2018-01-22 Yao Qi <yao.qi@linaro.org>
* jit.c (jit_frame_prev_register): Call regcache::cooked_read
instead of gdbarch_pseudo_register_read_value.
2018-01-22 Joel Brobecker <brobecker@adacore.com>
* dwarf2read.c (need_gnat_info): Return nonzero if the cu's
language is Ada.
wrong line number in breakpoint location Consider the following situation, where we have one file containing... $ cat -n body.inc 1 i = i + 1; ... we include that file from some code, like so: $ cat -n cat -n small.c [...] 17 int 18 next (int i) 19 { 20 #include "body.inc" 21 return i; 22 } When trying to insert a breakpoint on line 18, for instance: (gdb) b small.c:18 Breakpoint 1 at 0x40049f: file body.inc, line 18. ^^ || Here, the issue is that GDB reports the breakpoint to be in file body.inc, which is true, but with the line number that corresponding to the user-requested location, which is not correct. Although the simple reproducer may look slightly artificial, the above is simply one way to reproduce the same issue observed when trying to insert a breakpoint on a function provided in a .h files and then subsequently inlined in a C file. What happens is the following: 1. We resolve the small.c:18 linespec into a symtab_and_line which has "small.c" and 18 as the symtab and line number. 2. Next, we call skip_prologue_sal, which calculates the PC past the prologue, and updates the symtab_and_line: PC, but also symtab (now body.inc) and the new line (now 1). 3. However, right after that, we do: /* Make sure the line matches the request, not what was found. */ intermediate_results.sals[i].line = val.line; We should either restore both symtab and line, or leave the actual line to match the actual symtab. This patch chose the latter. This introduces a few changes in a few tests, which required some updates, but looking at those change, I believe them to be expected. gdb/ChangeLog: * linespec.c (create_sals_line_offset): Remove code that preserved the symtab_and_line's line number. gdb/testsuite/ChangeLog: * gdb.base/break-include.c, gdb.base/break-include.inc, gdb.base/break-include.exp: New files. * gdb.base/ending-run.exp: Minor adaptations due to the breakpoint's line number now being the actual line number where the breakpoint was inserted. * gdb.mi/mi-break.exp: Likewise. * gdb.mi/mi-reverse.exp: Likewise. * gdb.mi/mi-simplerun.exp: Ditto. Tested on x86_64-linux.
2018-01-22 05:14:50 +01:00
2018-01-22 Joel Brobecker <brobecker@adacore.com>
* linespec.c (create_sals_line_offset): Remove code that preserved
the symtab_and_line's line number.
2018-01-21 Andrew Burgess <andrew.burgess@embecosm.com>
* varobj.c (varobj_create): Don't set valid_block when creating a
floating varobj.
2018-01-21 Andrew Burgess <andrew.burgess@embecosm.com>
* varobj.c (varobj_create): Remove out of date comment.
gdb: PR mi/20395: Fix -var-update for registers in frames 1 and up This patch fixes a problem with using the MI -var-update command to access the values of registers in frames other than the current frame. The patch includes a test that demonstrates the problem: * run so there are several frames on the stack * create a fixed varobj for $pc in each frame, #'s 1 and above * step one instruction, to modify the value of $pc * call -var-update for each of the previously created varobjs to verify that they are not reported as having changed. Without the patch, the -var-update command reported that $pc for all frames 1 and above had changed to the value of $pc in frame 0. A varobj is created as either fixed, the expression is evaluated within the context of a specific frame, or floating, the expression is evaluated within the current frame, whatever that may be. When a varobj is created by -var-create we set two fields of the varobj to track the context in which the varobj was created, these two fields are varobj->root->frame and var->root->valid_block. If a varobj is of type fixed, then, when we subsequently try to reevaluate the expression associated with the varobj we must determine if the original frame (and block) is still available, if it is not then the varobj can no longer be evaluated. The problem is that for register expressions varobj->root->valid_block is not set correctly. This block tracking is done using the global 'innermost_block' which is set in the various parser files (for example c-exp.y). However, this is not set for register expressions. The fix then seems like it should be to just update the innermost block when parsing register expressions, however, that solution causes several test regressions. The problem is that in some cases we rely on the expression parsing code not updating the innermost block for registers, one example is when we parse the expression for a 'display' command. The display commands treats registers like floating varobjs, but symbols are treated like fixed varobjs. So 'display $reg_name' will always show the value of '$reg_name' even as the user moves from frame to frame, while 'display my_variable' will only show 'my_variable' while it is in the current frame and/or block, when the user moves to a new frame and/or block (even one with a different 'my_variable' in) then the display of 'my_variable' stops. For the case of 'display', without the option to force fixed or floating expressions, the current behaviour is probably the best choice. For the varobj system though, we can choose between floating and fixed, and we should try to make this work for registers. There's only one existing test case that needs to be updated, in that test a fixed varobj is created using a register, the MI output now include the thread-id in which the varobj should be evaluated, which I believe is correct behaviour. I also added a new floating test case into the same test script, however, right now this also includes the thread-id in the expected output, which I believe is an existing gdb bug, which I plan to fix next. Tested on x86_64 Linux native and native-gdbserver, no regressions. gdb/ChangeLog: PR mi/20395 * ada-exp.y (write_var_from_sym): Pass extra parameter when updating innermost block. * parse.c (innermost_block_tracker::update): Take extra type parameter, and check types match before updating innermost block. (write_dollar_variable): Update innermost block for registers. * parser-defs.h (enum innermost_block_tracker_type): New enum. (innermost_block_tracker::innermost_block_tracker): Initialise m_types member. (innermost_block_tracker::reset): Take type parameter. (innermost_block_tracker::update): Take type parameter, and pass type through as needed. (innermost_block_tracker::m_types): New member. * varobj.c (varobj_create): Pass type when reseting innermost block. gdb/testsuite/ChangeLog: * gdb.mi/basics.c: Add new global. * gdb.mi/mi-frame-regs.exp: New file. * gdb.mi/mi-var-create-rtti.exp: Update expected results, add new case.
2017-10-18 21:07:19 +02:00
2018-01-21 Andrew Burgess <andrew.burgess@embecosm.com>
PR mi/20395
* ada-exp.y (write_var_from_sym): Pass extra parameter when
updating innermost block.
* parse.c (innermost_block_tracker::update): Take extra type
parameter, and check types match before updating innermost block.
(write_dollar_variable): Update innermost block for registers.
* parser-defs.h (enum innermost_block_tracker_type): New enum.
(innermost_block_tracker::innermost_block_tracker): Initialise
m_types member.
(innermost_block_tracker::reset): Take type parameter.
(innermost_block_tracker::update): Take type parameter, and pass
type through as needed.
(innermost_block_tracker::m_types): New member.
* varobj.c (varobj_create): Pass type when reseting innermost
block.
2018-01-21 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-exp.y (write_var_from_sym): Switch to innermost_block API.
* ada-lang.c (resolve_subexp): Likewise.
* breakpoint.c (set_breakpoint_condition) Likewise.
(watch_command_1) Likewise.
* c-exp.y (variable): Likewise.
* d-exp.y (PrimaryExpression): Likewise.
* f-exp.y (variable): Likewise.
* go-exp.y (variable): Likewise.
* m2-exp.y (variable): Likewise.
* objfiles.c (objfile::~objfile): Likewise.
* p-exp.y (variable): Likewise.
* parse.c (innermost_block): Change type.
* parser-defs.h (class innermost_block_tracker): New.
(innermost_block): Change to innermost_block_tracker.
* printcmd.c (display_command): Switch to innermost_block API.
(do_one_display): Likewise.
* rust-exp.y (do_one_display): Likewise.
* symfile.c (clear_symtab_users): Likewise.
* varobj.c (varobj_create): Switch to innermost_block API, replace
use of innermost_block with block stored on varobj object.
2018-01-21 Andrew Burgess <andrew.burgess@embecosm.com>
* expression.h (innermost_block): Remove declaration.
* varobj.c: Add 'parser-defs.h' include.
2018-01-19 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_lookup_symbol_nonlocal): Look up qualified
symbols in the static and global blocks.
2018-01-19 James Clarke <jrtc27@jrtc27.com>
* nat/linux-ptrace.c: Remove unnecessary reinclusion of
gdb_ptrace.h, and move including gdb_wait.h ...
* nat/linux-ptrace.h: ... to here.
2018-01-19 Simon Marchi <simon.marchi@ericsson.com>
* inf-ptrace.c (inf_ptrace_detach): Adjust call to
inf_ptrace_detach_success.
(inf_ptrace_detach_success): Add inferior parameter, use it
instead of inferior_ptid, pass it to detach_inferior.
* inf-ptrace.h (inf_ptrace_detach_success): Add inferior
parameter.
* inferior.c (detach_inferior): Add overload that takes an
inferior object.
* inferior.h (detach_inferior): Likewise.
* linux-nat.c (linux_nat_detach): Use the inf parameter, don't
use inferior_ptid, adjust call to inf_ptrace_detach_success.
* linux-thread-db.c (thread_db_detach): Use inf parameter.
Pass inferior down to target_detach and to_detach The to_detach target_ops method implementations are currently expected to work on current_inferior/inferior_ptid. In order to make things more explicit, and remove some "shadow" parameter passing through globals, this patch adds an "inferior" parameter to to_detach. Implementations will be expected to use this instead of relying on the global. However, to keep things simple, this patch only does the minimum that is necessary to add the parameter. The following patch gives an example of how one such implementation would be adapted. If the approach is deemed good, we can then look into adapting more implementations. Until then, they'll continue to work as they do currently. gdb/ChangeLog: * target.h (struct target_ops) <to_detach>: Add inferior parameter. (target_detach): Likewise. * target.c (dispose_inferior): Pass inferior down. (target_detach): Pass inferior down. Assert that it is equal to the current inferior. * aix-thread.c (aix_thread_detach): Pass inferior down. * corefile.c (core_file_command): Pass current_inferior() down. * corelow.c (core_detach): Add inferior parameter. * darwin-nat.c (darwin_detach): Likewise. * gnu-nat.c (gnu_detach): Likewise. * inf-ptrace.c (inf_ptrace_detach): Likewise. * infcmd.c (detach_command): Pass current_inferior() down to target_detach. * infrun.c (follow_fork_inferior): Pass parent_inf to target_detach. (handle_vfork_child_exec_or_exit): Pass inf->vfork_parent to target_detach. * linux-nat.c (linux_nat_detach): Add inferior parameter. * linux-thread-db.c (thread_db_detach): Likewise. * nto-procfs.c (procfs_detach): Likewise. * procfs.c (procfs_detach): Likewise. * record.c (record_detach): Likewise. * record.h (struct inferior): Forward-declare. (record_detach): Add inferior parameter. * remote-sim.c (gdbsim_detach): Likewise. * remote.c (remote_detach_1): Likewise. (remote_detach): Likewise. (extended_remote_detach): Likewise. * sol-thread.c (sol_thread_detach): Likewise. * target-debug.h (target_debug_print_inferior_p): New macro. * target-delegates.c: Re-generate. * top.c (kill_or_detach): Pass inferior down to target_detach. * windows-nat.c (windows_detach): Add inferior parameter.
2018-01-19 17:47:57 +01:00
2018-01-19 Simon Marchi <simon.marchi@ericsson.com>
* target.h (struct target_ops) <to_detach>: Add inferior
parameter.
(target_detach): Likewise.
* target.c (dispose_inferior): Pass inferior down.
(target_detach): Pass inferior down. Assert that it is equal to
the current inferior.
* aix-thread.c (aix_thread_detach): Pass inferior down.
* corefile.c (core_file_command): Pass current_inferior() down.
* corelow.c (core_detach): Add inferior parameter.
* darwin-nat.c (darwin_detach): Likewise.
* gnu-nat.c (gnu_detach): Likewise.
* inf-ptrace.c (inf_ptrace_detach): Likewise.
* infcmd.c (detach_command): Pass current_inferior() down to
target_detach.
* infrun.c (follow_fork_inferior): Pass parent_inf to
target_detach.
(handle_vfork_child_exec_or_exit): Pass inf->vfork_parent to
target_detach.
* linux-nat.c (linux_nat_detach): Add inferior parameter.
* linux-thread-db.c (thread_db_detach): Likewise.
* nto-procfs.c (procfs_detach): Likewise.
* procfs.c (procfs_detach): Likewise.
* record.c (record_detach): Likewise.
* record.h (struct inferior): Forward-declare.
(record_detach): Add inferior parameter.
* remote-sim.c (gdbsim_detach): Likewise.
* remote.c (remote_detach_1): Likewise.
(remote_detach): Likewise.
(extended_remote_detach): Likewise.
* sol-thread.c (sol_thread_detach): Likewise.
* target-debug.h (target_debug_print_inferior_p): New macro.
* target-delegates.c: Re-generate.
* top.c (kill_or_detach): Pass inferior down to target_detach.
* windows-nat.c (windows_detach): Add inferior parameter.
Remove args from target detach I was looking into adding a parameter to target_detach, and was wondering what the args parameter was. It seems like in the distant past, it was possible to specify a signal number when detaching. That signal was injected in the process before it was detached. There is an example of code handling this in linux_nat_detach. With today's GDB, I can't get this to work. Doing "detach 15" (15 == SIGTERM) doesn't work, because detach is a prefix command and doesn't recognize the sub-command 15. Doing "detach inferiors 15" doesn't work because it expects a list of inferior id to detach. Therefore, I don't think there's a way of invoking detach_command with a non-NULL args. I also didn't find any documentation related to this feature. I assume that this feature stopped working when detach was made a prefix command, which is in f73adfeb8bae36885e6ea248d12223ab0d5eb9cb (sorry, there's no commit title) from 2006. Given that this feature was broken for such a long time and we haven't heard anything (AFAIK, I did not find any related bug), I think it's safe to remove it, as well as the args parameter to target_detach. If someone wants to re-introduce it, I would suggest rethinking the user interface, and in particular would suggest using signal name instead of numbers. I tried to fix all the impacted code, but I might have forgotten some spots. It shouldn't be hard to fix if that's the case. I also couldn't build-test everything I changed, especially the nto and solaris stuff. gdb/ChangeLog: * target.h (struct target_ops) <to_detach>: Remove args parameter. (target_detach): Likewise. * target.c (dispose_inferior): Adjust. (target_detach): Remove args parameter, adjust. * aix-thread.c (aix_thread_detach): Adjust. * corefile.c (core_file_command): Adjust. * corelow.c (core_detach): Adjust. * darwin-nat.c (darwin_detach): Adjust. * gnu-nat.c (gnu_detach): Adjust. * inf-ptrace.c (inf_ptrace_detach): Adjust. * infcmd.c (detach_command): Adjust * infrun.c (follow_fork_inferior): Adjust. (handle_vfork_child_exec_or_exit): Adjust. * linux-fork.c (linux_fork_detach): Remove args parameter. * linux-fork.h (linux_fork_detach): Likewise. * linux-nat.c (linux_nat_detach): Likewise, and adjust. * linux-thread-db.c (thread_db_detach): Likewise. * nto-procfs.c (procfs_detach): Likewise. * procfs.c (procfs_detach): Likewise. (do_detach): Remove signo parameter. * record.c (record_detach): Remove args parameter. * record.h (record_detach): Likewise. * remote-sim.c (gdbsim_detach): Likewise. * remote.c (remote_detach_1): Likewise. (remote_detach): Likewise. (extended_remote_detach): Likewise. * sol-thread.c (sol_thread_detach): Likewise. * target-delegates.c: Re-generate. * top.c (struct qt_args) <args>: Remove field. (kill_or_detach): Don't pass args. (quit_force): Don't set args. * windows-nat.c (windows_detach): Remove args parameter.
2018-01-19 17:47:24 +01:00
2018-01-19 Simon Marchi <simon.marchi@ericsson.com>
* target.h (struct target_ops) <to_detach>: Remove args
parameter.
(target_detach): Likewise.
* target.c (dispose_inferior): Adjust.
(target_detach): Remove args parameter, adjust.
* aix-thread.c (aix_thread_detach): Adjust.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_detach): Adjust.
* darwin-nat.c (darwin_detach): Adjust.
* gnu-nat.c (gnu_detach): Adjust.
* inf-ptrace.c (inf_ptrace_detach): Adjust.
* infcmd.c (detach_command): Adjust
* infrun.c (follow_fork_inferior): Adjust.
(handle_vfork_child_exec_or_exit): Adjust.
* linux-fork.c (linux_fork_detach): Remove args parameter.
* linux-fork.h (linux_fork_detach): Likewise.
* linux-nat.c (linux_nat_detach): Likewise, and adjust.
* linux-thread-db.c (thread_db_detach): Likewise.
* nto-procfs.c (procfs_detach): Likewise.
* procfs.c (procfs_detach): Likewise.
(do_detach): Remove signo parameter.
* record.c (record_detach): Remove args parameter.
* record.h (record_detach): Likewise.
* remote-sim.c (gdbsim_detach): Likewise.
* remote.c (remote_detach_1): Likewise.
(remote_detach): Likewise.
(extended_remote_detach): Likewise.
* sol-thread.c (sol_thread_detach): Likewise.
* target-delegates.c: Re-generate.
* top.c (struct qt_args) <args>: Remove field.
(kill_or_detach): Don't pass args.
(quit_force): Don't set args.
* windows-nat.c (windows_detach): Remove args parameter.
2018-01-19 Yao Qi <yao.qi@linaro.org>
* arm-linux-tdep.c (arm_linux_gcc_target_options): New function.
(arm_linux_init_abi): Install it.
2018-01-19 Yao Qi <yao.qi@linaro.org>
* osabi.c (gdb_osabi_names): Extend the regexp for
arm-linux-gnueabihf.
2018-01-18 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (abbrev_table) <abbrevs>: Rename it to
m_abbrevs.
(abbrev_table::add_abbrev): Update.
(abbrev_table::lookup_abbrev): Update.
2018-01-18 Yao Qi <yao.qi@linaro.org>
* ppc-linux-tdep.c (ppu2spu_prev_register): Call cooked_read.
2018-01-17 Sergio Durigan Junior <sergiodj@redhat.com>
* compile/compile.c (compile_to_object): Convert "triplet_rx"
to "std::string".
2018-01-17 Tom Tromey <tom@tromey.com>
* dwarf2read.c (symbolp): Remove typedef. Don't instantiate VEC.
2018-01-17 Tom Tromey <tom@tromey.com>
* gdbtypes.h (add_dyn_prop): Remove objfile parameter.
* gdbtypes.c (add_dyn_prop): Remove objfile parameter.
(create_array_type_with_stride): Update.
* dwarf2read.c (set_die_type): Update.
2018-01-17 Tom Tromey <tom@tromey.com>
* dwarf2read.c (delayed_method_info): Remove typedef.
(dwarf2_cu::method_info): Now a std::vector.
(add_to_method_list): Update.
(free_delayed_list): Remove.
(compute_delayed_physnames): Update.
(process_full_comp_unit, process_full_type_unit): Clear the method
list. Remove cleanups.
(psymtab_include_file_name): Add name_holder parameter. Use
unique_xmalloc_ptr.
(dwarf_decode_lines): Update.
2018-01-17 Tom Tromey <tom@tromey.com>
Simon Marchi <simon.marchi@ericsson.com>
* dwarf2read.c (struct dwarf2_cu): Add constructor, destructor.
(dwarf2_per_objfile::free_cached_comp_units)
(init_tu_and_read_dwo_dies, init_cutu_and_read_dies)
(init_cutu_and_read_dies_no_follow): Update.
(dwarf2_cu::dwarf2_cu): Rename from init_one_comp_unit.
(dwarf2_cu::~dwarf2_cu): New.
(free_heap_comp_unit, free_stack_comp_unit): Remove.
(age_cached_comp_units, free_one_cached_comp_unit): Update.
2018-01-17 Tom Tromey <tom@tromey.com>
Simon Marchi <simon.marchi@ericsson.com>
* dwarf2read.c (struct dwarf2_cu) <abbrev_table>: Remove.
(struct die_reader_specs) <abbrev_table>: New member.
(struct abbrev_table): Add constructor.
<alloc_abbrev, add_abbrev, lookup_abbrev>: Declare.
<abbrev_obstack>: Now an auto_obstack.
(abbrev_table_up): New typedef.
(init_cu_die_reader): Add abbrev_table parameter.
(read_cutu_die_from_dwo): Remove abbrev_table_provided parameter.
Add result_dwo_abbrev_table.
(init_tu_and_read_dwo_dies, init_cutu_and_read_dies)
(init_cutu_and_read_dies_no_follow, build_type_psymtabs_1):
Update.
(peek_die_abbrev): Take die_reader_specs, not dwarf_cu as
parameter.
(skip_children): Update.
(abbrev_table::alloc_abbrev): Rename from
abbrev_table_alloc_abbrev.
(abbrev_table::add_abbrev): Rename from abbrev_table_add_abbrev.
(abbrev_table::lookup_abbrev): Rename from
abbrev_table_lookup_abbrev.
(abbrev_table_read_table): Return abbrev_table_up.
(abbrev_table_free, abbrev_table_free_cleanup)
(dwarf2_read_abbrevs, dwarf2_free_abbrev_table): Remove.
(load_partial_dies): Update.
2018-01-17 Tom Tromey <tom@tromey.com>
* dwarf2read.c (dwarf2_compute_name): Update comment.
(read_func_scope, read_variable): Update.
(new_symbol): Remove.
(new_symbol_full): Rename to new_symbol.
2018-01-17 18:59:51 +01:00
2018-01-17 Mike Gulick <mgulick@mathworks.com>
Fix gdb segv when objfile can't be opened This fixes PR 16577. This patch changes gdb_bfd_map_section to issue a warning rather than an error if it is unable to read the object file, and sets the size of the section/frame that it attempted to read to 0 on error. The description of gdb_bfd_map_section states that it will try to read or map the contents of the section SECT, and if successful, the section data is returned and *SIZE is set to the size of the section data. This function was throwing an error and leaving *SIZE as-is. Setting the section size to 0 indicates to dwarf2_build_frame_info that there is no data to read, otherwise it will try to read from an invalid frame pointer. Changing the error to a warning allows this to be handled gracefully. Additionally, the error was clobbering the breakpoint output indicating the current frame (function name, arguments, source file, and line number). E.g. Thread 3 "foo" hit Breakpoint 1, BFD: reopening /tmp/jna-1013829440/jna2973250704389291330.tmp: No such file or directory BFD: reopening /tmp/jna-1013829440/jna2973250704389291330.tmp: No such file or directory (gdb) While the "BFD: reopening ..." messages will still appear interspersed in the breakpoint output, the current frame info is now displayed: Thread 3 "foo" hit Breakpoint 1, BFD: reopening /tmp/jna-1013829440/jna1875755897659885075.tmp: No such file or directory BFD: reopening /tmp/jna-1013829440/jna1875755897659885075.tmp: No such file or directory warning: Can't read data for section '.eh_frame' in file '/tmp/jna-1013829440/jna1875755897659885075.tmp' do_something () at file.cpp:80 80 { (gdb)
2017-10-30 23:13:44 +01:00
PR gdb/16577
* gdb_bfd.c (gdb_bfd_map_section): If unable to read object file, issue
a warning instead of throwing an error, set section size to 0 and return
NULL.
* gdb_bfd.h (gdb_bfd_map_section): Update description.
2018-01-17 Simon Marchi <simon.marchi@ericsson.com>
* nat/linux-ptrace.h (linux_ptrace_attach_fail_reason): Return
std::string.
(linux_ptrace_attach_fail_reason_string): Likewise.
* nat/linux-ptrace.c (linux_ptrace_attach_fail_reason):
Likewise.
(linux_ptrace_attach_fail_reason_string): Likewise.
* linux-nat.c (attach_proc_task_lwp_callback): Adjust.
2018-01-17 Simon Marchi <simon.marchi@ericsson.com>
* linux-nat.c (linux_nat_attach): Remove xstrdup.
configure: Fix test for fs_base/gs_base in <sys/user.h> Make <sys/types.h> be included prior to including <sys/user.h>. glibc versions older than 2.14 use __uintNN_t types within certain structures defined in <sys/user.h> probably assuming these types are defined prior to including the header. This results in the following `configure` feature test compilation error that makes it think that `struct user_regs_struct` doesn't have `fs_base`/`gs_base` fields, althouh it does. configure:13617: checking for struct user_regs_struct.fs_base configure:13617: gcc -c -g -O2 -I/linux/include conftest.c >&5 In file included from conftest.c:158:0: /usr/include/sys/user.h:32:3: error: unknown type name '__uint16_t' __uint16_t cwd; ^ /usr/include/sys/user.h:33:3: error: unknown type name '__uint16_t' __uint16_t swd; ^ /usr/include/sys/user.h:34:3: error: unknown type name '__uint16_t' __uint16_t ftw; ^ /usr/include/sys/user.h:35:3: error: unknown type name '__uint16_t' __uint16_t fop; ^ /usr/include/sys/user.h:36:3: error: unknown type name '__uint64_t' __uint64_t rip; ^ /usr/include/sys/user.h:37:3: error: unknown type name '__uint64_t' __uint64_t rdp; ^ /usr/include/sys/user.h:38:3: error: unknown type name '__uint32_t' __uint32_t mxcsr; ^ /usr/include/sys/user.h:39:3: error: unknown type name '__uint32_t' __uint32_t mxcr_mask; ^ /usr/include/sys/user.h:40:3: error: unknown type name '__uint32_t' __uint32_t st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ ^ /usr/include/sys/user.h:41:3: error: unknown type name '__uint32_t' __uint32_t xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */ ^ /usr/include/sys/user.h:42:3: error: unknown type name '__uint32_t' __uint32_t padding[24]; ^ configure:13617: $? = 1 configure: failed program was: | /* confdefs.h */ ... | /* end confdefs.h. */ | #include <sys/user.h> | | int | main () | { | static struct user_regs_struct ac_aggr; | if (ac_aggr.fs_base) | return 0; | ; | return 0; | } Recent glibc versions don't use typedef'ed int types in <sys/user.h>, thus allowing it to be included as is (glibc commit d79a9c949c84e7f0ba33e87447c47af833e9f11a). However there're still some distros alive that use older glibc, for instance, RHEL/CentOS 6 package glibc 2.12. Also affects PR gdb/21559: ../../gdb/regcache.c:1087: internal-error: void regcache_raw_supply(regcache, int, const void): Assertion `regnum >= 0 && regnum < regcache->descr->nr_raw_registers' failed. As noted by Andrew Paprocki, who submitted the PR (https://sourceware.org/bugzilla/show_bug.cgi?id=21559#c3): > It should be noted that modifying `configure` to force on > `HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE` and > `HAVE_STRUCT_USER_REGS_STRUCT_GS_BASE` fixes this issue. For some > reason the `configure` tests for `fs_base` and `gs_base` fail > even though `sys/user.h` on RHEL5 has the fields defined in > `user_regs_struct`. Note that this patch does NOT fix the root cause of PR gdb/21559, although now that `configure` properly detects the presence of the fields and sets HAVE_XXX accordingly, the execution takes another path, which doesn't lead to the assertion failure in question. gdb/ChangeLog: 2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com> PR gdb/21559 * configure.ac: Include <sys/types.h> prior to <sys/user.h> when checking for fs_base/gs_base fields in struct user_regs_struct. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com> PR gdb/21559 * configure.ac: Include <sys/types.h> prior to <sys/user.h> when checking for fs_base/gs_base fields in struct user_regs_struct. * configure: Regenerate.
2018-01-15 14:57:42 +01:00
2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com>
PR gdb/21559
* configure.ac: Include <sys/types.h> prior to <sys/user.h> when
checking for fs_base/gs_base fields in struct user_regs_struct.
* configure: Regenerate.
2018-01-17 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-tdep.c (aarch64_linux_gcc_target_options): New
function.
(aarch64_linux_init_abi): Install it to gdbarch hook
gcc_target_options.
2018-01-15 Pedro Alves <palves@redhat.com>
* common/signals-state-save-restore.c
(save_original_signals_state): Fix typos.
2017-01-12 Tom Tromey <tom@tromey.com>
Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (install-only): Install gdb-add-index.
2018-01-12 John Baldwin <jhb@FreeBSD.org>
* fbsd-tdep.c (KVE_PROTECTION): Correct value.
Fix GDB hang with remote after error from resume Since this commit -- Fix PR18360 - internal error when using "interrupt -a" (https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=c65d6b55) -- the testsuite shows long delays on s390 with native-gdbserver when executing certain tests, such as watchpoints.exp. These hangs have been discussed before in the context of buildbot problems, see here: https://sourceware.org/ml/gdb-patches/2017-12/msg00413.html The problem can easily be triggered by stopping on a breakpoint, then setting impossible watchpoints, and finally doing "continue". Then, after having set the step-over state (in keep_going_pass_signal in infrun.c), GDB tries to insert breakpoints and watchpoints into the inferior. This fails, and the "continue" command is aborted. But the step-over state is not cleared in this case, which causes future step-over attempts to be skipped since GDB thinks that "we already have an in-line step-over operation ongoing" (see start_step_over in infrun.c). Thus the next "continue" just goes on to wait for events from the remote, which will never occur. The problem can also be reproduced on amd64 with native-gdbserver, using the following change to watchpoints.exp: -- >8 -- --- a/gdb/testsuite/gdb.base/watchpoints.exp +++ b/gdb/testsuite/gdb.base/watchpoints.exp @@ -61,2 +61,3 @@ with_test_prefix "before inferior start" { gdb_test "watch ival3" ".*" "" + gdb_test "watch *(char \[256\] *) main" -- >8 -- To fix the hang, this patch clears the step-over info when insert_breakpoints has failed. Of course, with native-gdbserver the watchpoints.exp test case still causes many FAILs on s390, because gdbserver does not support watchpoints for that target. This is a separate issue. gdb/ChangeLog: 2018-01-12 Andreas Arnez <arnez@linux.vnet.ibm.com> * infrun.c (keep_going_pass_signal): Clear step-over info when insert_breakpoints fails.
2018-01-12 19:52:39 +01:00
2018-01-12 Andreas Arnez <arnez@linux.vnet.ibm.com>
* infrun.c (keep_going_pass_signal): Clear step-over info when
insert_breakpoints fails.
gdb.base/breakpoint-in-ro-region.exp regression on sss targets (PR gdb/22583) As Maciej reported at <https://sourceware.org/ml/gdb-patches/2017-12/msg00212.html>, this commit: commit d930703d68ae160ddfe8ebe5fdcf416fb6090e1e Date: Thu Nov 16 18:44:43 2017 +0000 Subject: Don't ever Quit out of resume caused regressions on software single-set targets, specifically: FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: single-step breakpoint is not left behind FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw on: single-step breakpoint is not left behind FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw off: step in ro region (cannot insert hw break) FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw off: single-step breakpoint is not left behind FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw on: single-step breakpoint is not left behind and indeed detailed logs indicate a breakpoint is left lingering, e.g.: (gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: step in ro region (cannot insert sw break) maint info breakpoints 0 Num Type Disp Enb Address What 0 sw single-step keep y 0x00400774 in main at [...]/gdb/testsuite/gdb.base/breakpoint-in-ro-region.c:24 inf 1 thread 1 stop only in thread 1 (gdb) FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: single-step breakpoint is not left behind vs: (gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: step in ro region (cannot insert sw break) maint info breakpoints 0 No breakpoint or watchpoint matching '0'. (gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: single-step breakpoint is not left behind as at commit d930703d68ae^. Before commit d930703d68ae, we had a cleanup installed in 'resume' that would delete single-step breakpoints on error: /* Resuming. */ /* Things to clean up if we QUIT out of resume (). */ static void resume_cleanups (void *ignore) { if (!ptid_equal (inferior_ptid, null_ptid)) delete_single_step_breakpoints (inferior_thread ()); normal_stop (); } That whole function was removed by d930703d68ae mainly to eliminate the normal_stop call: ~~~~ Note that the exception called from within resume ends up calling normal_stop via resume_cleanups. That's very borked though, because normal_stop is going to re-handle whatever was the last reported event, possibly even re-running a hook stop... ~~~~ But as the regression shows, removing resume_cleanups completely went a bit too far, as the delete_single_step_breakpoints call is still necessary. So fix the regression by reinstating the delete_single_step_breakpoints call on error. However, since we're trying to eliminate cleanups, restore it in a different form (using TRY/CATCH). Tested on x86-64 GNU/Linux both top of master and on top of a series that implements software single-step on x86. gdb/ChangeLog: 2018-01-11 Pedro Alves <palves@redhat.com> PR gdb/22583 * infrun.c (resume): Rename to ... (resume_1): ... this. (resume): Reimplement as wrapper around resume_1.
2018-01-11 18:50:31 +01:00
2018-01-11 Pedro Alves <palves@redhat.com>
PR gdb/22583
* infrun.c (resume): Rename to ...
(resume_1): ... this.
(resume): Reimplement as wrapper around resume_1.
Fix backwards compatibility with old GDBservers (PR remote/22597) At <https://sourceware.org/ml/gdb-patches/2017-12/msg00285.html>, Maciej reported that commit: commit 5cd63fda035d4ba949e6478406162c4673b3c9ef Date: Wed Oct 4 18:21:10 2017 +0100 Subject: Fix "Remote 'g' packet reply is too long" problems with multiple inferiors made GDB stop working with older stubs. Any attempt to continue execution after the initial connection fails with: [...] Process .../gdb/testsuite/outputs/gdb.base/advance/advance created; pid = 2670 Listening on port 2346 target remote [...]:2346 Remote debugging using [...]:2346 Reading symbols from .../lib64/ld.so.1...done. [Switching to Thread <main>] (gdb) continue Cannot execute this command without a live selected thread. (gdb) The problem is: (gdb) c Cannot execute this command without a live selected thread. (gdb) info threads Id Target Id Frame 1 Thread 14917 0x00007f341cd98ed0 in _start () from /lib64/ld-linux-x86-64.so.2 The current thread <Thread ID 2> has terminated. See `help thread'. ^^^^^^^^^^^ (gdb) Note, thread _2_. There's really only one thread in the inferior (it's still at the entry point), but still GDB added a bogus second thread. The reason GDB started adding a second thread after 5cd63fda035d is this hunk: + if (event->ptid == null_ptid) + { + const char *thr = strstr (p1 + 1, ";thread:"); + if (thr != NULL) + event->ptid = read_ptid (thr + strlen (";thread:"), + NULL); + else + event->ptid = magic_null_ptid; + } Note the else branch that falls back to magic_null_ptid. We reach that when we process the initial stop reply sent back in response to the the "?" (status) packet early in the connection setup: Sending packet: $?#3f...Ack Packet received: T0506:0000000000000000;07:40a510f4fd7f0000;10:d0fe1201577f0000; And note that that response does not include a ";thread:XXX" part. This stop reply is processed after listing threads with qfThreadInfo / qsThreadInfo : Sending packet: $qfThreadInfo#bb...Ack Packet received: m3915 Sending packet: $qsThreadInfo#c8...Ack Packet received: l meaning, when we process that stop reply, we treat the event as coming from a thread with ptid == magic_null_ptid, which is not yet in the thread list, so we add it then: (top-gdb) p ptid $1 = {m_pid = 42000, m_lwp = -1, m_tid = 1} (top-gdb) bt #0 0x0000000000840a8c in add_thread_silent(ptid_t) (ptid=...) at src/gdb/thread.c:269 #1 0x00000000007ad61d in remote_add_thread(ptid_t, int, int) (ptid=..., running=0, executing=0) at src/gdb/remote.c:1838 #2 0x00000000007ad8de in remote_notice_new_inferior(ptid_t, int) (currthread=..., executing=0) at src/gdb/remote.c:1921 #3 0x00000000007b758b in process_stop_reply(stop_reply*, target_waitstatus*) (stop_reply=0x1158860, status=0x7fffffffcc00) at src/gdb/remote.c:7217 #4 0x00000000007b7a38 in remote_wait_as(ptid_t, target_waitstatus*, int) (ptid=..., status=0x7fffffffcc00, options=0) at src/gdb/remote.c:7380 #5 0x00000000007b7cd1 in remote_wait(target_ops*, ptid_t, target_waitstatus*, int) (ops=0x102fac0 <remote_ops>, ptid=..., status=0x7fffffffcc00, options=0) at src/gdb/remote.c:7446 #6 0x000000000081587b in delegate_wait(target_ops*, ptid_t, target_waitstatus*, int) (self=0x102fac0 <remote_ops>, arg1=..., arg2=0x7fffffffcc00, arg3=0) at src/gdb/target-delegates.c:138 #7 0x0000000000827d77 in target_wait(ptid_t, target_waitstatus*, int) (ptid=..., status=0x7fffffffcc00, options=0) at src/gdb/target.c:2179 #8 0x0000000000715fda in do_target_wait(ptid_t, target_waitstatus*, int) (ptid=..., status=0x7fffffffcc00, options=0) at src/gdb/infrun.c:3589 #9 0x0000000000716351 in wait_for_inferior() () at src/gdb/infrun.c:3707 #10 0x0000000000715435 in start_remote(int) (from_tty=1) at src/gdb/infrun.c:3212 things go downhill from this. We don't see the problem with current master gdbserver, because that version always sends the ";thread:" part in the initial stop reply: Sending packet: $?#3f...Packet received: T0506:0000000000000000;07:a0d4ffffff7f0000;10:d05eddf7ff7f0000;thread:p3cea.3cea;core:3; Years ago I had added a "--disable-packet=" command line option to gdbserver which comes in handy for testing this, since the existing "--disable-packet=Tthread" precisely makes gdbserver not send that ";thread:" part in stop replies. The testcase added by this commit emulates old gdbserver making use of that. I've compared a testrun at 5cd63fda035d^ (before regression) with 'current master+patch', against old gdbserver at f8b73d13b7ca^. I hacked out --once, and "monitor exit" to be able to test. The results are a bit too unstable to tell accurately, but it looked like there were no regressions. Maciej confirmed this worked for him as well. No regressions on master (against master gdbserver). gdb/ChangeLog: 2018-01-11 Pedro Alves <palves@redhat.com> PR remote/22597 * remote.c (remote_parse_stop_reply): Default to the last-set general thread instead of to 'magic_null_ptid'. gdb/testsuite/ChangeLog: 2018-01-11 Pedro Alves <palves@redhat.com> PR remote/22597 * gdb.server/stop-reply-no-thread.c: New file. * gdb.server/stop-reply-no-thread.exp: New file.
2018-01-11 01:23:04 +01:00
2018-01-11 Pedro Alves <palves@redhat.com>
PR remote/22597
* remote.c (remote_parse_stop_reply): Default to the last-set
general thread instead of to 'magic_null_ptid'.
2018-01-10 Pedro Alves <palves@redhat.com>
* language.h (language_get_symbol_name_matcher): Rename ...
(get_symbol_name_matcher): ... this.
* language.c (language_get_symbol_name_matcher): Ditto.
* dictionary.c, linespec.c, minsyms.c, psymtab.c, symtab.c: All
callers adjusted.
Ada: make verbatim matcher override other language matchers (PR gdb/22670) A previous patch fixed verbatim matching in the lookup at the minimal symbol level, but we should also be finding that same symbol through the partial/full symtab search. For example, this is what happens if we use "print" instead of "break": (gdb) p <MixedCaseFunc> $1 = {<text variable, no debug info>} 0x4024dc <MixedCaseFunc> Before the C++ wildmatching series, GDB knows that MixedCaseFunc is a function without parameters, and the expression above means calling it. If you try it before having started the inferior, you'd get the following (expected) error: (gdb) print <MixedCaseFunc> You can't do that without a process to debug. The main idea behind making the name matcher be determined by the symbol's language is so that C++ (etc.) wildmatching in linespecs works even if the current language is not C++, as e.g., when you step through C or assembly code. Ada's verbatim matching syntax however ("<...>") isn't quite the same. It is more a property of the current language than of a particular symbol's language. We want to support this syntax when debugging an Ada program, but it's reason of existence is to find non-Ada symbols. This suggests going back to enabling it depending on current language instead of language of the symbol being matched. I'm not entirely happy with the "current_language" reference (though I think that it's harmless). I think we could try storing the current language in the lookup_name_info object, and then convert a bunch of functions more to pass around lookup_name_info objects instead of "const char *" names. I.e., build the lookup_name_info higher up. I'm not sure about that, I'll have to think more about it. Maybe something different will be better. Meanwhile, this gets us going. I've extended the testcase to also exercise a no-debug-info function, for extra coverage of the minsyms-only paths. gdb/ChangeLog: 2018-01-10 Pedro Alves <palves@redhat.com> PR gdb/22670 * dwarf2read.c (gdb_index_symbol_name_matcher::gdb_index_symbol_name_matcher): Adjust to use language_get_symbol_name_matcher instead of language_defn::la_get_symbol_name_matcher. * language.c (language_get_symbol_name_matcher): If in Ada mode and the lookup name is a verbatim match, return Ada's matcher. * language.h (language_get_symbol_name_matcher): Adjust comment. (ada_lookup_name_info::verbatim_p):: New method. gdb/testsuite/ChangeLog: 2018-01-10 Pedro Alves <palves@redhat.com> PR gdb/22670 * gdb.ada/bp_c_mixed_case.exp: Add intro comment. Test printing C functions too. Test setting breakpoints and printing C functions with no debug info too. * gdb.ada/bp_c_mixed_case/qux.c: New file.
2018-01-10 21:38:07 +01:00
2018-01-10 Pedro Alves <palves@redhat.com>
PR gdb/22670
* dwarf2read.c
(gdb_index_symbol_name_matcher::gdb_index_symbol_name_matcher):
Adjust to use language_get_symbol_name_matcher instead of
language_defn::la_get_symbol_name_matcher.
* language.c (language_get_symbol_name_matcher): If in Ada mode
and the lookup name is a verbatim match, return Ada's matcher.
* language.h (language_get_symbol_name_matcher): Adjust comment.
(ada_lookup_name_info::verbatim_p):: New method.
Fix gdb.ada/complete.exp's "complete break ada" test (PR gdb/22670) This patch fixes the regression covered by the test added by: commit 344420da6beac1e0b2f7964e7101f8dcdb509b0d Date: Thu Jan 4 03:30:37 2018 -0500 Subject: Add "complete break ada" test to gdb.ada/complete.exp The regression had been introduced by: commit b5ec771e60c1a0863e51eb491c85c674097e9e13 Date: Wed Nov 8 14:22:32 2017 +0000 Subject: Introduce lookup_name_info and generalize Ada's FULL/WILD name matching The gist of it is that linespec completion in Ada mode is generating additional matches that should not appear in the match list (internally generated symbols, or symbols that should be enclosed between "<...>"). These extraneous entries have uppercase characters, such as: break ada__stringsS break ada__strings__R11s [etc] These matches come from minimal symbols. The problem is that Ada minsyms end up with no language set (language_auto), and thus we end up using the generic symbol name matcher for those instead of Ada's. We already had a special case for in compare_symbol_name to handle this, but it was limited to expressions, while the case at hand is completing a linespec. Fix this by applying the special case to linespec completion as well. I.e., remove the EXPRESSION check from compare_symbol_name. That alone turns out to not be sufficient still -- GDB would still show a couple entries that shouldn't be there: ~~ break ada__exceptions__exception_data__append_info_exception_name__2Xn break ada__exceptions__exception_data__exception_name_length__2Xn ~~ The reason is that these minimal symbols end up with their language set to language_cplus / C++, because those encoded names manage to demangle successfully as C++ symbols (using an old C++ mangling scheme): $ echo ada__exceptions__exception_data__append_info_exception_name__2Xn | c++filt Xn::ada__exceptions__exception_data__append_info_exception_name(void) It's unfortunate that Ada's encoding scheme doesn't start with some unique prefix like "_Z" in the C++ Itanium ABI mangling scheme. For now, paper over that by treating C++ minsyms as Ada minsyms. gdb/ChangeLog: 2018-01-10 Pedro Alves <palves@redhat.com> PR gdb/22670 * ada-lang.c (ada_collect_symbol_completion_matches): If the minsym's language is language_auto or language_cplus, pass down language_ada instead. * symtab.c (compare_symbol_name): Don't frob symbol language here. gdb/testsuite/ChangeLog: 2018-01-10 Pedro Alves <palves@redhat.com> PR gdb/22670 * gdb.ada/complete.exp ("complete break ada"): Replace kfail with a fail.
2018-01-10 21:38:07 +01:00
2018-01-10 Pedro Alves <palves@redhat.com>
PR gdb/22670
* ada-lang.c (ada_collect_symbol_completion_matches): If the
minsym's language is language_auto or language_cplus, pass down
language_ada instead.
* symtab.c (compare_symbol_name): Don't frob symbol language here.
2018-01-10 Pedro Alves <palves@redhat.com>
PR gdb/22670
* minsyms.c (linkage_name_str): New function.
(iterate_over_minimal_symbols): Use it.
2018-01-09 John Baldwin <jhb@FreeBSD.org>
* NEWS: Document that 'info proc' now works on FreeBSD.
2018-01-09 John Baldwin <jhb@FreeBSD.org>
* configure.ac: Check for kinfo_getfile in libutil.
* configure: Regenerate.
* config.in: Regenerate.
* fbsd-nat.c: Include "fbsd-tdep.h".
(fbsd_fetch_cmdline): New.
(fbsd_fetch_kinfo_proc): Move earlier and change to return a bool
rather than calling error.
(fbsd_info_proc): New.
(fbsd_thread_name): Report error if fbsd_fetch_kinfo_proc fails.
(fbsd_wait): Report warning if fbsd_fetch_kinfo_proc fails.
(fbsd_nat_add_target): Set "to_info_proc" to "fbsd_info_proc".
2018-01-09 John Baldwin <jhb@FreeBSD.org>
* fbsd-nat.c (struct free_deleter): Remove.
(fbsd_find_memory_regions): Use gdb::unique_xmalloc_ptr<>.
2018-01-09 John Baldwin <jhb@FreeBSD.org>
* fbsd-nat.c (fbsd_pid_to_exec_file) [KERN_PROC_PATHNAME]: Return
NULL for an empty pathname.
2018-01-09 John Baldwin <jhb@FreeBSD.org>
* fbsd-tdep.c (KVE_STRUCTSIZE, KVE_START, KVE_END, KVE_OFFSET)
(KVE_FLAGS, KVE_PROTECTION, KVE_PATH, KINFO_VME_PROT_READ)
(KINFO_VME_PROT_WRITE, KINFO_VME_PROT_EXEC, KINFO_VME_FLAG_COW)
(KINFO_VME_FLAG_NEEDS_COPY, KINFO_VME_FLAG_NOCOREDUMP)
(KINFO_VME_FLAG_SUPER, KINFO_VME_FLAG_GROWS_UP)
(KINFO_VME_FLAG_GROWS_DOWN, KF_STRUCTSIZE, KF_TYPE, KF_FD)
(KF_PATH, KINFO_FILE_TYPE_VNODE, KINFO_FILE_FD_TYPE_CWD)
(KINFO_FILE_FD_TYPE_TEXT, SIG_WORDS, struct kinfo_proc_layout)
(kinfo_proc_layout_32, kinfo_proc_layout_i386)
(kinfo_proc_layout_64, fbsd_vm_map_entry_flags)
(fbsd_core_info_proc_mappings, fbsd_core_vnode_path)
(fbsd_core_fetch_timeval, fbsd_print_sigset)
(fbsd_core_info_proc_status, fbsd_core_info_proc): New.
(fbsd_init_abi): Install gdbarch "core_info_proc" method.
* fbsd-tdep.h (fbsd_vm_map_entry_flags): New.
2018-01-08 Samuel Thibault <samuel.thibault@ens-lyon.org>
* gdb/gnu-nat.c: Include <elf.h> and <link.h>.
(gnu_xfer_auxv): New function.
(gnu_xfer_partial): Call gnu_xfer_auxv when `object' is
TARGET_OBJECT_AUXV.
Fix GDB build failure when $development is false We don't build GDB selftests bits when $development is false. However, if we turn bfd/development.sh:$development to false, common/selftest.c is compiled which is not expected. It causes the build failure, selftest.o: In function `selftests::run_tests(char const*)': binutils-gdb/gdb/common/selftest.c:97: undefined reference to `selftests::reset()' collect2: error: ld returned 1 exit status I fix this issue by putting selftest.o selftest-arch.o into CONFIG_OBS only when $development is true. After this is fixed, there are other build failures in maint.c, this patch fixes them as well. In the release mode, the output of these commands are: (gdb) maintenance selftest Selftests are not available in a non-development build. (gdb) maintenance selftest foo Selftests are not available in a non-development build. (gdb) maintenance info selftests Selftests are not available in a non-development build. gdb: 2018-01-08 Yao Qi <yao.qi@linaro.org> Simon Marchi <simon.marchi@ericsson.com> * Makefile.in (COMMON_SFILES): Remove selftest-arch.c and common/selftest.c. (COMMON_OBS): Remove selftest.o. * configure.ac: Append selftest-arch.c and common/selftest.c to CONFIG_SRCS. Append selftest-arch.o and selftest.o to COMMON_OBS. * configure: Re-generated. * maint.c (maintenance_selftest): Wrap selftests::run_tests with GDB_SELF_TEST. (maintenance_info_selftests): Likewise. gdb/testsuite: 2018-01-08 Simon Marchi <simon.marchi@ericsson.com> * gdb.gdb/unittest.exp: Match output in non-development mode.
2018-01-08 11:09:32 +01:00
2018-01-08 Yao Qi <yao.qi@linaro.org>
Simon Marchi <simon.marchi@ericsson.com>
* Makefile.in (COMMON_SFILES): Remove selftest-arch.c and
common/selftest.c.
(COMMON_OBS): Remove selftest.o.
* configure.ac: Append selftest-arch.c and common/selftest.c to
CONFIG_SRCS. Append selftest-arch.o and selftest.o to COMMON_OBS.
* configure: Re-generated.
* maint.c (maintenance_selftest): Wrap selftests::run_tests with
GDB_SELF_TEST.
(maintenance_info_selftests): Likewise.
2018-01-08 Xavier Roirand <roirand@adacore.com>
* ada-valprint.c (val_print_packed_array_elements): Use
proper number of elements when printing an array indexed
by an enumeration type.
Remove dwarf2_cu::dwarf2_per_objfile This patch removes the dwarf2_per_objfile field of dwarf2_cu. It is redundant, since we can access dwarf2_per_objfile through dwarf2_per_objfile, which is guaranteed to be set. gdb/ChangeLog: * dwarf2read.c (struct dwarf2_cu) <dwarf2_per_objfile>: Remove. (dw2_get_file_names_reader): Adjust. (lookup_dwo_signatured_type): Adjust. (lookup_dwp_signatured_type): Adjust. (lookup_signatured_type): Adjust. (create_type_unit_group): Adjust. (get_type_unit_group): Adjust. (process_psymtab_comp_unit_reader): Adjust. (build_type_psymtabs_reader): Adjust. (scan_partial_symbols): Adjust. (add_partial_symbol): Adjust. (add_partial_subprogram): Adjust. (peek_die_abbrev): Adjust. (fixup_go_packaging): Adjust. (process_imported_unit_die): Adjust. (dwarf2_compute_name): Adjust. (dwarf2_physname): Adjust. (read_import_statement): Adjust. (handle_DW_AT_stmt_list): Adjust. (read_file_scope): Adjust. (read_func_scope): Adjust. (read_lexical_block_scope): Adjust. (read_call_site_scope): Adjust. (read_variable): Adjust. (dwarf2_rnglists_process): Adjust. (dwarf2_ranges_process): Adjust. (dwarf2_ranges_read): Adjust. (dwarf2_get_pc_bounds): Adjust. (dwarf2_record_block_ranges): Adjust. (dwarf2_add_field): Adjust. (dwarf2_add_member_fn): Adjust. (read_structure_type): Adjust. (process_structure_scope): Adjust. (read_enumeration_type): Adjust. (read_array_type): Adjust. (mark_common_block_symbol_computed): Adjust. (read_common_block): Adjust. (read_namespace_type): Adjust. (read_namespace): Adjust. (read_module_type): Adjust. (read_tag_pointer_type): Adjust. (read_tag_ptr_to_member_type): Adjust. (read_tag_string_type): Adjust. (read_subroutine_type): Adjust. (read_typedef): Adjust. (read_base_type): Adjust. (attr_to_dynamic_prop): Adjust. (read_subrange_type): Adjust. (read_unspecified_type): Adjust. (dwarf2_read_abbrevs): Adjust. (load_partial_dies): Adjust. (read_partial_die): Adjust. (find_partial_die): Adjust. (guess_partial_die_structure_name): Adjust. (fixup_partial_die): Adjust. (read_attribute_value): Adjust. (read_addr_index): Adjust. (read_addr_index_from_leb128): Adjust. (read_str_index): Adjust. (dwarf2_string_attr): Adjust. (get_debug_line_section): Adjust. (dwarf_decode_line_header): Adjust. (lnp_state_machine::check_line_address): Adjust. (dwarf_decode_lines_1): Adjust. (dwarf_decode_lines): Adjust. (dwarf2_start_symtab): Adjust. (var_decode_location): Adjust. (new_symbol_full): Adjust. (dwarf2_const_value_data): Adjust. (dwarf2_const_value_attr): Adjust. (dwarf2_const_value): Adjust. (die_type): Adjust. (die_containing_type): Adjust. (build_error_marker_type): Adjust. (lookup_die_type): Adjust. (guess_full_die_structure_name): Adjust. (anonymous_struct_prefix): Adjust. (determine_prefix): Adjust. (dwarf2_name): Adjust. (follow_die_ref_or_sig): Adjust. (follow_die_offset): Adjust. (follow_die_ref): Adjust. (follow_die_sig_1): Adjust. (follow_die_sig): Adjust. (get_signatured_type): Adjust. (get_DW_AT_signature_type): Adjust. (decode_locdesc): Adjust. (dwarf_decode_macros): Adjust. (cu_debug_loc_section): Adjust. (fill_in_loclist_baton): Adjust. (dwarf2_symbol_mark_computed): Adjust. (init_one_comp_unit): Don't assign dwarf2_cu::dwarf2_per_objfile. (set_die_type): Adjust.
2018-01-07 17:22:46 +01:00
2018-01-07 Simon Marchi <simon.marchi@polymtl.ca>
* dwarf2read.c (struct dwarf2_cu) <dwarf2_per_objfile>: Remove.
(dw2_get_file_names_reader): Adjust.
(lookup_dwo_signatured_type): Adjust.
(lookup_dwp_signatured_type): Adjust.
(lookup_signatured_type): Adjust.
(create_type_unit_group): Adjust.
(get_type_unit_group): Adjust.
(process_psymtab_comp_unit_reader): Adjust.
(build_type_psymtabs_reader): Adjust.
(scan_partial_symbols): Adjust.
(add_partial_symbol): Adjust.
(add_partial_subprogram): Adjust.
(peek_die_abbrev): Adjust.
(fixup_go_packaging): Adjust.
(process_imported_unit_die): Adjust.
(dwarf2_compute_name): Adjust.
(dwarf2_physname): Adjust.
(read_import_statement): Adjust.
(handle_DW_AT_stmt_list): Adjust.
(read_file_scope): Adjust.
(read_func_scope): Adjust.
(read_lexical_block_scope): Adjust.
(read_call_site_scope): Adjust.
(read_variable): Adjust.
(dwarf2_rnglists_process): Adjust.
(dwarf2_ranges_process): Adjust.
(dwarf2_ranges_read): Adjust.
(dwarf2_get_pc_bounds): Adjust.
(dwarf2_record_block_ranges): Adjust.
(dwarf2_add_field): Adjust.
(dwarf2_add_member_fn): Adjust.
(read_structure_type): Adjust.
(process_structure_scope): Adjust.
(read_enumeration_type): Adjust.
(read_array_type): Adjust.
(mark_common_block_symbol_computed): Adjust.
(read_common_block): Adjust.
(read_namespace_type): Adjust.
(read_namespace): Adjust.
(read_module_type): Adjust.
(read_tag_pointer_type): Adjust.
(read_tag_ptr_to_member_type): Adjust.
(read_tag_string_type): Adjust.
(read_subroutine_type): Adjust.
(read_typedef): Adjust.
(read_base_type): Adjust.
(attr_to_dynamic_prop): Adjust.
(read_subrange_type): Adjust.
(read_unspecified_type): Adjust.
(dwarf2_read_abbrevs): Adjust.
(load_partial_dies): Adjust.
(read_partial_die): Adjust.
(find_partial_die): Adjust.
(guess_partial_die_structure_name): Adjust.
(fixup_partial_die): Adjust.
(read_attribute_value): Adjust.
(read_addr_index): Adjust.
(read_addr_index_from_leb128): Adjust.
(read_str_index): Adjust.
(dwarf2_string_attr): Adjust.
(get_debug_line_section): Adjust.
(dwarf_decode_line_header): Adjust.
(lnp_state_machine::check_line_address): Adjust.
(dwarf_decode_lines_1): Adjust.
(dwarf_decode_lines): Adjust.
(dwarf2_start_symtab): Adjust.
(var_decode_location): Adjust.
(new_symbol_full): Adjust.
(dwarf2_const_value_data): Adjust.
(dwarf2_const_value_attr): Adjust.
(dwarf2_const_value): Adjust.
(die_type): Adjust.
(die_containing_type): Adjust.
(build_error_marker_type): Adjust.
(lookup_die_type): Adjust.
(guess_full_die_structure_name): Adjust.
(anonymous_struct_prefix): Adjust.
(determine_prefix): Adjust.
(dwarf2_name): Adjust.
(follow_die_ref_or_sig): Adjust.
(follow_die_offset): Adjust.
(follow_die_ref): Adjust.
(follow_die_sig_1): Adjust.
(follow_die_sig): Adjust.
(get_signatured_type): Adjust.
(get_DW_AT_signature_type): Adjust.
(decode_locdesc): Adjust.
(dwarf_decode_macros): Adjust.
(cu_debug_loc_section): Adjust.
(fill_in_loclist_baton): Adjust.
(dwarf2_symbol_mark_computed): Adjust.
(init_one_comp_unit): Don't assign
dwarf2_cu::dwarf2_per_objfile.
(set_die_type): Adjust.
Remove dwarf2_per_objfile global This patch removes the global variable dwarf2_per_objfile. This global variable is set at the various entry points of dwarf2read.c (using dw2_setup), and is referred to throughout the file. Instead of passing data between functions in global variables like this one, it would be better if the functions that depend on it either received it as argument or got it from the existing arguments they receive. For example, a function receiving a reference to a dwarf2_per_cu_data can access it from dwarf2_per_cu_data::dwarf2_per_objfile. This patch has been tested on the buildbot. gdb/ChangeLog: * dwarf2read.c (struct mapped_debug_names): Add constructor. <dwarf2_per_objfile>: New field. (dwarf2_per_objfile): Remove global. (get_dwarf2_per_objfile): New function. (set_dwarf2_per_objfile): New function. (dwarf2_build_psymtabs_hard): Change objfile parameter to dwarf2_per_objfile. (abbrev_table_read_table): Add dwarf2_per_objfile parameter. (read_abbrev_offset): Likewise. (read_indirect_string): Likewise. (read_indirect_line_string): Likewise. (read_indirect_string_at_offset): Likewise. (read_indirect_string_from_dwz): Likewise. (dwarf2_find_containing_comp_unit): Change objfile parameter to dwarf2_per_objfile. (age_cached_comp_units): Add dwarf2_per_objfile parameter. (create_all_comp_units): Change objfile parameter to dwarf2_per_objfile. (create_all_type_units): Likewise. (process_queue): Add dwarf2_per_objfile parameter. (read_and_check_comp_unit_head): Likewise. (lookup_dwo_unit_in_dwp): Likewise. (get_dwp_file): Likewise. (process_cu_includes): Likewise. (struct free_dwo_file_cleanup_data): New struct. (dwarf2_has_info): Use get_dwarf2_per_objfile and set_dwarf2_per_objfile. (dwarf2_get_dwz_file): Add dwarf2_per_objfile parameter. (dw2_do_instantiate_symtab): Get dwarf2_per_objfile from context, adjust calls. (dw2_instantiate_symtab): Likewise. (dw2_get_cutu): Add dwarf2_per_objfile parameter. (dw2_get_cu): Likewise. (create_cu_from_index_list): Change objfile parameter to dwarf2_per_objfile. (create_cus_from_index_list): Get dwarf2_per_objfile from context, adjust calls. (create_cus_from_index): Likewise. (create_signatured_type_table_from_index): Change objfile parameter to dwarf2_per_objfile. (create_signatured_type_table_from_debug_names): Change objfile parameter to dwarf2_per_objfile. (create_addrmap_from_index): Likewise. (create_addrmap_from_aranges): Likewise. (dwarf2_read_index): Use get_dwarf2_per_objfile, adjust calls. (dw2_setup): Remove. (dw2_get_file_names_reader): Get dwarf2_per_objfile from context. (dw2_find_last_source_symtab): Get dwarf2_per_objfile using get_dwarf2_per_objfile. (dw2_forget_cached_source_info): Likewise. (dw2_map_symtabs_matching_filename): Likewise. (struct dw2_symtab_iterator) <index>: Remove. <dwarf2_per_objfile>: New field. (dw2_symtab_iter_init): Replace index parameter with dwarf2_per_objfile. (dw2_symtab_iter_next): Use dwarf2_per_objfile from iter. (dw2_lookup_symbol): Use get_dwarf2_per_objfile and adjust. (dw2_print_stats): Likewise. (dw2_dump): Likewise. (dw2_expand_symtabs_for_function): Likewise. (dw2_expand_all_symtabs): Likewise. (dw2_expand_symtabs_with_fullname): Likewise. (dw2_expand_marked_cus): Replace index and objfile parameters with dwarf2_per_objfile. (dw_expand_symtabs_matching_file_matcher): Add dwarf2_per_objfile parameter and adjust calls. (dw2_expand_symtabs_matching): Use get_dwarf2_per_objfile and adjust calls. (dw2_find_pc_sect_compunit_symtab): Don't call dw2_setup. (dw2_map_symbol_filenames): Use get_dwarf2_per_objfile and adjust calls. (create_cus_from_debug_names_list): Replace objfile parameter with dwarf2_per_objfile and adjust calls. (create_cus_from_debug_names): Likewise. (dwarf2_read_debug_names): Likewise. (mapped_debug_names::namei_to_name): Adjust call. (dw2_debug_names_iterator::next): Likewise. (dw2_debug_names_iterator::find_vec_in_debug_names): Likewise. (dw2_debug_names_lookup_symbol): Use get_dwarf2_per_objfile. (dw2_debug_names_dump): Likewise. (dw2_debug_names_expand_symtabs_for_function): Likewise. (dw2_debug_names_expand_symtabs_matching): Likewise. (dwarf2_initialize_objfile): Likewise. (dwarf2_build_psymtabs): Likewise. (get_abbrev_section_for_cu): Get dwarf2_per_objfile from this_cu. (error_check_comp_unit_head): Add dwarf2_per_objfile parameter. (read_and_check_comp_unit_head): Likewise. (read_abbrev_offset): Likewise. (create_debug_type_hash_table): Likewise. (create_debug_types_hash_table): Likewise. (create_all_type_units): Replace objfile parameter with dwarf2_per_objfile. (add_type_unit): Add dwarf2_per_objfile parameter. (fill_in_sig_entry_from_dwo_entry): Replace objfile parameter with dwarf2_per_objfile. (lookup_dwo_signatured_type): Get dwarf2_per_objfile from cu. (lookup_dwp_signatured_type): Likewise. (lookup_signatured_type): Likewise. (read_cutu_die_from_dwo): Likewise. (init_tu_and_read_dwo_dies): Likewise. (init_cutu_and_read_dies): Likewise. (init_cutu_and_read_dies_no_follow): Likewise. (allocate_type_unit_groups_table): Add objfile parameter. (create_type_unit_group): Use dwarf2_per_objfile from cu. (get_type_unit_group): Likewise. (process_psymtab_comp_unit): Update call. (build_type_psymtabs_reader): Use dwarf2_per_objfile from cu. (build_type_psymtabs_1): Add dwarf2_per_objfile parameter. (print_tu_stats): Likewise. (build_type_psymtab_dependencies): Use dwarf2_per_objfile passed in void* parameter. (build_type_psymtabs): Change objfile parameter to dwarf2_per_objfile. (process_skeletonless_type_unit): Use dwarf2_per_objfile passed in void* parameter. (process_skeletonless_type_units): Change objfile parameter to dwarf2_per_objfile. (set_partial_user): Likewise. (dwarf2_build_psymtabs_hard): Likewise. (read_comp_units_from_section): Likewise. (create_all_comp_units): Likewise. (scan_partial_symbols): Update calls. (add_partial_symbol): Likewise. (dwarf2_read_symtab): Use get_dwarf2_per_objfile. (maybe_queue_comp_unit): Use dwarf2_read_symtab from cu. (process_queue): Add dwarf2_per_objfile parameter. (get_compunit_symtab): Use dwarf2_per_objfile from cu. (compute_compunit_symtab_includes): Likewise. (process_cu_includes): Add dwarf2_per_objfile parameter. (process_full_comp_unit): Use dwarf2_per_objfile from cu. (process_full_type_unit): Likewise. (process_imported_unit_die): Update call. (handle_DW_AT_stmt_list): Use dwarf2_per_objfile from cu. (read_file_scope): Likewise. (allocate_dwo_file_hash_table): Add objfile parameter. (lookup_dwo_file_slot): Add dwarf2_per_objfile parameter. (create_cus_hash_table): Likewise. (create_dwp_hash_table): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwp_v2_section): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (lookup_dwo_unit_in_dwp): Likewise. (try_open_dwop_file): Likewise. (open_dwo_file): Likewise. Use dwarf2_per_objfile from cu. (open_and_init_dwo_file): Use dwarf2_per_objfile from cu, update cleanup to include a reference to dwarf2_per_objfile. (open_dwp_file): Add dwarf2_per_objfile parameter. (open_and_init_dwp_file): Likewise. (get_dwp_file): Likewise. (lookup_dwo_cutu): Use dwarf2_per_objfile from cu. (queue_and_load_all_dwo_tus): Update call. (free_dwo_file_cleanup): Use dwarf2_per_objfile from cleanup data. (dwarf2_rnglists_process): Use dwarf2_per_objfile from cu. (dwarf2_ranges_process): Likewise. (dwarf2_get_pc_bounds): Likewise. (mark_common_block_symbol_computed): Likewise. (abbrev_table_read_table): Add dwarf2_per_objfile parameter. (dwarf2_read_abbrevs): Update call. (read_partial_die): Use dwarf2_per_objfile from cu. (find_partial_die): Likewise. (fixup_partial_die): Likewise. (read_attribute_value): Likewise. (read_indirect_string_at_offset_from): Add objfile parameter. (read_indirect_string_at_offset): Add dwarf2_per_objfile parameter. (read_indirect_string_from_dwz): Add objfile parameter. (read_indirect_string): Add objfile parameter. (read_addr_index_1): Add dwarf2_per_objfile parameter. (read_addr_index): Use dwarf2_per_objfile from cu. (dwarf2_read_addr_index): Use dwarf2_per_objfile from cu, don't call dw2_setup. (read_str_index): Use dwarf2_per_objfile from cu. (get_debug_line_section): Likewise. (read_formatted_entries): Add dwarf2_per_objfile parameter. (dwarf_decode_line_header): Use dwarf2_per_objfile from cu. (new_symbol_full): Use dwarf2_per_objfile from cu. (build_error_marker_type): Likewise. (lookup_die_type): Likewise. (determine_prefix): Likewise. (follow_die_offset): Likewise. (dwarf2_fetch_die_loc_sect_off): Use get_dwarf2_per_objfile. (dwarf2_fetch_constant_bytes): Don't call dw2_setup. (dwarf2_fetch_die_type_sect_off): Likewise. (dwarf2_get_die_type): Likewise. (follow_die_sig_1): Use dwarf2_per_objfile from cu. (get_signatured_type): Likewise. (get_DW_AT_signature_type): Likewise. (dwarf_decode_macro_bytes): Add dwarf2_per_objfile parameter. (dwarf_decode_macros): Use dwarf2_per_objfile from cu. (cu_debug_loc_section): Likewise. (fill_in_loclist_baton): Likewise. (dwarf2_symbol_mark_computed): Likewise. (dwarf2_find_containing_comp_unit): Change objfile parameter to dwarf2_per_objfile. (free_cached_comp_units): Use dwarf2_per_objfile passed in void* parameter. (age_cached_comp_units): Add dwarf2_per_objfile parameter. (free_one_cached_comp_unit): Use dwarf2_per_objfile from cu. (dwarf2_free_objfile): Use get_dwarf2_per_objfile. (set_die_type): Use dwarf2_free_objfile from cu. (get_die_type_at_offset): Likewise. (dwarf2_per_objfile_free): Don't assign global variable. (debug_names) <constructor>: Add dwarf2_per_objfile parameter, update m_debugstrlookup construction. (debug_names::debug_str_lookup): Add dwarf2_per_objfile parameter. <m_dwarf2_per_objfile>: New field. <lookup>: Use m_dwarf2_per_objfile. (check_dwarf64_offsets): Add dwarf2_per_objfile parameter. (psyms_seen_size): Likewise. (write_gdbindex): Replace objfile parameter with dwarf2_per_objfile. (write_debug_names): Likewise. (write_psymtabs_to_index): Likewise. (save_gdb_index_command): Use get_dwarf2_per_objfile, update calls.
2018-01-07 17:22:46 +01:00
2018-01-07 Simon Marchi <simon.marchi@ericsson.com>
* dwarf2read.c (struct mapped_debug_names): Add constructor.
<dwarf2_per_objfile>: New field.
(dwarf2_per_objfile): Remove global.
(get_dwarf2_per_objfile): New function.
(set_dwarf2_per_objfile): New function.
(dwarf2_build_psymtabs_hard): Change objfile parameter to
dwarf2_per_objfile.
(abbrev_table_read_table): Add dwarf2_per_objfile parameter.
(read_abbrev_offset): Likewise.
(read_indirect_string): Likewise.
(read_indirect_line_string): Likewise.
(read_indirect_string_at_offset): Likewise.
(read_indirect_string_from_dwz): Likewise.
(dwarf2_find_containing_comp_unit): Change objfile parameter to
dwarf2_per_objfile.
(age_cached_comp_units): Add dwarf2_per_objfile parameter.
(create_all_comp_units): Change objfile parameter to
dwarf2_per_objfile.
(create_all_type_units): Likewise.
(process_queue): Add dwarf2_per_objfile parameter.
(read_and_check_comp_unit_head): Likewise.
(lookup_dwo_unit_in_dwp): Likewise.
(get_dwp_file): Likewise.
(process_cu_includes): Likewise.
(struct free_dwo_file_cleanup_data): New struct.
(dwarf2_has_info): Use get_dwarf2_per_objfile and
set_dwarf2_per_objfile.
(dwarf2_get_dwz_file): Add dwarf2_per_objfile parameter.
(dw2_do_instantiate_symtab): Get dwarf2_per_objfile from
context, adjust calls.
(dw2_instantiate_symtab): Likewise.
(dw2_get_cutu): Add dwarf2_per_objfile parameter.
(dw2_get_cu): Likewise.
(create_cu_from_index_list): Change objfile parameter to
dwarf2_per_objfile.
(create_cus_from_index_list): Get dwarf2_per_objfile from
context, adjust calls.
(create_cus_from_index): Likewise.
(create_signatured_type_table_from_index): Change objfile
parameter to dwarf2_per_objfile.
(create_signatured_type_table_from_debug_names): Change objfile
parameter to dwarf2_per_objfile.
(create_addrmap_from_index): Likewise.
(create_addrmap_from_aranges): Likewise.
(dwarf2_read_index): Use get_dwarf2_per_objfile, adjust calls.
(dw2_setup): Remove.
(dw2_get_file_names_reader): Get dwarf2_per_objfile from
context.
(dw2_find_last_source_symtab): Get dwarf2_per_objfile using
get_dwarf2_per_objfile.
(dw2_forget_cached_source_info): Likewise.
(dw2_map_symtabs_matching_filename): Likewise.
(struct dw2_symtab_iterator) <index>: Remove.
<dwarf2_per_objfile>: New field.
(dw2_symtab_iter_init): Replace index parameter with
dwarf2_per_objfile.
(dw2_symtab_iter_next): Use dwarf2_per_objfile from iter.
(dw2_lookup_symbol): Use get_dwarf2_per_objfile and adjust.
(dw2_print_stats): Likewise.
(dw2_dump): Likewise.
(dw2_expand_symtabs_for_function): Likewise.
(dw2_expand_all_symtabs): Likewise.
(dw2_expand_symtabs_with_fullname): Likewise.
(dw2_expand_marked_cus): Replace index and objfile parameters
with dwarf2_per_objfile.
(dw_expand_symtabs_matching_file_matcher): Add
dwarf2_per_objfile parameter and adjust calls.
(dw2_expand_symtabs_matching): Use get_dwarf2_per_objfile and
adjust calls.
(dw2_find_pc_sect_compunit_symtab): Don't call dw2_setup.
(dw2_map_symbol_filenames): Use get_dwarf2_per_objfile and
adjust calls.
(create_cus_from_debug_names_list): Replace objfile parameter
with dwarf2_per_objfile and adjust calls.
(create_cus_from_debug_names): Likewise.
(dwarf2_read_debug_names): Likewise.
(mapped_debug_names::namei_to_name): Adjust call.
(dw2_debug_names_iterator::next): Likewise.
(dw2_debug_names_iterator::find_vec_in_debug_names): Likewise.
(dw2_debug_names_lookup_symbol): Use get_dwarf2_per_objfile.
(dw2_debug_names_dump): Likewise.
(dw2_debug_names_expand_symtabs_for_function): Likewise.
(dw2_debug_names_expand_symtabs_matching): Likewise.
(dwarf2_initialize_objfile): Likewise.
(dwarf2_build_psymtabs): Likewise.
(get_abbrev_section_for_cu): Get dwarf2_per_objfile from
this_cu.
(error_check_comp_unit_head): Add dwarf2_per_objfile parameter.
(read_and_check_comp_unit_head): Likewise.
(read_abbrev_offset): Likewise.
(create_debug_type_hash_table): Likewise.
(create_debug_types_hash_table): Likewise.
(create_all_type_units): Replace objfile parameter with
dwarf2_per_objfile.
(add_type_unit): Add dwarf2_per_objfile parameter.
(fill_in_sig_entry_from_dwo_entry): Replace objfile parameter
with dwarf2_per_objfile.
(lookup_dwo_signatured_type): Get dwarf2_per_objfile from cu.
(lookup_dwp_signatured_type): Likewise.
(lookup_signatured_type): Likewise.
(read_cutu_die_from_dwo): Likewise.
(init_tu_and_read_dwo_dies): Likewise.
(init_cutu_and_read_dies): Likewise.
(init_cutu_and_read_dies_no_follow): Likewise.
(allocate_type_unit_groups_table): Add objfile parameter.
(create_type_unit_group): Use dwarf2_per_objfile from cu.
(get_type_unit_group): Likewise.
(process_psymtab_comp_unit): Update call.
(build_type_psymtabs_reader): Use dwarf2_per_objfile from cu.
(build_type_psymtabs_1): Add dwarf2_per_objfile parameter.
(print_tu_stats): Likewise.
(build_type_psymtab_dependencies): Use dwarf2_per_objfile passed
in void* parameter.
(build_type_psymtabs): Change objfile parameter to
dwarf2_per_objfile.
(process_skeletonless_type_unit): Use dwarf2_per_objfile
passed in void* parameter.
(process_skeletonless_type_units): Change objfile parameter to
dwarf2_per_objfile.
(set_partial_user): Likewise.
(dwarf2_build_psymtabs_hard): Likewise.
(read_comp_units_from_section): Likewise.
(create_all_comp_units): Likewise.
(scan_partial_symbols): Update calls.
(add_partial_symbol): Likewise.
(dwarf2_read_symtab): Use get_dwarf2_per_objfile.
(maybe_queue_comp_unit): Use dwarf2_read_symtab from cu.
(process_queue): Add dwarf2_per_objfile parameter.
(get_compunit_symtab): Use dwarf2_per_objfile from cu.
(compute_compunit_symtab_includes): Likewise.
(process_cu_includes): Add dwarf2_per_objfile parameter.
(process_full_comp_unit): Use dwarf2_per_objfile from cu.
(process_full_type_unit): Likewise.
(process_imported_unit_die): Update call.
(handle_DW_AT_stmt_list): Use dwarf2_per_objfile from cu.
(read_file_scope): Likewise.
(allocate_dwo_file_hash_table): Add objfile parameter.
(lookup_dwo_file_slot): Add dwarf2_per_objfile parameter.
(create_cus_hash_table): Likewise.
(create_dwp_hash_table): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwp_v2_section): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(lookup_dwo_unit_in_dwp): Likewise.
(try_open_dwop_file): Likewise.
(open_dwo_file): Likewise. Use dwarf2_per_objfile from cu.
(open_and_init_dwo_file): Use dwarf2_per_objfile from cu, update
cleanup to include a reference to dwarf2_per_objfile.
(open_dwp_file): Add dwarf2_per_objfile parameter.
(open_and_init_dwp_file): Likewise.
(get_dwp_file): Likewise.
(lookup_dwo_cutu): Use dwarf2_per_objfile from cu.
(queue_and_load_all_dwo_tus): Update call.
(free_dwo_file_cleanup): Use dwarf2_per_objfile from cleanup
data.
(dwarf2_rnglists_process): Use dwarf2_per_objfile from cu.
(dwarf2_ranges_process): Likewise.
(dwarf2_get_pc_bounds): Likewise.
(mark_common_block_symbol_computed): Likewise.
(abbrev_table_read_table): Add dwarf2_per_objfile parameter.
(dwarf2_read_abbrevs): Update call.
(read_partial_die): Use dwarf2_per_objfile from cu.
(find_partial_die): Likewise.
(fixup_partial_die): Likewise.
(read_attribute_value): Likewise.
(read_indirect_string_at_offset_from): Add objfile parameter.
(read_indirect_string_at_offset): Add dwarf2_per_objfile
parameter.
(read_indirect_string_from_dwz): Add objfile parameter.
(read_indirect_string): Add objfile parameter.
(read_addr_index_1): Add dwarf2_per_objfile parameter.
(read_addr_index): Use dwarf2_per_objfile from cu.
(dwarf2_read_addr_index): Use dwarf2_per_objfile from cu, don't
call dw2_setup.
(read_str_index): Use dwarf2_per_objfile from cu.
(get_debug_line_section): Likewise.
(read_formatted_entries): Add dwarf2_per_objfile parameter.
(dwarf_decode_line_header): Use dwarf2_per_objfile from cu.
(new_symbol_full): Use dwarf2_per_objfile from cu.
(build_error_marker_type): Likewise.
(lookup_die_type): Likewise.
(determine_prefix): Likewise.
(follow_die_offset): Likewise.
(dwarf2_fetch_die_loc_sect_off): Use get_dwarf2_per_objfile.
(dwarf2_fetch_constant_bytes): Don't call dw2_setup.
(dwarf2_fetch_die_type_sect_off): Likewise.
(dwarf2_get_die_type): Likewise.
(follow_die_sig_1): Use dwarf2_per_objfile from cu.
(get_signatured_type): Likewise.
(get_DW_AT_signature_type): Likewise.
(dwarf_decode_macro_bytes): Add dwarf2_per_objfile parameter.
(dwarf_decode_macros): Use dwarf2_per_objfile from cu.
(cu_debug_loc_section): Likewise.
(fill_in_loclist_baton): Likewise.
(dwarf2_symbol_mark_computed): Likewise.
(dwarf2_find_containing_comp_unit): Change objfile parameter to
dwarf2_per_objfile.
(free_cached_comp_units): Use dwarf2_per_objfile passed in void*
parameter.
(age_cached_comp_units): Add dwarf2_per_objfile parameter.
(free_one_cached_comp_unit): Use dwarf2_per_objfile from cu.
(dwarf2_free_objfile): Use get_dwarf2_per_objfile.
(set_die_type): Use dwarf2_free_objfile from cu.
(get_die_type_at_offset): Likewise.
(dwarf2_per_objfile_free): Don't assign global variable.
(debug_names) <constructor>: Add dwarf2_per_objfile
parameter, update m_debugstrlookup construction.
(debug_names::debug_str_lookup): Add dwarf2_per_objfile
parameter.
<m_dwarf2_per_objfile>: New field.
<lookup>: Use m_dwarf2_per_objfile.
(check_dwarf64_offsets): Add dwarf2_per_objfile parameter.
(psyms_seen_size): Likewise.
(write_gdbindex): Replace objfile parameter with
dwarf2_per_objfile.
(write_debug_names): Likewise.
(write_psymtabs_to_index): Likewise.
(save_gdb_index_command): Use get_dwarf2_per_objfile, update
calls.
Replace objfile field in dwarf2_cu and dwarf2_per_cu_data with dwarf2_per_objfile The next patch aims to remove the dwarf2_per_objfile global. In many functions, we need to find a way to get a reference to the current dwarf2_per_objfile through the objects passed in parameters. Often, we have access to a dwarf2_cu or a dwarf2_per_cu_data. These objects have a reference to the objfile, through which we can get the dwarf2_per_objfile: dwarf2_per_objfile = ((struct dwarf2_per_objfile *) objfile_data (objfile, dwarf2_objfile_data_key)); However, this is a bit cumbersome to do all over the place. It would be more logical if the dwarf2_cu and dwarf2_per_cu_data had a reference to their dwarf2_per_objfile, which would then have a reference to the objfile. It would be more in line with the object hierarchy, where dwarf2_per_objfile owns the dwarf2_per_cu_data instances. We could even remove the reference dwarf2_cu has to dwarf2_per_objfile, since we can access dwarf2_per_objfile through dwarf2_cu::per_cu. In a graphical way, references would look like this after the current patch: objfile <--- dwarf2_per_objfile <--- dwarf2_per_cu_data | ^ | | `- dwarf2_cu This patch has been tested on the buildbot. gdb/ChangeLog: * dwarf2read.c (struct dwarf2_cu) <objfile>: Remove. <dwarf2_per_objfile>: New field. (struct dwarf2_per_cu_data) <objfile>: Remove. <dwarf2_per_objfile>: New field. (create_cu_from_index_list): Assign dwarf2_per_objfile instead of objfile. (create_signatured_type_table_from_index): Likewise. (create_debug_type_hash_table): Likewise. (fill_in_sig_entry_from_dwo_entry): Likewise. (lookup_dwo_unit): Access objfile through dwarf2_per_objfile. (create_type_unit_group): Assign dwarf2_per_objfile instead of objfile. (create_partial_symtab): Access objfile through dwarf2_per_objfile. (process_psymtab_comp_unit_reader): Likewise. (read_comp_units_from_section): Likewise. (scan_partial_symbols): Likewise. (add_partial_symbol): Likewise. (add_partial_subprogram): Likewise. (peek_die_abbrev): Likewise. (fixup_go_packaging): Likewise. (process_full_comp_unit): Likewise. (process_full_type_unit): Likewise. (process_imported_unit_die): Likewise. (dwarf2_compute_name): Likewise. (dwarf2_physname): Likewise. (read_import_statement): Likewise. (create_cus_hash_table): Assign dwarf2_physname instead of objfile. (read_func_scope): Access objfile through dwarf2_per_objfile. (read_lexical_block_scope): Likewise. (read_call_site_scope): Likewise. (read_variable): Likewise. (dwarf2_rnglists_process): Likewise. (dwarf2_ranges_process): Likewise. (dwarf2_ranges_read): Likewise. (dwarf2_record_block_ranges): Likewise. (dwarf2_add_field): Likewise. (dwarf2_add_member_fn): Likewise. (read_structure_type): Likewise. (process_structure_scope): Likewise. (read_enumeration_type): Likewise. (read_array_type): Likewise. (read_common_block): Likewise. (read_namespace_type): Likewise. (read_namespace): Likewise. (read_module_type): Likewise. (read_tag_pointer_type): Likewise. (read_tag_ptr_to_member_type): Likewise. (read_tag_string_type): Likewise. (read_subroutine_type): Likewise. (read_typedef): Likewise. (read_base_type): Likewise. (attr_to_dynamic_prop): Likewise. (read_subrange_type): Likewise. (read_unspecified_type): Likewise. (load_partial_dies): Likewise. (read_partial_die): Likewise. (find_partial_die): Likewise. (guess_partial_die_structure_name): Likewise. (fixup_partial_die): Likewise. (read_attribute_value): Likewise. (read_addr_index_from_leb128): Likewise. (dwarf2_read_addr_index): Likewise. (dwarf2_string_attr): Likewise. (lnp_state_machine::check_line_address): Likewise. (dwarf_decode_lines_1): Likewise. (dwarf_decode_lines): Likewise. (dwarf2_start_symtab): Likewise. (var_decode_location): Likewise. (new_symbol_full): Likewise. (dwarf2_const_value_data): Likewise. (dwarf2_const_value_attr): Likewise. (dwarf2_const_value): Likewise. (die_type): Likewise. (die_containing_type): Likewise. (lookup_die_type): Likewise. (guess_full_die_structure_name): Likewise. (anonymous_struct_prefix): Likewise. (dwarf2_name): Likewise. (follow_die_ref_or_sig): Likewise. (follow_die_offset): Likewise. (follow_die_ref): Likewise. (dwarf2_fetch_die_loc_sect_off): Likewise. (dwarf2_fetch_constant_bytes): Likewise. (dwarf2_fetch_die_type_sect_off): Likewise. (dwarf2_get_die_type): Likewise. (follow_die_sig): Likewise. (decode_locdesc): Likewise. (dwarf2_per_cu_objfile): Likewise. (dwarf2_per_cu_text_offset): Likewise. (init_one_comp_unit): Assign dwarf2_per_objfile instead of objfile. (set_die_type): Access objfile through dwarf2_per_objfile.
2018-01-07 17:22:45 +01:00
2018-01-07 Simon Marchi <simon.marchi@ericsson.com>
* dwarf2read.c (struct dwarf2_cu) <objfile>: Remove.
<dwarf2_per_objfile>: New field.
(struct dwarf2_per_cu_data) <objfile>: Remove.
<dwarf2_per_objfile>: New field.
(create_cu_from_index_list): Assign dwarf2_per_objfile instead
of objfile.
(create_signatured_type_table_from_index): Likewise.
(create_debug_type_hash_table): Likewise.
(fill_in_sig_entry_from_dwo_entry): Likewise.
(lookup_dwo_unit): Access objfile through dwarf2_per_objfile.
(create_type_unit_group): Assign dwarf2_per_objfile instead of
objfile.
(create_partial_symtab): Access objfile through
dwarf2_per_objfile.
(process_psymtab_comp_unit_reader): Likewise.
(read_comp_units_from_section): Likewise.
(scan_partial_symbols): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(peek_die_abbrev): Likewise.
(fixup_go_packaging): Likewise.
(process_full_comp_unit): Likewise.
(process_full_type_unit): Likewise.
(process_imported_unit_die): Likewise.
(dwarf2_compute_name): Likewise.
(dwarf2_physname): Likewise.
(read_import_statement): Likewise.
(create_cus_hash_table): Assign dwarf2_physname instead of
objfile.
(read_func_scope): Access objfile through dwarf2_per_objfile.
(read_lexical_block_scope): Likewise.
(read_call_site_scope): Likewise.
(read_variable): Likewise.
(dwarf2_rnglists_process): Likewise.
(dwarf2_ranges_process): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf2_record_block_ranges): Likewise.
(dwarf2_add_field): Likewise.
(dwarf2_add_member_fn): Likewise.
(read_structure_type): Likewise.
(process_structure_scope): Likewise.
(read_enumeration_type): Likewise.
(read_array_type): Likewise.
(read_common_block): Likewise.
(read_namespace_type): Likewise.
(read_namespace): Likewise.
(read_module_type): Likewise.
(read_tag_pointer_type): Likewise.
(read_tag_ptr_to_member_type): Likewise.
(read_tag_string_type): Likewise.
(read_subroutine_type): Likewise.
(read_typedef): Likewise.
(read_base_type): Likewise.
(attr_to_dynamic_prop): Likewise.
(read_subrange_type): Likewise.
(read_unspecified_type): Likewise.
(load_partial_dies): Likewise.
(read_partial_die): Likewise.
(find_partial_die): Likewise.
(guess_partial_die_structure_name): Likewise.
(fixup_partial_die): Likewise.
(read_attribute_value): Likewise.
(read_addr_index_from_leb128): Likewise.
(dwarf2_read_addr_index): Likewise.
(dwarf2_string_attr): Likewise.
(lnp_state_machine::check_line_address): Likewise.
(dwarf_decode_lines_1): Likewise.
(dwarf_decode_lines): Likewise.
(dwarf2_start_symtab): Likewise.
(var_decode_location): Likewise.
(new_symbol_full): Likewise.
(dwarf2_const_value_data): Likewise.
(dwarf2_const_value_attr): Likewise.
(dwarf2_const_value): Likewise.
(die_type): Likewise.
(die_containing_type): Likewise.
(lookup_die_type): Likewise.
(guess_full_die_structure_name): Likewise.
(anonymous_struct_prefix): Likewise.
(dwarf2_name): Likewise.
(follow_die_ref_or_sig): Likewise.
(follow_die_offset): Likewise.
(follow_die_ref): Likewise.
(dwarf2_fetch_die_loc_sect_off): Likewise.
(dwarf2_fetch_constant_bytes): Likewise.
(dwarf2_fetch_die_type_sect_off): Likewise.
(dwarf2_get_die_type): Likewise.
(follow_die_sig): Likewise.
(decode_locdesc): Likewise.
(dwarf2_per_cu_objfile): Likewise.
(dwarf2_per_cu_text_offset): Likewise.
(init_one_comp_unit): Assign dwarf2_per_objfile instead of
objfile.
(set_die_type): Access objfile through
dwarf2_per_objfile.
2018-01-07 Simon Marchi <simon.marchi@ericsson.com>
* valprint.c (converted_character_d): Remove typedef.
(DEF_VEC_O (converted_character_d)): Remove.
(count_next_character): Use std::vector.
(print_converted_chars_to_obstack): Likewise.
(generic_printstr): Likewise.
Replace VEC(gdb_xml_value_s) with std::vector This patch replaces VEC(gdb_xml_value_s), which is passed to XML visitors, with an std::vector. In order to be able to remove the cleanup in gdb_xml_parser::start_element, the gdb_xml_parser structure is made to own the value with a gdb::unique_xmalloc_ptr. This patch has been tested on the buildbot. gdb/ChangeLog: * xml-support.h (struct gdb_xml_value): Add constructor. <value>: Change type to unique_xmalloc_ptr. (gdb_xml_value_s): Remove typedef. (DEF_VEC_O (gdb_xml_value_s)): Remove. (gdb_xml_element_start_handler): Change parameter type to std::vector. (xml_find_attribute): Likewise. * xml-support.c (xml_find_attribute): Change parameter type to std::vector and adjust. (gdb_xml_values_cleanup): Remove. (gdb_xml_parser::start_element): Adjust to std::vector. (xinclude_start_include): Change paraeter type to std::vector and adjust. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_start_property): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. * remote.c (start_thread): Likewise. * solib-aix.c (library_list_start_library): Likewise. (library_list_start_list): Likewise. * solib-svr4.c (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. * tracepoint.c (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. * xml-syscall.c (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_enum): Likewise. (tdesc_start_field): Likewise. (tdesc_start_enum_value): Likewise. (tdesc_start_vector): Likewise.
2018-01-07 15:29:52 +01:00
2018-01-07 Simon Marchi <simon.marchi@polymtl.ca>
* xml-support.h (struct gdb_xml_value): Add constructor.
<value>: Change type to unique_xmalloc_ptr.
(gdb_xml_value_s): Remove typedef.
(DEF_VEC_O (gdb_xml_value_s)): Remove.
(gdb_xml_element_start_handler): Change parameter type to
std::vector.
(xml_find_attribute): Likewise.
* xml-support.c (xml_find_attribute): Change parameter type to
std::vector and adjust.
(gdb_xml_values_cleanup): Remove.
(gdb_xml_parser::start_element): Adjust to std::vector.
(xinclude_start_include): Change paraeter type to std::vector
and adjust.
* btrace.c (check_xml_btrace_version): Likewise.
(parse_xml_btrace_block): Likewise.
(parse_xml_btrace_pt_config_cpu): Likewise.
(parse_xml_btrace_pt): Likewise.
(parse_xml_btrace_conf_bts): Likewise.
(parse_xml_btrace_conf_pt): Likewise.
* memory-map.c (memory_map_start_memory): Likewise.
(memory_map_start_property): Likewise.
* osdata.c (osdata_start_osdata): Likewise.
(osdata_start_item): Likewise.
(osdata_start_column): Likewise.
* remote.c (start_thread): Likewise.
* solib-aix.c (library_list_start_library): Likewise.
(library_list_start_list): Likewise.
* solib-svr4.c (library_list_start_library): Likewise.
(svr4_library_list_start_list): Likewise.
* solib-target.c (library_list_start_segment): Likewise.
(library_list_start_section): Likewise.
(library_list_start_library): Likewise.
(library_list_start_list): Likewise.
* tracepoint.c (traceframe_info_start_memory): Likewise.
(traceframe_info_start_tvar): Likewise.
* xml-syscall.c (syscall_start_syscall): Likewise.
* xml-tdesc.c (tdesc_start_target): Likewise.
(tdesc_start_feature): Likewise.
(tdesc_start_reg): Likewise.
(tdesc_start_union): Likewise.
(tdesc_start_struct): Likewise.
(tdesc_start_flags): Likewise.
(tdesc_start_enum): Likewise.
(tdesc_start_field): Likewise.
(tdesc_start_enum_value): Likewise.
(tdesc_start_vector): Likewise.
2018-01-07 Simon Marchi <simon.marchi@polymtl.ca>
* extension.h (struct xmethod_worker) <clone>: Remove.
* python/py-xmethods.c (struct python_xmethod_worker) <clone>:
Remove.
(python_xmethod_worker::clone): Remove.
* valops.c (find_overload_match): Use std::move instead of
clone.
C++ify xmethod_worker, get rid of VEC(xmethod_worker_ptr) The initial goal of this patch was to remove the usage of VEC(xmethod_worker_ptr) and corresponding cleanups. I ended up having to C++ify the xmethod_worker code, to be able to have xmethod_workers free their data in destructors, and therefore be able to use vectors of xmethod_worker unique_ptr. The operations in extension_language_ops that act on one instance of xmethod_worker (get result type, get args type, invoke) are transformed to methods of xmethod_worker. xmethod_worker becomes an abstract base class with virtual pure methods which python_xmethod_worker implements. The only xmethod-related operation left in extension_language_ops is get_matching_xmethod_workers, which returns a list of xmethod_workers. The changes are relatively straightforward, but here are some notes on things that may raise eyebrows: - I was not really comfortable with the value_of_xmethod function. At first it looks like a simple getter, so I considered making it a method of xmethod_worker. But actually it creates a value and transfers the ownership of the xmethod_worker to it. It would be a bit weird and error-prone if calling a method on an object silently removed the ownership of the object from the caller. To reflect the behavior more accurately, I renamed it to value_from_xmethod and made it accept an rvalue-reference (so the caller knows it gives away the ownership). I noticed the backlink from xmethod_worker to its owning value was not used, so I removed it. - Some code, like get_matching_xmethod_workers, made each callee fill a new vector, which was then merged in the result vector. I think it's safe if we always pass the same vector around, and each implementation just appends to it. - The clone operation does not seem particularly useful, it is removed in the following patch. gdb/ChangeLog: * extension-priv.h (enum ext_lang_rc): Remove, move to extension.h. (struct extension_language_ops) <clone_xmethod_worker_data>: Remove. <free_xmethod_worker_data>: Remove. <get_matching_xmethod_workers>: Chance VEC to std::vector. <get_xmethod_arg_types>: Remove. <get_xmethod_result_type>: Remove. <invoke_xmethod>: Remove. * extension.c (new_xmethod_worker): Remove. (clone_xmethod_worker): Remove. (get_matching_xmethod_workers): Return void, pass std::vector by pointer. (get_xmethod_arg_types): Rename to... (xmethod_worker::get_arg_types): ... this, and adjust. (get_xmethod_result_type): Rename to... (xmethod_worker::get_result_type): ... this, and adjust. (invoke_xmethod): Remove. (free_xmethod_worker): Remove. (free_xmethod_worker_vec): Remove. * extension.h (enum ext_lang_rc): Move here from extension-priv.h. (struct xmethod_worker): Add constructor and destructor. <data>: Remove. <value>: Remove. <invoke, clone, do_get_result_type, do_get_arg_types>: New virtual pure methods. <get_arg_types, get_result_type>: New methods. (xmethod_worker_ptr): Remove typedef. (DEF_VEC_P (xmethod_worker_ptr)): Remove. (xmethod_worker_vec): Remove typedef. (xmethod_worker_up): New typedef. (invoke_xmethod): Remove. (clone_xmethod_worker): Remove. (free_xmethod_worker): Remove. (free_xmethod_worker_vec): Remove. (get_xmethod_arg_types): Remove. (get_xmethod_result_type): Remove. * valops.c (find_method_list): Use std::vector, don't use intermediate vector. (value_find_oload_method_list): Use std::vector. (find_overload_match): Use std::vector. (find_oload_champ): Use std::vector. * value.c (value_free): Use operator delete. (value_of_xmethod): Rename to... (value_from_xmethod): ... this. Don't assign xmethod_worker::value, take rvalue-reference. (result_type_of_xmethod): Adjust. (call_xmethod): Adjust. * value.h: Include extension.h. (struct xmethod_worker): Don't forward-declare. (value_of_xmethod): Rename to... (value_from_xmethod): ... this, take rvalue-reference. * python/py-xmethods.c (struct gdbpy_worker_data): Rename to... (struct python_xmethod_worker): ... this, add constructor and destructor. <invoke, clone, do_get_arg_types, do_get_result_type>: Implement. (gdbpy_free_xmethod_worker_data): Rename to... (python_xmethod_worker::~python_xmethod_worker): ... this and adjust. (gdbpy_clone_xmethod_worker_data): Rename to... (python_xmethod_worker::clone): ... this and adjust. (gdbpy_get_matching_xmethod_workers): Use std::vector, don't use temporary vector. (gdbpy_get_xmethod_arg_types): Rename to... (python_xmethod_worker::do_get_arg_types): ... this and adjust. (gdbpy_get_xmethod_result_type): Rename to... (python_xmethod_worker::do_get_result_type): ... this and adjust. (gdbpy_invoke_xmethod): Rename to... (python_xmethod_worker::invoke): ... this and adjust. (new_python_xmethod_worker): Rename to... (python_xmethod_worker::python_xmethod_worker): ... this and adjust. * python/python-internal.h (gdbpy_clone_xmethod_worker_data): Remove. (gdbpy_free_xmethod_worker_data): Remove. (gdbpy_get_matching_xmethod_workers): Use std::vector. (gdbpy_get_xmethod_arg_types): Remove. (gdbpy_get_xmethod_result_type): Remove. (gdbpy_invoke_xmethod): Remove. * python/python.c (python_extension_ops): Remove obsolete callbacks.
2018-01-07 15:25:32 +01:00
2018-01-07 Simon Marchi <simon.marchi@polymtl.ca>
* extension-priv.h (enum ext_lang_rc): Remove, move to extension.h.
(struct extension_language_ops) <clone_xmethod_worker_data>: Remove.
<free_xmethod_worker_data>: Remove.
<get_matching_xmethod_workers>: Chance VEC to std::vector.
<get_xmethod_arg_types>: Remove.
<get_xmethod_result_type>: Remove.
<invoke_xmethod>: Remove.
* extension.c (new_xmethod_worker): Remove.
(clone_xmethod_worker): Remove.
(get_matching_xmethod_workers): Return void, pass std::vector by
pointer.
(get_xmethod_arg_types): Rename to...
(xmethod_worker::get_arg_types): ... this, and adjust.
(get_xmethod_result_type): Rename to...
(xmethod_worker::get_result_type): ... this, and adjust.
(invoke_xmethod): Remove.
(free_xmethod_worker): Remove.
(free_xmethod_worker_vec): Remove.
* extension.h (enum ext_lang_rc): Move here from
extension-priv.h.
(struct xmethod_worker): Add constructor and destructor.
<data>: Remove.
<value>: Remove.
<invoke, clone, do_get_result_type, do_get_arg_types>: New
virtual pure methods.
<get_arg_types, get_result_type>: New methods.
(xmethod_worker_ptr): Remove typedef.
(DEF_VEC_P (xmethod_worker_ptr)): Remove.
(xmethod_worker_vec): Remove typedef.
(xmethod_worker_up): New typedef.
(invoke_xmethod): Remove.
(clone_xmethod_worker): Remove.
(free_xmethod_worker): Remove.
(free_xmethod_worker_vec): Remove.
(get_xmethod_arg_types): Remove.
(get_xmethod_result_type): Remove.
* valops.c (find_method_list): Use std::vector, don't use
intermediate vector.
(value_find_oload_method_list): Use std::vector.
(find_overload_match): Use std::vector.
(find_oload_champ): Use std::vector.
* value.c (value_free): Use operator delete.
(value_of_xmethod): Rename to...
(value_from_xmethod): ... this. Don't assign
xmethod_worker::value, take rvalue-reference.
(result_type_of_xmethod): Adjust.
(call_xmethod): Adjust.
* value.h: Include extension.h.
(struct xmethod_worker): Don't forward-declare.
(value_of_xmethod): Rename to...
(value_from_xmethod): ... this, take rvalue-reference.
* python/py-xmethods.c (struct gdbpy_worker_data): Rename to...
(struct python_xmethod_worker): ... this, add constructor and
destructor.
<invoke, clone, do_get_arg_types, do_get_result_type>: Implement.
(gdbpy_free_xmethod_worker_data): Rename to...
(python_xmethod_worker::~python_xmethod_worker): ... this and
adjust.
(gdbpy_clone_xmethod_worker_data): Rename to...
(python_xmethod_worker::clone): ... this and adjust.
(gdbpy_get_matching_xmethod_workers): Use std::vector, don't use
temporary vector.
(gdbpy_get_xmethod_arg_types): Rename to...
(python_xmethod_worker::do_get_arg_types): ... this and adjust.
(gdbpy_get_xmethod_result_type): Rename to...
(python_xmethod_worker::do_get_result_type): ... this and
adjust.
(gdbpy_invoke_xmethod): Rename to...
(python_xmethod_worker::invoke): ... this and adjust.
(new_python_xmethod_worker): Rename to...
(python_xmethod_worker::python_xmethod_worker): ... this and
adjust.
* python/python-internal.h (gdbpy_clone_xmethod_worker_data):
Remove.
(gdbpy_free_xmethod_worker_data): Remove.
(gdbpy_get_matching_xmethod_workers): Use std::vector.
(gdbpy_get_xmethod_arg_types): Remove.
(gdbpy_get_xmethod_result_type): Remove.
(gdbpy_invoke_xmethod): Remove.
* python/python.c (python_extension_ops): Remove obsolete
callbacks.
Fix regression: cannot start with LD_PRELOAD=libSegFault.so (PR gdb/18653#c7) At https://sourceware.org/bugzilla/show_bug.cgi?id=18653#c7, Andrew reports that the fix for PR gdb/18653 made GDB useless if you preload libSegFault.so, because GDB internal-errors on startup: $ LD_PRELOAD=libSegFault.so gdb src/gdb/common/signals-state-save-restore.c:64: internal-error: unexpected signal handler A problem internal to GDB has been detected, further debugging may prove unreliable. Aborted (core dumped) $ The internal error comes from the code saving the signal dispositions inherited from gdb's parent: (top-gdb) bt #0 0x000000000056b001 in internal_error(char const*, int, char const*, ...) (file=0xaf5f38 "src/gdb/common/signals-state-save-restore.c", line=64, fmt=0xaf5f18 "unexpected signal handler") at src/gdb/common/errors.c:54 #1 0x00000000005752c9 in save_original_signals_state() () at src/gdb/common/signals-state-save-restore.c:64 #2 0x00000000007425de in captured_main_1(captured_main_args*) (context=0x7fffffffd860) at src/gdb/main.c:509 #3 0x0000000000743622 in captured_main(void*) (data=0x7fffffffd860) at src/gdb/main.c:1145 During symbol reading, cannot get low and high bounds for subprogram DIE at 24065. #4 0x00000000007436f9 in gdb_main(captured_main_args*) (args=0x7fffffffd860) at src/gdb/main.c:1171 #5 0x0000000000413acd in main(int, char**) (argc=1, argv=0x7fffffffd968) at src/gdb/gdb.c:32 This commit downgrades the internal error to a warning. You'll get instead: ~~~ $ LD_PRELOAD=libSegFault.so gdb warning: Found custom handler for signal 11 (Segmentation fault) preinstalled. Some signal dispositions inherited from the environment (SIG_DFL/SIG_IGN) won't be propagated to spawned programs. GNU gdb (GDB) 8.0.50.20171213-git Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... (gdb) ~~~ This also moves the location where save_original_signals_state is called a bit further below (to after option processing), so that "-q" disables the warning: ~~~ $ LD_PRELOAD=libSegFault.so gdb -q (gdb) ~~~ New testcase included. gdb/ChangeLog: 2018-01-05 Pedro Alves <palves@redhat.com> PR gdb/18653 * common/signals-state-save-restore.c (save_original_signals_state): New parameter 'quiet'. Warn if we find a custom handler preinstalled, instead of internal erroring. But only warn if !quiet. * common/signals-state-save-restore.h (save_original_signals_state): New parameter 'quiet'. * main.c (captured_main_1): Move save_original_signals_state call after option handling, and pass QUIET. gdb/gdbserver/ChangeLog: 2018-01-05 Pedro Alves <palves@redhat.com> PR gdb/18653 * server.c (captured_main): Pass quiet=false to save_original_signals_state. gdb/testsuite/ChangeLog: 2018-01-05 Pedro Alves <palves@redhat.com> PR gdb/18653 * gdb.base/libsegfault.exp: New.
2018-01-05 19:26:18 +01:00
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/18653
* common/signals-state-save-restore.c
(save_original_signals_state): New parameter 'quiet'. Warn if we
find a custom handler preinstalled, instead of internal erroring.
But only warn if !quiet.
* common/signals-state-save-restore.h
(save_original_signals_state): New parameter 'quiet'.
* main.c (captured_main_1): Move save_original_signals_state call
after option handling, and pass QUIET.
2018-01-05 Pedro Alves <palves@redhat.com>
* spu-tdep.c (spu_catch_start): Pass
symbol_name_match_type::SEARCH_NAME to block_lookup_symbol.
Fix regresssion(internal-error) printing subprogram argument (PR gdb/22670) At <https://sourceware.org/ml/gdb-patches/2017-12/msg00298.html>, Joel wrote: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider the following code which first declares a tagged type (the equivalent of a class in Ada), and then a procedure which takes a pointer (access) to this type's 'Class. package Pck is type Top_T is tagged record N : Integer := 1; end record; procedure Inspect (Obj: access Top_T'Class); end Pck; Putting a breakpoint in that procedure and then running to it triggers an internal error: (gdb) break inspect (gdb) continue Breakpoint 1, pck.inspect (obj=0x63e010 /[...]/gdb/stack.c:621: internal-error: void print_frame_args(symbol*, frame_info*, int, ui_file*): Assertion `nsym != NULL' failed. What's special about this subprogram is that it takes an access to what we call a 'Class type, and for implementation reasons, the compiler adds an extra argument named "objL". If you are curious why, it allows the compiler for perform dynamic accessibility checks that are mandated by the language. If we look at the location where we get the internal error (in stack.c), we find that we are looping over the symbol of each parameter, and for each parameter, we do: /* We have to look up the symbol because arguments can have two entries (one a parameter, one a local) and the one we want is the local, which lookup_symbol will find for us. [...] nsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), b, VAR_DOMAIN, NULL).symbol; gdb_assert (nsym != NULL); The lookup_symbol goes through the lookup structure, which means the symbol's linkage name ("objL") gets transformed into a lookup_name_info object (in block_lookup_symbol), before it gets fed to the block symbol dictionary iterators. This, in turn, triggers the symbol matching by comparing the "lookup" name which, for Ada, means among other things, lowercasing the given name to "objl". It is this transformation that causes the lookup find no matches, and therefore trip this assertion. Going back to the "offending" call to lookup_symbol in stack.c, what we are trying to do, here, is do a lookup by linkage name. So, I think what we mean to be doing is a completely literal symbol lookup, so maybe not even strcmp_iw, but actually just plain strcmp??? In the past, in practice, you could get that effect by doing a lookup using the C language. But that doesn't work, because we still end up somehow using Ada's lookup_name routine which transforms "objL". So, ideally, as I hinted before, I think what we need is a way to perform a literal lookup so that searches by linkage names like the above can be performed. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This commit fixes the problem by implementing something similar to Joel's literal idea, but with some important differences. I considered adding a symbol_name_match_type::LINKAGE and supporting searching by linkage name for any language, but the problem with that is that the dictionaries only work with SYMBOL_SEARCH_NAME, because that's what is used for hashing. We'd need separate dictionaries for hashed linkage names. So with the current symbol tables infrastructure, it's not literal linkage names that we want to pass down, but instead literal _search_ names (SYMBOL_SEARCH_NAME, etc.). However, psymbols have no overload/function parameter info in C++, so a straight strcmp doesn't work properly for C++ name matching. So what we do is be a little less aggressive then and add a new symbol_name_match_type::SEARCH_SYMBOL instead that takes as input a non-user-input search symbol, and then we skip any decoding/demangling steps and make: - Ada treat that as a verbatim match, - other languages treat it as symbol_name_match_type::FULL. This also fixes the new '"maint check-psymtabs" for Ada' testcase for me (gdb.ada/maint_with_ada.exp). I've not removed the kfail yet because Joel still sees that testcase failing with this patch. That'll be fixed in follow up patches. gdb/ChangeLog: 2018-01-05 Pedro Alves <palves@redhat.com> PR gdb/22670 * ada-lang.c (literal_symbol_name_matcher): New function. (ada_get_symbol_name_matcher): Use it for symbol_name_match_type::SEARCH_NAME. * block.c (block_lookup_symbol): New parameter 'match_type'. Pass it down instead of assuming symbol_name_match_type::FULL. * block.h (block_lookup_symbol): New parameter 'match_type'. * c-valprint.c (print_unpacked_pointer): Use lookup_symbol_search_name instead of lookup_symbol. * compile/compile-object-load.c (get_out_value_type): Pass down symbol_name_match_type::SEARCH_NAME. * cp-namespace.c (cp_basic_lookup_symbol): Pass down symbol_name_match_type::FULL. * cp-support.c (cp_get_symbol_name_matcher): Handle symbol_name_match_type::SEARCH_NAME. * infrun.c (insert_exception_resume_breakpoint): Use lookup_symbol_search_name. * p-valprint.c (pascal_val_print): Use lookup_symbol_search_name. * psymtab.c (maintenance_check_psymtabs): Use symbol_name_match_type::SEARCH_NAME and SYMBOL_SEARCH_NAME. * stack.c (print_frame_args): Use lookup_symbol_search_name and SYMBOL_SEARCH_NAME. * symtab.c (lookup_local_symbol): Don't demangle the lookup name if symbol_name_match_type::SEARCH_NAME. (lookup_symbol_in_language): Pass down symbol_name_match_type::FULL. (lookup_symbol_search_name): New. (lookup_language_this): Pass down symbol_name_match_type::SEARCH_NAME. (lookup_symbol_aux, lookup_local_symbol): New parameter 'match_type'. Pass it down. * symtab.h (symbol_name_match_type::SEARCH_NAME): New enumerator. (lookup_symbol_search_name): New declaration. (lookup_symbol_in_block): New 'match_type' parameter. gdb/testsuite/ChangeLog: 2018-01-05 Joel Brobecker <brobecker@adacore.com> PR gdb/22670 * gdb.ada/access_tagged_param.exp: New file. * gdb.ada/access_tagged_param/foo.adb: New file.
2018-01-05 15:04:09 +01:00
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/22670
* ada-lang.c (literal_symbol_name_matcher): New function.
(ada_get_symbol_name_matcher): Use it for
symbol_name_match_type::SEARCH_NAME.
* block.c (block_lookup_symbol): New parameter 'match_type'. Pass
it down instead of assuming symbol_name_match_type::FULL.
* block.h (block_lookup_symbol): New parameter 'match_type'.
* c-valprint.c (print_unpacked_pointer): Use
lookup_symbol_search_name instead of lookup_symbol.
* compile/compile-object-load.c (get_out_value_type): Pass down
symbol_name_match_type::SEARCH_NAME.
* cp-namespace.c (cp_basic_lookup_symbol): Pass down
symbol_name_match_type::FULL.
* cp-support.c (cp_get_symbol_name_matcher): Handle
symbol_name_match_type::SEARCH_NAME.
* infrun.c (insert_exception_resume_breakpoint): Use
lookup_symbol_search_name.
* p-valprint.c (pascal_val_print): Use lookup_symbol_search_name.
* psymtab.c (maintenance_check_psymtabs): Use
symbol_name_match_type::SEARCH_NAME and SYMBOL_SEARCH_NAME.
* stack.c (print_frame_args): Use lookup_symbol_search_name and
SYMBOL_SEARCH_NAME.
* symtab.c (lookup_local_symbol): Don't demangle the lookup name
if symbol_name_match_type::SEARCH_NAME.
(lookup_symbol_in_language): Pass down
symbol_name_match_type::FULL.
(lookup_symbol_search_name): New.
(lookup_language_this): Pass down
symbol_name_match_type::SEARCH_NAME.
(lookup_symbol_aux, lookup_local_symbol): New parameter
'match_type'. Pass it down.
* symtab.h (symbol_name_match_type::SEARCH_NAME): New enumerator.
(lookup_symbol_search_name): New declaration.
(lookup_symbol_in_block): New 'match_type' parameter.
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/22670
* ada-lang.c (ada_lookup_encoded_symbol): Reimplement in terms of
ada_lookup_symbol.
(ada_lookup_symbol): Reimplement in terms of
ada_lookup_symbol_list, bits factored out from
ada_lookup_encoded_symbol.
(Ada) problem printing renaming which references a subprogram parameter Consider the following code, which creates a local variable B which is a renaming whose expression references a subprogram parameter: procedure Flip (Bits : in out Bits_Type; I : Natural) is begin declare B : Boolean renames Bits (I); begin B := not B; -- BREAK end; end Flip; Trying to print the value of B when at the "BREAK" line currently does not work: (gdb) p b Could not find i What happens is the following: For the renaming, GNAT generates a variable whose name is encoded as follow: b___XR_bits___XEXSi GDB properly detects that variable, determines that, to compute the variable's value, we start from the symbol "Bits", which we then have to subscript (XS) using 'i' as the index. The error occurs while trying to find 'i'. This is because we forgot to pass the block in the call to ada_lookup_encoded_symbol, which this patch fixes. gdb/ChangeLog: * ada-exp.y (write_object_renaming): When subscripting an array using a symbol as the index, pass the block in call to ada_lookup_encoded_symbol when looking that symbol up. gdb/testsuite/ChangeLog: * gdb.ada/rename_subscript_param: New testcase. Tested on x86_64-linux. Note: This requires the following GCC patch: | 2017-04-25 Pierre-Marie de Rodat <derodat@adacore.com> | | * exp_dbug.adb: In Debug_Renaming_Declaration, | when dealing with indexed component, accept to produce a renaming | symbol when the index is an IN parameter or when it is a name | defined in an outer scope.
2018-01-05 10:29:54 +01:00
2018-01-05 Joel Brobecker <brobecker@adacore.com>
* ada-exp.y (write_object_renaming): When subscripting an array
using a symbol as the index, pass the block in call to
ada_lookup_encoded_symbol when looking that symbol up.
2018-01-05 Jerome Guitton <guitton@adacore.com>
* ada-lang.c (ada_array_length): Use ada_index_type instead of
TYPE_INDEX_TYPE.
memory error printing component of record from convenience variable Consider the following situation Ada code: type Kind_T is (One, Two, Three); type Time_Set_T is array (Kind_T) of Integer; type T is record Started : Time_Set_T; end record; Null_T : constant T := (Started => (others => 0)); My_Item : Pck.T := Pck.Null_T; Trying to print the value of My_Item.Started is no problem: (gdb) p item.started $1 = (0, 0, 0) However, if you save My_Item into a convenience variable first, and then try to print a component of that record, you get an unexpected memory error, instead of getting the same result. For instance: (gdb) set variable $item := item (gdb) p $item.started Cannot access memory at address 0x0 The issue occurs when, after we extracted the component from the convenience variable, we next try to "fix" it (which is ada-lang speak for resolving the type into a static type). This is done in ada_to_fixed_value, which delegates to ada_to_fixed_value_create via: val = ada_to_fixed_value_create (value_type (val), value_address (val), val); And looking at ada_to_fixed_value_create, we see that: struct type *type = ada_to_fixed_type (type0, 0, address, NULL, 1); if (type == type0 && val0 != NULL) return val0; else return value_from_contents_and_address (type, 0, address); The part that interests us, in this case, is the "else" branch, where we obviously make the implicit assumption that our object has an address, which is not true, in this case, because we are actually dealing with a convenience variable. This patch plugs that hole by adding special handing for situations where val does not live in memory. In that case, we just create a not_lval value using val's contents. gdb/ChangeLog: * ada-lang.c (ada_to_fixed_value_create): Add handling of the case where VALUE_LVAL (val0) is not lval_memory. gdb/testsuite/ChangeLog: * gdb.ada/convvar_comp: New testcase. Tested on x86_64-linux.
2018-01-05 08:37:38 +01:00
2018-01-05 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (ada_to_fixed_value_create): Add handling of
the case where VALUE_LVAL (val0) is not lval_memory.
2018-01-05 08:39:10 +01:00
2018-01-05 Xavier Roirand <roirand@adacore.com>
* ada-valprint.c (print_optional_low_bound): Handle
character-indexed array printing like boolean-indexed array
printing.
2018-01-05 Joel Brobecker <brobecker@adacore.com>
* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.
2018-01-05 Joel Brobecker <brobecker@adacore.com>
GDB 8.1 branch created (5219ac6237c272b938c28517bf371429260c71e7):
* version.in: Bump version to 8.1.50.DATE-git.
(Ada) New command to stop at start of exception handler. When using gdb for debugging Ada source code, there are several catchpoint types you can define in order to stop upon certain conditions. Let's use this small example: procedure Foo is begin begin raise Constraint_Error; exception when Program_Error => null; when Constraint_Error => null; when others => null; end; end Foo; One can stop when the exception is being raised by using the exception catchpoint like below: (gdb) catch exception Catchpoint 1: all Ada exceptions (gdb) In that case, when running Foo, gdb will stop at the line where the exception was raised: begin >>> raise Constraint_Error; exception This patch introduces new type of catchpoint, when the user wants to stop at the location of the exception handling. Imagine we want to stop on any exception handled by the program, we can do: (gdb) catch handlers Catchpoint 1: all Ada exceptions handlers (gdb) r Starting program: /tmp/foo By doing so, when running Foo, gdb will stop here: Catchpoint 1, exception at 0x000000000040255a in foo () at foo.adb:25 25 when Constraint_Error => (gdb) It is also possible to stop when the Constraint_Error exception is being handled in this program. With this patch, we can use: (gdb) catch handlers Constraint_Error Catchpoint 1: `Constraint_Error' Ada exception handlers (gdb) Like for other catchpoint, you can set a condition when adding a catchpoint on exception handlers. Here the handlers catchpoint checks Global_Var: (gdb) catch handlers Constraint_Error if Global_Var /= 0 gdb/ChangeLog: * ada-lang.h (ada_exception_catchpoint_kind) <ada_catch_handlers>: Add field. * ada-lang.c (struct exception_support_info) <catch_handlers_sym>: Add field. (default_exception_support_info) <catch_handlers_sym>: Add field. (exception_support_info_fallback) <catch_handlers_sym>: Add field. (ada_exception_name_addr_1): Add "catch handlers" handling. (ada_exception_catchpoint_cond_string) <ex>: New parameter. Update all callers. (create_excep_cond_exprs) <ex>: Add parameter. (re_set_exception): Update create_excep_cond_exprs call. (print_it_exception, print_one_exception, print_mention_exception) (print_recreate_exception): Add "catch handler" handling. (allocate_location_catch_handlers, re_set_catch_handlers) (check_status_catch_handlers, print_it_catch_handlers) (print_one_catch_handlers, print_mention_catch_handlers) (print_recreate_catch_handlers): New function. (catch_handlers_breakpoint_ops): New variable. (catch_ada_exception_command_split) <is_catch_handlers_cmd>: Add parameter. Add "catch handler" handling. (ada_exception_sym_name, ada_exception_breakpoint_ops): Add "catch handler" handling. (ada_exception_catchpoint_cond_string): Add "catch handler" handling. (create_ada_exception_catchpoint): Update create_excep_cond_exprs call. (catch_ada_handlers_command): New function. (initialize_ada_catchpoint_ops): Initialize "catch handlers" operations structure. (_initialize_ada_language): Add "catch handlers" command entry. * NEWS: Document "catch handlers" feature. gdb/doc/ChangeLog: * gdb.texinfo (Set Catchpoints): Add documentation for new "catch handlers" action. gdb/testsuite/ChangeLog: * gdb.ada/excep_handle.exp: New testcase. * gdb.ada/excep_handle/foo.adb: New file. * gdb.ada/excep_handle/pck.ads: New file. Tested on x86_64-linux.
2017-11-22 10:40:39 +01:00
2018-01-03 Xavier Roirand <roirand@adacore.com>
* ada-lang.h (ada_exception_catchpoint_kind) <ada_catch_handlers>:
Add field.
* ada-lang.c (struct exception_support_info) <catch_handlers_sym>:
Add field.
(default_exception_support_info) <catch_handlers_sym>: Add field.
(exception_support_info_fallback) <catch_handlers_sym>: Add field.
(ada_exception_name_addr_1): Add "catch handlers" handling.
(ada_exception_catchpoint_cond_string) <ex>: New parameter.
Update all callers.
(create_excep_cond_exprs) <ex>: Add parameter.
(re_set_exception): Update create_excep_cond_exprs call.
(print_it_exception, print_one_exception, print_mention_exception)
(print_recreate_exception): Add "catch handler" handling.
(allocate_location_catch_handlers, re_set_catch_handlers)
(check_status_catch_handlers, print_it_catch_handlers)
(print_one_catch_handlers, print_mention_catch_handlers)
(print_recreate_catch_handlers): New function.
(catch_handlers_breakpoint_ops): New variable.
(catch_ada_exception_command_split) <is_catch_handlers_cmd>:
Add parameter. Add "catch handler" handling.
(ada_exception_sym_name, ada_exception_breakpoint_ops):
Add "catch handler" handling.
(ada_exception_catchpoint_cond_string): Add "catch handler"
handling.
(create_ada_exception_catchpoint): Update create_excep_cond_exprs
call.
(catch_ada_handlers_command): New function.
(initialize_ada_catchpoint_ops): Initialize "catch handlers"
operations structure.
(_initialize_ada_language): Add "catch handlers" command entry.
* NEWS: Document "catch handlers" feature.
[gdb/Ada] slices of arrays with dynamic strides Consider the following Ada code: procedure Nested (L, U : Integer) is subtype Small_Type is Integer range L .. U; type Record_Type (I : Small_Type := L) is record S : String (1 .. I); end record; type Array_Type is array (Integer range <>) of Record_Type; A1 : Array_Type := (1 => (I => 0, S => <>), 2 => (I => 1, S => "A"), 3 => (I => 2, S => "AB")); procedure Discard (R : Record_Type) is begin null; end Discard; begin Discard (A1 (1)); -- STOP end; Trying to print a slice of that array currently yields: (gdb) p a1(1..3) $1 = ((i => 0, s => ""), (i => 0, s => ""), (i => 0, s => "")) We expected instead: (gdb) p a1(1..3) $1 = ((i => 0, s => ""), (i => 1, s => "A"), (i => 2, s => "AB")) This is because the functions we use in ada-lang.c to create the type of the array slice (ada_value_slice and ada_value_slice_from_ptr) was not taking into account the stride of the array. This patch fixes this. gdb/ChangeLog: * ada-lang.c (ada_value_slice_from_ptr): Take array stride into account when creating the array type of the slice. (ada_value_slice): Likewise. gdb/testsuite/ChangeLog: * gdb.ada/dyn_stride.exp: Add slice test. Note that, with the current use of ada_value_slice, the enhancement to handle dynamic array strides seems unnecessary, because I do not see how an array with a dynamic stride can be referenced by either by reference or pointer. Since references are coerced to array pointers, in both cases, the slice is performed by ada_value_slice_from_ptr. But ada_value_slice is enhanced nonetheless, in the spirit of making the code more robust, in case we missed something, and also as similar as possible with its from_ptr counterpart. tested on x86_64-linux.
2018-01-02 04:53:55 +01:00
2018-01-02 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (ada_value_slice_from_ptr): Take array stride into
account when creating the array type of the slice.
(ada_value_slice): Likewise.
Add support for dynamic DW_AT_byte_stride. This patch adds support for DW_AT_byte_stride, using Ada as one example of where this would be useful. However, the implementation is language-agnostic. Consider the following Ada code: procedure Nested (L, U : Integer) is subtype Small_Type is Integer range L .. U; type Record_Type (I : Small_Type := L) is record S : String (1 .. I); end record; type Array_Type is array (Integer range <>) of Record_Type; A1 : Array_Type := (1 => (I => 0, S => <>), 2 => (I => 1, S => "A"), 3 => (I => 2, S => "AB")); procedure Discard (R : Record_Type) is begin null; end Discard; begin Discard (A1 (1)); -- STOP end; It defines an array A1 of Record_Type, which is a variant record type whose maximum size actually depends on the value of the parameters passed when calling Nested. As a result, the stride of the array A1 cannot be known statically, which leads the compiler to generate a dynamic DW_AT_byte_stride attribute for our type. Here is what the debugging info looks like with GNAT: .uleb128 0x10 # (DIE (0x14e) DW_TAG_array_type) .long .LASF17 # DW_AT_name: "foo__nested__T18b" .long 0x141 # DW_AT_byte_stride .long 0xdc # DW_AT_type .uleb128 0x11 # (DIE (0x15f) DW_TAG_subrange_type) .long 0x166 # DW_AT_type .byte 0x3 # DW_AT_upper_bound .byte 0 # end of children of DIE 0x14e There DW_AT_byte_stride is a reference to a local (internal) variable: .uleb128 0x9 # (DIE (0x141) DW_TAG_variable) .long .LASF6 # DW_AT_name: "foo__nested__T18b___PAD___XVZ" This patch enhances GDB to handle this dynamic byte stride attribute by first adding a new dynamic_prop_node_kind (DYN_PROP_BYTE_STRIDE) to store the array dynamic stride info (when dynamic). It then enhances the dynamic type resolver to handle this dynamic property. Before applying this patch, trying to print the value of some of A1's elements after having stopped at the "STOP" comment does not work. For instance: (gdb) p a1(2) Cannot access memory at address 0x80000268dec0 With this patch applied, GDB now prints the value of all 3 elements correctly: (gdb) print A1(1) $1 = (i => 0, s => "") (gdb) print A1(2) $2 = (i => 1, s => "A") (gdb) print A1(3) $3 = (i => 2, s => "AB") gdb/ChangeLog: * gdbtypes.h (enum dynamic_prop_node_kind) <DYN_PROP_BYTE_STRIDE>: New enum value. (create_array_type_with_stride): Add byte_stride_prop parameter. * gdbtypes.c (create_array_type_with_stride) <byte_stride_prop>: New parameter. Update all callers in this file. (array_type_has_dynamic_stride): New function. (is_dynamic_type_internal, resolve_dynamic_array): Add handling of arrays with dynamic byte strides. * dwarf2read.c (read_array_type): Add support for dynamic DW_AT_byte_stride attributes. gdb/testsuite/ChangeLog: * gdb.ada/dyn_stride: New testcase. Tested on x86_64-linux.
2018-01-02 04:47:18 +01:00
2018-01-02 Joel Brobecker <brobecker@adacore.com>
* gdbtypes.h (enum dynamic_prop_node_kind) <DYN_PROP_BYTE_STRIDE>:
New enum value.
(create_array_type_with_stride): Add byte_stride_prop parameter.
* gdbtypes.c (create_array_type_with_stride) <byte_stride_prop>:
New parameter. Update all callers in this file.
(array_type_has_dynamic_stride): New function.
(is_dynamic_type_internal, resolve_dynamic_array): Add handling
of arrays with dynamic byte strides.
* dwarf2read.c (read_array_type): Add support for dynamic
DW_AT_byte_stride attributes.
2018-01-02 Joel Brobecker <brobecker@adacore.com>
* dwarf2read.c (read_unspecified_type): Treat
DW_TAG_enumeration_type DIEs from Ada units as stubs.
2018-01-01 Joel Brobecker <brobecker@adacore.com>
Update copyright year range in all GDB files.
2018-01-01 Joel Brobecker <brobecker@adacore.com>
* copyright.py (BY_HAND): Remove gdb/testsuite/gdb.base/step-line.inp
and gdb/testsuite/gdb.base/step-line.c.
2018-01-01 Joel Brobecker <brobecker@adacore.com>
* copyright.py (main): Dump the contents of
MULTIPLE_COPYRIGHT_HEADERS (separately) from BY_HAND,
even if BY_HAND is empty.
2018-01-01 Joel Brobecker <brobecker@adacore.com>
* top.c (print_gdb_version): Update Copyright year in version
message.
2018-01-01 Joel Brobecker <brobecker@adacore.com>
* config/djgpp/fnchange.lst: Add entry for gdb/ChangeLog-2017.
For older changes see ChangeLog-2017.
Local Variables:
mode: change-log
left-margin: 8
fill-column: 74
version-control: never
2007-08-10 00:44:38 +02:00
coding: utf-8
End: