Age | Commit message (Collapse) | Author | Files | Lines |
|
This fixes a typo that used strncmp instead of strprefix when
checking for an exec event in a stop reply packet.
gdb/ChangeLog:
* remote.c (remote_parse_stop_reply): Call strprefix instead
of strncmp.
|
|
See previous patch's description.
gdb/ChangeLog:
* macrocmd.c (print_macro_callback): Add cast(s).
* macrotab.c (macro_bcache_str): Likewise.
(new_macro_definition): Likewise.
* main.c (captured_main): Likewise.
* maint.c (print_bfd_section_info): Likewise.
* mdebugread.c (mdebug_build_psymtabs): Likewise.
(basic_type): Likewise.
* memattr.c (mem_region_cmp): Likewise.
* memory-map.c (memory_map_start_memory): Likewise.
(memory_map_end_memory): Likewise.
(memory_map_start_property): Likewise.
(memory_map_end_property): Likewise.
(clear_result): Likewise.
* memrange.c (compare_mem_ranges): Likewise.
* mep-tdep.c (mep_analyze_frame_prologue): Likewise.
* mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise.
* mi/mi-console.c (mi_console_file_delete): Likewise.
(mi_console_file_fputs): Likewise.
(mi_console_raw_packet): Likewise.
(mi_console_file_flush): Likewise.
(mi_console_set_raw): Likewise.
* mi/mi-interp.c (mi_interpreter_resume): Likewise.
(mi_new_thread): Likewise.
(mi_thread_exit): Likewise.
(mi_record_changed): Likewise.
(mi_inferior_added): Likewise.
(mi_inferior_appeared): Likewise.
(mi_inferior_exit): Likewise.
(mi_inferior_removed): Likewise.
(mi_interp_data): Likewise.
(mi_on_normal_stop): Likewise.
(mi_traceframe_changed): Likewise.
(mi_tsv_created): Likewise.
(mi_tsv_deleted): Likewise.
(mi_tsv_modified): Likewise.
(mi_breakpoint_created): Likewise.
(mi_breakpoint_deleted): Likewise.
(mi_breakpoint_modified): Likewise.
(mi_output_running_pid): Likewise.
(mi_inferior_count): Likewise.
(mi_solib_loaded): Likewise.
(mi_solib_unloaded): Likewise.
(mi_command_param_changed): Likewise.
(mi_memory_changed): Likewise.
(report_initial_inferior): Likewise.
(mi_ui_out): Likewise.
(mi_set_logging): Likewise.
* mi/mi-main.c (collect_cores): Likewise.
(print_one_inferior): Likewise.
(free_vector_of_ints): Likewise.
(free_splay_tree): Likewise.
(mi_execute_command): Likewise.
* mi/mi-out.c (mi_table_body): Likewise.
(mi_table_end): Likewise.
(mi_table_header): Likewise.
(mi_begin): Likewise.
(mi_end): Likewise.
(mi_field_int): Likewise.
(mi_field_string): Likewise.
(mi_field_fmt): Likewise.
(mi_flush): Likewise.
(mi_redirect): Likewise.
(field_separator): Likewise.
(mi_open): Likewise.
(mi_close): Likewise.
(mi_out_buffered): Likewise.
(mi_out_rewind): Likewise.
(mi_out_put): Likewise.
(mi_version): Likewise.
(mi_out_data_dtor): Likewise.
* mi/mi-parse.c (mi_parse_cleanup): Likewise.
* microblaze-tdep.c (microblaze_frame_cache): Likewise.
* minidebug.c (lzma_open): Likewise.
(lzma_pread): Likewise.
(lzma_close): Likewise.
(lzma_stat): Likewise.
* mips-linux-tdep.c (mips_linux_init_abi): Likewise.
* mips-sde-tdep.c (mips_sde_frame_cache): Likewise.
(mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise.
* mips-tdep.c (mips_insn16_frame_cache): Likewise.
(mips_micro_frame_cache): Likewise.
(mips_insn32_frame_cache): Likewise.
(mips_stub_frame_cache): Likewise.
(gdb_print_insn_mips): Likewise.
(value_of_mips_user_reg): Likewise.
(mips_gdbarch_init): Likewise.
* mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise.
* mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise.
(mipsnbsd_supply_gregset): Likewise.
* mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise.
(am33_collect_gregset_method): Likewise.
(am33_collect_fpregset_method): Likewise.
* mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise.
* moxie-tdep.c (moxie_frame_cache): Likewise.
* msp430-tdep.c (msp430_get_opcode_byte): Likewise.
(msp430_analyze_frame_prologue): Likewise.
* mt-tdep.c (mt_frame_unwind_cache): Likewise.
* nios2-linux-tdep.c (nios2_supply_gregset): Likewise.
(nios2_collect_gregset): Likewise.
* nios2-tdep.c (nios2_frame_unwind_cache): Likewise.
(nios2_stub_frame_cache): Likewise.
* objc-lang.c (find_methods): Likewise.
* objfiles.c (objfiles_pspace_data_cleanup): Likewise.
(get_objfile_pspace_data): Likewise.
(get_objfile_bfd_data): Likewise.
(objfile_bfd_data_free): Likewise.
(add_to_objfile_sections): Likewise.
(do_free_objfile_cleanup): Likewise.
(resume_section_map_updates_cleanup): Likewise.
* opencl-lang.c (builtin_opencl_type): Likewise.
* osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise.
* osdata.c (osdata_start_osdata): Likewise.
(osdata_start_item): Likewise.
(osdata_start_column): Likewise.
(osdata_end_column): Likewise.
(clear_parsing_data): Likewise.
(osdata_free_cleanup): Likewise.
* parse.c (type_stack_cleanup): Likewise.
(exp_uses_objfile_iter): Likewise.
* ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise.
(ppc_linux_collect_gregset): Likewise.
(ppu2spu_prev_arch): Likewise.
(ppu2spu_this_id): Likewise.
(ppu2spu_prev_register): Likewise.
(ppu2spu_unwind_register): Likewise.
(ppu2spu_sniffer): Likewise.
(ppu2spu_dealloc_cache): Likewise.
(ppc_linux_init_abi): Likewise.
* ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* progspace.c (restore_program_space): Likewise.
* psymtab.c (find_pc_sect_psymtab): Likewise.
(compare_psymbols): Likewise.
(psymbol_bcache_full): Likewise.
(allocate_psymtab): Likewise.
(discard_psymtabs_upto): Likewise.
* python/py-block.c (set_block): Likewise.
(del_objfile_blocks): Likewise.
* python/py-breakpoint.c (build_bp_list): Likewise.
* python/py-inferior.c (inferior_to_inferior_object): Likewise.
(build_inferior_list): Likewise.
(py_free_inferior): Likewise.
* python/py-objfile.c (py_free_objfile): Likewise.
(objfile_to_objfile_object): Likewise.
* python/py-prettyprint.c (py_restore_tstate): Likewise.
* python/py-progspace.c (py_free_pspace): Likewise.
(pspace_to_pspace_object): Likewise.
* python/py-symbol.c (set_symbol): Likewise.
(del_objfile_symbols): Likewise.
* python/py-symtab.c (set_sal): Likewise.
(set_symtab): Likewise.
(del_objfile_symtab): Likewise.
(del_objfile_sal): Likewise.
* python/py-type.c (save_objfile_types): Likewise.
(set_type): Likewise.
* python/py-unwind.c (pyuw_prev_register): Likewise.
(pyuw_on_new_gdbarch): Likewise.
* python/py-utils.c (py_decref): Likewise.
(py_xdecref): Likewise.
(gdb_py_generic_dict): Likewise.
* python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise.
(gdbpy_clone_xmethod_worker_data): Likewise.
(gdbpy_get_xmethod_arg_types): Likewise.
(gdbpy_get_xmethod_result_type): Likewise.
(gdbpy_invoke_xmethod): Likewise.
* python/python.c (gdbpy_apply_type_printers): Likewise.
(gdbpy_free_type_printers): Likewise.
* record-btrace.c (record_btrace_disable_callback): Likewise.
(bfcache_hash): Likewise.
(bfcache_eq): Likewise.
(btrace_get_frame_function): Likewise.
(record_btrace_frame_unwind_stop_reason): Likewise.
(record_btrace_frame_this_id): Likewise.
(record_btrace_frame_prev_register): Likewise.
(record_btrace_frame_dealloc_cache): Likewise.
* record-full.c (record_full_message_wrapper): Likewise.
(record_full_save_cleanups): Likewise.
* regcache.c (regcache_descr): Likewise.
(do_regcache_xfree): Likewise.
(do_regcache_invalidate): Likewise.
(do_cooked_read): Likewise.
(regcache_transfer_regset): Likewise.
* reggroups.c (reggroup_add): Likewise.
(reggroup_next): Likewise.
(reggroup_prev): Likewise.
* remote-fileio.c (do_remote_fileio_request): Likewise.
* remote-notif.c (remote_async_get_pending_events_handler): Likewise.
(do_notif_event_xfree): Likewise.
* remote.c (get_remote_arch_state): Likewise.
(remote_pspace_data_cleanup): Likewise.
(get_remote_exec_file): Likewise.
(set_pspace_remote_exec_file): Likewise.
(compare_pnums): Likewise.
(clear_threads_listing_context): Likewise.
(remote_newthread_step): Likewise.
(start_thread): Likewise.
(end_thread): Likewise.
(remove_child_of_pending_fork): Likewise.
(remove_stop_reply_for_inferior): Likewise.
(remove_stop_reply_of_remote_state): Likewise.
(remote_notif_remove_once_on_match): Likewise.
(stop_reply_match_ptid_and_ws): Likewise.
(kill_child_of_pending_fork): Likewise.
(register_remote_g_packet_guess): Likewise.
(remote_read_description_p): Likewise.
(remote_read_description): Likewise.
(free_actions_list_cleanup_wrapper): Likewise.
(remote_async_serial_handler): Likewise.
* rl78-tdep.c (rl78_get_opcode_byte): Likewise.
(rl78_analyze_frame_prologue): Likewise.
* rs6000-tdep.c (ppc_supply_gregset): Likewise.
(ppc_supply_fpregset): Likewise.
(ppc_supply_vsxregset): Likewise.
(ppc_supply_vrregset): Likewise.
(ppc_collect_gregset): Likewise.
(ppc_collect_fpregset): Likewise.
(ppc_collect_vsxregset): Likewise.
(ppc_collect_vrregset): Likewise.
(e500_move_ev_register): Likewise.
(do_regcache_raw_write): Likewise.
(rs6000_frame_cache): Likewise.
(rs6000_epilogue_frame_cache): Likewise.
(rs6000_gdbarch_init): Likewise.
* rx-tdep.c (rx_get_opcode_byte): Likewise.
(rx_analyze_frame_prologue): Likewise.
(rx_frame_type): Likewise.
(rx_frame_sniffer_common): Likewise.
* s390-linux-tdep.c (s390_check_for_saved): Likewise.
(s390_frame_unwind_cache): Likewise.
(s390_stub_frame_unwind_cache): Likewise.
(s390_sigtramp_frame_unwind_cache): Likewise.
* score-tdep.c (score_make_prologue_cache): Likewise.
* sentinel-frame.c (sentinel_frame_prev_register): Likewise.
(sentinel_frame_prev_arch): Likewise.
* ser-base.c (fd_event): Likewise.
(push_event): Likewise.
(ser_base_write): Likewise.
* ser-pipe.c (pipe_close): Likewise.
* serial.c (serial_write): Likewise.
* sh-tdep.c (sh_frame_cache): Likewise.
(sh_stub_this_id): Likewise.
* sh64-tdep.c (sh64_frame_cache): Likewise.
* solib-aix.c (get_solib_aix_inferior_data): Likewise.
(library_list_start_library): Likewise.
(library_list_start_list): Likewise.
(solib_aix_free_library_list): Likewise.
* solib-darwin.c (get_darwin_info): Likewise.
* solib-dsbt.c (get_dsbt_info): Likewise.
* solib-spu.c (append_ocl_sos): Likewise.
* solib-svr4.c (svr4_pspace_data_cleanup): Likewise.
(get_svr4_info): Likewise.
(library_list_start_library): Likewise.
(svr4_library_list_start_list): Likewise.
(hash_probe_and_action): Likewise.
(equal_probe_and_action): Likewise.
(svr4_update_solib_event_breakpoint): Likewise.
(set_solib_svr4_fetch_link_map_offsets): Likewise.
(svr4_fetch_link_map_offsets): Likewise.
(svr4_have_link_map_offsets): Likewise.
* solib-target.c (library_list_start_segment): Likewise.
(library_list_start_section): Likewise.
(library_list_start_library): Likewise.
(library_list_end_library): Likewise.
(library_list_start_list): Likewise.
(solib_target_free_library_list): Likewise.
* solib.c (solib_ops): Likewise.
(set_solib_ops): Likewise.
* sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise.
* sparc-tdep.c (sparc_frame_cache): Likewise.
(sparc32_frame_cache): Likewise.
(sparc32_supply_gregset): Likewise.
(sparc32_collect_gregset): Likewise.
(sparc32_supply_fpregset): Likewise.
(sparc32_collect_fpregset): Likewise.
* sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise.
* sparc64-tdep.c (sparc64_supply_gregset): Likewise.
(sparc64_collect_gregset): Likewise.
(sparc64_supply_fpregset): Likewise.
(sparc64_collect_fpregset): Likewise.
* sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise.
* sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise.
* sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise.
(sparc64obsd_trapframe_cache): Likewise.
* sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise.
* sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise.
* spu-multiarch.c (spu_gdbarch): Likewise.
* spu-tdep.c (spu_frame_unwind_cache): Likewise.
(spu2ppu_prev_arch): Likewise.
(spu2ppu_this_id): Likewise.
(spu2ppu_prev_register): Likewise.
(spu2ppu_dealloc_cache): Likewise.
(spu_dis_asm_print_address): Likewise.
(gdb_print_insn_spu): Likewise.
(spu_get_overlay_table): Likewise.
* stabsread.c (rs6000_builtin_type): Likewise.
* stack.c (do_print_variable_and_value): Likewise.
* stap-probe.c (get_stap_base_address_1): Likewise.
* symfile-debug.c (debug_qf_has_symbols): Likewise.
(debug_qf_find_last_source_symtab): Likewise.
(debug_qf_forget_cached_source_info): Likewise.
(debug_qf_map_symtabs_matching_filename): Likewise.
(debug_qf_lookup_symbol): Likewise.
(debug_qf_print_stats): Likewise.
(debug_qf_dump): Likewise.
(debug_qf_relocate): Likewise.
(debug_qf_expand_symtabs_for_function): Likewise.
(debug_qf_expand_all_symtabs): Likewise.
(debug_qf_expand_symtabs_with_fullname): Likewise.
(debug_qf_map_matching_symbols): Likewise.
(debug_qf_expand_symtabs_matching): Likewise.
(debug_qf_find_pc_sect_compunit_symtab): Likewise.
(debug_qf_map_symbol_filenames): Likewise.
(debug_sym_get_probes): Likewise.
(debug_sym_new_init): Likewise.
(debug_sym_init): Likewise.
(debug_sym_read): Likewise.
(debug_sym_read_psymbols): Likewise.
(debug_sym_finish): Likewise.
(debug_sym_offsets): Likewise.
(debug_sym_read_linetable): Likewise.
(debug_sym_relocate): Likewise.
(uninstall_symfile_debug_logging): Likewise.
* symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise.
* symfile.c (place_section): Likewise.
(add_section_size_callback): Likewise.
(load_progress): Likewise.
(load_section_callback): Likewise.
(clear_memory_write_data): Likewise.
(allocate_symtab): Likewise.
* symmisc.c (maintenance_expand_file_matcher): Likewise.
* symtab.c (lookup_symtab_callback): Likewise.
(hash_demangled_name_entry): Likewise.
(eq_demangled_name_entry): Likewise.
(get_symbol_cache): Likewise.
(symbol_cache_cleanup): Likewise.
(set_symbol_cache_size): Likewise.
(symbol_cache_flush): Likewise.
(maintenance_print_symbol_cache): Likewise.
(maintenance_print_symbol_cache_statistics): Likewise.
(delete_filename_seen_cache): Likewise.
(output_partial_symbol_filename): Likewise.
(search_symbols_file_matches): Likewise.
(search_symbols_name_matches): Likewise.
(do_free_completion_list): Likewise.
(maybe_add_partial_symtab_filename): Likewise.
(get_main_info): Likewise.
(main_info_cleanup): Likewise.
* target-dcache.c (target_dcache_cleanup): Likewise.
(target_dcache_init_p): Likewise.
(target_dcache_invalidate): Likewise.
(target_dcache_get): Likewise.
(target_dcache_get_or_init): Likewise.
* target-descriptions.c (target_find_description): Likewise.
(tdesc_find_type): Likewise.
(tdesc_data_cleanup): Likewise.
(tdesc_find_arch_register): Likewise.
(tdesc_register_name): Likewise.
(tdesc_register_type): Likewise.
(tdesc_register_reggroup_p): Likewise.
(set_tdesc_pseudo_register_name): Likewise.
(set_tdesc_pseudo_register_type): Likewise.
(set_tdesc_pseudo_register_reggroup_p): Likewise.
(tdesc_use_registers): Likewise.
(free_target_description): Likewise.
* target-memory.c (compare_block_starting_address): Likewise.
(cleanup_request_data): Likewise.
(cleanup_write_requests_vector): Likewise.
* target.c (open_target): Likewise.
(cleanup_restore_target_terminal): Likewise.
(free_memory_read_result_vector): Likewise.
* thread.c (disable_thread_stack_temporaries): Likewise.
(finish_thread_state_cleanup): Likewise.
(do_restore_current_thread_cleanup): Likewise.
(restore_current_thread_cleanup_dtor): Likewise.
(set_thread_refcount): Likewise.
(tp_array_compar): Likewise.
(do_captured_thread_select): Likewise.
* tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise.
(tic6x_stub_this_id): Likewise.
* tilegx-tdep.c (tilegx_frame_cache): Likewise.
* top.c (do_restore_instream_cleanup): Likewise.
(gdb_readline_wrapper_cleanup): Likewise.
(kill_or_detach): Likewise.
(print_inferior_quit_action): Likewise.
* tracefile-tfile.c (match_blocktype): Likewise.
(build_traceframe_info): Likewise.
* tracefile.c (trace_file_writer_xfree): Likewise.
* tracepoint.c (memrange_cmp): Likewise.
(do_collect_symbol): Likewise.
(do_clear_collection_list): Likewise.
(do_restore_current_traceframe_cleanup): Likewise.
(restore_current_traceframe_cleanup_dtor): Likewise.
(free_current_marker): Likewise.
(traceframe_info_start_memory): Likewise.
(traceframe_info_start_tvar): Likewise.
(free_result): Likewise.
* tramp-frame.c (tramp_frame_cache): Likewise.
* tui/tui-file.c (tui_file_delete): Likewise.
(tui_fileopen): Likewise.
(tui_sfileopen): Likewise.
(tui_file_isatty): Likewise.
(tui_file_rewind): Likewise.
(tui_file_put): Likewise.
(tui_file_fputs): Likewise.
(tui_file_get_strbuf): Likewise.
(tui_file_adjust_strbuf): Likewise.
(tui_file_flush): Likewise.
* tui/tui-layout.c (make_command_window): Likewise.
(make_data_window): Likewise.
(show_source_disasm_command): Likewise.
(show_data): Likewise.
(make_source_or_disasm_window): Likewise.
(show_source_or_disasm_and_command): Likewise.
* tui/tui-out.c (tui_field_int): Likewise.
(tui_field_string): Likewise.
(tui_field_fmt): Likewise.
(tui_text): Likewise.
* typeprint.c (hash_typedef_field): Likewise.
(eq_typedef_field): Likewise.
(do_free_typedef_hash): Likewise.
(copy_typedef_hash_element): Likewise.
(do_free_global_table): Likewise.
(find_global_typedef): Likewise.
(find_typedef_in_hash): Likewise.
* ui-file.c (ui_file_write_for_put): Likewise.
(do_ui_file_xstrdup): Likewise.
(mem_file_delete): Likewise.
(mem_file_rewind): Likewise.
(mem_file_put): Likewise.
(mem_file_write): Likewise.
(stdio_file_delete): Likewise.
(stdio_file_flush): Likewise.
(stdio_file_read): Likewise.
(stdio_file_write): Likewise.
(stdio_file_write_async_safe): Likewise.
(stdio_file_fputs): Likewise.
(stdio_file_isatty): Likewise.
(stdio_file_fseek): Likewise.
(tee_file_delete): Likewise.
(tee_file_flush): Likewise.
(tee_file_write): Likewise.
(tee_file_fputs): Likewise.
(tee_file_isatty): Likewise.
* ui-out.c (do_cleanup_table_end): Likewise.
(do_cleanup_end): Likewise.
* user-regs.c (user_reg_add): Likewise.
(user_reg_map_name_to_regnum): Likewise.
(usernum_to_user_reg): Likewise.
(maintenance_print_user_registers): Likewise.
* utils.c (do_bfd_close_cleanup): Likewise.
(do_fclose_cleanup): Likewise.
(do_obstack_free): Likewise.
(do_ui_file_delete): Likewise.
(do_ui_out_redirect_pop): Likewise.
(do_free_section_addr_info): Likewise.
(restore_integer): Likewise.
(do_unpush_target): Likewise.
(do_htab_delete_cleanup): Likewise.
(do_restore_ui_file): Likewise.
(do_value_free): Likewise.
(do_free_so): Likewise.
(free_current_contents): Likewise.
(do_regfree_cleanup): Likewise.
(core_addr_hash): Likewise.
(core_addr_eq): Likewise.
(do_free_char_ptr_vec): Likewise.
* v850-tdep.c (v850_frame_cache): Likewise.
* varobj.c (do_free_variable_cleanup): Likewise.
* vax-tdep.c (vax_supply_gregset): Likewise.
(vax_frame_cache): Likewise.
* vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise.
* xml-support.c (gdb_xml_body_text): Likewise.
(gdb_xml_values_cleanup): Likewise.
(gdb_xml_start_element): Likewise.
(gdb_xml_start_element_wrapper): Likewise.
(gdb_xml_end_element): Likewise.
(gdb_xml_end_element_wrapper): Likewise.
(gdb_xml_cleanup): Likewise.
(gdb_xml_fetch_external_entity): Likewise.
(gdb_xml_parse_attr_enum): Likewise.
(xinclude_start_include): Likewise.
(xinclude_end_include): Likewise.
(xml_xinclude_default): Likewise.
(xml_xinclude_start_doctype): Likewise.
(xml_xinclude_end_doctype): Likewise.
(xml_xinclude_cleanup): Likewise.
(xml_fetch_content_from_file): Likewise.
* xml-syscall.c (free_syscalls_info): Likewise.
(syscall_start_syscall): Likewise.
* xml-tdesc.c (tdesc_end_arch): Likewise.
(tdesc_end_osabi): Likewise.
(tdesc_end_compatible): Likewise.
(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_field): Likewise.
(tdesc_start_vector): Likewise.
(fetch_available_features_from_target): Likewise.
* xstormy16-tdep.c (xstormy16_frame_cache): Likewise.
* xtensa-tdep.c (xtensa_supply_gregset): Likewise.
(xtensa_frame_cache): Likewise.
(xtensa_frame_prev_register): Likewise.
(xtensa_extract_return_value): Likewise.
|
|
Most allocation functions (if not all) return a void* pointing to the
allocated memory. In C++, we need to add an explicit cast when
assigning the result to a pointer to another type (which is the case
more often than not).
The content of this patch is taken from Pedro's branch, from commit
"(mostly) auto-generated patch to insert casts needed for C++". I
validated that the changes make sense and manually reflowed the code to
make it respect the coding style. I also found multiple places where I
could use XNEW/XNEWVEC/XRESIZEVEC/etc.
Thanks a lot to whoever did that automated script to insert casts, doing
it completely by hand would have taken a ridiculous amount of time.
Only files built on x86 with --enable-targets=all are modified. This
means that all other -nat.c files are untouched and will have to be
dealt with later by using appropiate compilers. Or maybe we can try to
build them with a regular g++ just to know where to add casts, I don't
know.
I built-tested this with --enable-targets=all and reg-tested.
Here's the changelog entry, which was not too bad to make despite the
size, thanks to David Malcom's script. I fixed some bits by hand, but
there might be some wrong parts left (hopefully not).
gdb/ChangeLog:
* aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast
to allocation result assignment.
* ada-exp.y (write_object_renaming): Likewise.
(write_ambiguous_var): Likewise.
(ada_nget_field_index): Likewise.
(write_var_or_type): Likewise.
* ada-lang.c (ada_decode_symbol): Likewise.
(ada_value_assign): Likewise.
(value_pointer): Likewise.
(cache_symbol): Likewise.
(add_nonlocal_symbols): Likewise.
(ada_name_for_lookup): Likewise.
(symbol_completion_add): Likewise.
(ada_to_fixed_type_1): Likewise.
(ada_get_next_arg): Likewise.
(defns_collected): Likewise.
* ada-lex.l (processId): Likewise.
(processString): Likewise.
* ada-tasks.c (read_known_tasks_array): Likewise.
(read_known_tasks_list): Likewise.
* ada-typeprint.c (decoded_type_name): Likewise.
* addrmap.c (addrmap_mutable_create_fixed): Likewise.
* amd64-tdep.c (amd64_push_arguments): Likewise.
(amd64_displaced_step_copy_insn): Likewise.
(amd64_classify_insn_at): Likewise.
(amd64_relocate_instruction): Likewise.
* amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise.
* arch-utils.c (simple_displaced_step_copy_insn): Likewise.
(initialize_current_architecture): Likewise.
* arm-linux-tdep.c (arm_stap_parse_special_token): Likewise.
* arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise.
* arm-tdep.c (arm_exidx_new_objfile): Likewise.
(arm_push_dummy_call): Likewise.
(extend_buffer_earlier): Likewise.
(arm_adjust_breakpoint_address): Likewise.
(arm_skip_stub): Likewise.
* auto-load.c (filename_is_in_pattern): Likewise.
(maybe_add_script_file): Likewise.
(maybe_add_script_text): Likewise.
(auto_load_objfile_script_1): Likewise.
* auxv.c (ld_so_xfer_auxv): Likewise.
* ax-general.c (new_agent_expr): Likewise.
(grow_expr): Likewise.
(ax_reg_mask): Likewise.
* bcache.c (bcache_full): Likewise.
* breakpoint.c (program_breakpoint_here_p): Likewise.
* btrace.c (parse_xml_raw): Likewise.
* build-id.c (build_id_to_debug_bfd): Likewise.
* buildsym.c (end_symtab_with_blockvector): Likewise.
* c-exp.y (string_exp): Likewise.
(qualified_name): Likewise.
(write_destructor_name): Likewise.
(operator_stoken): Likewise.
(parse_number): Likewise.
(scan_macro_expansion): Likewise.
(yylex): Likewise.
(c_print_token): Likewise.
* c-lang.c (c_get_string): Likewise.
(emit_numeric_character): Likewise.
* charset.c (wchar_iterate): Likewise.
* cli/cli-cmds.c (complete_command): Likewise.
(make_command): Likewise.
* cli/cli-dump.c (restore_section_callback): Likewise.
(restore_binary_file): Likewise.
* cli/cli-interp.c (cli_interpreter_exec): Likewise.
* cli/cli-script.c (execute_control_command): Likewise.
* cli/cli-setshow.c (do_set_command): Likewise.
* coff-pe-read.c (add_pe_forwarded_sym): Likewise.
(read_pe_exported_syms): Likewise.
* coffread.c (coff_read_struct_type): Likewise.
(coff_read_enum_type): Likewise.
* common/btrace-common.c (btrace_data_append): Likewise.
* common/buffer.c (buffer_grow): Likewise.
* common/filestuff.c (gdb_fopen_cloexec): Likewise.
* common/format.c (parse_format_string): Likewise.
* common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise.
* common/xml-utils.c (xml_escape_text): Likewise.
* compile/compile-object-load.c (copy_sections): Likewise.
(compile_object_load): Likewise.
* compile/compile-object-run.c (compile_object_run): Likewise.
* completer.c (filename_completer): Likewise.
* corefile.c (read_memory_typed_address): Likewise.
(write_memory_unsigned_integer): Likewise.
(write_memory_signed_integer): Likewise.
(complete_set_gnutarget): Likewise.
* corelow.c (get_core_register_section): Likewise.
* cp-name-parser.y (d_grab): Likewise.
(allocate_info): Likewise.
(cp_new_demangle_parse_info): Likewise.
* cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise.
(cp_lookup_symbol_in_namespace): Likewise.
(lookup_namespace_scope): Likewise.
(find_symbol_in_baseclass): Likewise.
(cp_lookup_nested_symbol): Likewise.
(cp_lookup_transparent_type_loop): Likewise.
* cp-support.c (copy_string_to_obstack): Likewise.
(make_symbol_overload_list): Likewise.
(make_symbol_overload_list_namespace): Likewise.
(make_symbol_overload_list_adl_namespace): Likewise.
(first_component_command): Likewise.
* cp-valprint.c (cp_print_value): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* d-exp.y (StringExp): Likewise.
* d-namespace.c (d_lookup_symbol_in_module): Likewise.
(lookup_module_scope): Likewise.
(find_symbol_in_baseclass): Likewise.
(d_lookup_nested_symbol): Likewise.
* dbxread.c (find_stab_function_addr): Likewise.
(read_dbx_symtab): Likewise.
(dbx_end_psymtab): Likewise.
(cp_set_block_scope): Likewise.
* dcache.c (dcache_alloc): Likewise.
* demangle.c (_initialize_demangler): Likewise.
* dicos-tdep.c (dicos_load_module_p): Likewise.
* dictionary.c (dict_create_hashed_expandable): Likewise.
(dict_create_linear_expandable): Likewise.
(expand_hashtable): Likewise.
(add_symbol_linear_expandable): Likewise.
* dwarf2-frame.c (add_cie): Likewise.
(add_fde): Likewise.
(dwarf2_build_frame_info): Likewise.
* dwarf2expr.c (dwarf_expr_grow_stack): Likewise.
(dwarf_expr_fetch_address): Likewise.
(add_piece): Likewise.
(execute_stack_op): Likewise.
* dwarf2loc.c (chain_candidate): Likewise.
(dwarf_entry_parameter_to_value): Likewise.
(read_pieced_value): Likewise.
(write_pieced_value): Likewise.
* dwarf2read.c (dwarf2_read_section): Likewise.
(add_type_unit): Likewise.
(read_comp_units_from_section): Likewise.
(fixup_go_packaging): Likewise.
(dwarf2_compute_name): Likewise.
(dwarf2_physname): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(read_func_scope): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_attach_fields_to_type): Likewise.
(process_structure_scope): Likewise.
(mark_common_block_symbol_computed): Likewise.
(read_common_block): Likewise.
(abbrev_table_read_table): Likewise.
(guess_partial_die_structure_name): Likewise.
(fixup_partial_die): Likewise.
(add_file_name): Likewise.
(dwarf2_const_value_data): Likewise.
(dwarf2_const_value_attr): Likewise.
(build_error_marker_type): Likewise.
(guess_full_die_structure_name): Likewise.
(anonymous_struct_prefix): Likewise.
(typename_concat): Likewise.
(dwarf2_canonicalize_name): Likewise.
(dwarf2_name): Likewise.
(write_constant_as_bytes): Likewise.
(dwarf2_fetch_constant_bytes): Likewise.
(copy_string): Likewise.
(parse_macro_definition): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_rel_plt_read): Likewise.
(elf_gnu_ifunc_resolve_by_cache): Likewise.
(elf_gnu_ifunc_resolve_by_got): Likewise.
(elf_read_minimal_symbols): Likewise.
(elf_gnu_ifunc_record_cache): Likewise.
* event-top.c (top_level_prompt): Likewise.
(command_line_handler): Likewise.
* exec.c (resize_section_table): Likewise.
* expprint.c (print_subexp_standard): Likewise.
* fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise.
* findcmd.c (parse_find_args): Likewise.
* findvar.c (address_from_register): Likewise.
* frame.c (get_prev_frame_always): Likewise.
* gdb_bfd.c (gdb_bfd_ref): Likewise.
(get_section_descriptor): Likewise.
* gdb_obstack.c (obconcat): Likewise.
(obstack_strdup): Likewise.
* gdbtypes.c (lookup_function_type_with_arguments): Likewise.
(create_set_type): Likewise.
(lookup_unsigned_typename): Likewise.
(lookup_signed_typename): Likewise.
(resolve_dynamic_union): Likewise.
(resolve_dynamic_struct): Likewise.
(add_dyn_prop): Likewise.
(copy_dynamic_prop_list): Likewise.
(arch_flags_type): Likewise.
(append_composite_type_field_raw): Likewise.
* gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise.
* gnu-v3-abi.c (gnuv3_rtti_type): Likewise.
* go-exp.y (string_exp): Likewise.
* go-lang.c (go_demangle): Likewise.
* guile/guile.c (compute_scheme_string): Likewise.
* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
(gdbscm_canonicalize_command_name): Likewise.
* guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise.
(ioscm_init_memory_port): Likewise.
(ioscm_reinit_memory_port): Likewise.
* guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise.
(gdbscm_gc_dup_argv): Likewise.
* h8300-tdep.c (h8300_push_dummy_call): Likewise.
* hppa-tdep.c (internalize_unwinds): Likewise.
(read_unwind_info): Likewise.
* i386-cygwin-tdep.c (core_process_module_section): Likewise.
(windows_core_xfer_shared_libraries): Likewise.
* i386-tdep.c (i386_displaced_step_copy_insn): Likewise.
(i386_stap_parse_special_token_triplet): Likewise.
(i386_stap_parse_special_token_three_arg_disp): Likewise.
* i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise.
* inf-child.c (inf_child_fileio_readlink): Likewise.
* inf-ptrace.c (inf_ptrace_fetch_register): Likewise.
(inf_ptrace_store_register): Likewise.
* infrun.c (follow_exec): Likewise.
(displaced_step_prepare_throw): Likewise.
(save_stop_context): Likewise.
(save_infcall_suspend_state): Likewise.
* jit.c (jit_read_descriptor): Likewise.
(jit_read_code_entry): Likewise.
(jit_symtab_line_mapping_add_impl): Likewise.
(finalize_symtab): Likewise.
(jit_unwind_reg_get_impl): Likewise.
* jv-exp.y (QualifiedName): Likewise.
* jv-lang.c (get_java_utf8_name): Likewise.
(type_from_class): Likewise.
(java_demangle_type_signature): Likewise.
(java_class_name_from_physname): Likewise.
* jv-typeprint.c (java_type_print_base): Likewise.
* jv-valprint.c (java_value_print): Likewise.
* language.c (add_language): Likewise.
* linespec.c (add_sal_to_sals_basic): Likewise.
(add_sal_to_sals): Likewise.
(decode_objc): Likewise.
(find_linespec_symbols): Likewise.
* linux-fork.c (fork_save_infrun_state): Likewise.
* linux-nat.c (linux_nat_detach): Likewise.
(linux_nat_fileio_readlink): Likewise.
* linux-record.c (record_linux_sockaddr): Likewise.
(record_linux_msghdr): Likewise.
(Do): Likewise.
* linux-tdep.c (linux_core_info_proc_mappings): Likewise.
(linux_collect_regset_section_cb): Likewise.
(linux_get_siginfo_data): Likewise.
* linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise.
(try_thread_db_load_from_dir): Likewise.
(thread_db_load_search): Likewise.
(info_auto_load_libthread_db): Likewise.
* m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise.
(m32c_m16c_pointer_to_address): Likewise.
* m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise.
* m68k-tdep.c (m68k_get_longjmp_target): Likewise.
* machoread.c (macho_check_dsym): Likewise.
* macroexp.c (resize_buffer): Likewise.
(gather_arguments): Likewise.
(maybe_expand): Likewise.
* macrotab.c (new_macro_key): Likewise.
(new_source_file): Likewise.
(new_macro_definition): Likewise.
* mdebugread.c (parse_symbol): Likewise.
(parse_type): Likewise.
(parse_partial_symbols): Likewise.
(psymtab_to_symtab_1): Likewise.
* mem-break.c (default_memory_insert_breakpoint): Likewise.
* mi/mi-cmd-break.c (mi_argv_to_format): Likewise.
* mi/mi-main.c (mi_cmd_data_read_memory): Likewise.
(mi_cmd_data_read_memory_bytes): Likewise.
(mi_cmd_data_write_memory_bytes): Likewise.
(mi_cmd_trace_frame_collected): Likewise.
* mi/mi-parse.c (mi_parse_argv): Likewise.
(mi_parse): Likewise.
* minidebug.c (lzma_open): Likewise.
(lzma_pread): Likewise.
* mips-tdep.c (mips_read_fp_register_single): Likewise.
(mips_print_fp_register): Likewise.
* mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise.
* mipsread.c (read_alphacoff_dynamic_symtab): Likewise.
* mt-tdep.c (mt_register_name): Likewise.
(mt_registers_info): Likewise.
(mt_push_dummy_call): Likewise.
* namespace.c (add_using_directive): Likewise.
* nat/linux-btrace.c (perf_event_read): Likewise.
(linux_enable_bts): Likewise.
* nat/linux-osdata.c (linux_common_core_of_thread): Likewise.
* nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise.
* nto-tdep.c (nto_find_and_open_solib): Likewise.
(nto_parse_redirection): Likewise.
* objc-lang.c (objc_demangle): Likewise.
(find_methods): Likewise.
* objfiles.c (get_objfile_bfd_data): Likewise.
(set_objfile_main_name): Likewise.
(allocate_objfile): Likewise.
(objfile_relocate): Likewise.
(update_section_map): Likewise.
* osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise.
* p-exp.y (exp): Likewise.
(yylex): Likewise.
* p-valprint.c (pascal_object_print_value): Likewise.
* parse.c (initialize_expout): Likewise.
(mark_completion_tag): Likewise.
(copy_name): Likewise.
(parse_float): Likewise.
(type_stack_reserve): Likewise.
* ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise.
(ppu2spu_prev_register): Likewise.
* ppc-ravenscar-thread.c (supply_register_at_address): Likewise.
* printcmd.c (printf_wide_c_string): Likewise.
(printf_pointer): Likewise.
* probe.c (parse_probes): Likewise.
* python/py-cmd.c (gdbpy_parse_command_name): Likewise.
(cmdpy_init): Likewise.
* python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise.
* python/py-symtab.c (set_sal): Likewise.
* python/py-unwind.c (pyuw_sniffer): Likewise.
* python/python.c (python_interactive_command): Likewise.
(compute_python_string): Likewise.
* ravenscar-thread.c (get_running_thread_id): Likewise.
* record-full.c (record_full_exec_insn): Likewise.
(record_full_core_open_1): Likewise.
* regcache.c (regcache_raw_read_signed): Likewise.
(regcache_raw_read_unsigned): Likewise.
(regcache_cooked_read_signed): Likewise.
(regcache_cooked_read_unsigned): Likewise.
* remote-fileio.c (remote_fileio_func_open): Likewise.
(remote_fileio_func_rename): Likewise.
(remote_fileio_func_unlink): Likewise.
(remote_fileio_func_stat): Likewise.
(remote_fileio_func_system): Likewise.
* remote-mips.c (mips_xfer_memory): Likewise.
(mips_load_srec): Likewise.
(pmon_end_download): Likewise.
* remote.c (new_remote_state): Likewise.
(map_regcache_remote_table): Likewise.
(remote_register_number_and_offset): Likewise.
(init_remote_state): Likewise.
(get_memory_packet_size): Likewise.
(remote_pass_signals): Likewise.
(remote_program_signals): Likewise.
(remote_start_remote): Likewise.
(remote_check_symbols): Likewise.
(remote_query_supported): Likewise.
(extended_remote_attach): Likewise.
(process_g_packet): Likewise.
(store_registers_using_G): Likewise.
(putpkt_binary): Likewise.
(read_frame): Likewise.
(compare_sections_command): Likewise.
(remote_hostio_pread): Likewise.
(remote_hostio_readlink): Likewise.
(remote_file_put): Likewise.
(remote_file_get): Likewise.
(remote_pid_to_exec_file): Likewise.
(_initialize_remote): Likewise.
* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
* rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise.
(bfd_uses_spe_extensions): Likewise.
* s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise.
* score-tdep.c (score7_malloc_and_get_memblock): Likewise.
* solib-dsbt.c (decode_loadmap): Likewise.
(fetch_loadmap): Likewise.
(scan_dyntag): Likewise.
(enable_break): Likewise.
(dsbt_relocate_main_executable): Likewise.
* solib-frv.c (fetch_loadmap): Likewise.
(enable_break2): Likewise.
(frv_relocate_main_executable): Likewise.
* solib-spu.c (spu_relocate_main_executable): Likewise.
(spu_bfd_open): Likewise.
* solib-svr4.c (lm_info_read): Likewise.
(read_program_header): Likewise.
(find_program_interpreter): Likewise.
(scan_dyntag): Likewise.
(elf_locate_base): Likewise.
(open_symbol_file_object): Likewise.
(read_program_headers_from_bfd): Likewise.
(svr4_relocate_main_executable): Likewise.
* solib-target.c (solib_target_relocate_section_addresses): Likewise.
* solib.c (solib_find_1): Likewise.
(exec_file_find): Likewise.
(solib_find): Likewise.
* source.c (openp): Likewise.
(print_source_lines_base): Likewise.
(forward_search_command): Likewise.
* sparc-ravenscar-thread.c (supply_register_at_address): Likewise.
* spu-tdep.c (spu2ppu_prev_register): Likewise.
(spu_get_overlay_table): Likewise.
* stabsread.c (patch_block_stabs): Likewise.
(define_symbol): Likewise.
(again:): Likewise.
(read_member_functions): Likewise.
(read_one_struct_field): Likewise.
(read_enum_type): Likewise.
(common_block_start): Likewise.
* stack.c (read_frame_arg): Likewise.
(backtrace_command): Likewise.
* stap-probe.c (stap_parse_register_operand): Likewise.
* symfile.c (syms_from_objfile_1): Likewise.
(find_separate_debug_file): Likewise.
(load_command): Likewise.
(load_progress): Likewise.
(load_section_callback): Likewise.
(reread_symbols): Likewise.
(add_filename_language): Likewise.
(allocate_compunit_symtab): Likewise.
(read_target_long_array): Likewise.
(simple_read_overlay_table): Likewise.
* symtab.c (symbol_set_names): Likewise.
(resize_symbol_cache): Likewise.
(rbreak_command): Likewise.
(completion_list_add_name): Likewise.
(completion_list_objc_symbol): Likewise.
(add_filename_to_list): Likewise.
* target-descriptions.c (maint_print_c_tdesc_cmd): Likewise.
* target-memory.c (target_write_memory_blocks): Likewise.
* target.c (target_read_string): Likewise.
(read_whatever_is_readable): Likewise.
(target_read_alloc_1): Likewise.
(simple_search_memory): Likewise.
(target_fileio_read_alloc_1): Likewise.
* tilegx-tdep.c (tilegx_push_dummy_call): Likewise.
* top.c (command_line_input): Likewise.
* tracefile-tfile.c (tfile_fetch_registers): Likewise.
* tracefile.c (tracefile_fetch_registers): Likewise.
* tracepoint.c (add_memrange): Likewise.
(init_collection_list): Likewise.
(add_aexpr): Likewise.
(trace_dump_actions): Likewise.
(parse_trace_status): Likewise.
(parse_tracepoint_definition): Likewise.
(parse_tsv_definition): Likewise.
(parse_static_tracepoint_marker_definition): Likewise.
* tui/tui-file.c (tui_sfileopen): Likewise.
(tui_file_adjust_strbuf): Likewise.
* tui/tui-io.c (tui_expand_tabs): Likewise.
* tui/tui-source.c (tui_set_source_content): Likewise.
* typeprint.c (find_global_typedef): Likewise.
* ui-file.c (do_ui_file_xstrdup): Likewise.
(ui_file_obsavestring): Likewise.
(mem_file_write): Likewise.
* utils.c (make_hex_string): Likewise.
(get_regcomp_error): Likewise.
(puts_filtered_tabular): Likewise.
(gdb_realpath_keepfile): Likewise.
(ldirname): Likewise.
(gdb_bfd_errmsg): Likewise.
(substitute_path_component): Likewise.
* valops.c (search_struct_method): Likewise.
(find_oload_champ_namespace_loop): Likewise.
* valprint.c (print_decimal_chars): Likewise.
(read_string): Likewise.
(generic_emit_char): Likewise.
* varobj.c (varobj_delete): Likewise.
(varobj_value_get_print_value): Likewise.
* vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise.
* windows-tdep.c (display_one_tib): Likewise.
* xcoffread.c (read_xcoff_symtab): Likewise.
(process_xcoff_symbol): Likewise.
(swap_sym): Likewise.
(scan_xcoff_symtab): Likewise.
(xcoff_initial_scan): Likewise.
* xml-support.c (gdb_xml_end_element): Likewise.
(xml_process_xincludes): Likewise.
(xml_fetch_content_from_file): Likewise.
* xml-syscall.c (xml_list_of_syscalls): Likewise.
* xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise.
gdb/gdbserver/ChangeLog:
* ax.c (gdb_parse_agent_expr): Add cast to allocation result
assignment.
(gdb_unparse_agent_expr): Likewise.
* hostio.c (require_data): Likewise.
(handle_pread): Likewise.
* linux-low.c (disable_regset): Likewise.
(fetch_register): Likewise.
(store_register): Likewise.
(get_dynamic): Likewise.
(linux_qxfer_libraries_svr4): Likewise.
* mem-break.c (delete_fast_tracepoint_jump): Likewise.
(set_fast_tracepoint_jump): Likewise.
(uninsert_fast_tracepoint_jumps_at): Likewise.
(reinsert_fast_tracepoint_jumps_at): Likewise.
(validate_inserted_breakpoint): Likewise.
(clone_agent_expr): Likewise.
* regcache.c (init_register_cache): Likewise.
* remote-utils.c (putpkt_binary_1): Likewise.
(decode_M_packet): Likewise.
(decode_X_packet): Likewise.
(look_up_one_symbol): Likewise.
(relocate_instruction): Likewise.
(monitor_output): Likewise.
* server.c (handle_search_memory): Likewise.
(handle_qxfer_exec_file): Likewise.
(handle_qxfer_libraries): Likewise.
(handle_qxfer): Likewise.
(handle_query): Likewise.
(handle_v_cont): Likewise.
(handle_v_run): Likewise.
(captured_main): Likewise.
* target.c (write_inferior_memory): Likewise.
* thread-db.c (try_thread_db_load_from_dir): Likewise.
* tracepoint.c (init_trace_buffer): Likewise.
(add_tracepoint_action): Likewise.
(add_traceframe): Likewise.
(add_traceframe_block): Likewise.
(cmd_qtdpsrc): Likewise.
(cmd_qtdv): Likewise.
(cmd_qtstatus): Likewise.
(response_source): Likewise.
(response_tsv): Likewise.
(cmd_qtnotes): Likewise.
(gdb_collect): Likewise.
(initialize_tracepoint): Likewise.
|
|
Nowadays, GDB only knows whether architecture supports hardware single
step or software single step (through gdbarch hook software_single_step),
and for a given instruction or instruction sequence, GDB knows how to
do single step (hardware or software). However, GDB doesn't know whether
the target supports hardware single step. It is possible that the
architecture doesn't support hardware single step, such as arm, but
the target supports, such as simulator. This was discussed in this
thread https://www.sourceware.org/ml/gdb/2009-12/msg00033.html before.
I encounter this problem for aarch64 multi-arch support. When aarch64
debugs arm program, gdbarch is arm, so software single step is still
used. However, the underneath linux kernel does support hardware
single step, so IWBN to use it.
This patch is to add a new target_ops hook to_can_do_single_step, and
only use it in arm_linux_software_single_step to decide whether or not
to use hardware single step. On the native aarch64 linux target, 1 is
returned. On other targets, -1 is returned. On the remote target, if
the target supports s and S actions in the vCont? reply, then target
can do single step. However, old GDBserver will send s and S in the
reply to vCont?, which will confuse new GDB. For example, old GDBserver
on arm-linux will send s and S in the reply to vCont?, but it doesn't
support hardware single step. On the other hand, new GDBserver, on
arm-linux for example, will not send s and S in the reply to vCont?,
but old GDB thinks it doesn't support vCont packet at all. In order
to address this problem, I add a new qSupported feature vContSupported,
which indicates GDB wants to know the supported actions in the reply
to vCont?, and qSupported response contains vContSupported if the
stub is able tell supported vCont actions in the reply of vCont?.
If the patched GDB talks with patched GDBserver on x86, the RSP traffic
is like this:
-> $qSupported:...+;vContSupported+
<- ...+;vContSupported+
...
-> $vCont?
<- vCont;c;C;t;s;S;r
then, GDB knows the stub can do single step, and may stop using software
single step even the architecture doesn't support hardware single step.
If the patched GDB talks with patched GDBserver on arm, the last vCont?
reply will become:
<- vCont;c;C;t
GDB thinks the target doesn't support single step, so it will use software
single step.
If the patched GDB talks with unpatched GDBserver, the RSP traffic is like
this:
-> $qSupported:...+;vContSupported+
<- ...+
...
-> $vCont?
<- vCont;c;C;t;s;S;r
although GDBserver returns s and S, GDB still thinks GDBserver may not
support single step because it doesn't support vContSupported.
If the unpatched GDB talks with patched GDBserver on x86, the RSP traffic
is like:
-> $qSupported:...+;
<- ...+;vContSupported+
...
-> $vCont?
<- vCont;c;C;t;s;S;r
Since GDB doesn't sent vContSupported in the qSupported feature, GDBserver
sends s and S regardless of the support of hardware single step.
gdb:
2015-09-15 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-nat.c (aarch64_linux_can_do_single_step): New
function.
(_initialize_aarch64_linux_nat): Install it to to_can_do_single_step.
* arm-linux-tdep.c (arm_linux_software_single_step): Return 0
if target_can_do_single_step returns 1.
* remote.c (struct vCont_action_support) <s, S>: New fields.
(PACKET_vContSupported): New enum.
(remote_protocol_features): New element for vContSupported.
(remote_query_supported): Append "vContSupported+".
(remote_vcont_probe): Remove support_s and support_S, use
rs->supports_vCont.s and rs->supports_vCont.S instead. Disable
vCont packet if c and C actions are not supported.
(remote_can_do_single_step): New function.
(init_remote_ops): Install it to to_can_do_single_step.
(_initialize_remote): Call add_packet_config_cmd.
* target.h (struct target_ops) <to_can_do_single_step>: New field.
(target_can_do_single_step): New macro.
* target-delegates.c: Re-generated.
gdb/gdbserver:
2015-09-15 Yao Qi <yao.qi@linaro.org>
* server.c (vCont_supported): New global variable.
(handle_query): Set vCont_supported to 1 if "vContSupported+"
matches. Append ";vContSupported+" to own_buf.
(handle_v_requests): Append ";s;S" to own_buf if target supports
hardware single step or vCont_supported is false.
(capture_main): Set vCont_supported to zero.
gdb/doc:
2015-09-15 Yao Qi <yao.qi@linaro.org>
* gdb.texinfo (General Query Packets): Add vContSupported to
tables of 'gdbfeatures' and 'stub features' supported in the
qSupported packet, as well as to the list containing stub
feature details.
|
|
This patch implements exec catchpoints for extended-remote Linux
targets. The implementation follows the same approach used for
fork catchpoints, implementing extended-remote target routines for
inserting and removing the catchpoints by just checking if exec events
are supported. Existing host-side code and previous support for
extended-remote exec events takes care of the rest.
gdb/ChangeLog:
* remote.c (remote_exec_event_p): New function.
(remote_insert_exec_catchpoint): New function.
(remote_remove_exec_catchpoint): New function.
(init_extended_remote_ops): Initialize extended_remote_ops
members to_insert_exec_catchpoint and
to_remove_exec_catchpoint.
|
|
This patch implements support for exec events on extended-remote Linux
targets. Follow-exec-mode and rerun behave as expected. Catchpoints and
test updates are implemented in subsequent patches.
This patch was derived from a patch posted last October:
https://sourceware.org/ml/gdb-patches/2014-10/msg00877.html.
It was originally based on some work done by Luis Machado in 2013.
IMPLEMENTATION
----------------
Exec events are enabled via ptrace options.
When an exec event is detected by gdbserver, the existing process
data, along with all its associated lwp and thread data, is deleted
and replaced by data for a new single-threaded process. The new
process data is initialized with the appropriate parts of the state
of the execing process. This approach takes care of several potential
pitfalls, including:
* deleting the data for an execing non-leader thread before any
wait/sigsuspend occurs
* correctly initializing the architecture of the execed process
We then report the exec event using a new RSP stop reason, "exec".
When GDB receives an "exec" event, it saves the status in the event
structure's target_waitstatus field, like what is done for remote fork
events. Because the original and execed programs may have different
architectures, we skip parsing the section of the stop reply packet
that contains register data. The register data will be retrieved
later after the inferior's architecture has been set up by
infrun.c:follow_exec.
At that point the exec event is handled by the existing event handling
in GDB. However, a few changes were necessary so that
infrun.c:follow_exec could accommodate the remote target.
* Where follow-exec-mode "new" is handled, we now call
add_inferior_with_spaces instead of add_inferior with separate calls
to set up the program and address spaces. The motivation for this
is that add_inferior_with_spaces also sets up the initial architecture
for the inferior, which is needed later by target_find_description
when it calls target_gdbarch.
* We call a new target function, target_follow_exec. This function
allows us to store the execd_pathname in the inferior, instead of
using the static string remote_exec_file from remote.c. The static
string didn't work for follow-exec-mode "new", since once you switched
to the execed program, the original remote exec-file was lost. The
execd_pathname is now stored in the inferior's program space as a
REGISTRY field. All of the requisite mechanisms for this are
defined in remote.c.
gdb/gdbserver/ChangeLog:
* linux-low.c (linux_mourn): Static declaration.
(linux_arch_setup): Move in front of
handle_extended_wait.
(linux_arch_setup_thread): New function.
(handle_extended_wait): Handle exec events. Call
linux_arch_setup_thread. Make event_lwp argument a
pointer-to-a-pointer.
(check_zombie_leaders): Do not check stopped threads.
(linux_low_ptrace_options): Add PTRACE_O_TRACEEXEC.
(linux_low_filter_event): Add lwp and thread for exec'ing
non-leader thread if leader thread has been deleted.
Refactor code into linux_arch_setup_thread and call it.
Pass child lwp pointer by reference to handle_extended_wait.
(linux_wait_for_event_filtered): Update comment.
(linux_wait_1): Prevent clobbering exec event status.
(linux_supports_exec_events): New function.
(linux_target_ops) <supports_exec_events>: Initialize new member.
* lynx-low.c (lynx_target_ops) <supports_exec_events>: Initialize
new member.
* remote-utils.c (prepare_resume_reply): New stop reason 'exec'.
* server.c (report_exec_events): New global variable.
(handle_query): Handle qSupported query for exec-events feature.
(captured_main): Initialize report_exec_events.
* server.h (report_exec_events): Declare new global variable.
* target.h (struct target_ops) <supports_exec_events>: New
member.
(target_supports_exec_events): New macro.
* win32-low.c (win32_target_ops) <supports_exec_events>:
Initialize new member.
gdb/ChangeLog:
* infrun.c (follow_exec): Use process-style ptid for
exec message. Call add_inferior_with_spaces and
target_follow_exec.
* nat/linux-ptrace.c (linux_supports_traceexec): New function.
* nat/linux-ptrace.h (linux_supports_traceexec): Declare.
* remote.c (remote_pspace_data): New static variable.
(remote_pspace_data_cleanup): New function.
(get_remote_exec_file): New function.
(set_remote_exec_file_1): New function.
(set_remote_exec_file): New function.
(show_remote_exec_file): New function.
(remote_exec_file): Delete static variable.
(anonymous enum) <PACKET_exec_event_feature> New
enumeration constant.
(remote_protocol_features): Add entry for exec-events feature.
(remote_query_supported): Add client side of qSupported query
for exec-events feature.
(remote_follow_exec): New function.
(remote_parse_stop_reply): Handle 'exec' stop reason.
(extended_remote_run, extended_remote_create_inferior): Call
get_remote_exec_file and set_remote_exec_file_1.
(init_extended_remote_ops) <to_follow_exec>: Initialize new
member.
(_initialize_remote): Call
register_program_space_data_with_cleanup. Call
add_packet_config_cmd for remote exec-events feature.
Modify call to add_setshow_string_noescape_cmd for exec-file
to use new functions set_remote_exec_file and
show_remote_exec_file.
* target-debug.h, target-delegates.c: Regenerated.
* target.c (target_follow_exec): New function.
* target.h (struct target_ops) <to_follow_exec>: New member.
(target_follow_exec): Declare new function.
|
|
This adds an object oriented replacement for the "struct continuation"
mechanism, and converts the stepping commands (step, next, stepi,
nexti) and the "finish" commands to use it.
It adds a new thread "class" (struct thread_fsm) that contains the
necessary info and callbacks to manage the state machine of a thread's
execution command.
This allows getting rid of some hacks. E.g., in fetch_inferior_event
and normal_stop we no longer need to know whether a thread is doing a
multi-step (e.g., step N). This effectively makes the
intermediate_continuations unused -- they'll be garbage collected in a
separate patch. (They were never a proper abstraction, IMO. See how
fetch_inferior_event needs to check step_multi before knowing whether
to call INF_EXEC_CONTINUE or INF_EXEC_COMPLETE.)
The target async vs !async uiout hacks in mi_on_normal_stop go away
too.
print_stop_event is no longer called from normal_stop. Instead it is
now called from within each interpreter's normal_stop observer. This
clears the path to make each interpreter print a stop event the way it
sees fit. Currently we have some hacks in common code to
differenciate CLI vs TUI vs MI around this area.
The "finish" command's FSM class stores the return value plus that
value's position in the value history, so that those can be printed to
both MI and CLI's streams. This fixes the CLI "finish" command when
run from MI -- it now also includes the function's return value in the
CLI stream:
(gdb)
~"callee3 (strarg=0x400730 \"A string argument.\") at src/gdb/testsuite/gdb.mi/basics.c:35\n"
~"35\t}\n"
+~"Value returned is $1 = 0\n"
*stopped,reason="function-finished",frame=...,gdb-result-var="$1",return-value="0",thread-id="1",stopped-threads="all",core="0"
-FAIL: gdb.mi/mi-cli.exp: CLI finish: check CLI output
+PASS: gdb.mi/mi-cli.exp: CLI finish: check CLI output
gdb/ChangeLog:
2015-09-09 Pedro Alves <palves@redhat.com>
* Makefile.in (COMMON_OBS): Add thread-fsm.o.
* breakpoint.c (handle_jit_event): Print debug output.
(bpstat_what): Split event callback handling to ...
(bpstat_run_callbacks): ... this new function.
(momentary_bkpt_print_it): No longer handle bp_finish here.
* breakpoint.h (bpstat_run_callbacks): Declare.
* gdbthread.h (struct thread_info) <step_multi>: Delete field.
<thread_fsm>: New field.
(thread_cancel_execution_command): Declare.
* infcmd.c: Include thread-fsm.h.
(struct step_command_fsm): New.
(step_command_fsm_ops): New global.
(new_step_command_fsm, step_command_fsm_prepare): New functions.
(step_1): Adjust to use step_command_fsm_prepare and
prepare_one_step.
(struct step_1_continuation_args): Delete.
(step_1_continuation): Delete.
(step_command_fsm_should_stop): New function.
(step_once): Delete.
(step_command_fsm_clean_up, step_command_fsm_async_reply_reason)
(prepare_one_step): New function, based on step_once.
(until_next_command): Remove step_multi reference.
(struct return_value_info): New.
(print_return_value): Rename to ...
(print_return_value_1): ... this. New struct return_value_info
parameter. Adjust.
(print_return_value): Reimplement as wrapper around
print_return_value_1.
(struct finish_command_fsm): New.
(finish_command_continuation): Delete.
(finish_command_fsm_ops): New global.
(new_finish_command_fsm, finish_command_fsm_should_stop): New
functions.
(finish_command_fsm_clean_up, finish_command_fsm_return_value):
New.
(finish_command_continuation_free_arg): Delete.
(finish_command_fsm_async_reply_reason): New.
(finish_backward, finish_forward): Change symbol parameter to a
finish_command_fsm. Adjust.
(finish_command): Create a finish_command_fsm. Adjust.
* infrun.c: Include "thread-fsm.h".
(clear_proceed_status_thread): Delete the thread's FSM.
(infrun_thread_stop_requested_callback): Cancel the thread's
execution command.
(clean_up_just_stopped_threads_fsms): New function.
(fetch_inferior_event): Handle the event_thread's should_stop
method saying the command isn't done yet.
(process_event_stop_test): Run breakpoint callbacks here.
(print_stop_event): Rename to ...
(print_stop_location): ... this.
(restore_current_uiout_cleanup): New function.
(print_stop_event): Reimplement.
(normal_stop): No longer notify the end_stepping_range observers
here handle "step N" nor "finish" here. No longer call
print_stop_event here.
* infrun.h (struct return_value_info): Forward declare.
(print_return_value): Declare.
(print_stop_event): Change prototype.
* thread-fsm.c: New file.
* thread-fsm.h: New file.
* thread.c: Include "thread-fsm.h".
(thread_cancel_execution_command): New function.
(clear_thread_inferior_resources): Call it.
* cli/cli-interp.c (cli_on_normal_stop): New function.
(cli_interpreter_init): Install cli_on_normal_stop as normal_stop
observer.
* mi/mi-interp.c: Include "thread-fsm.h".
(restore_current_uiout_cleanup): Delete.
(mi_on_normal_stop): If the thread has an FSM associated, and it
finished, ask it for the async-reply-reason to print. Always call
print_stop_event here, regardless of the top-level interpreter.
Check bpstat_what to tell whether an asynchronous breakpoint hit
triggered.
* tui/tui-interp.c (tui_on_normal_stop): New function.
(tui_init): Install tui_on_normal_stop as normal_stop observer.
gdb/testsuite/ChangeLog:
2015-09-09 Pedro Alves <palves@redhat.com>
* gdb.mi/mi-cli.exp: Add CLI finish tests.
|
|
The remote packet buffer size is currently capped to 16384 mostly for
historical reasons, related to use of alloca. Stop using alloca and
remove the limitation.
Tested on x86_64 Fedora 20.
gdb/ChangeLog:
2015-08-27 Pedro Alves <palves@redhat.com>
* remote.c (DEFAULT_MAX_MEMORY_PACKET_SIZE)
(MIN_MEMORY_PACKET_SIZE): New.
(MAX_REMOTE_PACKET_SIZE, MIN_REMOTE_PACKET_SIZE): Delete.
(get_memory_packet_size): Adjust. No longer limit the max packet
size.
(set_memory_packet_size): Adjust, and remove dead code.
(remote_check_symbols): Use xmalloc and a cleanup instead of
alloca.
(remote_packet_size): No longer cap the packet size.
(putpkt_binary): Use xmalloc and a cleanup instead of alloca.
|
|
This patch is part of the make-gdb-buildable-in-C++ effort. The idea is
to change some calls to the xmalloc family of functions to calls to the
equivalents in the XNEW family. This avoids adding an explicit cast, so
it keeps the code a bit more readable. Some of them also map relatively
well to a C++ equivalent (XNEW (struct foo) -> new foo), so it will be
possible to do scripted replacements if needed.
I only changed calls that were obviously allocating memory for one or
multiple "objects". Allocation of variable sizes (such as strings or
buffer handling) will be for later (and won't use XNEW).
- xmalloc (sizeof (struct foo)) -> XNEW (struct foo)
- xmalloc (num * sizeof (struct foo)) -> XNEWVEC (struct foo, num)
- xcalloc (1, sizeof (struct foo)) -> XCNEW (struct foo)
- xcalloc (num, sizeof (struct foo)) -> XCNEWVEC (struct foo, num)
- xrealloc (p, num * sizeof (struct foo) -> XRESIZEVEC (struct foo, p, num)
- obstack_alloc (ob, sizeof (struct foo)) -> XOBNEW (ob, struct foo)
- obstack_alloc (ob, num * sizeof (struct foo)) -> XOBNEWVEC (ob, struct foo, num)
- alloca (sizeof (struct foo)) -> XALLOCA (struct foo)
- alloca (num * sizeof (struct foo)) -> XALLOCAVEC (struct foo, num)
Some instances of xmalloc followed by memset to zero the buffer were
replaced by XCNEW or XCNEWVEC.
I regtested on x86-64, Ubuntu 14.04, but the patch touches many
architecture-specific files. For those I'll have to rely on the
buildbot or people complaining that I broke their gdb.
gdb/ChangeLog:
* aarch64-linux-nat.c (aarch64_add_process): Likewise.
* aarch64-tdep.c (aarch64_gdbarch_init): Likewise.
* ada-exp.y (write_ambiguous_var): Likewise.
* ada-lang.c (resolve_subexp): Likewise.
(user_select_syms): Likewise.
(assign_aggregate): Likewise.
(ada_evaluate_subexp): Likewise.
(cache_symbol): Likewise.
* addrmap.c (allocate_key): Likewise.
(addrmap_create_mutable): Likewise.
* aix-thread.c (sync_threadlists): Likewise.
* alpha-tdep.c (alpha_push_dummy_call): Likewise.
(alpha_gdbarch_init): Likewise.
* amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise.
* arm-linux-nat.c (arm_linux_add_process): Likewise.
* arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise.
* arm-tdep.c (push_stack_item): Likewise.
(arm_displaced_step_copy_insn): Likewise.
(arm_gdbarch_init): Likewise.
(_initialize_arm_tdep): Likewise.
* avr-tdep.c (push_stack_item): Likewise.
* ax-general.c (new_agent_expr): Likewise.
* block.c (block_initialize_namespace): Likewise.
* breakpoint.c (alloc_counted_command_line): Likewise.
(update_dprintf_command_list): Likewise.
(parse_breakpoint_sals): Likewise.
(decode_static_tracepoint_spec): Likewise.
(until_break_command): Likewise.
(clear_command): Likewise.
(update_global_location_list): Likewise.
(get_breakpoint_objfile_data) Likewise.
* btrace.c (ftrace_new_function): Likewise.
(btrace_set_insn_history): Likewise.
(btrace_set_call_history): Likewise.
* buildsym.c (add_symbol_to_list): Likewise.
(record_pending_block): Likewise.
(start_subfile): Likewise.
(start_buildsym_compunit): Likewise.
(push_subfile): Likewise.
(end_symtab_get_static_block): Likewise.
(buildsym_init): Likewise.
* cli/cli-cmds.c (source_command): Likewise.
* cli/cli-decode.c (add_cmd): Likewise.
* cli/cli-script.c (build_command_line): Likewise.
(setup_user_args): Likewise.
(realloc_body_list): Likewise.
(process_next_line): Likewise.
(copy_command_lines): Likewise.
* cli/cli-setshow.c (do_set_command): Likewise.
* coff-pe-read.c (read_pe_exported_syms): Likewise.
* coffread.c (coff_locate_sections): Likewise.
(coff_symtab_read): Likewise.
(coff_read_struct_type): Likewise.
* common/cleanups.c (make_my_cleanup2): Likewise.
* common/common-exceptions.c (throw_it): Likewise.
* common/filestuff.c (make_cleanup_close): Likewise.
* common/format.c (parse_format_string): Likewise.
* common/queue.h (DEFINE_QUEUE_P): Likewise.
* compile/compile-object-load.c (munmap_list_add): Likewise.
(compile_object_load): Likewise.
* compile/compile-object-run.c (compile_object_run): Likewise.
* compile/compile.c (append_args): Likewise.
* corefile.c (specify_exec_file_hook): Likewise.
* cp-support.c (make_symbol_overload_list): Likewise.
* cris-tdep.c (push_stack_item): Likewise.
(cris_gdbarch_init): Likewise.
* ctf.c (ctf_trace_file_writer_new): Likewise.
* dbxread.c (init_header_files): Likewise.
(add_new_header_file): Likewise.
(init_bincl_list): Likewise.
(dbx_end_psymtab): Likewise.
(start_psymtab): Likewise.
(dbx_end_psymtab): Likewise.
* dcache.c (dcache_init): Likewise.
* dictionary.c (dict_create_hashed): Likewise.
(dict_create_hashed_expandable): Likewise.
(dict_create_linear): Likewise.
(dict_create_linear_expandable): Likewise.
* dtrace-probe.c (dtrace_process_dof_probe): Likewise.
* dummy-frame.c (register_dummy_frame_dtor): Likewise.
* dwarf2-frame-tailcall.c (cache_new_ref1): Likewise.
* dwarf2-frame.c (dwarf2_build_frame_info): Likewise.
(decode_frame_entry_1): Likewise.
* dwarf2expr.c (new_dwarf_expr_context): Likewise.
* dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise.
* dwarf2read.c (dwarf2_has_info): Likewise.
(create_signatured_type_table_from_index): Likewise.
(dwarf2_read_index): Likewise.
(dw2_get_file_names_reader): Likewise.
(create_all_type_units): Likewise.
(read_cutu_die_from_dwo): Likewise.
(init_tu_and_read_dwo_dies): Likewise.
(init_cutu_and_read_dies): Likewise.
(create_all_comp_units): Likewise.
(queue_comp_unit): Likewise.
(inherit_abstract_dies): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_add_field): Likewise.
(dwarf2_add_typedef): Likewise.
(dwarf2_add_member_fn): Likewise.
(attr_to_dynamic_prop): Likewise.
(abbrev_table_alloc_abbrev): Likewise.
(abbrev_table_read_table): Likewise.
(add_include_dir): Likewise.
(add_file_name): Likewise.
(dwarf_decode_line_header): Likewise.
(dwarf2_const_value_attr): Likewise.
(dwarf_alloc_block): Likewise.
(parse_macro_definition): Likewise.
(set_die_type): Likewise.
(write_psymtabs_to_index): Likewise.
(create_cus_from_index): Likewise.
(dwarf2_create_include_psymtab): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(build_type_psymtab_dependencies): Likewise.
(read_comp_units_from_section): Likewise.
(compute_compunit_symtab_includes): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(read_func_scope): Likewise.
(process_structure_scope): Likewise.
(mark_common_block_symbol_computed): Likewise.
(load_partial_dies): Likewise.
(dwarf2_symbol_mark_computed): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_read_minimal_symbols): Likewise.
* environ.c (make_environ): Likewise.
* eval.c (evaluate_subexp_standard): Likewise.
* event-loop.c (create_file_handler): Likewise.
(create_async_signal_handler): Likewise.
(create_async_event_handler): Likewise.
(create_timer): Likewise.
* exec.c (build_section_table): Likewise.
* fbsd-nat.c (fbsd_remember_child): Likewise.
* fork-child.c (fork_inferior): Likewise.
* frv-tdep.c (new_variant): Likewise.
* gdbarch.sh (gdbarch_alloc): Likewise.
(append_name): Likewise.
* gdbtypes.c (rank_function): Likewise.
(copy_type_recursive): Likewise.
(add_dyn_prop): Likewise.
* gnu-nat.c (make_proc): Likewise.
(make_inf): Likewise.
(gnu_write_inferior): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
(build_std_type_info_type): Likewise.
* guile/scm-param.c (compute_enum_list): Likewise.
* guile/scm-utils.c (gdbscm_parse_function_args): Likewise.
* guile/scm-value.c (gdbscm_value_call): Likewise.
* h8300-tdep.c (h8300_gdbarch_init): Likewise.
* hppa-tdep.c (hppa_init_objfile_priv_data): Likewise.
(read_unwind_info): Likewise.
* ia64-tdep.c (ia64_gdbarch_init): Likewise.
* infcall.c (dummy_frame_context_saver_setup): Likewise.
(call_function_by_hand_dummy): Likewise.
* infcmd.c (step_once): Likewise.
(finish_forward): Likewise.
(attach_command): Likewise.
(notice_new_inferior): Likewise.
* inferior.c (add_inferior_silent): Likewise.
* infrun.c (add_displaced_stepping_state): Likewise.
(save_infcall_control_state): Likewise.
(save_inferior_ptid): Likewise.
(_initialize_infrun): Likewise.
* jit.c (bfd_open_from_target_memory): Likewise.
(jit_gdbarch_data_init): Likewise.
* language.c (add_language): Likewise.
* linespec.c (decode_line_2): Likewise.
* linux-nat.c (add_to_pid_list): Likewise.
(add_initial_lwp): Likewise.
* linux-thread-db.c (add_thread_db_info): Likewise.
(record_thread): Likewise.
(info_auto_load_libthread_db): Likewise.
* m32c-tdep.c (m32c_gdbarch_init): Likewise.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise.
* m68k-tdep.c (m68k_gdbarch_init): Likewise.
* m88k-tdep.c (m88k_analyze_prologue): Likewise.
* macrocmd.c (macro_define_command): Likewise.
* macroexp.c (gather_arguments): Likewise.
* macroscope.c (sal_macro_scope): Likewise.
* macrotab.c (new_macro_table): Likewise.
* mdebugread.c (push_parse_stack): Likewise.
(parse_partial_symbols): Likewise.
(parse_symbol): Likewise.
(psymtab_to_symtab_1): Likewise.
(new_block): Likewise.
(new_psymtab): Likewise.
(mdebug_build_psymtabs): Likewise.
(add_pending): Likewise.
(elfmdebug_build_psymtabs): Likewise.
* mep-tdep.c (mep_gdbarch_init): Likewise.
* mi/mi-main.c (mi_execute_command): Likewise.
* mi/mi-parse.c (mi_parse_argv): Likewise.
* minidebug.c (lzma_open): Likewise.
* minsyms.c (terminate_minimal_symbol_table): Likewise.
* mips-linux-nat.c (mips_linux_insert_watchpoint): Likewise.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* mn10300-tdep.c (mn10300_gdbarch_init): Likewise.
* msp430-tdep.c (msp430_gdbarch_init): Likewise.
* mt-tdep.c (mt_registers_info): Likewise.
* nat/aarch64-linux.c (aarch64_linux_new_thread): Likewise.
* nat/linux-btrace.c (linux_enable_bts): Likewise.
(linux_enable_pt): Likewise.
* nat/linux-osdata.c (linux_xfer_osdata_processes): Likewise.
(linux_xfer_osdata_processgroups): Likewise.
* nios2-tdep.c (nios2_gdbarch_init): Likewise.
* nto-procfs.c (procfs_meminfo): Likewise.
* objc-lang.c (start_msglist): Likewise.
(selectors_info): Likewise.
(classes_info): Likewise.
(find_methods): Likewise.
* objfiles.c (allocate_objfile): Likewise.
(update_section_map): Likewise.
* osabi.c (gdbarch_register_osabi): Likewise.
(gdbarch_register_osabi_sniffer): Likewise.
* parse.c (start_arglist): Likewise.
* ppc-linux-nat.c (hwdebug_find_thread_points_by_tid): Likewise.
(hwdebug_insert_point): Likewise.
* printcmd.c (display_command): Likewise.
(ui_printf): Likewise.
* procfs.c (create_procinfo): Likewise.
(load_syscalls): Likewise.
(proc_get_LDT_entry): Likewise.
(proc_update_threads): Likewise.
* prologue-value.c (make_pv_area): Likewise.
(pv_area_store): Likewise.
* psymtab.c (extend_psymbol_list): Likewise.
(init_psymbol_list): Likewise.
(allocate_psymtab): Likewise.
* python/py-inferior.c (add_thread_object): Likewise.
* python/py-param.c (compute_enum_values): Likewise.
* python/py-value.c (valpy_call): Likewise.
* python/py-varobj.c (py_varobj_iter_next): Likewise.
* python/python.c (ensure_python_env): Likewise.
* record-btrace.c (record_btrace_start_replaying): Likewise.
* record-full.c (record_full_reg_alloc): Likewise.
(record_full_mem_alloc): Likewise.
(record_full_end_alloc): Likewise.
(record_full_core_xfer_partial): Likewise.
* regcache.c (get_thread_arch_aspace_regcache): Likewise.
* remote-fileio.c (remote_fileio_init_fd_map): Likewise.
* remote-notif.c (remote_notif_state_allocate): Likewise.
* remote.c (demand_private_info): Likewise.
(remote_notif_stop_alloc_reply): Likewise.
(remote_enable_btrace): Likewise.
* reverse.c (save_bookmark_command): Likewise.
* rl78-tdep.c (rl78_gdbarch_init): Likewise.
* rx-tdep.c (rx_gdbarch_init): Likewise.
* s390-linux-nat.c (s390_insert_watchpoint): Likewise.
* ser-go32.c (dos_get_tty_state): Likewise.
(dos_copy_tty_state): Likewise.
* ser-mingw.c (ser_windows_open): Likewise.
(ser_console_wait_handle): Likewise.
(ser_console_get_tty_state): Likewise.
(make_pipe_state): Likewise.
(net_windows_open): Likewise.
* ser-unix.c (hardwire_get_tty_state): Likewise.
(hardwire_copy_tty_state): Likewise.
* solib-aix.c (solib_aix_new_lm_info): Likewise.
* solib-dsbt.c (dsbt_current_sos): Likewise.
(dsbt_relocate_main_executable): Likewise.
* solib-frv.c (frv_current_sos): Likewise.
(frv_relocate_main_executable): Likewise.
* solib-spu.c (spu_bfd_fopen): Likewise.
* solib-svr4.c (lm_info_read): Likewise.
(svr4_copy_library_list): Likewise.
(svr4_default_sos): Likewise.
* source.c (find_source_lines): Likewise.
(line_info): Likewise.
(add_substitute_path_rule): Likewise.
* spu-linux-nat.c (spu_bfd_open): Likewise.
* spu-tdep.c (info_spu_dma_cmdlist): Likewise.
* stabsread.c (dbx_lookup_type): Likewise.
(read_type): Likewise.
(read_member_functions): Likewise.
(read_struct_fields): Likewise.
(read_baseclasses): Likewise.
(read_args): Likewise.
(_initialize_stabsread): Likewise.
* stack.c (func_command): Likewise.
* stap-probe.c (handle_stap_probe): Likewise.
* symfile.c (addrs_section_sort): Likewise.
(addr_info_make_relative): Likewise.
(load_section_callback): Likewise.
(add_symbol_file_command): Likewise.
(init_filename_language_table): Likewise.
* symtab.c (create_filename_seen_cache): Likewise.
(sort_search_symbols_remove_dups): Likewise.
(search_symbols): Likewise.
* target.c (make_cleanup_restore_target_terminal): Likewise.
* thread.c (new_thread): Likewise.
(enable_thread_stack_temporaries): Likewise.
(make_cleanup_restore_current_thread): Likewise.
(thread_apply_all_command): Likewise.
* tic6x-tdep.c (tic6x_gdbarch_init): Likewise.
* top.c (gdb_readline_wrapper): Likewise.
* tracefile-tfile.c (tfile_trace_file_writer_new): Likewise.
* tracepoint.c (trace_find_line_command): Likewise.
(all_tracepoint_actions_and_cleanup): Likewise.
(make_cleanup_restore_current_traceframe): Likewise.
(get_uploaded_tp): Likewise.
(get_uploaded_tsv): Likewise.
* tui/tui-data.c (tui_alloc_generic_win_info): Likewise.
(tui_alloc_win_info): Likewise.
(tui_alloc_content): Likewise.
(tui_add_content_elements): Likewise.
* tui/tui-disasm.c (tui_find_disassembly_address): Likewise.
(tui_set_disassem_content): Likewise.
* ui-file.c (ui_file_new): Likewise.
(stdio_file_new): Likewise.
(tee_file_new): Likewise.
* utils.c (make_cleanup_restore_integer): Likewise.
(add_internal_problem_command): Likewise.
* v850-tdep.c (v850_gdbarch_init): Likewise.
* valops.c (find_oload_champ): Likewise.
* value.c (allocate_value_lazy): Likewise.
(record_latest_value): Likewise.
(create_internalvar): Likewise.
* varobj.c (install_variable): Likewise.
(new_variable): Likewise.
(new_root_variable): Likewise.
(cppush): Likewise.
(_initialize_varobj): Likewise.
* windows-nat.c (windows_make_so): Likewise.
* x86-nat.c (x86_add_process): Likewise.
* xcoffread.c (arrange_linetable): Likewise.
(allocate_include_entry): Likewise.
(process_linenos): Likewise.
(SYMBOL_DUP): Likewise.
(xcoff_start_psymtab): Likewise.
(xcoff_end_psymtab): Likewise.
* xml-support.c (gdb_xml_parse_attr_ulongest): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
gdb/gdbserver/ChangeLog:
* ax.c (gdb_parse_agent_expr): Likewise.
(compile_bytecodes): Likewise.
* dll.c (loaded_dll): Likewise.
* event-loop.c (append_callback_event): Likewise.
(create_file_handler): Likewise.
(create_file_event): Likewise.
* hostio.c (handle_open): Likewise.
* inferiors.c (add_thread): Likewise.
(add_process): Likewise.
* linux-aarch64-low.c (aarch64_linux_new_process): Likewise.
* linux-arm-low.c (arm_new_process): Likewise.
(arm_new_thread): Likewise.
* linux-low.c (add_to_pid_list): Likewise.
(linux_add_process): Likewise.
(handle_extended_wait): Likewise.
(add_lwp): Likewise.
(enqueue_one_deferred_signal): Likewise.
(enqueue_pending_signal): Likewise.
(linux_resume_one_lwp_throw): Likewise.
(linux_resume_one_thread): Likewise.
(linux_read_memory): Likewise.
(linux_write_memory): Likewise.
* linux-mips-low.c (mips_linux_new_process): Likewise.
(mips_linux_new_thread): Likewise.
(mips_add_watchpoint): Likewise.
* linux-x86-low.c (initialize_low_arch): Likewise.
* lynx-low.c (lynx_add_process): Likewise.
* mem-break.c (set_raw_breakpoint_at): Likewise.
(set_breakpoint): Likewise.
(add_condition_to_breakpoint): Likewise.
(add_commands_to_breakpoint): Likewise.
(clone_agent_expr): Likewise.
(clone_one_breakpoint): Likewise.
* regcache.c (new_register_cache): Likewise.
* remote-utils.c (look_up_one_symbol): Likewise.
* server.c (queue_stop_reply): Likewise.
(start_inferior): Likewise.
(queue_stop_reply_callback): Likewise.
(handle_target_event): Likewise.
* spu-low.c (fetch_ppc_memory): Likewise.
(store_ppc_memory): Likewise.
* target.c (set_target_ops): Likewise.
* thread-db.c (thread_db_load_search): Likewise.
(try_thread_db_load_1): Likewise.
* tracepoint.c (add_tracepoint): Likewise.
(add_tracepoint_action): Likewise.
(create_trace_state_variable): Likewise.
(cmd_qtdpsrc): Likewise.
(cmd_qtro): Likewise.
(add_while_stepping_state): Likewise.
* win32-low.c (child_add_thread): Likewise.
(get_image_name): Likewise.
|
|
This patch fixes a segmentation fault in native GDB when
handling an exec event with follow-exec-mode set to "new".
The stack trace from the segfault was this:
0 0x0000000000669594 in gdbarch_data (gdbarch=0x0, data=0x20da7a0)
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/gdbarch.c:4847
1 0x00000000004d430e in get_remote_arch_state ()
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/remote.c:603
2 0x00000000004d431e in get_remote_state ()
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/remote.c:616
3 0x00000000004dda8b in discard_pending_stop_replies (inf=0x217c710)
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/remote.c:5775
4 0x00000000006a5928 in observer_inferior_exit_notification_stub (
data=0x4dda7a <discard_pending_stop_replies>, args_data=0x7fff12c258f0)
at ./observer.inc:1137
5 0x00000000006a419a in generic_observer_notify (subject=0x21dfbe0,
args=0x7fff12c258f0)
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/observer.c:167
6 0x00000000006a59ba in observer_notify_inferior_exit (inf=0x217c710)
at ./observer.inc:1162
7 0x00000000007981d5 in exit_inferior_1 (inftoex=0x217c710, silent=1)
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/inferior.c:244
8 0x00000000007982f2 in exit_inferior_num_silent (num=1)
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/inferior.c:286
9 0x000000000062f93d in follow_exec (ptid=...,
execd_pathname=0x7fff12c259a0 "/scratch/dbreazea/sandbox/exec-nat/build/gdb/testsuite/gdb.base/execd-prog")
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/infrun.c:1195
In follow_exec we were creating a new inferior for the execd program,
as required by the exec mode, but we were doing it before calling
exit_inferior_num_silent on the original inferior. So on entry to
exit_inferior_num_silent we had two inferiors with the same ptid.
In the calls made by exit_inferior_num_silent, the current inferior
is temporarily saved and replaced in order to make use of functions
that only operate on the current inferior (for example, in
do_all_continuations, called while deleting the threads of the original
inferior). When we restored the original inferior, we just took the
first inferior that matched the ptid of the original and got the new
(wrong) one. It hadn't been initialized yet and had no gdbarch
pointer, and GDB segfaulted.
The fix for that is to call exit_inferior_num_silent before adding the new
inferior, so that we never have two inferiors with the same ptid. Then
exit_inferior_num_silent uses the original inferior as the current inferior
throughout, and can find a valid gdbarch pointer.
Once we have finished with the exit of the old inferior and added the
new one, we need to create a new thread for the new inferior. In the
function that called follow_exec, handle_inferior_event_1,
ecs->event_thread now points to the thread that was deleted with the
exit of the original inferior. To remedy this we create the new thread,
and once we return from follow_exec we reset ecs->event_thread.
Note that we are guaranteed that we can reset ecs->event_thread
safely using inferior_thread because we have set the current
inferior in follow_exec, and inferior_ptid was set by the call
to context_switch at the beginning of exec event handling.
gdb/ChangeLog:
* infrun.c (follow_exec): Re-order operations for
handling follow-exec-mode "new".
(handle_inferior_event_1): Assign ecs->event_thread
to the current thread.
* remote.c (get_remote_arch_state): Add an assertion.
|
|
Currently, when remote debugging, if you type Ctrl-C just while the
target stopped for an internal event, and GDB is busy doing something
that takes a while (e.g., fetching chunks of a shared library off of
the target, with vFile, to process ELF headers and debug info), the
Ctrl-C is lost.
The patch hooks up the QUIT macro to a new target method that lets the
target react to the double-Ctrl-C before the event loop is reached,
which allows reacting to a double-Ctrl-C even when GDB is busy doing
some long operation and not waiting for a stop reply. That end result
is:
(gdb) c
Continuing.
^C
^C
Interrupted while waiting for the program.
Give up waiting? (y or n) y
Quit
(gdb) info threads
Id Target Id Frame
* 1 Thread 11673 0x00007ffff7deb240 in _dl_debug_state () from target:/lib64/ld-linux-x86-64.so.2
(gdb)
If, however, GDB is waiting for a stop reply (because the target has
been resumed, with e.g., vCont;c), but the target isn't responding, we
now get:
(gdb) c
Continuing.
^C
^C
The target is not responding to interrupt requests.
Stop debugging it? (y or n) y
Disconnected from target.
(gdb) info threads
No threads.
This offers to disconnect, because when we're waiting for a stop
reply, there's nothing else we can send the target other than an
interrupt request. And if that doesn't work, there's nothing else we
can do.
The Ctrl-C is presently lost because until we get to a user-visible
stop, the SIGINT handler that is installed is the one that forwards
the interrupt to the remote side, with the \003 "packet" [1]. But,
gdbserver ignores an interrupt request if the program is stopped.
Still, even if it didn't, the server can only report back a
stop-because-of-SIGINT when the program is next resumed. And it may
take a while to actually re-resume the target.
[1] - In the old sync days, the remote target would react to a
double-Ctrl-C by asking users whether they wanted to give up waiting
and disconnect. The code is still there, but it it isn't reacheable
on most hosts, which support serial connections in async mode
(probably only DJGPP doesn't). Even then, in sync mode, remote.c's
SIGINT handler is only installed while the target is resumed, and is
removed as soon as the target sends back a stop reply. That means
that a Ctrl-C just while GDB is processing an internal event can end
up with an odd "Quit" at the prompt instead of "Program stopped by
SIGINT". In contrast, in async mode, remote.c's SIGINT handler is set
up as long as target_terminal_inferior or
target_terminal_ours_for_output are in effect (IOW, until we get a
user-visible stop and call target_terminal_ours), so the user
shouldn't get back a spurious Quit. However, it's still desirable to
be able to interrupt a long-running GDB operation, if GDB takes a
while to re-resume the target or get back to the event loop.
Tested on x86_64 Fedora 20.
gdb/ChangeLog:
2015-08-24 Pedro Alves <palves@redhat.com>
* defs.h (maybe_quit): Declare.
(QUIT): Now calls maybe_quit.
* event-loop.c (clear_async_signal_handler)
(async_signal_handler_is_marked): New functions.
* event-loop.h (async_signal_handler_is_marked)
(clear_async_signal_handler): New declarations.
* remote.c (remote_check_pending_interrupt): New function.
(interrupt_query): Use make_cleanup_restore_target_terminal. No
longer check whether the target is async. If waiting for a stop
reply, and a Ctrl-C as been sent to the target, offer to
disconnect, and throw TARGET_CLOSE_ERROR instead of a quit.
Otherwise do not disconnect and throw a quit.
(_initialize_remote): Install remote_check_pending_interrupt as
to_check_pending_interrupt.
* target.c (target_check_pending_interrupt): New function.
* target.h (struct target_ops) <to_check_pending_interrupt>: New
field.
(target_check_pending_interrupt): New declaration.
* utils.c (maybe_quit): New function.
* target-delegates.c: Regenerate.
|
|
Being able to force-disable the RSP multiprocess extensions is useful
for testing.
gdb/ChangeLog:
2015-08-24 Pedro Alves <palves@redhat.com>
* NEWS (New commands): Mention set/show remote
multiprocess-extensions-packet.
* remote.c (remote_query_supported): Only tell the server to use
the multiprocess extensions if the user hasn't force-disabled them
with "set remote multiprocess-extensions-packet off".
gdb/doc/ChangeLog:
2015-08-24 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Remote Configuration): Document the "set/show
remote multiprocess-extensions-packet" commands.
|
|
After the last gnulib import (Dec 2012), gnulib upstream started
replacing mingw's 'struct timeval' with a version with 64-bit time_t,
for POSIX compliance:
commit f8e84098084b3b53bc6943a5542af1f607ffd477
Author: Bruno Haible <bruno@clisp.org>
Date: Sat Jan 28 18:12:10 2012 +0100
sys_time: Override 'struct timeval' on some native Windows platforms.
See:
https://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00372.html
However, that results in conflicts with native Winsock2's 'select':
select()'s argument
http://sourceforge.net/p/mingw-w64/mailman/message/29610438/
... and libiberty's timeval-utils.h timeval_add/timeval_sub, at the
least.
We don't really need the POSIX compliance, so this patch prepares us
to simply not use gnulib's 'struct timeval' replacement once a more
recent gnulib is imported, thus preserving the current behavior, by
adding a sys/time.h wrapper header that undefs gnulib's replacements,
and including that everywhere instead.
The SIZE -> OSIZE change is necessary because newer gnulib's
sys/time.h also includes windows.h/winsock2.h, which defines a
conflicting SIZE symbol.
Cross build-tested mingw-w64 32-bit and 64-bit.
Regtested on x86_64 Fedora 20.
gdb/ChangeLog:
2015-08-24 Pedro Alves <palves@redhat.com>
* Makefile.in (HFILES_NO_SRCDIR): Add common/gdb_sys_time.h.
* common/gdb_sys_time.h: New file.
* event-loop.c: Include gdb_sys_time.h instead of sys/time.h.
* gdb_select.h: Likewise.
* gdb_usleep.c: Likewise.
* maint.c: Likewise.
* mi/mi-main.c: Likewise.
* mi/mi-parse.h: Likewise.
* remote-fileio.c: Likewise.
* remote-m32r-sdi.c: Likewise.
* remote.c: Likewise.
* ser-base.c: Likewise.
* ser-pipe.c: Likewise.
* ser-tcp.c: Likewise.
* ser-unix.c: Likewise.
* symfile.c: Likewise.
* symfile.c: Likewise. Rename OSIZE to SIZE throughout.
* target-memory.c: Include gdb_sys_time.h instead of sys/time.h.
* utils.c: Likewise.
gdb/gdbserver/ChangeLog:
2015-08-24 Pedro Alves <palves@redhat.com>
* debug.c: Include gdb_sys_time.h instead of sys/time.h.
* event-loop.c: Likewise.
* remote-utils.c: Likewise.
* tracepoint.c: Likewise.
|
|
GDB provides no indicator of progress during file operations, and can
appear to have locked up during slow remote transfers. This commit
updates GDB to print a warning each time a file is accessed over RSP.
An additional message detailing how to avoid remote transfers is
printed for the first transfer only.
gdb/ChangeLog:
* target.h (struct target_ops) <to_fileio_open>: New argument
warn_if_slow. Update comment. All implementations updated.
(target_fileio_open_warn_if_slow): New declaration.
* target.c (target_fileio_open): Renamed as...
(target_fileio_open_1): ...this. New argument warn_if_slow.
Pass warn_if_slow to implementation. Update debug printing.
(target_fileio_open): New function.
(target_fileio_open_warn_if_slow): Likewise.
* gdb_bfd.c (gdb_bfd_iovec_fileio_open): Use new function
target_fileio_open_warn_if_slow.
gdb/testsuite/ChangeLog:
* gdb.trace/pending.exp: Cope with remote transfer warnings.
|
|
This patch almost halves the time it takes to "target remote + run to
main" on a higher-latency connection.
E.g., I've got a ping time of ~85ms to an x86-64 machine on the gcc
compile farm (almost 2000km away from me), and I'm behind a ~16Mbit
ADSL. When I connect to a gdbserver debugging itself on that machine
and run to main, it takes almost 55 seconds:
[palves@gcc76] $ ./gdbserver :9999 ./gdbserver
[palves@home] $ ssh -L 9999:localhost:9999 gcc76.fsffrance.org
[palves@home] $ time ./gdb -data-directory=data-directory -ex "tar rem :9999" -ex "b main" -ex "c" -ex "set confirm off" -ex "quit"
Pristine gdb 7.10.50.20150820-cvs gets us:
...
Remote debugging using :9999
Reading symbols from target:/home/palves/gdb/build/gdb/gdbserver/gdbserver...done.
Reading symbols from target:/lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
0x00007ffff7ddd190 in ?? () from target:/lib64/ld-linux-x86-64.so.2
Breakpoint 1 at 0x41200c: file ../../../src/gdb/gdbserver/server.c, line 3635.
Continuing.
Breakpoint 1, main (argc=1, argv=0x7fffffffe3d8) at ../../../src/gdb/gdbserver/server.c:3635
3635 ../../../src/gdb/gdbserver/server.c: No such file or directory.
/home/palves/gdb/build/gdb/gdbserver/gdbserver: No such file or directory.
real 0m54.803s
user 0m0.329s
sys 0m0.064s
While with the readahead cache added by this patch, it drops to:
real 0m29.462s
user 0m0.454s
sys 0m0.054s
I added a few counters to show cache hit/miss, and got:
readahead cache miss 142
readahead cache hit 310
Tested on x86_64 Fedora 20.
gdb/ChangeLog:
2015-08-21 Pedro Alves <palves@redhat.com>
* remote.c (struct readahead_cache): New.
(struct remote_state) <readahead_cache>: New field.
(remote_open_1): Invalidate the cache.
(readahead_cache_invalidate, readahead_cache_invalidate_fd): New
functions.
(remote_hostio_pwrite): Invalidate the readahead cache.
(remote_hostio_pread): Rename to ...
(remote_hostio_pread_vFile): ... this.
(remote_hostio_pread_from_cache): New function.
(remote_hostio_pread): Reimplement.
(remote_hostio_close): Invalidate the readahead cache.
|
|
The main motivation for this is making non-stop / all-stop behave
similarly on initial connection, in order to move in the direction of
reimplementing all-stop mode with the remote target always running in
non-stop mode.
When we connect to a remote target in non-stop mode, we may find
threads either running or already stopped. The act of connecting
itself does not force threads to stop. To handle that, the remote
non-stop connection is currently roughly like this:
#1 - Fetch list of remote threads (qXfer:threads:read, qfThreadInfo,
etc). All threads are assumed to be running until the target
reports an asynchronous stop reply for them.
#2 - Fetch the initial set of threads that were already stopped, with
the '?' packet. (In non-stop, this is coupled with the vStopped
mechanism to be able to retrieve the status of more than one
thread.)
The stop replies fetched in #2 are placed in the pending stop reply
queue, and left for the regular event loop to process. That is,
"target remote" finishes and returns _before_ those stops are
processed.
That means that it's possible to have GDB process further commands
before the initial set of stopped threads is reported to the user.
E.g., before the patch, note how the prompt is printed before the
frame:
Remote debugging using :9999
(gdb)
[Thread 15296] #1 stopped.
0x0000003615a011f0 in ?? ()
Even though thread #1 was not running, for a moment, the user can see
it as such:
$ gdb a.out -ex "set non-stop 1" -ex "tar rem :9999" -ex "info threads" -ex "info registers"
Remote debugging using :9999
Id Target Id Frame
* 1 Thread 4772 (running)
Target is executing. <<<<<<< info registers
(gdb)
[Thread 4772] #1 stopped.
0x0000003615a011f0 in ?? ()
To fix that, this commit makes gdb process all threads found already
stopped at connection time, before giving the prompt to the user.
The fix takes a cue from fork-child.c:startup_inferior [1], and
processes the events locally in remote.c, avoiding the whole
wait_for_inferior/handle_inferior_event path. I decided to try this
approach after noticing that:
- several cases in handle_inferior_event miss checking stop_soon.
- we don't want to fetch the thread list in normal_stop.
and trying to fix them was resulting in sprinkling stop_soon checks in
many places, and uglifying normal_stop even more.
While with this patch, I'm avoiding changing GDB's output other than
when the prompt is printed, I think this approach is more flexible if
we do want to change it. And also, it's likely easier to get rid of
the MI *running event that is still sent for threads that are
initially found stopped, if we want to.
This happens to fix the testsuite too. All non-stop tests are racy
against "target remote" / gdbserver testing currently. That is,
sometimes the tests run, but other times they're just skipped without
any indication of PASS/FAIL. When that happens, the logs show:
target remote localhost:2346
Remote debugging using localhost:2346
(gdb)
[Thread 25418] #1 stopped.
0x0000003615a011f0 in ?? ()
^CQuit
(gdb) Remote debugging from host 127.0.0.1
Killing process(es): 25418
monitor exit
(gdb) Remote connection closed
(gdb) testcase /home/pedro/gdb/mygit/build/../src/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp completed in 61 seconds
The trouble here is that there's output after the prompt, and the
regex in question doesn't expect that:
-re "Remote debugging using .*$serialport_re.*$gdb_prompt $" {
verbose "Set target to $targetname"
return 0
}
[1] - before startup_inferior was added, we'd go through
wait_for_inferior/handle_inferior_event while going through the shell,
and that turned out problematic.
Tested on x86_64 Fedora 20, gdbserver.
gdb/ChangeLog:
2015-08-20 Pedro Alves <palves@redhat.com>
* infrun.c (print_target_wait_results): Make extern.
* infrun.h (print_target_wait_results): Declare.
* remote.c (set_stop_requested_callback): Delete.
(process_initial_stop_replies): New function.
(remote_start_remote): Use it.
(stop_reply_queue_length): New function.
gdb/testsuite/ChangeLog:
2015-08-20 Pedro Alves <palves@redhat.com>
* gdb.server/connect-stopped-target.c: New file.
* gdb.server/connect-stopped-target.exp: New file.
|
|
2015-08-18 Sandra Loosemore <sandra@codesourcery.com>
gdb/
* remote.c (strprefix): New.
(remote_parse_stop_reply): Use strprefix instead of strncmp
to ensure exact match of keyword.
|
|
This patch converts the code base to use the new struct event_location
API being introduced. This patch preserves the current functionality and
adds no new features.
The "big picture" API usage introduced by this patch may be illustrated
with a simple exmaple. Where previously developers would write:
void
my_command (char *arg, int from_tty)
{
create_breakpoint (..., arg, ...);
...
}
one now uses:
void
my_command (char *arg, int from_tty)
{
struct event_locaiton *location;
struct cleanup *back_to;
location = string_to_event_locaiton (&arg, ...);
back_to = make_cleanup_delete_event_location (location);
create_breakpoint (..., location, ...);
do_cleanups (back_to);
}
Linespec-decoding functions (now called location-decoding) such as
decode_line_full no longer skip argument pointers over processed input.
That functionality has been moved into string_to_event_location as
demonstrated above.
gdb/ChangeLog
* ax-gdb.c: Include location.h.
(agent_command_1) Use linespec location instead of address
string.
* break-catch-throw.c: Include location.h.
(re_set_exception_catchpoint): Use linespec locations instead
of address strings.
* breakpoint.c: Include location.h.
(create_overlay_event_breakpoint, create_longjmp_master_breakpoint)
(create_std_terminate_master_breakpoint)
(create_exception_master_breakpoint, update_breakpoints_after_exec):
Use linespec location instead of address string.
(print_breakpoint_location): Use locations and
event_location_to_string.
Print extra_string for pending locations for non-MI streams.
(print_one_breakpoint_location): Use locations and
event_location_to_string.
(init_raw_breakpoint_without_location): Initialize b->location.
(create_thread_event_breakpoint): Use linespec location instead of
address string.
(init_breakpoint_sal): Likewise.
Only save extra_string if it is non-NULL and not the empty string.
Use event_location_to_string instead of `addr_string'.
Constify `p' and `endp'.
Use skip_spaces_const/skip_space_const instead of non-const versions.
Copy the location into the breakpoint.
If LOCATION is NULL, save the breakpoint address as a linespec location
instead of an address string.
(create_breakpoint_sal): Change `addr_string' parameter to a struct
event_location. All uses updated.
(create_breakpoints_sal): Likewise for local variable `addr_string'.
(parse_breakpoint_sals): Use locations instead of address strings.
Remove check for empty linespec with conditional.
Refactor.
(decode_static_tracepoint_spec): Make argument const and update
function.
(create_breakpoint): Change `arg' to a struct event_location and
rename.
Remove `copy_arg' and `addr_start'.
If EXTRA_STRING is empty, set it to NULL.
Don't populate `canonical' for pending breakpoints.
Pass `extra_string' to find_condition_and_thread.
Clear `extra_string' if `rest' was NULL.
Do not error with "garbage after location" if setting a dprintf
breakpoint.
Copy the location into the breakpoint instead of an address string.
(break_command_1): Use string_to_event_location and pass this to
create_breakpoint instead of an address string.
Check against `arg_cp' for a probe linespec.
(dprintf_command): Use string_to_event_location and pass this to
create_breakpoint instead of an address string.
Throw an exception if no format string was specified.
(print_recreate_ranged_breakpoint): Use event_location_to_string
instead of address strings.
(break_range_command, until_break_command)
(init_ada_exception_breakpoint): Use locations instead
of address strings.
(say_where): Print out extra_string for pending locations.
(base_breakpoint_dtor): Delete `location' and `location_range_end' of
the breakpoint.
(base_breakpoint_create_sals_from_location): Use struct event_location
instead of address string.
Remove `addr_start' and `copy_arg' parameters.
(base_breakpoint_decode_location): Use struct event_location instead of
address string.
(bkpt_re_set): Use locations instead of address strings.
Use event_location_empty_p to check for unset location.
(bkpt_print_recreate): Use event_location_to_string instead of
an address string.
Print out extra_string for pending locations.
(bkpt_create_sals_from_location, bkpt_decode_location)
(bkpt_probe_create_sals_from_location): Use struct event_location
instead of address string.
(bkpt_probe_decode_location): Use struct event_location instead of
address string.
(tracepoint_print_recreate): Use event_location_to_string to
recreate the tracepoint.
(tracepoint_create_sals_from_location, tracepoint_decode_location)
(tracepoint_probe_create_sals_from_location)
(tracepoint_probe_decode_location): Use struct event_location
instead of address string.
(dprintf_print_recreate): Use event_location_to_string to recreate
the dprintf.
(dprintf_re_set): Remove check for valid/missing format string.
(strace_marker_create_sals_from_location)
(strace_marker_create_breakpoints_sal, strace_marker_decode_location)
(update_static_tracepoint): Use struct event_location instead of
address string.
(location_to_sals): Likewise.
Pass `extra_string' to find_condition_and_thread.
For newly resolved pending breakpoint locations, clear the location's
string representation.
Assert that the breakpoint's condition string is NULL when
condition_not_parsed.
(breakpoint_re_set_default, create_sals_from_location_default)
(decode_location_default, trace_command, ftrace_command)
(strace_command, create_tracepoint_from_upload): Use locations
instead of address strings.
* breakpoint.h (struct breakpoint_ops) <create_sals_from_location>:
Use struct event_location instead of address string.
Update all uses.
<decode_location>: Likewise.
(struct breakpoint) <addr_string>: Change to struct event_location
and rename `location'.
<addr_string_range_end>: Change to struct event_location and rename
`location_range_end'.
(create_breakpoint): Use struct event_location instead of address
string.
* cli/cli-cmds.c: Include location.h.
(edit_command, list_command): Use locations instead of address strings.
* elfread.c: Include location.h.
(elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string.
* guile/scm-breakpoint.c: Include location.h.
(bpscm_print_breakpoint_smob): Use event_location_to_string.
(gdbscm_register_breakpoint): Use locations instead of address
strings.
* linespec.c: Include location.h.
(struct ls_parser) <stream>: Change to const char *.
(PARSER_STREAM): Update.
(lionespec_lexer_lex_keyword): According to find_condition_and_thread,
keywords must be followed by whitespace.
(canonicalize_linespec): Save a linespec location into `canonical'.
Save a canonical linespec into `canonical'.
(parse_linespec): Change `argptr' to const char * and rename `arg'.
All uses updated.
Update function description.
(linespec_parser_new): Initialize `parser'.
Update initialization of parsing stream.
(event_location_to_sals): New function.
(decode_line_full): Change `argptr' to a struct event_location and
rename it `location'.
Use locations instead of address strings.
Call event_location_to_sals instead of parse_linespec.
(decode_line_1): Likewise.
(decode_line_with_current_source, decode_line_with_last_displayed)
Use locations instead of address strings.
(decode_objc): Likewise.
Change `argptr' to const char * and rename `arg'.
(destroy_linespec_result): Delete the linespec result's location
instead of freeing the address string.
* linespec.h (struct linespec_result) <addr_string>: Change to
struct event_location and rename to ...
<location>: ... this.
(decode_line_1, decode_line_full): Change `argptr' to struct
event_location. All callers updated.
* mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h.
(mi_cmd_break_insert_1): Use locations instead of address strings.
Throw an error if there was "garbage" at the end of the specified
linespec.
* probe.c: Include location.h.
(parse_probes): Change `argptr' to struct event_location.
Use event locations instead of address strings.
* probe.h (parse_probes): Change `argptr' to struct event_location.
* python/py-breakpoint.c: Include location.h.
(bppy_get_location): Constify local variable `str'.
Use event_location_to_string.
(bppy_init): Use locations instead of address strings.
* python/py-finishbreakpoint.c: Include location.h.
(bpfinishpy_init): Remove local variable `addr_str'.
Use locations instead of address strings.
* python/python.c: Include location.h.
(gdbpy_decode_line): Use locations instead of address strings.
* remote.c: Include location.h.
(remote_download_tracepoint): Use locations instead of address
strings.
* spu-tdep.c: Include location.h.
(spu_catch_start): Remove local variable `buf'.
Use locations instead of address strings.
* tracepoint.c: Include location.h.
(scope_info): Use locations instead of address strings.
(encode_source_string): Constify parameter `src'.
* tracepoint.h (encode_source_string): Likewise.
gdb/testsuite/ChangeLog
* gdb.base/dprintf-pending.exp: Update dprintf "without format"
test.
Add tests for missing ",FMT" and ",".
|
|
With "maint set target-non-stop on" we get:
@@ -66,13 +66,16 @@ Continuing.
interrupt
(gdb) PASS: gdb.base/interrupt-noterm.exp: interrupt
-Program received signal SIGINT, Interrupt.
-PASS: gdb.base/interrupt-noterm.exp: inferior received SIGINT
-testcase src/gdb/testsuite/gdb.base/interrupt-noterm.exp completed in 0 seconds
+[process 12119] #1 stopped.
+0x0000003615ebc6d0 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:81
+81 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
+FAIL: gdb.base/interrupt-noterm.exp: inferior received SIGINT (timeout)
+testcase src/gdb/testsuite/gdb.base/interrupt-noterm.exp completed in 10 seconds
That is, we get "[$thread] #1 stopped" instead of SIGINT.
The issue is that we don't currently distinguish send
"interrupt/ctrl-c" to target terminal vs "stop/pause" thread well;
both cases go through "target_stop".
And then, the native Linux backend (linux-nat.c) implements
target_stop with SIGSTOP in non-stop mode, and SIGINT in all-stop
mode. Since "maint set target-non-stop on" forces the backend to be
always running in non-stop mode, even though the user-visible behavior
is "set non-stop" is "off", "interrupt" causes a SIGSTOP instead of
the SIGINT the test expects.
Fix this by introducing a target_interrupt method to use in the
"interrupt/ctrl-c" case, so "set non-stop off" can always work the
same irrespective of "maint set target-non-stop on/off". I'm
explictly considering changing the "set non-stop on" behavior as out
of scope here.
Most of the patch is an across-the-board rename of to_stop hook
implementations to to_interrupt. The only targets where something
more than a rename is being done are linux-nat.c and remote.c, which
are the only targets that support async, and thus are the only ones
the core side calls target_stop on.
gdb/ChangeLog:
2015-08-07 Pedro Alves <palves@redhat.com>
* darwin-nat.c (darwin_stop): Rename to ...
(darwin_interrupt): ... this.
(_initialize_darwin_inferior): Adjust.
* gnu-nat.c (gnu_stop): Delete.
(gnu_target): Don't install gnu_stop.
* inf-ptrace.c (inf_ptrace_stop): Rename to ...
(inf_ptrace_interrupt): ... this.
(inf_ptrace_target): Adjust.
* infcmd.c (interrupt_target_1): Use target_interrupt instead of
target_stop.
* linux-nat (linux_nat_stop): Rename to ...
(linux_nat_interrupt): ... this.
(linux_nat_stop): Reimplement.
(linux_nat_add_target): Install linux_nat_interrupt.
* nto-procfs.c (nto_interrupt_twice): Rename to ...
(nto_handle_sigint_twice): ... this.
(nto_interrupt): Rename to ...
(nto_handle_sigint): ... this. Call target_interrupt instead of
target_stop.
(procfs_wait): Adjust.
(procfs_stop): Rename to ...
(procfs_interrupt): ... this.
(init_procfs_targets): Adjust.
* procfs.c (procfs_stop): Rename to ...
(procfs_interrupt): ... this.
(procfs_target): Adjust.
* remote-m32r-sdi.c (m32r_stop): Rename to ...
(m32r_interrupt): ... this.
(init_m32r_ops): Adjust.
* remote-sim.c (gdbsim_stop_inferior): Rename to ...
(gdbsim_interrupt_inferior): ... this.
(gdbsim_stop): Rename to ...
(gdbsim_interrupt): ... this.
(gdbsim_cntrl_c): Adjust.
(init_gdbsim_ops): Adjust.
* remote.c (sync_remote_interrupt): Adjust comments.
(remote_stop_as): Rename to ...
(remote_interrupt_as): ... this.
(remote_stop): Adjust comment.
(remote_interrupt): New function.
(init_remote_ops): Install remote_interrupt.
* target.c (target_interrupt): New function.
* target.h (struct target_ops) <to_interrupt>: New field.
(target_interrupt): New declaration.
* windows-nat.c (windows_stop): Rename to ...
(windows_interrupt): ... this.
* target-delegates.c: Regenerate.
|
|
Even though "target remote" supports target-async, the all-stop
target_wait implementation ignores TARGET_WNOHANG. If the core
happens to poll for events and we've already read the stop reply out
of the serial/socket, remote_wait_as hangs forever instead of
returning an indication that there are no events to process. This
can't happen currently, but later changes will trigger this.
gdb/ChangeLog:
2015-08-07 Pedro Alves <palves@redhat.com>
* remote.c (remote_wait_as): If not waiting for a stop reply,
return TARGET_WAITKIND_NO_RESUMED. If TARGET_WNOHANG is
requested, don't block waiting forever.
|
|
This is a patch I extracted from Pedro's C++ branch. It contains the
most trivial enum fixes, where an integer type/value was used instead
of the appropriate enum type/value. It fixes many C++ errors, since
in C++ you can't mix integers and enums implicitely.
Regardless of the C++ conversion, I think this is a good cleanup to make
use of the appropriate enum types.
Regression-tested on native x86_64.
gdb/ChangeLog:
* aarch64-linux-nat.c (aarch64_linux_can_use_hw_breakpoint): Use enum
type or value instead of integer.
(aarch64_linux_insert_watchpoint): Likewise.
(aarch64_linux_remove_watchpoint): Likewise.
* ada-lang.c (ada_op_print_tab): Likewise.
* amd64-linux-tdep.c (amd64_canonicalize_syscall): Likewise.
(amd64_linux_syscall_record_common): Likewise.
* arch-utils.c (target_byte_order_user): Likewise.
(default_byte_order): Likewise.
* arm-linux-nat.c (arm_linux_can_use_hw_breakpoint): Likewise.
(arm_linux_get_hwbp_type): Likewise.
(arm_linux_hw_watchpoint_initialize): Likewise.
(arm_linux_insert_watchpoint): Likewise.
* arm-linux-tdep.c (arm_canonicalize_syscall): Likewise.
(arm_linux_syscall_record): Likewise.
* breakpoint.c (update_watchpoint): Likewise.
(breakpoint_here_p): Likewise.
(bpstat_print): Likewise.
(enable_breakpoint_disp): Likewise.
* c-lang.c (c_op_print_tab): Likewise.
* cli/cli-decode.c (add_info_alias): Likewise.
* d-lang.c (d_op_print_tab): Likewise.
* eval.c (evaluate_subexp_standard): Likewise.
* f-exp.y (dot_ops): Likewise.
(f77_keywords): Likewise.
* f-lang.c (f_op_print_tab): Likewise.
* go-lang.c (go_op_print_tab): Likewise.
* guile/scm-breakpoint.c (gdbscm_make_breakpoint): Likewise.
* guile/scm-cmd.c (gdbscm_make_command): Likewise.
* guile/scm-param.c (gdbscm_make_parameter): Likewise.
* guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer): Likewise.
* guile/scm-string.c (struct scm_to_stringn_data): Likewise.
(struct scm_from_stringn_data): Likewise.
* i386-linux-tdep.c (i386_canonicalize_syscall): Likewise.
* ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise.
(ia64_linux_remove_watchpoint): Likewise.
(ia64_linux_can_use_hw_breakpoint): Likewise.
* infrun.c (print_stop_event): Likewise.
* jv-lang.c (java_op_print_tab): Likewise.
* linux-nat.c (linux_proc_xfer_partial): Likewise.
* linux-nat.h (struct lwp_info): Likewise.
* linux-thread-db.c (enable_thread_event): Likewise.
* m2-lang.c (m2_op_print_tab): Likewise.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_locals): Likewise.
(mi_cmd_stack_list_variables): Likewise.
* mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise.
* mi/mi-out.c (mi_table_begin): Likewise.
(mi_table_header): Likewise.
* mips-linux-nat.c (mips_linux_can_use_hw_breakpoint): Likewise.
(mips_linux_insert_watchpoint): Likewise.
(mips_linux_remove_watchpoint): Likewise.
* nat/mips-linux-watch.c (mips_linux_watch_type_to_irw): Likewise.
* nat/mips-linux-watch.h (struct mips_watchpoint): Likewise.
(mips_linux_watch_type_to_irw): Likewise.
* nto-procfs.c (procfs_can_use_hw_breakpoint): Likewise.
(procfs_insert_hw_watchpoint): Likewise.
(procfs_remove_hw_watchpoint): Likewise.
(procfs_hw_watchpoint): Likewise.
(procfs_can_use_hw_breakpoint): Likewise.
(procfs_remove_hw_watchpoint): Likewise.
(procfs_insert_hw_watchpoint): Likewise.
* p-lang.c (pascal_op_print_tab): Likewise.
* ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Likewise.
* ppc-linux-tdep.c (ppu2spu_unwind_register): Likewise.
* ppc-sysv-tdep.c (get_decimal_float_return_value): Likewise.
* procfs.c (procfs_can_use_hw_breakpoint): Likewise.
(procfs_insert_watchpoint): Likewise.
(procfs_remove_watchpoint): Likewise.
* psymtab.c (recursively_search_psymtabs): Likewise.
* remote-m32r-sdi.c (m32r_can_use_hw_watchpoint): Likewise.
(m32r_insert_watchpoint): Likewise.
* remote-mips.c (mips_can_use_watchpoint): Likewise.
(mips_insert_watchpoint): Likewise.
(mips_remove_watchpoint): Likewise.
* remote.c (watchpoint_to_Z_packet): Likewise.
(remote_insert_watchpoint): Likewise.
(remote_remove_watchpoint): Likewise.
(remote_check_watch_resources): Likewise.
* s390-linux-nat.c (s390_insert_watchpoint): Likewise.
(s390_remove_watchpoint): Likewise.
(s390_can_use_hw_breakpoint): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* spu-linux-nat.c (spu_can_use_hw_breakpoint): Likewise.
* target.h (struct target_ops): Likewise.
* tilegx-tdep.c (tilegx_analyze_prologue): Likewise.
* ui-out.c (struct ui_out_hdr): Likewise.
(append_header_to_list): Likewise.
(get_next_header): Likewise.
(verify_field): Likewise.
(ui_out_begin): Likewise.
(ui_out_field_int): Likewise.
(ui_out_field_fmt_int): Likewise.
(ui_out_field_skip): Likewise.
(ui_out_field_string): Likewise.
(ui_out_field_fmt): Likewise.
* varobj.c (new_variable): Likewise.
* x86-nat.c (x86_insert_watchpoint): Likewise.
(x86_remove_watchpoint): Likewise.
(x86_can_use_hw_breakpoint): Likewise.
* xtensa-tdep.h (struct gdbarch_tdep): Likewise.
* inflow.c (enum gdb_has_a_terminal_flag_enum): Add name to
previously anonymous enumeration type..
* linux-record.h (enum gdb_syscall): Add gdb_sys_no_syscall
value.
* target-debug.h (target_debug_print_enum_target_hw_bp_type): New.
(target_debug_print_enum_bptype): New.
* target-delegates.c: Regenerate.
|
|
This patch removes the isize output argument from the
fast_tracepoint_valid_at gdbarch hook. It was used to return the size
of the instruction that needs to be replaced when installing a fast
tracepoint. Instead of getting this value from the
fast_tracepoint_valid_at hook, we can call the gdb_insn_length function.
If we do not do this, then architectures which do not have a restriction
on where to install the fast tracepoint will send uninitialized memory
off to GDBserver. See remote_download_tracepoint:
~~~
int isize;
if (gdbarch_fast_tracepoint_valid_at (target_gdbarch (),
tpaddr, &isize, NULL))
xsnprintf (buf + strlen (buf), BUF_SIZE - strlen (buf), ":F%x",
isize);
~~~
The default implementation of fast_tracepoint_valid_at will not set
isize resulting in uninitialized memory being sent. Later on, GDBserver
could use this information to compute a jump offset.
gdb/ChangeLog:
* arch-utils.c (default_fast_tracepoint_valid_at): Remove unused
isize argument.
* arch-utils.h (default_fast_tracepoint_valid_at): Likewise.
* breakpoint.c (check_fast_tracepoint_sals): Adjust call to
gdbarch_fast_tracepoint_valid_at.
* gdbarch.sh (fast_tracepoint_valid_at): Remove isize argument.
* gdbarch.h: Regenerate.
* gdbarch.c: Regenerate.
* i386-tdep.c (i386_fast_tracepoint_valid_at): Remove isize
argument. Do not set it.
* remote.c (remote_download_tracepoint): Adjust call to
gdbarch_fast_tracepoint_valid_at. Call gdb_insn_length to get
the instruction length.
|
|
When using GDB to debug an RX target using the GDB remote protocol,
using a Renesas supplied debug agent, I encountered the following
assertion error:
thread.c:85: internal-error: inferior_thread: Assertion `tp' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n
Command aborted.
This assertion error occurs due to the fact that the value associated
with inferior_ptid is not on the thread list.
The remote debug output (obtained with "set debug remote 1") is fairly
short, so I will include it up to the point where things go wrong -
which is somewhat before the assertion failure:
(gdb) target remote coyote.lan:61234
Remote debugging using coyote.lan:61234
Sending packet: $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+#c9...Ack
Packet received: PacketSize=c00;qXfer:memory-map:read-;qXfer:features:read-;QStartNoAckMode+;multiprocess+;QNonStop+
Packet qSupported (supported-packets) is supported
Sending packet: $QStartNoAckMode#b0...Ack
Packet received: OK
Sending packet: $Hgp0.0#ad...Packet received: OK
Sending packet: $QNonStop:0#8c...Packet received: OK
Sending packet: $qTStatus#49...Packet received:
Packet qTStatus (trace-status) is NOT supported
Sending packet: $?#3f...Packet received: S02
Sending packet: $qfThreadInfo#bb...Packet received: m1
Sending packet: $qsThreadInfo#c8...Packet received: l
Sending packet: $qAttached:a410#bf...Packet received: 0
Packet qAttached (query-attached) is supported
Sending packet: $Hc-1#09...Packet received: OK
Sending packet: $qC#b4...Packet received: QC not supported
Above is the trace starting from the invocation of "target remote"
through the call of get_current_thread() in remote_start_remote().
Below, I've pasted this line of code along with additional lines of
context. The test following the call is especially important to
understanding both the problem and my patch.
/* We have thread information; select the thread the target
says should be current. If we're reconnecting to a
multi-threaded program, this will ideally be the thread
that last reported an event before GDB disconnected. */
inferior_ptid = get_current_thread (wait_status);
if (ptid_equal (inferior_ptid, null_ptid))
{
/* Odd... The target was able to list threads, but not
tell us which thread was current (no "thread"
register in T stop reply?). Just pick the first
thread in the thread list then. */
inferior_ptid = thread_list->ptid;
}
}
Prior to getting to the code pasted above, remote_start_remote()
made a call to target_update_thread_list(). This corresponds to the
following lines from the above trace:
Sending packet: $qfThreadInfo#bb...Packet received: m1
Sending packet: $qsThreadInfo#c8...Packet received: l
Sending packet: $qAttached:a410#bf...Packet received: 0
Packet qAttached (query-attached) is supported
Once target_update_thread_list has completed, the thread list
contains a single entry: {pid = 42000, lwp = 1, tid = 0}.
remote_start_remote() then makes a call to set_continue_thread(),
accounting for this line of the trace:
Sending packet: $Hc-1#09...Packet received: OK
Finally, the call to get_current_thread() is responsible for the last
line of the trace that I provided above:
Sending packet: $qC#b4...Packet received: QC not supported
get_current_thread() calls stop_reply_extract_thread() with the wait
status. This returns null_ptid.
get_current_thread() then calls remote_current_thread with a null
inferior_ptid. After the calls to putpkt() and getpkt(), rs->buf[0]
is 'Q', so read_ptid() is called and its result is returned.
The buffer passed to read_ptid() is " not supported". read_ptid ultimately
returns a ptid of {pid = 4200, lwp = 0, tid = 0}.
However, this thread is not on the thread list. As noted earlier, the
call to target_update_thread_list() had placed {pid = 42000, lwp = 1,
tid = 0} on the list. This is the only thread in the list.
When these calls ultimately return to remote_start_remote(),
inferior_ptid gets set to {pid = 4200, lwp = 0, tid = 0}, which
(again) is not on the thread list.
It appears to me that the string " not supported" is coming from the
debug agent. If so, it should be fixed, but I don't see a reason to
not consult the thread list in order to place a valid thread id in
inferior_ptid.
This (consultation of the thread list) is what is done when
inferior_ptid is null_ptid:
if (ptid_equal (inferior_ptid, null_ptid))
{
/* Odd... The target was able to list threads, but not
tell us which thread was current (no "thread"
register in T stop reply?). Just pick the first
thread in the thread list then. */
inferior_ptid = thread_list->ptid;
}
My patch causes a null inferior_ptid to be returned by read_ptid when
no thread id is found in the response from the debug agent. This
return value ends up being returned by remote_current_thread() and
then by get_current_thread. The assignment then places this null
value into inferior_ptid. That, in turn, allows the ptid_equal test
(noted above) to fetch a valid thread from the thread list. I no
longer see the assertion failure due a good value (which is on the
thread list) being placed in inferior_ptid.
This patch also adds two log warnings that may be output when "set
debug remote 1" is used. When running against the Renesas debug agent
mentioned earlier, this is the relevant portion of the log output:
Sending packet: $qC#b4...Packet received: QC not supported
warning: garbage in qC reply
warning: couldn't determine remote current thread; picking first in list.
gdb/ChangeLog:
* remote.c (read_ptid): Return null_ptid when no thread id
is found.
(remote_current_thread): Add log warning for malformed
qC reply.
(remote_start_remote): Add log warning when current thread
not found.
|
|
We did a code refacotr here
https://sourceware.org/ml/gdb-patches/2013-11/msg00063.html
> (get_current_thread): New function, factored out from ...
> (add_current_inferior_and_thread): ... this. Adjust.
>
>@@ -3332,18 +3371,8 @@ add_current_inferior_and_thread (char *wait_status)
>
> inferior_ptid = null_ptid;
>
>- /* Now, if we have thread information, update inferior_ptid. First
>- if we have a stop reply handy, maybe it's a T stop reply with a
>- "thread" register we can extract the current thread from. If
>- not, ask the remote which is the current thread, with qC. The
>- former method avoids a roundtrip. Note we don't use
>- remote_parse_stop_reply as that makes use of the target
>- architecture, which we haven't yet fully determined at this
>- point. */
>- if (wait_status != NULL)
>- ptid = stop_reply_extract_thread (wait_status);
>- if (ptid_equal (ptid, null_ptid))
>- ptid = remote_current_thread (inferior_ptid);
>+ /* Now, if we have thread information, update inferior_ptid. */
>+ ptid = get_current_thread (wait_status);
but after the refactor, local variable ptid is used without
initialisation. However, before this change, ptid is initialised to
null_ptid. This error can be found by valgrind too...
==3298== at 0x6B99BA: ptid_equal (ptid.c:80)
==3298== by 0x4C67FF: get_current_thread (remote.c:3484)
==3298== by 0x4C6951: add_current_inferior_and_thread (remote.c:3511)
==3298== by 0x4C762C: extended_remote_create_inferior (remote.c:8506)
==3298== by 0x5A5312: run_command_1 (infcmd.c:606)
==3298== by 0x68B4FB: execute_command (top.c:463)
==3298== by 0x5C7214: command_handler (event-top.c:494)
==3298== by 0x5C78A3: command_line_handler (event-top.c:692)
==3298== by 0x6DEB57: rl_callback_read_char (callback.c:220)
==3298== by 0x5C7278: rl_callback_read_char_wrapper (event-top.c:171)
==3298== by 0x5C72C2: stdin_event_handler (event-top.c:432)
==3298== by 0x5C6194: gdb_wait_for_event (event-loop.c:834)
This patch initialises local variable ptid to null in get_current_thread.
We don't need to initialise ptid in add_current_inferior_and_thread,
so this patch also removes the ptid initialisation.
gdb:
2015-07-17 Yao Qi <yao.qi@linaro.org>
* remote.c (get_current_thread): Initialise ptid to null_ptid.
(add_current_inferior_and_thread): Don't initialise ptid.
|
|
Adds a new command "record btrace pt" to configure the kernel to use
Intel(R) Processor Trace instead of Branch Trace Strore.
The "record btrace" command chooses the tracing format automatically.
Intel(R) Processor Trace support requires Linux 4.1 and libipt.
gdb/
* NEWS: Announce new commands "record btrace pt" and "record pt".
Announce new options "set|show record btrace pt buffer-size".
* btrace.c: Include "rsp-low.h".
Include "inttypes.h".
(btrace_add_pc): Add forward declaration.
(pt_reclassify_insn, ftrace_add_pt, btrace_pt_readmem_callback)
(pt_translate_cpu_vendor, btrace_finalize_ftrace_pt)
(btrace_compute_ftrace_pt): New.
(btrace_compute_ftrace): Support BTRACE_FORMAT_PT.
(check_xml_btrace_version): Update version check.
(parse_xml_raw, parse_xml_btrace_pt_config_cpu)
(parse_xml_btrace_pt_raw, parse_xml_btrace_pt)
(btrace_pt_config_cpu_attributes, btrace_pt_config_children)
(btrace_pt_children): New.
(btrace_children): Add support for "pt".
(parse_xml_btrace_conf_pt, btrace_conf_pt_attributes): New.
(btrace_conf_children): Add support for "pt".
* btrace.h: Include "intel-pt.h".
(btrace_pt_error): New.
* common/btrace-common.c (btrace_format_string, btrace_data_fini)
(btrace_data_empty): Support BTRACE_FORMAT_PT.
* common/btrace-common.h (btrace_format): Add BTRACE_FORMAT_PT.
(struct btrace_config_pt): New.
(struct btrace_config)<pt>: New.
(struct btrace_data_pt_config, struct btrace_data_pt): New.
(struct btrace_data)<pt>: New.
* features/btrace-conf.dtd (btrace-conf)<pt>: New.
(pt): New.
* features/btrace.dtd (btrace)<pt>: New.
(pt, pt-config, cpu): New.
* nat/linux-btrace.c (perf_event_read, perf_event_read_all)
(perf_event_pt_event_type, kernel_supports_pt)
(linux_supports_pt): New.
(linux_supports_btrace): Support BTRACE_FORMAT_PT.
(linux_enable_bts): Free tinfo on error.
(linux_enable_pt): New.
(linux_enable_btrace): Support BTRACE_FORMAT_PT.
(linux_disable_pt): New.
(linux_disable_btrace): Support BTRACE_FORMAT_PT.
(linux_fill_btrace_pt_config, linux_read_pt): New.
(linux_read_btrace): Support BTRACE_FORMAT_PT.
* nat/linux-btrace.h (struct btrace_tinfo_pt): New.
(struct btrace_target_info)<pt>: New.
* record-btrace.c (set_record_btrace_pt_cmdlist)
(show_record_btrace_pt_cmdlist): New.
(record_btrace_print_pt_conf): New.
(record_btrace_print_conf): Support BTRACE_FORMAT_PT.
(btrace_ui_out_decode_error): Support BTRACE_FORMAT_PT.
(cmd_record_btrace_pt_start): New.
(cmd_record_btrace_start): Support BTRACE_FORMAT_PT.
(cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): New.
(_initialize_record_btrace): Add new commands.
* remote.c (PACKET_Qbtrace_pt, PACKET_Qbtrace_conf_pt_size): New.
(remote_protocol_features): Add "Qbtrace:pt".
Add "Qbtrace-conf:pt:size".
(remote_supports_btrace): Support BTRACE_FORMAT_PT.
(btrace_sync_conf): Support PACKET_Qbtrace_conf_pt_size.
(remote_enable_btrace): Support BTRACE_FORMAT_PT.
(_initialize_remote): Add new commands.
gdbserver/
* linux-low.c: Include "rsp-low.h"
(linux_low_encode_pt_config, linux_low_encode_raw): New.
(linux_low_read_btrace): Support BTRACE_FORMAT_PT.
(linux_low_btrace_conf): Support BTRACE_FORMAT_PT.
(handle_btrace_enable_pt): New.
(handle_btrace_general_set): Support "pt".
(handle_btrace_conf_general_set): Support "pt:size".
doc/
* gdb.texinfo (Process Record and Replay): Spell out that variables
and registers are not available during btrace replay.
Describe the new "record btrace pt" command.
Describe the new "set|show record btrace pt buffer-size" options.
(General Query Packets): Describe the new Qbtrace:pt and
Qbtrace-conf:pt:size packets.
Expand "bts" to "Branch Trace Store".
Update the branch trace DTD.
|
|
Since fed040c6a50399617d8265cbddc7fd21b3f134ef gdb_sysroot is
never NULL. This commit removes all gdb_sysroot NULL checks.
gdb/ChangeLog:
* exec.c (exec_file_locate_attach): Remove gdb_sysroot NULL check.
* infrun.c (follow_exec): Likewise.
* remote.c (remote_filesystem_is_local): Likewise.
* solib.c (solib_find_1): Likewise.
|
|
Adapt code in remote.c to take into account addressable unit size when
reading/writing memory.
A few variables are renamed and suffixed with _bytes or _units. This
way, it's more obvious if there is any place where we add or compare
values of different kinds (which would be a mistake).
gdb/ChangeLog:
* common/rsp-low.c (needs_escaping): New.
(remote_escape_output): Add unit_size parameter. Refactor to
support multi-byte addressable units. Rename parameters.
* common/rsp-low.h (remote_escape_output): Add unit_size
parameter and rename others. Update doc.
* remote.c (align_for_efficient_write): New.
(remote_write_bytes_aux): Add unit_size parameter and use it.
Rename some variables. Update doc.
(remote_xfer_partial): Get unit size and use it.
(remote_read_bytes_1): Add unit_size parameter and use it.
Rename some variables. Update doc.
(remote_write_bytes): Same.
(remote_xfer_live_readonly_partial): Same.
(remote_read_bytes): Same.
(remote_flash_write): Update call to remote_write_bytes_aux.
(remote_write_qxfer): Update call to remote_escape_output.
(remote_search_memory): Same.
(remote_hostio_pwrite): Same.
gdb/gdbserver/ChangeLog:
* server.c (write_qxfer_response): Update call to
remote_escape_output.
|
|
This commit allows GDB to access executables and shared libraries
on remote targets where the remote stub does not share a common
filesystem with the inferior(s). A new packet "vFile:setfs" is
added to the remote protocol and the three remote hostio functions
with filename arguments are modified to send "vFile:setfs" packets
as necessary.
gdb/ChangeLog:
* remote.c (struct remote_state) <fs_pid>: New field.
(new_remote_state): Initialize the above.
(PACKET_vFile_setfs): New enum value.
(remote_hostio_set_filesystem): New function.
(remote_hostio_open): Call the above.
(remote_hostio_unlink): Likewise.
(remote_hostio_readlink): Likewise.
(_initialize_remote): Register new "set/show remote
hostio-setfs-packet" command.
* NEWS: Announce new vFile:setfs packet.
gdb/doc/ChangeLog:
* gdb.texinfo (Remote Configuration): Document the
"set/show remote hostio-setfs-packet" command.
(Host I/O Packets): Document the vFile:setfs packet.
|
|
This commit adds a new argument to all target_fileio functions with
filename arguments to allow the desired inferior to be specified.
This allows GDB to support systems where processes do not necessarily
share a common filesystem.
gdb/ChangeLog:
* target.h (struct inferior): New forward declaration.
(struct target_ops) <to_filesystem_is_local>: Update comment.
(struct target_ops) <to_fileio_open>: New argument inf.
Update comment. All implementations updated.
(struct target_ops) <to_fileio_unlink>: Likewise.
(struct target_ops) <to_fileio_readlink>: Likewise.
(target_filesystem_is_local): Update comment.
(target_fileio_open): New argument inf. Update comment.
(target_fileio_unlink): Likewise.
(target_fileio_readlink): Likewise.
(target_fileio_read_alloc): Likewise.
(target_fileio_read_stralloc): Likewise.
* target.c (target_fileio_open): New argument inf.
Pass inf to implementation. Update debug printing.
(target_fileio_unlink): Likewise.
(target_fileio_readlink): Likewise.
(target_fileio_read_alloc_1): New argument inf. Pass inf
to target_fileio_open.
(target_fileio_read_alloc): New argument inf. Pass inf to
target_fileio_read_alloc_1.
(target_fileio_read_stralloc): Likewise.
* gdb_bfd.c (inferior.h): New include.
(gdb_bfd_iovec_fileio_open): Replace unused "open_closure"
argument with new argument "inferior". Pass inferior to
target_fileio_open.
(gdb_bfd_open): Supply inferior argument to
gdb_bfd_iovec_fileio_open.
* linux-tdep.c (linux_info_proc): Supply inf argument to
relevant target_fileio calls.
(linux_find_memory_regions_full): Likewise.
(linux_fill_prpsinfo): Likewise.
* remote.c (remote_filesystem_is_local): Supply inf
argument to remote_hostio_open.
(remote_file_put): Likewise.
(remote_file_get): Likewise.
(remote_file_delete): Supply inf argument to
remote_hostio_unlink.
|
|
Comments on the various implementations of target fileio functions
duplicate information documented in target.h. This commit replaces
the duplicated documentation with breadcrumbs, and inserts blank
lines to separate comments from the functions they describe where
necessary.
gdb/ChangeLog:
* inf-child.c (inf_child_fileio_open): Replace comment.
(inf_child_fileio_pwrite): Likewise.
(inf_child_fileio_pread): Likewise.
(inf_child_fileio_fstat): Insert blank line before comment.
(inf_child_fileio_close): Replace comment.
(inf_child_fileio_unlink): Likewise.
(inf_child_fileio_readlink): Likewise.
* remote.c (remote_hostio_open): Likewise.
(remote_hostio_pread): Likewise.
(remote_hostio_pwrite): Likewise.
(remote_hostio_close): Likewise.
(remote_hostio_unlink): Likewise.
(remote_hostio_readlink): Likewise.
(remote_hostio_fstat): Likewise.
(remote_filesystem_is_local): Likewise.
* target.c (target_fileio_open): Likewise.
(target_fileio_pwrite): Likewise.
(target_fileio_pread): Likewise.
(target_fileio_fstat): Insert blank line before comment.
(target_fileio_close): Replace comment.
(target_fileio_unlink): Likewise.
(target_fileio_readlink): Likewise.
(target_fileio_read_alloc): Likewise.
(target_fileio_read_stralloc): Likewise.
|
|
Valgrind GDB (vgdb) presents itself as a remote target but works on
the local filesystem. gdb_bfd_open contained a special case to make
vgdb work with "target:" sysroots, but the implementation meant that
GDB would fall back to the local filesystem if *any* to_fileio_open
method failed with ENOSYS for *any* reason. This commit moves the
vgdb special case to remote_filesystem_is_local to allow the fallback
to be restricted only to the specific case that remote file transfer
is unsupported. This commit also adds a warning which is displayed
the first time the fallback is used.
gdb/ChangeLog:
* gdb_bfd.c (gdb_bfd_open): Move vgdb special case to...
* remote.c (remote_filesystem_is_local): ...here.
|
|
This patch implements catchpoints for fork events on extended-remote
Linux targets.
Implementation appeared to be straightforward, requiring four new functions
in remote.c to implement insert/remove of fork/vfork catchpoints. These
functions are essentially stubs that just return 0 ('success') if the
required features are enabled. If the fork events are being reported, then
catchpoints are set and hit.
However, there are some extra issues that arise with catchpoints.
1) Thread creation reporting -- fork catchpoints are hit before the
follow_fork has been completed. When stopped at a fork catchpoint
in the native implementation, the new process is not 'reported'
until after the follow is done. It doesn't show up in the inferiors
list or the threads list. However, in the gdbserver case, an
'info threads' while stopped at a fork catchpoint will retrieve the
new thread info from the target and add it to GDB's data structures,
prior to the follow operations. Because of this premature report,
things on the GDB side eventually get very confused.
So in remote.c:remote_update_thread_list, we check to see if there
are any pending fork parent threads. If there are we remove the
related fork child thread from the thread list sent by the target.
2) Kill process before fork is followed -- on the native side in
linux-nat.c:linux_nat_kill, there is some code to handle the case where
a fork has occurred but follow_fork hasn't been called yet. It does
this by using the last status to determine if a follow is pending, and
if it is, to kill the child task. The use of last_status is fragile
in situations like non-stop mode where other events may have occurred
after the fork event. This patch identifies a fork parent
in remote.c:extended_remote_kill in a way similar to that used in
thread creation reporting above. If one is found, it kills the new
child as well.
Tested on x64 Ubuntu Lucid, native, remote, extended-remote. Tested the
case of killing the forking process before the fork has been followed
manually.
gdb/ChangeLog:
* remote.c (remote_insert_fork_catchpoint): New function.
(remote_remove_fork_catchpoint): New function.
(remote_insert_vfork_catchpoint): New function.
(remote_remove_vfork_catchpoint): New function.
(pending_fork_parent_callback): New function.
(remove_new_fork_child): New function.
(remote_update_thread_list): Call remote_notif_get_pending_events
and remove_new_fork_child.
(extended_remote_kill): Kill fork child when killing the
parent before follow_fork completes.
(init_extended_remote_ops): Initialize target vector with
new fork catchpoint functions.
|
|
This patch implements follow-fork for vfork on extended-remote Linux targets.
The implementation follows the native implementation as much as possible.
Most of the work is done on the GDB side in the existing code now in
infrun.c. GDBserver just has to report the events and do a little
bookkeeping.
Implementation includes:
* enabling VFORK events by adding ptrace options for VFORK and VFORK_DONE
to linux-low.c:linux_low_ptrace_options.
* handling VFORK and VFORK_DONE events in linux-low.c:handle_extended_wait
and reporting them to GDB.
* including VFORK and VFORK_DONE events in the predicate
linux-low.c:extended_event_reported.
* adding support for VFORK and VFORK_DONE events in RSP by adding stop
reasons "vfork" and "vforkdone" to the 'T' Stop Reply Packet in both
gdbserver/remote-utils.c and gdb/remote.c.
Tested on x64 Ubuntu Lucid, native, remote, extended-remote.
gdb/gdbserver/ChangeLog:
* linux-low.c (handle_extended_wait): Handle PTRACE_EVENT_FORK and
PTRACE_EVENT_VFORK_DONE.
(linux_low_ptrace_options, extended_event_reported): Add vfork
events.
* remote-utils.c (prepare_resume_reply): New stop reasons "vfork"
and "vforkdone" for RSP 'T' Stop Reply Packet.
* server.h (report_vfork_events): Declare
global variable.
gdb/ChangeLog:
* remote.c (remove_vfork_event_p): New function.
(remote_follow_fork): Add vfork event type to event checking.
(remote_parse_stop_reply): New stop reasons "vfork" and
"vforkdone" for RSP 'T' Stop Reply Packet.
|
|
This patch implements basic support for follow-fork and detach-on-fork on
extended-remote Linux targets. Only 'fork' is supported in this patch;
'vfork' support is added n a subsequent patch. This patch depends on
the previous patches in the patch series.
Sufficient extended-remote functionality has been implemented here to pass
gdb.base/multi-forks.exp, as well as gdb.base/foll-fork.exp with the
catchpoint tests commented out. Some other fork tests fail with this
patch because it doesn't provide the architecture support needed for
watchpoint inheritance or fork catchpoints.
The implementation follows the same general structure as for the native
implementation as much as possible.
This implementation includes:
* enabling fork events in linux-low.c in initialize_low and
linux_enable_extended_features
* handling fork events in gdbserver/linux-low.c:handle_extended_wait
- when a fork event occurs in gdbserver, we must do the full creation
of the new process, thread, lwp, and breakpoint lists. This is
required whether or not the new child is destined to be
detached-on-fork, because GDB will make target calls that require all
the structures. In particular we need the breakpoint lists in order
to remove the breakpoints from a detaching child. If we are not
detaching the child we will need all these structures anyway.
- as part of this event handling we store the target_waitstatus in a new
member of the parent lwp_info structure, 'waitstatus'. This
is used to store extended event information for reporting to GDB.
- handle_extended_wait is given a return value, denoting whether the
handled event should be reported to GDB. Previously it had only
handled clone events, which were never reported.
* using a new predicate in gdbserver to control handling of the fork event
(and eventually all extended events) in linux_wait_1. The predicate,
extended_event_reported, checks a target_waitstatus.kind for an
extended ptrace event.
* implementing a new RSP 'T' Stop Reply Packet stop reason: "fork", in
gdbserver/remote-utils.c and remote.c.
* implementing new target and RSP support for target_follow_fork with
target extended-remote. (The RSP components were actually defined in
patch 1, but they see their first use here).
- remote target routine remote_follow_fork, which just sends the 'D;pid'
detach packet to detach the new fork child cleanly. We can't just
call target_detach because the data structures for the forked child
have not been allocated on the host side.
Tested on x64 Ubuntu Lucid, native, remote, extended-remote.
gdb/gdbserver/ChangeLog:
* linux-low.c (handle_extended_wait): Implement return value,
rename argument 'event_child' to 'event_lwp', handle
PTRACE_EVENT_FORK, call internal_error for unrecognized event.
(linux_low_ptrace_options): New function.
(linux_low_filter_event): Call linux_low_ptrace_options,
use different argument fo linux_enable_event_reporting,
use return value from handle_extended_wait.
(extended_event_reported): New function.
(linux_wait_1): Call extended_event_reported and set
status to report fork events.
(linux_write_memory): Add pid to debug message.
(reset_lwp_ptrace_options_callback): New function.
(linux_handle_new_gdb_connection): New function.
(linux_target_ops): Initialize new structure member.
* linux-low.h (struct lwp_info) <waitstatus>: New member.
* lynx-low.c: Initialize new structure member.
* remote-utils.c (prepare_resume_reply): Implement stop reason
"fork" for "T" stop message.
* server.c (handle_query): Call handle_new_gdb_connection.
* server.h (report_fork_events): Declare global flag.
* target.h (struct target_ops) <handle_new_gdb_connection>:
New member.
(target_handle_new_gdb_connection): New macro.
* win32-low.c: Initialize new structure member.
gdb/ChangeLog:
* linux-nat.c (linux_nat_ptrace_options): New function.
(linux_init_ptrace, wait_lwp, linux_nat_filter_event):
Call linux_nat_ptrace_options and use different argument to
linux_enable_event_reporting.
(_initialize_linux_nat): Delete call to
linux_ptrace_set_additional_flags.
* nat/linux-ptrace.c (current_ptrace_options): Rename to
supported_ptrace_options.
(additional_flags): Delete variable.
(linux_check_ptrace_features): Use supported_ptrace_options.
(linux_test_for_tracesysgood, linux_test_for_tracefork):
Likewise, and remove additional_flags check.
(linux_enable_event_reporting): Change 'attached' argument to
'options'. Use supported_ptrace_options.
(ptrace_supports_feature): Change comment. Use
supported_ptrace_options.
(linux_ptrace_set_additional_flags): Delete function.
* nat/linux-ptrace.h (linux_ptrace_set_additional_flags):
Delete function prototype.
* remote.c (remote_fork_event_p): New function.
(remote_detach_pid): New function.
(remote_detach_1): Call remote_detach_pid, don't mourn inferior
if doing detach-on-fork.
(remote_follow_fork): New function.
(remote_parse_stop_reply): Handle new "T" stop reason "fork".
(remote_pid_to_str): Print "process" strings for pid/0/0 ptids.
(init_extended_remote_ops): Initialize to_follow_fork.
|
|
This patch implements a mechanism for GDB to determine whether fork
events are supported in gdbserver. This is a preparatory patch for
remote fork and exec event support.
Two new RSP packets are defined to represent fork and vfork event
support. These packets are used just like PACKET_multiprocess_feature
to denote whether the corresponding event is supported. GDB sends
fork-events+ and vfork-events+ to gdbserver to inquire about fork
event support. If the response enables these packets, then GDB
knows that gdbserver supports the corresponding events and will
enable them.
Target functions used to query for support are included along with
each new packet.
In order for gdbserver to know whether the events are supported at the
point where the qSupported packet arrives, the code in nat/linux-ptrace.c
had to be reorganized. Previously it would test for fork/exec event
support, then enable the events using the pid of the inferior. When the
qSupported packet arrives there may not be an inferior. So the mechanism
was split into two parts: a function that checks whether the events are
supported, called when gdbserver starts up, and another that enables the
events when the inferior stops for the first time.
Another gdbserver change was to add some global variables similar to
multi_process, one per new packet. These are used to control whether
the corresponding fork events are enabled. If GDB does not inquire
about the event support in the qSupported packet, then gdbserver will
not set these "report the event" flags. If the flags are not set, the
events are ignored like they were in the past. Thus, gdbserver will
never send fork event notification to an older GDB that doesn't
recognize fork events.
Tested on Ubuntu x64, native/remote/extended-remote, and as part of
subsequent patches in the series.
gdb/gdbserver/ChangeLog:
* linux-low.c (linux_supports_fork_events): New function.
(linux_supports_vfork_events): New function.
(linux_target_ops): Initialize new structure members.
(initialize_low): Call linux_check_ptrace_features.
* lynx-low.c (lynx_target_ops): Initialize new structure
members.
* server.c (report_fork_events, report_vfork_events):
New global flags.
(handle_query): Add new features to qSupported packet and
response.
(captured_main): Initialize new global variables.
* target.h (struct target_ops) <supports_fork_events>:
New member.
<supports_vfork_events>: New member.
(target_supports_fork_events): New macro.
(target_supports_vfork_events): New macro.
* win32-low.c (win32_target_ops): Initialize new structure
members.
gdb/ChangeLog:
* nat/linux-ptrace.c (linux_check_ptrace_features): Change
from static to extern.
* nat/linux-ptrace.h (linux_check_ptrace_features): Declare.
* remote.c (anonymous enum): <PACKET_fork_event_feature,
* PACKET_vfork_event_feature>: New enumeration constants.
(remote_protocol_features): Add table entries for new packets.
(remote_query_supported): Add new feature queries to qSupported
packet.
(_initialize_remote): Exempt new packets from the requirement
to have 'set remote' commands.
|
|
This commit allows GDB to determine filenames of main executables
when debugging using remote stubs without multiprocess extensions.
The qXfer:exec-file:read packet is extended to allow an empty
annex, with the meaning that the remote stub should supply the
filename of whatever it thinks is the current process.
gdb/ChangeLog:
* remote.c (remote_add_inferior): Call exec_file_locate_attach
for fake PIDs as well as real ones.
(remote_pid_to_exec_file): Send empty annex if PID is fake.
gdb/doc/ChangeLog:
* gdb.texinfo (General Query Packets): Document
qXfer:exec-file:read with empty annex.
gdb/gdbserver/ChangeLog:
* server.c (handle_qxfer_exec_file): Use current process
if annex is empty.
|
|
This commit modifies remote_add_inferior to take an extra argument
try_open_exec. If this is nonzero, remote_add_inferior will attempt
to open this inferior's executable as the main executable if no main
executable is open already. Callers are updated appropriately.
With this commit, remote debugging can now be initiated using only a
"target remote" or "target extended-remote" command; no "set sysroot"
or "file" commands are required, e.g.
bash$ gdb -q
(gdb) target remote | gdbserver - /bin/sh
Remote debugging using | gdbserver - /bin/sh
Process /bin/sh created; pid = 32166
stdin/stdout redirected
Remote debugging using stdio
Reading symbols from target:/bin/bash...
One testcase required updating as a result of this commit. The test
checked that GDB's "info files" command does not crash if no main
executable is open, and relied on GDB's inability to access the main
executable over the remote protocol. The test was updated to inhibit
this new behavior.
gdb/ChangeLog:
* remote.c (remote_add_inferior): New argument try_open_exec.
If nonzero, attempt to open the inferior's executable file as
the main executable if no main executable is open already.
All callers updated.
* NEWS: Mention that GDB now supports automatic location and
retrieval of executable + files from remote targets.
gdb/doc/ChangeLog:
* gdb.texinfo (Connecting to a Remote Target): Mention that
GDB can access program files from remote targets that support
qXfer:exec-file:read and Host I/O packets.
gdb/testsuite/ChangeLog:
* gdb.server/server-exec-info.exp: Inhibit GDB from accessing
the main executable over the remote protocol.
|
|
This commit adds a new packet "qXfer:exec-file:read" to the remote
protocol that can be used to obtain the pathname of the file that
was executed to create a process on the remote system. Support for
this packet is added to GDB and remote_ops.to_pid_to_exec_file is
implemented using it.
gdb/ChangeLog:
* target.h (TARGET_OBJECT_EXEC_FILE): New enum value.
* remote.c (PACKET_qXfer_exec_file): Likewise.
(remote_protocol_features): Register the
"qXfer:exec-file:read" feature.
(remote_xfer_partial): Handle TARGET_OBJECT_EXEC_FILE.
(remote_pid_to_exec_file): New function.
(init_remote_ops): Initialize to_pid_to_exec_file.
(_initialize_remote): Register new "set/show remote
pid-to-exec-file-packet" command.
* NEWS: Announce new qXfer:exec-file:read packet.
gdb/doc/ChangeLog:
* gdb.texinfo (Remote Configuration): Document the "set/show
remote pid-to-exec-file-packet" command.
(General Query Packets): Document the qXfer:exec-file:read
qSupported features. Document the qXfer:exec-file:read packet.
|
|
On GNU/Linux, if the running kernel supports clone events, then
linux-thread-db.c defers thread listing to the target beneath:
static void
thread_db_update_thread_list (struct target_ops *ops)
{
...
if (target_has_execution && !thread_db_use_events ())
ops->beneath->to_update_thread_list (ops->beneath);
else
thread_db_update_thread_list_td_ta_thr_iter (ops);
...
}
However, when live debugging, the target beneath, linux-nat.c, does
not implement the to_update_thread_list method. The result is that if
a thread is marked exited (because it can't be deleted right now,
e.g., it was the selected thread), then it won't ever be deleted,
until the process exits or is killed/detached.
A similar thing happens with the remote.c target. Because its
target_update_thread_list implementation skips exited threads when it
walks the current thread list looking for threads that no longer exits
on the target side, using ALL_NON_EXITED_THREADS_SAFE, stale exited
threads are never deleted.
This is not a big deal -- I can't think of any way this might be user
visible, other than gdb's memory growing a tiny bit whenever a thread
gets stuck in exited state. Still, might as well clean things up
properly.
All other targets use prune_threads, so are unaffected.
The fix adds a ALL_THREADS_SAFE macro, that like
ALL_NON_EXITED_THREADS_SAFE, walks the thread list and allows deleting
the iterated thread, and uses that in places that are walking the
thread list in order to delete threads. Actually, after converting
linux-nat.c and remote.c to use this, we find the only other user of
ALL_NON_EXITED_THREADS_SAFE is also walking the list to delete
threads. So we convert that too, and end up deleting
ALL_NON_EXITED_THREADS_SAFE.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/ChangeLog
2015-04-07 Pedro Alves <palves@redhat.com>
* gdbthread.h (ALL_NON_EXITED_THREADS_SAFE): Rename to ...
(ALL_THREADS_SAFE): ... this, and don't skip exited threads.
(delete_exited_threads): New declaration.
* infrun.c (follow_exec): Use ALL_THREADS_SAFE.
* linux-nat.c (linux_nat_update_thread_list): New function.
(linux_nat_add_target): Install it.
* remote.c (remote_update_thread_list): Use ALL_THREADS_SAFE.
* thread.c (prune_threads): Use ALL_THREADS_SAFE.
(delete_exited_threads): New function.
|
|
The functionality of "target:" sysroots is a superset of the
functionality of "remote:" sysroots. This commit causes the
"set sysroot" command to rewrite "remote:" sysroots as "target:"
sysroots and replaces "remote:" specific code with "target:"
specific code where still necessary.
gdb/ChangeLog:
* remote.h (REMOTE_SYSROOT_PREFIX): Remove definition.
(remote_filename_p): Remove declaration.
(remote_bfd_open): Likewise.
* remote.c (remote_bfd_iovec_open): Remove function.
(remote_bfd_iovec_close): Likewise.
(remote_bfd_iovec_pread): Likewise.
(remote_bfd_iovec_stat): Likewise.
(remote_filename_p): Likewise.
(remote_bfd_open): Likewise.
* symfile.h (gdb_bfd_open_maybe_remote): Remove declaration.
* symfile.c (separate_debug_file_exists): Use gdb_bfd_open.
(gdb_bfd_open_maybe_remote): Remove function.
(symfile_bfd_open): Replace remote filename check with
target filename check.
(reread_symbols): Use gdb_bfd_open.
* build-id.c (gdbcore.h): New include.
(build_id_to_debug_bfd): Use gdb_bfd_open.
* infcmd.c (attach_command_post_wait): Remove remote filename
check.
* solib.c (solib_find): Replace remote-specific handling with
target-specific handling. Update comments where necessary.
(solib_bfd_open): Replace remote-specific handling with
target-specific handling.
(gdb_sysroot_changed): New function.
(_initialize_solib): Call the above when gdb_sysroot changes.
* windows-tdep.c (gdbcore.h): New include.
(windows_xfer_shared_library): Use gdb_bfd_open.
|
|
This commit introduces a new target method target_filesystem_is_local
which can be used to determine whether or not the filesystem accessed
by the target_fileio_* methods is the local filesystem.
gdb/ChangeLog:
* target.h (struct target_ops) <to_filesystem_is_local>:
New field.
(target_filesystem_is_local): New macro.
* target-delegates.c: Regenerate.
* remote.c (remote_filesystem_is_local): New function.
(init_remote_ops): Initialize to_filesystem_is_local.
|
|
This commit introduces a new target method target_fileio_fstat
which can be used to retrieve information about files opened with
target_fileio_open.
gdb/ChangeLog:
* target.h (struct target_ops) <to_fileio_fstat>: New field.
(target_fileio_fstat): New declaration.
* target.c (target_fileio_fstat): New function.
* inf-child.c (inf_child_fileio_fstat): Likewise.
(inf_child_target): Initialize to_fileio_fstat.
* remote.c (init_remote_ops): Likewise.
|
|
gdb/ChangeLog:
* remote.c (remote_mourn_1): Remove function. Update all callers
to use remote_mourn.
(extended_remote_mourn_1): Remove function. Update all callers
to use extended_remote_mourn.
(extended_remote_attach_1): Remove function. Update all callers
to use extended_remote_attach.
|
|
gdb/ChangeLog:
2015-03-26 Don Breazeal <donb@codesourcery.com>
* remote.c (_initialize_remote): Update comment.
|
|
All callers of target_async pass it the same callback
(inferior_event_handler). Since both common code and target backends
need to be able to put the target in and out of target async mode at
any given time, there's really no way that a different callback could
be passed. This commit simplifies things, and removes the indirection
altogether. Bonus: with this, gdb's target_async method ends up with
the same signature as gdbserver's.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/ChangeLog:
2015-03-25 Pedro Alves <palves@redhat.com>
* target.h <to_async>: Replace 'callback' and 'context' parameters
with boolean 'enable' parameter.
(target_async): Replace CALLBACK and CONTEXT parameters with
boolean ENABLE parameter.
* inf-loop.c (inferior_event_handler): Adjust.
* linux-nat.c (linux_nat_attach, linux_nat_resume)
(linux_nat_resume): Adjust.
(async_client_callback, async_client_context): Delete.
(handle_target_event): Call inferior_event_handler directly.
(linux_nat_async): Replace 'callback' and 'context' parameters
with boolean 'enable' parameter. Adjust. Remove references to
async_client_callback and async_client_context.
(linux_nat_close): Adjust.
* record-btrace.c (record_btrace_async): Replace 'callback' and
'context' parameters with boolean 'enable' parameter. Adjust.
(record_btrace_resume): Adjust.
* record-full.c (record_full_async): Replace 'callback' and
'context' parameters with boolean 'enable' parameter. Adjust.
(record_full_resume, record_full_core_resume): Adjust.
* remote.c (struct remote_state) <async_client_callback,
async_client_context>: Delete fields.
(remote_start_remote, extended_remote_attach_1, remote_resume)
(extended_remote_create_inferior): Adjust.
(remote_async_serial_handler): Call inferior_event_handler
directly.
(remote_async): Replace 'callback' and 'context' parameters with
boolean 'enable' parameter. Adjust.
* top.c (gdb_readline_wrapper_cleanup, gdb_readline_wrapper):
Adjust.
* target-delegates.c: Regenerate.
|
|
The "set serial parity" command allows the user to control which
parity to use when communicating over a serial connection, rather
than having the parity hardcoded to none.
gdb/ChangeLog:
* NEWS: Mention set/show serial parity command.
* monitor.c (monitor_open): Call serial_setparity.
* remote.c (remote_open_1): Likewise.
* ser-base.c (ser_base_serparity): New function.
* ser-base.h (ser_base_setparity): Add declaration.
* ser-go32.c (dos_ops): Set "setparity" field.
* ser-mingw.c (ser_windows_raw): Do not set state.fParity and
state.Parity.
(ser_windows_setparity): New function.
(hardwire_ops): Add ser_windows_setparity.
(tty_ops): Add NULL for setparity field.
(pipe_ops): Add ser_base_setparity.
(tcp_ops): Likewise.
* ser-pipe.c (pipe_ops): Likewise.
* ser-tcp.c (tcp_ops): Likewise.
* ser-unix.c (hardwire_setparity): Add declaration.
(hardwire_raw): Don't reset PARENB flag.
(hardwire_setparity): New function.
(hardwire_ops): Add hardwire_setparity.
* serial.c (serial_setparity): New function.
(serial_parity): New global.
(parity_none, parity_odd, parity_even, parity_enums, parity):
New static globals.
(set_parity): New function.
(_initialize_serial): Add set/show serial parity commands.
* serial.h (GDBPARITY_NONE): Define.
(GDBPARITY_ODD): Define.
(GDBPARITY_EVEN): Define.
(serial_setparity) Add declaration.
(struct serial_ops): Add setparity field.
* target.h (serial_parity): Add declaration.
gdb/doc/ChangeLog:
* gdb.texinfo (Remote configuration): Document "set/show
serial parity" command.
|
|
This commit makes support for the "vFile:fstat" packet be detected
by probing rather than using qSupported, for consistency with the
other vFile: packets.
gdb/ChangeLog:
(remote_protocol_features): Remove the "vFile:fstat" feature.
(remote_hostio_fstat): Probe for "vFile:fstat" support.
gdb/doc/ChangeLog:
* gdb.texinfo (General Query Packets): Remove documentation
for now-removed vFile:fstat qSupported features.
gdb/gdbserver/ChangeLog:
* server.c (handle_query): Do not report vFile:fstat as supported.
|
|
This commit adds a new packet "vFile:fstat:" to the remote protocol
that can be used by to retrieve information about files that have
been previously opened using vFile:open. vFile:fstat: support is
added to GDB, and remote_bfd_iovec_stat is implemented using it. If
vFile:fstat: is not supported by the remote GDB creates a dummy result
by zeroing the supplied stat structure and setting its st_size field
to INT_MAX. This mimics GDB's previous behaviour, with the exception
that GDB did not previously zero the structure so all other fields
would have been returned unchanged, which is to say very likely
populated with random values from the stack.
gdb/ChangeLog:
* remote-fileio.h (remote_fileio_to_host_stat): New declaration.
* remote-fileio.c (remote_fileio_to_host_uint): New function.
(remote_fileio_to_host_ulong): Likewise.
(remote_fileio_to_host_mode): Likewise.
(remote_fileio_to_host_time): Likewise.
(remote_fileio_to_host_stat): Likewise.
* remote.c (PACKET_vFile_fstat): New enum value.
(remote_protocol_features): Register the "vFile:fstat" feature.
(remote_hostio_fstat): New function.
(remote_bfd_iovec_stat): Use the above.
(_initialize_remote): Register new "set/show remote
hostio-fstat-packet" command.
* symfile.c (separate_debug_file_exists): Update comment.
* NEWS: Announce new vFile:fstat packet.
gdb/doc/ChangeLog:
* gdb.texinfo (Remote Configuration): Document the
"set/show remote hostio-fstat-packet" command.
(General Query Packets): Document the vFile:fstat
qSupported features.
(Host I/O Packets): Document the vFile:fstat packet.
|
|
This patch splits the TRY_CATCH macro into three, so that we go from
this:
~~~
volatile gdb_exception ex;
TRY_CATCH (ex, RETURN_MASK_ERROR)
{
}
if (ex.reason < 0)
{
}
~~~
to this:
~~~
TRY
{
}
CATCH (ex, RETURN_MASK_ERROR)
{
}
END_CATCH
~~~
Thus, we'll be getting rid of the local volatile exception object, and
declaring the caught exception in the catch block.
This allows reimplementing TRY/CATCH in terms of C++ exceptions when
building in C++ mode, while still allowing to build GDB in C mode
(using setjmp/longjmp), as a transition step.
TBC, after this patch, is it _not_ valid to have code between the TRY
and the CATCH blocks, like:
TRY
{
}
// some code here.
CATCH (ex, RETURN_MASK_ERROR)
{
}
END_CATCH
Just like it isn't valid to do that with C++'s native try/catch.
By switching to creating the exception object inside the CATCH block
scope, we can get rid of all the explicitly allocated volatile
exception objects all over the tree, and map the CATCH block more
directly to C++'s catch blocks.
The majority of the TRY_CATCH -> TRY+CATCH+END_CATCH conversion was
done with a script, rerun from scratch at every rebase, no manual
editing involved. After the mechanical conversion, a few places
needed manual intervention, to fix preexisting cases where we were
using the exception object outside of the TRY_CATCH block, and cases
where we were using "else" after a 'if (ex.reason) < 0)' [a CATCH
after this patch]. The result was folded into this patch so that GDB
still builds at each incremental step.
END_CATCH is necessary for two reasons:
First, because we name the exception object in the CATCH block, which
requires creating a scope, which in turn must be closed somewhere.
Declaring the exception variable in the initializer field of a for
block, like:
#define CATCH(EXCEPTION, mask) \
for (struct gdb_exception EXCEPTION; \
exceptions_state_mc_catch (&EXCEPTION, MASK); \
EXCEPTION = exception_none)
would avoid needing END_CATCH, but alas, in C mode, we build with C90,
which doesn't allow mixed declarations and code.
Second, because when TRY/CATCH are wired to real C++ try/catch, as
long as we need to handle cleanup chains, even if there's no CATCH
block that wants to catch the exception, we need for stop at every
frame in the unwind chain and run cleanups, then rethrow. That will
be done in END_CATCH.
After we require C++, we'll still need TRY/CATCH/END_CATCH until
cleanups are completely phased out -- TRY/CATCH in C++ mode will
save/restore the current cleanup chain, like in C mode, and END_CATCH
catches otherwise uncaugh exceptions, runs cleanups and rethrows, so
that C++ cleanups and exceptions can coexist.
IMO, this still makes the TRY/CATCH code look a bit more like a
newcomer would expect, so IMO worth it even if we weren't considering
C++.
gdb/ChangeLog.
2015-03-07 Pedro Alves <palves@redhat.com>
* common/common-exceptions.c (struct catcher) <exception>: No
longer a pointer to volatile exception. Now an exception value.
<mask>: Delete field.
(exceptions_state_mc_init): Remove all parameters. Adjust.
(exceptions_state_mc): No longer pop the catcher here.
(exceptions_state_mc_catch): New function.
(throw_exception): Adjust.
* common/common-exceptions.h (exceptions_state_mc_init): Remove
all parameters.
(exceptions_state_mc_catch): Declare.
(TRY_CATCH): Rename to ...
(TRY): ... this. Remove EXCEPTION and MASK parameters.
(CATCH, END_CATCH): New.
All callers adjusted.
gdb/gdbserver/ChangeLog:
2015-03-07 Pedro Alves <palves@redhat.com>
Adjust all callers of TRY_CATCH to use TRY/CATCH/END_CATCH
instead.
|
|
This normalizes some exception catch blocks that check for ex.reason
to look like this:
~~~
volatile gdb_exception ex;
TRY_CATCH (ex, RETURN_MASK_ALL)
{
...
}
if (ex.reason < 0)
{
...
}
~~~
This is a preparation step for running a script that converts all
TRY_CATCH uses to look like this instead:
~~~
TRY
{
...
}
CATCH (ex, RETURN_MASK_ALL)
{
...
}
END_CATCH
~~~
The motivation for that change is being able to reimplent TRY/CATCH in
terms of C++ try/catch.
This commit makes it so that:
- no condition other than ex.reason < 0 is checked in the if
predicate
- there's no "else" block to check whether no exception was caught
- there's no code between the TRY_CATCH (TRY) block and the
'if (ex.reason < 0)' block (CATCH).
- the exception object is no longer referred to outside the if/catch
block. Note the local volatile exception objects that are
currently defined inside functions that use TRY_CATCH will
disappear. In cases it's more convenient to still refer to the
exception outside the catch block, a new non-volatile local is
added and copy to that object is made within the catch block.
The following patches should make this all clearer.
gdb/ChangeLog:
2015-03-07 Pedro Alves <palves@redhat.com>
* amd64-tdep.c (amd64_frame_cache, amd64_sigtramp_frame_cache)
(amd64_epilogue_frame_cache): Normal exception handling code.
* break-catch-throw.c (check_status_exception_catchpoint)
(re_set_exception_catchpoint): Ditto.
* cli/cli-interp.c (safe_execute_command):
* cli/cli-script.c (script_from_file): Ditto.
* compile/compile-c-symbols.c (generate_c_for_for_one_variable):
Ditto.
* compile/compile-object-run.c (compile_object_run): Ditto.
* cp-abi.c (baseclass_offset): Ditto.
* cp-valprint.c (cp_print_value): Ditto.
* exceptions.c (catch_exceptions_with_msg):
* frame-unwind.c (frame_unwind_try_unwinder): Ditto.
* frame.c (get_frame_address_in_block_if_available): Ditto.
* i386-tdep.c (i386_frame_cache, i386_epilogue_frame_cache)
(i386_sigtramp_frame_cache): Ditto.
* infcmd.c (post_create_inferior): Ditto.
* linespec.c (parse_linespec, find_linespec_symbols):
* p-valprint.c (pascal_object_print_value): Ditto.
* parse.c (parse_expression_for_completion): Ditto.
* python/py-finishbreakpoint.c (bpfinishpy_init): Ditto.
* remote.c (remote_get_noisy_reply): Ditto.
* s390-linux-tdep.c (s390_frame_unwind_cache): Ditto.
* solib-svr4.c (solib_svr4_r_map): Ditto.
|