Commit Graph

1016 Commits

Author SHA1 Message Date
Simon Marchi 8d7493201c Replace some xmalloc-family functions with XNEW-family ones
This patch is part of the make-gdb-buildable-in-C++ effort.  The idea is
to change some calls to the xmalloc family of functions to calls to the
equivalents in the XNEW family.  This avoids adding an explicit cast, so
it keeps the code a bit more readable.  Some of them also map relatively
well to a C++ equivalent (XNEW (struct foo) -> new foo), so it will be
possible to do scripted replacements if needed.

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

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

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

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

gdb/ChangeLog:

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

gdb/gdbserver/ChangeLog:

	* ax.c (gdb_parse_agent_expr): Likewise.
	(compile_bytecodes): Likewise.
	* dll.c (loaded_dll): Likewise.
	* event-loop.c (append_callback_event): Likewise.
	(create_file_handler): Likewise.
	(create_file_event): Likewise.
	* hostio.c (handle_open): Likewise.
	* inferiors.c (add_thread): Likewise.
	(add_process): Likewise.
	* linux-aarch64-low.c (aarch64_linux_new_process): Likewise.
	* linux-arm-low.c (arm_new_process): Likewise.
	(arm_new_thread): Likewise.
	* linux-low.c (add_to_pid_list): Likewise.
	(linux_add_process): Likewise.
	(handle_extended_wait): Likewise.
	(add_lwp): Likewise.
	(enqueue_one_deferred_signal): Likewise.
	(enqueue_pending_signal): Likewise.
	(linux_resume_one_lwp_throw): Likewise.
	(linux_resume_one_thread): Likewise.
	(linux_read_memory): Likewise.
	(linux_write_memory): Likewise.
	* linux-mips-low.c (mips_linux_new_process): Likewise.
	(mips_linux_new_thread): Likewise.
	(mips_add_watchpoint): Likewise.
	* linux-x86-low.c (initialize_low_arch): Likewise.
	* lynx-low.c (lynx_add_process): Likewise.
	* mem-break.c (set_raw_breakpoint_at): Likewise.
	(set_breakpoint): Likewise.
	(add_condition_to_breakpoint): Likewise.
	(add_commands_to_breakpoint): Likewise.
	(clone_agent_expr): Likewise.
	(clone_one_breakpoint): Likewise.
	* regcache.c (new_register_cache): Likewise.
	* remote-utils.c (look_up_one_symbol): Likewise.
	* server.c (queue_stop_reply): Likewise.
	(start_inferior): Likewise.
	(queue_stop_reply_callback): Likewise.
	(handle_target_event): Likewise.
	* spu-low.c (fetch_ppc_memory): Likewise.
	(store_ppc_memory): Likewise.
	* target.c (set_target_ops): Likewise.
	* thread-db.c (thread_db_load_search): Likewise.
	(try_thread_db_load_1): Likewise.
	* tracepoint.c (add_tracepoint): Likewise.
	(add_tracepoint_action): Likewise.
	(create_trace_state_variable): Likewise.
	(cmd_qtdpsrc): Likewise.
	(cmd_qtro): Likewise.
	(add_while_stepping_state): Likewise.
	* win32-low.c (child_add_thread): Likewise.
	(get_image_name): Likewise.
2015-08-26 17:18:12 -04:00
Pierre-Marie de Rodat 63e43d3aed DWARF: handle non-local references in nested functions
GDB's current behavior when dealing with non-local references in the
context of nested fuctions is approximative:

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

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

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

gdb/ChangeLog:

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

gdb/testsuite/ChangeLog:

	* gdb.base/nested-subp1.exp: New file.
	* gdb.base/nested-subp1.c: New file.
	* gdb.base/nested-subp2.exp: New file.
	* gdb.base/nested-subp2.c: New file.
	* gdb.base/nested-subp3.exp: New file.
	* gdb.base/nested-subp3.c: New file.
2015-08-25 08:13:28 -04:00
Tom Tromey 049412e38f gdb/dwarf2read.c: rename a field for c++
Fixes:

 ../../src/gdb/dwarf2read.c:127:15: error: declaration of ‘asection* dwarf2_section_info::<anonymous union>::asection’ [-fpermissive]
      asection *asection;
		^
 In file included from ../../src/gdb/common/common-types.h:35:0,
		  from ../../src/gdb/common/common-defs.h:44,
		  from ../../src/gdb/defs.h:28,
		  from ../../src/gdb/dwarf2read.c:31:
 ../bfd/bfd.h:1596:3: error: changes meaning of ‘asection’ from ‘typedef struct bfd_section asection’ [-fpermissive]
  } asection;
    ^

gdb/ChangeLog:
2015-08-21  Tom Tromey  <tromey@redhat.com>

	* dwarf2read.c (struct dwarf2_section_info): Rename field
	'asection' to 'section'.
	(dwarf2_has_info, get_section_bfd_owner, get_section_bfd_section)
	(dwarf2_locate_sections, dwarf2_locate_sections)
	(locate_dwz_sections, locate_v1_virtual_dwo_sections)
	(dwarf2_locate_dwo_sections, dwarf2_locate_dwo_sections)
	(dwarf2_locate_v2_dwp_sections): Adjust.
2015-08-21 23:45:50 +01:00
Pedro Alves 40e3ad0ebb Fix language of compilation unit with unknown file extension
Here, in dwarfread.c:process_full_comp_unit:

      /* Set symtab language to language from DW_AT_language.  If the
	 compilation is from a C file generated by language preprocessors, do
	 not set the language if it was already deduced by start_subfile.  */
      if (!(cu->language == language_c
	    && COMPUNIT_FILETABS (cust)->language != language_c))
	COMPUNIT_FILETABS (cust)->language = cu->language;

in case start_subfile doesn't manage to deduce a language
COMPUNIT_FILETABS(cust)->language ends up as language_unknown, not
language_c.  So the condition above evals false and we never set the
language from the cu's language.

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

	* dwarf2read.c (process_full_comp_unit): To tell whether
	start_subfile managed to deduce a language, test for
	language_unknown instead of language_c.

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

	* gdb.dwarf2/comp-unit-lang.exp: New file.
	* gdb.dwarf2/comp-unit-lang.c: New file.
2015-08-20 12:30:08 +01:00
Kevin Buettner 7d45c7c3f6 dwarf2read.c: Check type of string valued attributes prior to decoding.
This change introduces a new function, dwarf2_string_attr(), which is
a wrapper for dwarf2_attr().  dwarf2read.c has been updated to
call dwarf2_string_attr in most instances where a string-valued
attribute is decoded to produce a string value.  In most cases, it
simplifies the code; in some instances, the complexity of the code
remains unchanged.

I performed this change by looking for instances where the
result of DW_STRING was used in an assignment.  Many of these
had a pattern which (roughly) looks something like this:

  struct attribute *attr = NULL;

  attr = dwarf2_attr (die, name, cu);
  if (attr != NULL && DW_STRING (attr))
    {
      const char *str;
      ...
      str = DW_STRING (attr);
      ... /* Use str in some fashion.  */
    }

Code of this form is transformed to look like this instead:

  const char *str;

  str = dwarf2_string_attr (die, name, cu)
  if (str != NULL)
    {
       ...
       /* Use str in some fashion.  */
       ...
    }

In addition to invoking dwarf2_attr() and DW_STRING(),
dwarf2_string_attr() checks to make sure that the attribute's
`form' field matches one of DW_FORM_strp, DW_FORM_string, or
DW_FORM_GNU_strp_alt.  If it does not match one of these forms,
it will return a NULL value in addition to calling complaint().

An earlier version of this patch did this type checking for one
particular instance where a string attribute was being decoded.
The situation that I was attempting to handle in that earlier patch is
this:

The Texas Instruments compiler uses the encoding for
DW_AT_MIPS_linkage_name for other purposes.  TI uses the encoding,
0x2007, for TI_AT_TI_end_line which, unlike DW_AT_MIPS_linkage_name,
does not have a string-typed value.  In this instance, GDB was attempting
to use an integer value as a string pointer, with predictable results.
(GDB would die with a segmentation fault.)

I've added a test which reproduces the problem that I was orignally
wanting to fix.  It uses DW_AT_MIPS_linkage name with an associate
value which is a string, and again, where the value is a small
integer.

My test case causes GDB to segfault in an unpatched GDB.  There
will be two PASSes in a patched GDB.

Unpatched GDB:

(gdb) ptype f
ERROR: Process no longer exists
UNRESOLVED: gdb.dwarf2/dw2-bad-mips-linkage-name.exp: ptype f
ERROR: Couldn't send ptype g to GDB.
UNRESOLVED: gdb.dwarf2/dw2-bad-mips-linkage-name.exp: ptype g

Patched GDB:

(gdb) ptype f
type = bool ()
(gdb) PASS: gdb.dwarf2/dw2-bad-mips-linkage-name.exp: ptype f
ptype g
type = bool ()
(gdb) PASS: gdb.dwarf2/dw2-bad-mips-linkage-name.exp: ptype g

I see no regressions on an x86_64 native target.

gdb/ChangeLog:

	* dwarf2read.c (dwarf2_string_attr): New function.
	(lookup_dwo_unit, process_psymtab_comp_unit_reader)
	(dwarf2_compute_name, dwarf2_physname, find_file_and_directory)
	(read_call_site_scope, namespace_name, guess_full_die_structure_name)
	(anonymous_struct_prefix, prepare_one_comp_unit): Use
	dwarf2_string_attr in place of dwarf2_attr and DW_STRING.

gdb/testsuite/ChangeLog:

	* gdb.dwarf2/dw2-bad-mips-linkage-name.c: New file.
	* gdb.dwarf2/dw2-bad-mips-linkage-name.exp: New file.
2015-08-19 11:48:13 -07:00
Doug Evans 1762568fd6 psymtab.c (add_psymbol_to_bcache): Remove "val" arg.
gdb/ChangeLog:

	* psymtab.c (add_psymbol_to_bcache): Remove "val" arg.  All callers
	updated.
	(add_psymbol_to_list): Ditto.
2015-08-15 22:08:47 -07:00
Doug Evans 8763cedeec Add end_psymtab_common, have all debug info readers call it.
gdb/ChangeLog:

	* dbxread.c (dbx_end_psymtab): Renamed from end_psymtab.  All callers
	updated.  Call end_psymtab_common.
	* dwarf2read.c (process_psymtab_comp_unit_reader): Call
	end_psymtab_common.
	(build_type_psymtabs_reader): Ditto.
	* psympriv.h (sort_pst_symbols): Delete.
	(end_psymtab_common): Declare.
	* psymtab.c (sort_pst_symbols): Make static.
	(end_psymtab_common): New function.
	* xcoffread.c (xcoff_end_psymtab): Call end_psymtab_common.
2015-08-15 16:46:20 -07:00
Pierre-Marie de Rodat 22cee43f9a [Ada] Add support for subprogram renamings
Consider the following declaration:

    function Foo (I : Integer) return Integer renames Pack.Bar;

As Foo is not materialized as a routine whose name is derived from Foo,
GDB currently cannot use it:

    (gdb) print foo(0)
    No definition of "foo" in current context.

However, compilers can emit DW_TAG_imported_declaration in order to
materialize the fact that Foo is actually another name for Pack.Bar.
This commit enhances the DWARF reader to record global renamings (it
used to put global ones in a static block) and enhances the Ada engine
to leverage this information during symbol lookup.

gdb/ChangeLog:

	* ada-lang.c: Include namespace.h
	(aux_add_nonlocal_symbols): Fix a function name in comment.
	(ada_add_block_renamings): New.
	(add_nonlocal_symbols): Add global renamings handling.
	(ada_lookup_symbol_list_worker): Move the symbol lookup part
	to...
	(ada_add_all_symbols): ... this new function.
	(ada_add_block_symbols): Try to match the input name against the
	"using directives list", perform a recursive symbol lookup on
	the matched declarations.
	* block.h (struct block): Move the_namespace to top-level as
	namespace_info. Remove the language_specific field.
	(BLOCK_NAMESPACE): Update access to the namespace_info field.
	* buildsym.h (using_directives): Rename into...
	(local_using_directives): ... this.
	(global_using_directives): New.
	(struct context_stack): Rename the using_directives field into
	local_using_directives.
	* buildsym.c (finish_block_internal): Deal with the proper
	using directives repository (local or global).
	(prepare_for_building): Reset local_using_directives. Assert
	that there is no pending global using directive.
	(reset_symtab_globals): Reset global_using_directives and
	local_using_directives.
	(end_symtab_get_static_block): Don't ignore symtabs that have
	only using directives.
	(push_context): Update references to local_using_directives.
	(buildsym_init): Do not reset using_directives.
	* cp-support.c: Include namespace.h.
	* cp-support.h (struct using_direct): Move to namespace.h.
	(cp_add_using_directives): Move to namespace.h.
	* cp-namespace.c: Include namespace.h
	(cp_add_using_directive): Move to namespace.c, rename it to
	add_using_directive, add a "using_directives" argument and use
	it as the pending using directives repository.  All callers
	updated.
	* dwarf2read.c (using_directives): New.
	(read_import_statement): Call using_directives.
	(read_func_scope): Update references to local_using_directives.
	(read_lexical_block_scope): Likewise.
	(read_namespace): Update the heading comment, call
	using_directives.
	* namespace.h: New file.
	* namespace.c: New file.
	* Makefile.in (SFILES): Add namespace.c.
	(COMMON_OBS): Add namespace.o

gdb/testsuite/ChangeLog:

	* gdb.ada/fun_renaming.exp: New testcase.
	* gdb.ada/fun_renaming/fun_renaming.adb: New file.
	* gdb.ada/fun_renaming/pack.adb: New file.
	* gdb.ada/fun_renaming/pack.ads: New file.

Tested on x86_64-linux.  Support for this in GCC is in the pipeline: see
<https://gcc.gnu.org/ml/gcc-patches/2015-07/msg02166.html>.
2015-08-13 09:33:42 +02:00
Simon Marchi aead7601eb Add casts for legitimate integer to enum conversions
This patch is mostly extracted from Pedro's C++ branch.  It adds explicit
casts from integer to enum types, where it is really the intention to do
so.  This could be because we are ...

 * iterating on enum values (we need to iterate on an equivalent integer)
 * converting from a value read from bytes (dwarf attribute, agent
 expression opcode) to the equivalent enum
 * reading the equivalent integer value from another language (Python/Guile)

An exception to that is the casts in regcache.c.  It seems to me like
struct regcache's register_status field could be a pointer to an array of
enum register_status.  Doing so would waste a bit of memory (4 bytes
used by the enum vs 1 byte used by the current signed char, for each
register).  If we switch to C++11 one day, we can define the underlying
type of an enum type, so we could have the best of both worlds.

gdb/ChangeLog:

	* arm-tdep.c (set_fp_model_sfunc): Add cast from integer to enum.
	(arm_set_abi): Likewise.
	* ax-general.c (ax_print): Likewise.
	* c-exp.y (exp : string_exp): Likewise.
	* compile/compile-loc2c.c (compute_stack_depth_worker): Likewise.
	(do_compile_dwarf_expr_to_c): Likewise.
	* cp-name-parser.y (demangler_special : DEMANGLER_SPECIAL start):
	Likewise.
	* dwarf2expr.c (execute_stack_op): Likewise.
	* dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise.
	(disassemble_dwarf_expression): Likewise.
	* dwarf2read.c (dwarf2_add_member_fn): Likewise.
	(read_array_order): Likewise.
	(abbrev_table_read_table): Likewise.
	(read_attribute_value): Likewise.
	(skip_unknown_opcode): Likewise.
	(dwarf_decode_macro_bytes): Likewise.
	(dwarf_decode_macros): Likewise.
	* eval.c (value_f90_subarray): Likewise.
	* guile/scm-param.c (gdbscm_make_parameter): Likewise.
	* i386-linux-tdep.c (i386_canonicalize_syscall): Likewise.
	* infrun.c (handle_command): Likewise.
	* memory-map.c (memory_map_start_memory): Likewise.
	* osabi.c (set_osabi): Likewise.
	* parse.c (operator_length_standard): Likewise.
	* ppc-linux-tdep.c (ppc_canonicalize_syscall): Likewise, and use
	single return point.
	* python/py-frame.c (gdbpy_frame_stop_reason_string): Likewise.
	* python/py-symbol.c (gdbpy_lookup_symbol): Likewise.
	(gdbpy_lookup_global_symbol): Likewise.
	* record-full.c (record_full_restore): Likewise.
	* regcache.c (regcache_register_status): Likewise.
	(regcache_raw_read): Likewise.
	(regcache_cooked_read): Likewise.
	* rs6000-tdep.c (powerpc_set_vector_abi): Likewise.
	* symtab.c (initialize_ordinary_address_classes): Likewise.
	* target-debug.h (target_debug_print_signals): Likewise.
	* utils.c (do_restore_current_language): Likewise.
2015-08-06 17:22:49 -04:00
Pedro Alves 666fcf91c0 dwarf2read.c: fix latent buglet
cust->includes is:

struct compunit_symtab
{
...
  struct compunit_symtab **includes;

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

	* dwarf2read.c (compute_compunit_symtab_includes): Use size of struct
	compunit_symtab pointer.
2015-08-03 18:55:12 +01:00
Doug Evans cc12ce380e Fix crash when reading dummy CUs.
Dummy CUs are used by the incremental linker to pre-allocate space
in the output file. They have a DWARF header but no contents.

gdb/ChangeLog:

	* dwarf2read.c (dwarf2_per_cu_data): Add comment.
	(load_cu): Handle dummy CUs.
	(dw2_do_instantiate_symtab, process_queuef): Ditto.
	(dwarf2_fetch_die_loc_sect_off, dwarf2_fetch_constant_bytes): Ditto.

gdb/testsuite/ChangeLog:

	* gdb.dwarf2/dw2-dummy-cu.S: New file.
	* gdb.dwarf2/dw2-dummy-cu.exp: New file.
2015-07-23 09:25:49 -07:00
Kevin Buettner b4e1fd615a dwarf2read: Allow SEC_ALLOC sections to be located at address 0.
GDB already allows statically initialized variables, located in
SEC_LOAD sections, to be placed at address 0.  This change allows
uninitialized variables (which are in SEC_ALLOC sections) to be placed
address 0 as well.

gdb/ChangeLog:

	* dwarf2read.c (dwarf2_locate_sections): Allow has_section_at_zero
	to be set for SEC_ALLOC sections too.
2015-07-18 10:10:15 -07:00
Iain Buclaw 452802827f Add support reading D modules from DWARF
Extends existing support for namespaces/modules in C++/Fortran/Java to
include language_d too.  However unlike Fortran/C++, the separator for
qualified names is a single dot.

2015-07-14  Iain Buclaw  <ibuclaw@gdcproject.org>

	* dwarf2read.c (find_slot_in_mapped_hash): Extend language support to
	also test for language_d.
	(dwarf2_compute_name): Likewise.
	(read_func_scope): Likewise.
	(read_structure_type): Likewise.
	(determine_prefix): Likewise.
	(read_import_statement): Use dot as the separator for language_d.
	(typename_concat): Likewise, but don't prefix the D main function.
2015-07-14 20:31:21 +02:00
Doug Evans 18a94d75a0 Remove special support in gdb for Sun's version of stabs.
Discussion:
https://sourceware.org/ml/gdb-patches/2015-05/msg00169.html

gdb/ChangeLog:

	* NEWS: Mention Sun's version of stabs is no longer supported.
	* elfread.c (free_elfinfo): Delete.  All uses updated.
	(elfstab_offset_sections): Delete.  All uses updated.
	* gdb-stabs.h (stab_section_info): Delete.  All uses updated.
	* psympriv.h (partial_symtab) <section_offsets>: Delete.
	All uses updated.
	* psymtab.c (start_psymtab_common): Delete arg section_offsets.
	All callers updated.

gdb/doc/ChangeLog:

	* stabs.texinfo (ELF Linker Relocation): Mention Sun stabs is no
	longer supported.
2015-06-19 11:34:43 -07:00
Simon Marchi e815d2d271 dwarf2read: call dwarf_finish_line when ending a sequence
Commit d9b3de22f3 introduced a behaviour
change where dwarf_finish_line was not called anymore when ending a
sequence of machine instructions. This patch restores the original
behaviour.

gdb/ChangeLog:

	* dwarf2read.c (dwarf_record_line): Call dwarf_record_line if
	 end_sequence is true.
2015-06-10 16:34:16 -04:00
Doug Evans a051152b64 * dwarf2read.c (record_line_ftype): Remove, duplicate.
gdb/Changelog:

	* dwarf2read.c (record_line_ftype): Remove, duplicate.
2015-05-28 09:42:02 -07:00
Doug Evans d9b3de22f3 Add struct to record dwarf line number state machine.
gdb/ChangeLog:

	* dwarf2read.c (lnp_state_machine): New typedef.
	(lnp_reader_state): New typedef.
	(dwarf_record_line_1): Renamed from dwarf_record_line.
	All callers updated.
	(dwarf_record_line): New function.
	(init_lnp_state_machine): New function.
	(check_line_address): Replace p_record_line parameter with state.
	All callers updated.
	(dwarf_decode_lines_1): Call dwarf_record_line, init_lnp_state_machine.
	Update to record state in lnp_state_machine.
2015-05-27 14:44:29 -07:00
Doug Evans 924c2928ae dwarf2read.c code cleanup, split out check_line_address
gdb/ChangeLog:

	* dwarf2read.c (record_line_ftype): New typedef.
	(check_line_address): New function.
	(dwarf_decode_lines_1): Call it.
2015-05-27 13:22:02 -07:00
Doug Evans 27e0867f4d Add set/show debug dwarf-line.
gdb/ChangeLog:

	* NEWS: Mention "set debug dwarf-line".
	* dwarf2read.c (dwarf_line_debug): New static global.
	(add_include_dir): Add debug dwarf-line support.
	(add_file_name, dwarf_record_line, dwarf_finish_line): Ditto.
	(_initialize_dwarf2_read): New parameter "debug dwarf-line".

gdb/doc/ChangeLog:

	* gdb.texinfo (Debugging Output): Mention set/show debug dwarf-line.
2015-05-27 12:55:19 -07:00
Doug Evans b2e2f908b8 PR symtab/18258
gdb/ChangeLog:

	* block.c (block_find_symbol): New function.
	(block_find_non_opaque_type): Ditto.
	(block_find_non_opaque_type_preferred): Ditto.
	* block.h (block_symbol_matcher_ftype): New typedef.
	(block_find_symbol): Declare.
	(block_find_non_opaque_type): Ditto.
	(block_find_non_opaque_type_preferred): Ditto.
	* dwarf2read.c (dw2_lookup_symbol): Call block_find_symbol.
	* psymtab.c (psym_lookup_symbol): Ditto.
	* symtab.c (basic_lookup_transparent_type_1): New function.
	(basic_lookup_transparent_type): Call it.

gdb/testsuite/ChangeLog:

	* gdb.dwarf2/opaque-type-lookup-2.c: New file.
	* gdb.dwarf2/opaque-type-lookup.c: New file.
	* gdb.dwarf2/opaque-type-lookup.exp: New file.
2015-05-27 11:50:38 -07:00
Doug Evans b4f5498457 Rename dwarf2 to dwarf in "set debug" and maintenance commands.
gdb/ChangeLog:

	* NEWS: Add entries for command renamings.
	* dwarf2read.c (dwarf_read_debug): Renamed from dwarf2_read_debug.
	All uses updated.
	(dwarf_die_debug): Renamed from dwarf2_die_debug.  All uses updated.
	(dwarf_max_cache_age): Renamed from dwarf2_max_cache_age.
	All uses updated.
	(show_dwarf_max_cache_age): Renamed from show_dwarf2_max_cache_age.
	All callers updated.  Fix spelling of DWARF in help text.
	(set_dwarf_cmdlist): Renamed from set_dwarf2_cmdlist.
	All uses updated.
	(show_dwarf_cmdlist): Renamed from show_dwarf2_cmdlist.
	All uses updated.
	(set_dwarf_cmd): Renamed from set_dwarf2_cmd.  All callers updated.
	(show_dwarf_cmd): Renamed from show_dwarf2_cmd.  All callers updated.
	(dwarf_always_disassemble): Renamed from dwarf_always_disassemble.
	All uses updated.
	(show_dwarf_always_disassemble): Renamed from
	show_dwarf2_always_disassemble.  All callers updated.
	(_initialize_dwarf2_read): Rename "set/show dwarf2" prefix to
	"set/show dwarf".  Rename "set/show dwarf2 max-cache-age" to
	"set/show dwarf max-cache-age".  Rename
	"set/show dwarf2 always-disassemble" to
	"set/show dwarf always-disassemble".  Rename
	"set/show debug dwarf2-read" to "set/show debug dwarf-read".  Rename
	"set/show debug dwarf2-die" to "set/show debug dwarf-die".

gdb/doc/ChangeLog:

	* gdb.texinfo (Debugging Output): Update for DWARF "set debug"
	command renamings.
	(Maintenance Commands): Update for DWARF "set debug" command renamings.

gdb/testsuite/ChangeLog:

	* gdb.dwarf2/dw2-op-call.exp: Update.
	* gdb.dwarf2/dw4-sig-types.exp: Update.
	* gdb.dwarf2/implptr.exp: Update.
	* gdb.mi/mi-cmd-param-changed.exp: Update.
2015-05-26 16:50:57 -07:00
Martin Galvan 08a76f8ab8 dwarf2read.c (die_needs_namespace): Return 1 for DW_TAG_inlined_subroutine.
gdb/ChangeLog:

	* dwarf2read.c (die_needs_namespace): Return 1 for
	DW_TAG_inlined_subroutine.
2015-05-13 14:09:19 -07:00
Doug Evans 93b2e21d4a revert previous patch, author not set 2015-05-13 14:07:03 -07:00
Doug Evans da0580a62b dwarf2read.c (die_needs_namespace): Return 1 for DW_TAG_inlined_subroutine.
gdb/ChangeLog:

	* dwarf2read.c (die_needs_namespace): Return 1 for
	DW_TAG_inlined_subroutine.
2015-05-13 13:55:09 -07:00
Doug Evans 83769d0b12 tweak some comments
gdb/ChangeLog:

	* dwarf2read.c (struct file_entry): Tweak comments.
	(get_debug_line_section): Tweak comments.
2015-05-12 10:42:49 -07:00
Sandra Loosemore afa6c9abf2 Avoid segfault on missing directory table.
2015-05-08  Yao Qi  <yao@codesourcery.com>
	    Sandra Loosemore  <sandra@codesourcery.com>

	gdb/
	* dwarf2read.c (setup_type_unit_groups): Do NULL pointer check
	to 'lh->include_dirs' before accessing to it.
	(psymtab_include_file_name): Likewise.
	(dwarf_decode_lines_1): Likewise.
	(dwarf_decode_lines): Likewise.
	(file_file_name): Likewise.
2015-05-08 12:43:39 -07:00
Joel Brobecker 6ad395a7a6 Problem printing record with array whose upper bound is record component
Consider the following declarations...

  type Obj_T (Selected_Flights_Length : Natural) is
     record
      Selected_Flights : Flights.List.T (1 .. Selected_Flights_Length);
    end record;
  Broken : Obj_T;

... which defines a variable named "broken" which is a discrimated
record where broken.Selected_Flights is an array whose upper bound
is stored in the record's Selected_Flights_Length component.

Trying to print the value of that object currently fails:

    (gdb) print broken
    cannot find reference address for offset property

Looking at the debugging info, we see that variable "Broken" is
a reference...

 <1><8e3>: Abbrev Number: 21 (DW_TAG_const_type)
    <8e4>   DW_AT_type        : <0x8e8>
 <1><8e8>: Abbrev Number: 22 (DW_TAG_reference_type)
    <8e9>   DW_AT_byte_size   : 8
    <8ea>   DW_AT_type        : <0x7ec>

... to ...

 <1><7ec>: Abbrev Number: 12 (DW_TAG_structure_type)
    <7ed>   DW_AT_name        : (indirect string, offset: 0xc6d): reprod__obj_t
    <7f1>   DW_AT_decl_file   : 2
    <7f2>   DW_AT_decl_line   : 15
    <7f3>   DW_AT_GNAT_descriptive_type: <0x87e>
    <7f7>   DW_AT_sibling     : <0x87e>

... which has 2 members, the first one being the discriminant...

 <2><7fb>: Abbrev Number: 9 (DW_TAG_member)
    <7fc>   DW_AT_name        : (indirect string, offset: 0xc98): selected_flights_length
    <800>   DW_AT_decl_file   : 2
    <801>   DW_AT_decl_line   : 15
    <802>   DW_AT_type        : <0x807>
    <806>   DW_AT_data_member_location: 0

... and the second one being the one that causes trouble...

 <2><83d>: Abbrev Number: 9 (DW_TAG_member)
    <83e>   DW_AT_name        : (indirect string, offset: 0xd17): selected_flights
    <842>   DW_AT_decl_file   : 2
    <843>   DW_AT_decl_line   : 17
    <844>   DW_AT_type        : <0x815>
    <848>   DW_AT_data_member_location: 4

The second field's type is an array....

 <2><815>: Abbrev Number: 14 (DW_TAG_array_type)
    <816>   DW_AT_name        : (indirect string, offset: 0xd2f): reprod__obj_t__T5sP
    <81a>   DW_AT_GNAT_descriptive_type: <0x7e1>
    <81e>   DW_AT_type        : <0x748>
    <822>   DW_AT_sibling     : <0x830>

... whose uppper bound is a reference to <0x7fb>...

 <3><826>: Abbrev Number: 15 (DW_TAG_subrange_type)
    <827>   DW_AT_type        : <0x830>
    <82b>   DW_AT_upper_bound : <0x7fb>
 <3><82f>: Abbrev Number: 0

Because the upper bound is dynamic, we try to resolve it.
As it happens, the upper-bound resolution for this range type
works fine. What breaks is when we try to resolve this range
type's target type, which is:

        <2><830>: Abbrev Number: 16 (DW_TAG_subrange_type)
           <831>   DW_AT_upper_bound : <0x7fb>
           <835>   DW_AT_name        : (indirect string, offset: 0xc7b): reprod__obj_t__T4s___XDLU_1__selected_flights_length
           <839>   DW_AT_type        : <0x766>
           <83d>   DW_AT_artificial  : 1

It is actually pretty much the same as the first subrange type,
so you might ask why this is causing trouble, when the resolution
of the previous DIE worked like a charm???

Well, for that, we need to backtrack a bit, and notice that, ahead
of the DW_TAG_structure_type's DIE, there is the following DIE:

 <1><7e1>: Abbrev Number: 6 (DW_TAG_typedef)
    <7e2>   DW_AT_name        : (indirect string, offset: 0xbae): reprod__obj_t__T5s
    <7e6>   DW_AT_decl_file   : 2
    <7e7>   DW_AT_decl_line   : 17
    <7e8>   DW_AT_type        : <0x849>

... and that DIE references an array type...

 <2><849>: Abbrev Number: 14 (DW_TAG_array_type)
    <84a>   DW_AT_name        : (indirect string, offset: 0xbae): reprod__obj_t__T5s
    <84e>   DW_AT_GNAT_descriptive_type: <0x864>
    <852>   DW_AT_type        : <0x748>
    <856>   DW_AT_sibling     : <0x864>

... whose subrange is...

 <3><85a>: Abbrev Number: 15 (DW_TAG_subrange_type)
    <85b>   DW_AT_type        : <0x830>
    <85f>   DW_AT_upper_bound : <0x7fb>

... where the subrange's base type is the DW_TAG_subrange_type DIE
that is causing problem.

In summary, we process the typedef first, which causes us to process
the second subrange BEFORE we process the struct DIE itself, and
therefore the struct's discriminent (DW_TAG_member #1). As a result,
while trying to handle the reference to that DW_TAG_member #1 as
the upper bound of the second range type, we do...

          case DW_AT_data_member_location:
            {
              [...]
              baton->referenced_type = get_die_type (target_die->parent,
                                                     target_cu);

... where target_die->parent (DW_TAG_member #1) hasn't been processed
yet, and thus get_die_type returns NULL.

This is what later causes us problems trying to find the right address
to use as the base address for our field, which then triggers the
error message we are seeing.

This patch fixes the issue by calling read_type_die instead of
get_die_type.  If the DIE has already been processed, then this
is the same as get_die_type. If not, the it'll get the parent
die to be read, and then get its type.

gdb/ChangeLog:

        * dwarf2read.c (attr_to_dynamic_prop)
        <DW_AT_data_member_location>: Use read_type_die isntead of
        get_die_type.

Tested on x86_64-linux, no regression.

No testcase, unfortunately, as the reproducer was given to us by
a customer, and it's been otherwise surprisingly difficult to
reproduce the same error outside of that reproducer.
2015-05-08 08:57:33 -07:00
Pierre-Marie de Rodat 3ea89b92fb DWARF: cannot break on out-of-line function nested inside inlined function.
Consider the following code, which defines a function, Child2,
which is itself nested inside Child1:

    procedure Foo_O224_021 is
        O1 : constant Object_Type := Get_Str ("Foo");
        procedure Child1 is
            O2 : constant Object_Type := Get_Str ("Foo");
            function Child2 (S : String) return Boolean is -- STOP
            begin
                for C of S loop
                    Do_Nothing (C);
                    if C = 'o' then
                        return True;
                    end if;
                end loop;
                return False;
            end Child2;
            R : Boolean;
        begin
            R := Child2 ("Foo");
            R := Child2 ("Bar");
            R := Child2 ("Foobar");
        end Child1;
    begin
        Child1;
    end Foo_O224_021;

On x86_64-linux, when compiled at -O2, GDB is unable to insert
a breakpoint on Child2:

    % gnatmake -g -O2 foo_o224_021
    % gdb foo_o224_021
    (gdb) b child2
    Function "child2" not defined.
    (gdb) b foo_o224_021.child1.child2
    Function "foo_o224_021.child1.child2" not defined.

The problem is caused by the fact that GDB did not create a symbol
for Child2, and this, in turn, is caused by the fact that the compiler
decided to inline Child1, but not Child2. The DWARF debugging info
first provides an abstract instance tree for Child1...

 <3><1b7b>: Abbrev Number: 29 (DW_TAG_subprogram)
    <1b7c>   DW_AT_name        : (indirect string, offset: 0x23f8): foo_o224_021__child1
    <1b82>   DW_AT_inline      : 1      (inlined)
    <1b83>   DW_AT_sibling     : <0x1c01>

... where that subprogram is given the DW_AT_inline attribute.
Inside that function there is a lexical block which has no PC
range (corresponding to the fact that this is the abstract tree):

 <4><1b87>: Abbrev Number: 30 (DW_TAG_lexical_block)

... inside which our subprogram Child2 is described:

 <5><1b92>: Abbrev Number: 32 (DW_TAG_subprogram)
    <1b93>   DW_AT_name        : (indirect string, offset: 0x2452): foo_o224_021__child1__child2
    <1b99>   DW_AT_type        : <0x1ab1>
    <1b9d>   DW_AT_low_pc      : 0x402300
    <1ba5>   DW_AT_high_pc     : 0x57
    [...]

Then, later on, we get the concrete instance tree, starting at:

 <3><1c5e>: Abbrev Number: 41 (DW_TAG_inlined_subroutine)
    <1c5f>   DW_AT_abstract_origin: <0x1b7b>
    <1c63>   DW_AT_entry_pc    : 0x4025fd
    <1c6b>   DW_AT_ranges      : 0x150

... which refers to Child1. One of that inlined subroutine children
is the concrete instance of the empty lexical block we saw above
(in the abstract instance tree), which gives the actual address
range for this inlined instance:

 <5><1c7a>: Abbrev Number: 43 (DW_TAG_lexical_block)
    <1c7b>   DW_AT_abstract_origin: <0x1b87>
    <1c7f>   DW_AT_ranges      : 0x180

This is the DIE which provides the context inside which we can
record Child2. But unfortunately, GDB does not take the abstract
origin into account when handling lexical blocks, causing it
to miss the fact that this block contains some symbols described
in the abstract instance tree. This is the first half of this patch:
modifying GDB to follow DW_AT_abstract_origin attributes for
lexical blocks.

But this not enough to fix the issue, as we're still unable to
break on Child2 with just that change. The second issue can be
traced to the way inherit_abstract_dies determines the list of
DIEs to inherit from. For that, it iterates over all the DIEs in
the concrete instance tree, and finds the list of DIEs from the
abstract instance tree that are not referenced from the concrete
instance tree. As it happens, there is one type of DIE in the
concrete instance tree which does reference Child2's DIE, but
in fact does otherwise define a concrete instance of the reference
DIE; that's (where <0x1b92> is Child2's DIE):

 <6><1d3c>: Abbrev Number: 35 (DW_TAG_GNU_call_site)
    <1d3d>   DW_AT_low_pc      : 0x4026a4
    <1d45>   DW_AT_abstract_origin: <0x1b92>

So, the second part of the patch is to modify inherit_abstract_dies
to ignore DW_TAG_GNU_call_site DIEs when iterating over the concrete
instance tree.

This patch also includes a testcase which can be used to reproduce
the issue. Unfortunately, for it to actually pass, a smal patch in
GCC is also necessary to make sure that GCC provides lexical blocks'
DW_AT_abstract_origin attributes from the concrete tree back to
the abstract tree. We hope to be able to submit and integrate that
patch in the GCC tree soon. Meanwhile, a setup_xfail has been added.

gdb/ChangeLog:

	2014-05-05  Pierre-Marie de Rodat  <derodat@adacore.com>
	* dwarf2read.c (inherit_abstract_dies): Skip
	DW_TAG_GNU_call_site dies while inheriting children of an
	abstract DIE into a scope.
	(read_lexical_block_scope): Inherit abstract DIE's for
	lexical scopes.

gdb/testsuite/ChangeLog:

        * gdb.ada/out_of_line_in_inlined: New testcase.
2015-05-05 11:06:09 -07:00
Doug Evans 61d96d7e2e Make info fun|var|types interruptable.
"info fun foo" can be a pain when it's not interruptable,
especially if you're not exactly sure of what you're looking for
and provide something that matches too much.

gdb/ChangeLog:

	* dwarf2read.c (dw2_expand_symtabs_matching): Add some QUIT calls.
2015-04-15 13:25:42 -07:00
Andy Wingo ff908ebf86 Properly intern constants into psymtab
Variables with a DW_AT_const_value but without a DW_AT_location were not
getting added to the partial symbol table.  They are added to the full
symbol table, however, when the compilation unit's psymtabs are
expanded.

Before:

   (gdb) p one
   No symbol "one" in current context.
   (gdb) mt flush-symbol-cache
   (gdb) mt expand one.c
   (gdb) p one
   $1 = 1

After:

   (gdb) p one
   $1 = 1

To the user it's pretty strange, as depending on whether tab completion
has forced expansion of all CUs or not the lookup might succeed, or not
if the failure was already added to the symbol cache.

This commit simply makes sure to add constants to the partial symbol
tables.

gdb/testsuite/ChangeLog:

	PR symtab/18148
	* gdb.dwarf2/dw2-intercu.S (one, two): Add variables that have a
	const_value but not a location.
	* gdb.dwarf2/dw2-intercu.exp: Add tests that constants without
	location defined in non-main CUs are visible.

gdb/ChangeLog:

	PR symtab/18148
	* dwarf2read.c (struct partial_die_info): Add has_const_value
	member.
	(add_partial_symbol): Don't punt on symbols that have const_value
	attributes.
	(read_partial_die): Detect DW_AT_const_value.
2015-03-26 19:41:54 +01:00
Joel Brobecker 93a8e2276f GDB: rename DYN_ATTR_DATA_LOCATION into DYN_PROP_DATA_LOCATION.
The terminology we've been using is (dynamic) "property" rather than
"attribute", so this patch renames an enum to use the same terminology.

No behavior change.

gdb/ChangeLog:

        * gdbtypes.h (enum dynamic_prop_node_kind) <DYN_PROP_DATA_LOCATION>:
        Renames DYN_ATTR_DATA_LOCATION.
        (TYPE_DATA_LOCATION): Use DYN_PROP_DATA_LOCATION instead of
        DYN_ATTR_DATA_LOCATION.
        * dwarf2read.c (set_die_type): Use DYN_PROP_DATA_LOCATION
        instead of DYN_ATTR_DATA_LOCATION.

Tested on x86_64-linux.
2015-03-24 11:24:43 -07:00
Keith Seitz 7e993ebf23 PR gdb/18021 - defend against "static virtual" methods
This bug appears to be caused by bad debuginfo. The method
causing the sefault in the reporter's test case is marked both static
and virtual.

This patch simply safegaurds against this case in dwarf2_add_member_fn,
where the code assumes that there is a `this' pointer when a virtual method
is seen (more specifically, when DW_AT_vtable_elem is seen).

It previously dereferenced the first formal parameter
(`this' pointer), which in this case doesn't exist. GDB consequently
segfaulted dereferencing a NULL pointer.

gdb/ChangeLog
	PR gdb/18021
	* dwarf2read.c (dwarf2_add_member_fn): Issue a complaint
	if we find a static method with DW_AT_vtable_elem_location.

gdb/testsuite/ChangeLog
	PR gdb/18021
	* gdb.dwarf2/staticvirtual.exp: New test.
2015-03-23 12:50:28 -07:00
Keven Boell d9823cbb39 [gdb/DWARF] Introduce linked list for dynamic attributes
This patch introduces a linked list for dynamic attributes of a type.
This is a pre-work for the Fortran dynamic array support. The Fortran
dynamic array support will add more dynamic attributes to a type.
As only a few types will have such dynamic attributes set, a linked
list is more efficient in terms of memory consumption than adding
multiple attributes to main_type.

gdb/ChangeLog:

        * gdbtypes.c (resolve_dynamic_type_internal): Adapt
        data_location usage to linked list.
        (resolve_dynamic_type_internal): Adapt data_location to
        linked list.
        (get_dyn_prop, add_dyn_prop, copy_dynamic_prop_list): New function.
        (copy_type_recursive, copy_type): Add copy of linked list.
        * gdbtypes.h (enum dynamic_prop_node_kind): New enum.
        (struct dynamic_prop_list): New struct.
        * dwarf2read.c (set_die_type): Set data_location data.
2015-03-20 17:52:03 -04:00
Pedro Alves 492d29ea1c Split TRY_CATCH into TRY + CATCH
This patch splits the TRY_CATCH macro into three, so that we go from
this:

~~~
  volatile gdb_exception ex;

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

to this:

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

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

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

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

  TRY
    {
    }

  // some code here.

  CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  END_CATCH

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

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

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

END_CATCH is necessary for two reasons:

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

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

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

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

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

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

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

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

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

	Adjust all callers of TRY_CATCH to use TRY/CATCH/END_CATCH
	instead.
2015-03-07 15:14:14 +00:00
Gary Benson 61012eef84 New common function "startswith"
This commit introduces a new inline common function "startswith"
which takes two string arguments and returns nonzero if the first
string starts with the second.  It also updates the 295 places
where this logic was written out longhand to use the new function.

gdb/ChangeLog:

	* common/common-utils.h (startswith): New inline function.
	All places where this logic was used updated to use the above.
2015-03-06 09:42:06 +00:00
Tom Tromey 52059ffd69 Fix struct, union, and enum nesting in C++
In C, an enum or structure defined inside other structure has global
scope just like it had been defined outside the struct in the first
place.  However, in C++, such a nested structure is given a name that
is nested inside the structure.  This patch moves such affected
structures/enums out to global scope, so that code using them works
the same in C++ as it works today in C.

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

	* dwarf2-frame.c (enum cfa_how_kind, struct
	dwarf2_frame_state_reg_info): Move out of struct
	dwarf2_frame_state.
	* dwarf2read.c (struct tu_stats): Move out of struct
	dwarf2_per_objfile.
	(struct file_entry): Move out of struct line_header.
	(struct nextfield, struct nextfnfield, struct fnfieldlist, struct
	typedef_field_list): Move out of struct field_info.
	* gdbtypes.h (enum dynamic_prop_kind, union dynamic_prop_data):
	Move out of struct dynamic_prop.
	(union type_owner, union field_location, struct field, struct
	range_bounds, union type_specific): Move out of struct main_type.
	(struct fn_fieldlist, struct fn_field, struct typedef_field)
	(VOFFSET_STATIC): Move out of struct cplus_struct_type.
	(struct call_site_target, union call_site_parameter_u, struct
	call_site_parameter): Move out of struct call_site.
	* m32c-tdep.c (enum m32c_prologue_kind): Move out of struct
	m32c_prologue.
	(enum srcdest_kind): Move out of struct srcdest.
	* main.c (enum cmdarg_kind): Move out of struct cmdarg.
	* prologue-value.h (enum prologue_value_kind): Move out of struct
	prologue_value.
	* s390-linux-tdep.c (enum s390_abi_kind): Move out of struct
	gdbarch_tdep.
	* stabsread.c (struct nextfield, struct next_fnfieldlist): Move
	out of struct field_info.
	* symfile.h (struct other_sections): Move out of struct
	section_addr_info.
	* symtab.c (struct symbol_cache_slot): Move out struct
	block_symbol_cache.
	* target-descriptions.c (enum tdesc_type_kind): Move out of
	typedef struct tdesc_type.
	* tui/tui-data.h (enum tui_line_or_address_kind): Move out of
	struct tui_line_or_address.
	* value.c (enum internalvar_kind, union internalvar_data): Move
	out of struct internalvar.
	* xtensa-tdep.h (struct ctype_cache): Move out of struct
	gdbarch_tdep.
2015-02-27 17:19:15 +00:00
Pedro Alves fe978cb071 C++ keyword cleanliness, mostly auto-generated
This patch renames symbols that happen to have names which are
reserved keywords in C++.

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

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

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

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

	Rename symbols whose names are reserved C++ keywords throughout.
2015-02-27 16:33:07 +00:00
Doug Evans 96553a0cff PR c++/17976, symtab/17821
This patch addresses two issues.

The basic problem is that "(anonymous namespace)" doesn't get entered
into the symbol table because when dwarf2read.c:new_symbol_full is called
the DIE has no name (dwarf2_name returns NULL).

PR 17976: ptype '(anonymous namespace)' should work like any namespace

PR 17821: perf issue looking up (anonymous namespace)

bash$ gdb monster-program
(gdb) mt set per on
(gdb) mt set symbol-cache-size 0
(gdb) break (anonymous namespace)::foo

Before:

Command execution time: 3.266289 (cpu), 6.169030 (wall)
Space used: 811429888 (+12910592 for this command)

After:

Command execution time: 1.264076 (cpu), 4.057408 (wall)
Space used: 798781440 (+0 for this command)

gdb/ChangeLog:

	PR c++/17976, symtab/17821
	* cp-namespace.c (cp_search_static_and_baseclasses): New parameter
	is_in_anonymous.  All callers updated.
	(find_symbol_in_baseclass): Ditto.
	(cp_lookup_nested_symbol_1): Ditto.  Don't search all static blocks
	for symbols in an anonymous namespace.
	* dwarf2read.c (namespace_name): Don't call dwarf2_name, fetch
	DW_AT_name directly.
	(dwarf2_name): Convert missing namespace name to
	CP_ANONYMOUS_NAMESPACE_STR.

gdeb/testsuite/ChangeLog:

	* gdb.cp/anon-ns.exp: Add test for ptype '(anonymous namespace)'.
2015-02-21 21:58:31 -08:00
Mark Wielaard b1ffba5a7f Change producer_is_gcc function return type to bool.
gdb/ChangeLog:

        * utils.h (producer_is_gcc): Change return type to bool. Add major
        argument.
        * utils.c (producer_is_gcc): Likewise.
        (producer_is_gcc_ge_4): Adjust producer_is_gcc call.
        * dwarf2read.c (check_producer): Likewise.
2015-02-10 21:20:38 +01:00
Mark Wielaard f7de9aab90 Recognize new DWARF5/GCC5 DW_LANG Fortran 2003 and Fortran 2008 standards.
DWARFv5 defines and GCC5 may output two new DW_LANG constants for the
Fortran 2003 and Fortran 2008 standards. Recognize both as variants of
language_fortran.

gdb/ChangeLog:

	* dwarf2read.c (set_cu_language): Recognize DW_LANG_Fortran03 and
	DW_LANG_Fortran08 as language_fortran.

http://dwarfstd.org/ShowIssue.php?issue=141121.1
2015-02-10 10:15:04 +01:00
Mark Wielaard a2c2acaf15 GCC5/DWARFv5 Handle DW_TAG_atomic_type for C11 _Atomic type qualifier.
gdb/ChangeLog

	* c-typeprint.c (cp_type_print_method_args): Handle '_Atomic'.
	(c_type_print_modifier): Likewise.
	* dwarf2read.c (read_tag_atomic_type): New function.
	(read_type_die_1): Handle DW_TAG_atomic_type.
	* gdbtypes.c (make_atomic_type): New function.
	(recursive_dump_type): Handle TYPE_ATOMIC.
	* gdbtypes.h (enum type_flag_values): Renumber.
	(enum type_instance_flag_value): Add TYPE_INSTANCE_FLAG_ATOMIC.
	(TYPE_ATOMIC): New macro.
	(make_atomic_type): Declare.

gdb/testsuite/ChangeLog

	* gdb.dwarf2/atomic.c: New file.
	* gdb.dwarf2/atomic-type.exp: Likewise.

include/ChangeLog

	* dwarf2.def: Add DW_TAG_atomic_type.
2015-02-09 15:09:22 +01:00
Doug Evans ae6ae97502 Move vptr_{fieldno,basetype} out of main_type, and update everything accordingly.
Every type has to pay the price in memory usage for their presence.
The proper place for them is in the type_specific field which exists
for this purpose.

gdb/ChangeLog:

	* dwarf2read.c (process_structure_scope): Update setting of
	TYPE_VPTR_BASETYPE, TYPE_VPTR_FIELDNO.
	* gdbtypes.c (internal_type_vptr_fieldno): New function.
	(set_type_vptr_fieldno): New function.
	(internal_type_vptr_basetype): New function.
	(set_type_vptr_basetype): New function.
	(get_vptr_fieldno): Update setting of TYPE_VPTR_FIELDNO,
	TYPE_VPTR_BASETYPE.
	(allocate_cplus_struct_type): Initialize vptr_fieldno.
	(recursive_dump_type): Printing of vptr_fieldno, vptr_basetype ...
	(print_cplus_stuff): ... moved here.
	(copy_type_recursive): Don't copy TYPE_VPTR_BASETYPE.
	* gdbtypes.h (struct main_type): Members vptr_fieldno, vptr_basetype
	moved to ...
	(struct cplus_struct_type): ... here.  All uses updated.
	(TYPE_VPTR_FIELDNO, TYPE_VPTR_BASETYPE): Rewrite.
	(internal_type_vptr_fieldno, set_type_vptr_fieldno): Declare.
	(internal_type_vptr_basetype, set_type_vptr_basetype): Declare.
	* stabsread.c (read_tilde_fields): Update setting of
	TYPE_VPTR_FIELDNO, TYPE_VPTR_BASETYPE.

gdb/testsuite/ChangeLog:

	* gdb.base/maint.exp <maint print type argc>: Update expected output.
2015-01-31 21:40:57 -08:00
Doug Evans 09e2d7c720 Move TYPE_SELF_TYPE into new field type_specific.
This patch moves TYPE_SELF_TYPE into new field type_specific.self_type
for MEMBERPTR,METHODPTR types, and into type_specific.func_stuff
for METHODs, and then updates everything to use that.
TYPE_CODE_METHOD could share some things with TYPE_CODE_FUNC
(e.g. TYPE_NO_RETURN) and it seemed simplest to keep them together.

Moving TYPE_SELF_TYPE into type_specific.func_stuff for TYPE_CODE_METHOD
is also nice because when we allocate space for function types we assume
they're TYPE_CODE_FUNCs. If TYPE_CODE_METHODs don't need or use that
space then that space would be wasted, and cleaning that up would involve
more invasive changes.

In order to catch errant uses I've added accessor functions
that do some checking.

One can no longer assign to TYPE_SELF_TYPE like this:

  TYPE_SELF_TYPE (foo) = bar;

One instead has to do:

  set_type_self_type (foo, bar);

But I've left reading of the type to the macro:

  bar = TYPE_SELF_TYPE (foo);

In order to discourage bypassing the TYPE_SELF_TYPE macro
I've named the underlying function that implements it
internal_type_self_type.

While testing this I found the stabs reader leaving methods
as TYPE_CODE_FUNCs, hitting my newly added asserts.
Since the dwarf reader smashes functions to methods (via
smash_to_method) I've done a similar thing for stabs.

gdb/ChangeLog:

	* cp-valprint.c (cp_find_class_member): Rename parameter domain_p
	to self_p.
	(cp_print_class_member): Rename local domain to self_type.
	* dwarf2read.c (quirk_gcc_member_function_pointer): Rename local
	domain_type to self_type.
	(set_die_type) <need_gnat_info>: Handle
	TYPE_CODE_METHODPTR, TYPE_CODE_MEMBERPTR, TYPE_CODE_METHOD.
	* gdb-gdb.py (StructMainTypePrettyPrinter): Handle
	TYPE_SPECIFIC_SELF_TYPE.
	* gdbtypes.c (internal_type_self_type): New function.
	(set_type_self_type): New function.
	(smash_to_memberptr_type): Rename parameter domain to self_type.
	Update setting of TYPE_SELF_TYPE.
	(smash_to_methodptr_type): Update setting of TYPE_SELF_TYPE.
	(smash_to_method_type): Rename parameter domain to self_type.
	Update setting of TYPE_SELF_TYPE.
	(check_stub_method): Call smash_to_method_type.
	(recursive_dump_type): Handle TYPE_SPECIFIC_SELF_TYPE.
	(copy_type_recursive): Ditto.
	* gdbtypes.h (enum type_specific_kind): New value
	TYPE_SPECIFIC_SELF_TYPE.
	(struct main_type) <type_specific>: New member self_type.
	(struct cplus_struct_type) <fn_field.type>: Update comment.
	(TYPE_SELF_TYPE): Rewrite.
	(internal_type_self_type, set_type_self_type): Declare.
	* gnu-v3-abi.c (gnuv3_print_method_ptr): Rename local domain to
	self_type.
	(gnuv3_method_ptr_to_value): Rename local domain_type to self_type.
	* m2-typeprint.c (m2_range): Replace TYPE_SELF_TYPE with
	TYPE_TARGET_TYPE.
	* stabsread.c (read_member_functions): Mark methods with
	TYPE_CODE_METHOD, not TYPE_CODE_FUNC.  Update setting of
	TYPE_SELF_TYPE.
2015-01-31 21:21:01 -08:00
Gary Benson 276d885b57 new callback parameter expansion_notify for expand_symtabs_matching
This commit adds a new callback parameter, "expansion_notify", to the
top-level expand_symtabs_matching function and to all the vectorized
functions it defers to.  If expansion_notify is non-NULL, it will be
called every time a symbol table is expanded.

gdb/ChangeLog:

	* symfile.h (expand_symtabs_exp_notify_ftype): New typedef.
	(struct quick_symbol_functions) <expand_symtabs_matching>:
	New argument expansion_notify.  All uses updated.
	(expand_symtabs_matching): New argument expansion_notify.
	All uses updated.
	* symfile-debug.c (debug_qf_expand_symtabs_matching):
	Also print expansion notify.
	* symtab.c (expand_symtabs_matching_via_partial): Call
	expansion_notify whenever a partial symbol table is expanded.
	* dwarf2read.c (dw2_expand_symtabs_matching): Call
	expansion_notify whenever a symbol table is instantiated.
2015-01-31 14:45:26 -08:00
Doug Evans cd366ee8c6 PR symtab/17890
gdb/ChangeLog:

	PR symtab/17890
	* dwarf2read.c (dwarf_decode_line_header): Punt if version > 4.
2015-01-29 10:27:36 -08:00
Mark Wielaard 38360086ae Merge GCC producer parsers. Allow digits in identifiers.
Both dwarf2read.c (checkproducer) and utils.c (producer_is_gcc_ge_4)
implemented a GCC producer parser that tried to extract the major and minor
version of GCC. Merge them into one GCC producer parser used by both. Also
allow digits in the identifier after "GNU " such as used by GCC5 like:
"GNU C11 5.0.0 20150123 (experimental) -mtune=generic -march=x86-64 -gdwarf-5"

gdb/ChangeLog:

	* dwarf2read.c (checkproducer): Call producer_is_gcc.
	* utils.c (producer_is_gcc_ge_4): Likewise.
	(producer_is_gcc): New function.
	* utils.h (producer_is_gcc): New declaration.
2015-01-29 13:39:01 +01:00
Joel Brobecker df25ebbd09 gdb/DWARF: Support for arrays whose bound is a discriminant.
Consider the following declarations:

   type Array_Type is array (Integer range <>) of Integer;
   type Record_Type (N : Integer) is record
      A : Array_Type (1 .. N);
   end record;
   R : Record_Type := Get (10);

It defines what Ada programers call a "discriminated record", where
"N" is a component of that record called a "discriminant", and where
"A" is a component defined as an array type whose upper bound is
equal to the value of the discriminant.

So far, we rely on a number of fairly complex GNAT-specific encodings
to handle this situation. This patch is to enhance GDB to be able to
print this record in the case where the compiler has been modified
to replace those encodings by pure DWARF constructs.

In particular, the debugging information generated for the record above
looks like the following. "R" is a record..

        .uleb128 0x10   # (DIE (0x13e) DW_TAG_structure_type)
        .long   .LASF17 # DW_AT_name: "foo__record_type"

... whose is is of course dynamic (not our concern here)...

        .uleb128 0xd    # DW_AT_byte_size
        .byte   0x97    # DW_OP_push_object_address
        .byte   0x94    # DW_OP_deref_size
        .byte   0x4
        .byte   0x99    # DW_OP_call4
        .long   0x19b
        .byte   0x23    # DW_OP_plus_uconst
        .uleb128 0x7
        .byte   0x9     # DW_OP_const1s
        .byte   0xfc
        .byte   0x1a    # DW_OP_and
        .byte   0x1     # DW_AT_decl_file (foo.adb)
        .byte   0x6     # DW_AT_decl_line

... and then has 2 members, fist "n" (our discriminant);

        .uleb128 0x11   # (DIE (0x153) DW_TAG_member)
        .ascii "n\0"    # DW_AT_name
        .byte   0x1     # DW_AT_decl_file (foo.adb)
        .byte   0x6     # DW_AT_decl_line
        .long   0x194   # DW_AT_type
        .byte   0       # DW_AT_data_member_location

... and "A"...

        .uleb128 0x11   # (DIE (0x181) DW_TAG_member)
        .ascii "a\0"    # DW_AT_name
        .long   0x15d   # DW_AT_type
        .byte   0x4     # DW_AT_data_member_location

... which is an array ...

        .uleb128 0x12   # (DIE (0x15d) DW_TAG_array_type)
        .long   .LASF18 # DW_AT_name: "foo__record_type__T4b"
        .long   0x194   # DW_AT_type

... whose lower bound is implicitly 1, and the upper bound
a reference to DIE 0x153 = "N":

        .uleb128 0x13   # (DIE (0x16a) DW_TAG_subrange_type)
        .long   0x174   # DW_AT_type
        .long   0x153   # DW_AT_upper_bound

This patch enhanced GDB to understand references to other DIEs
where the DIE's address is at an offset of its enclosing type.
The difficulty was that the address used to resolve the array's
type (R's address + 4 bytes) is different from the address used
as the base to compute N's address (an offset to R's address).

We're solving this issue by using a stack of addresses rather
than a single address when trying to resolve a type. Each address
in the stack corresponds to each containing level. For instance,
if resolving the field of a struct, the stack should contain
the address of the field at the top, and then the address of
the struct.  That way, if the field makes a reference to an object
of the struct, we can retrieve the address of that struct, and
properly resolve the dynamic property references that struct.

gdb/ChangeLog:

        * gdbtypes.h (struct dynamic_prop): New PROP_ADDR_OFFSET enum
        kind.
        * gdbtypes.c (resolve_dynamic_type_internal): Replace "addr"
        parameter by "addr_stack" parameter.
        (resolve_dynamic_range): Replace "addr" parameter by
        "stack_addr" parameter.  Update function documentation.
        Update code accordingly.
        (resolve_dynamic_array, resolve_dynamic_union)
        (resolve_dynamic_struct, resolve_dynamic_type_internal): Likewise.
        (resolve_dynamic_type): Update code, following the changes made
        to resolve_dynamic_type_internal's interface.
        * dwarf2loc.h (struct property_addr_info): New.
        (dwarf2_evaluate_property): Replace "address" parameter
        by "addr_stack" parameter.  Adjust function documentation.
        (struct dwarf2_offset_baton): New.
        (struct dwarf2_property_baton): Update documentation of
        field "referenced_type" to be more general. New field
        "offset_info" in union data field.
        * dwarf2loc.c (dwarf2_evaluate_property): Replace "address"
        parameter by "addr_stack" parameter.  Adjust code accordingly.
        Add support for PROP_ADDR_OFFSET properties.
        * dwarf2read.c (attr_to_dynamic_prop): Add support for
        DW_AT_data_member_location attributes as well.  Use case
        statements instead of if/else condition.

gdb/testsuite/ChangeLog:

        * gdb.ada/disc_arr_bound: New testcase.

Tested on x86_64-linux, no regression.
2015-01-29 12:08:47 +04:00
Jan Kratochvil 527f3840e1 Fix 100x slowdown regression on DWZ files
Since Fedora started to use DWZ DWARF compressor:
	http://fedoraproject.org/wiki/Features/DwarfCompressor
GDB has slowed down a lot.  To make it clear - DWZ is DWARF structure
rearrangement, "compressor" does not mean any zlib style data compression.

This patch reduces LibreOffice backtrace from 5 minutes to 3 seconds (100x)
and it also reduces memory consumption 20x.
[ benchmark is at the bottom of this mail ]

Example of DWZ output:
------------------------------------------------------------------------------
  Compilation Unit @ offset 0xc4:
 <0><cf>: Abbrev Number: 17 (DW_TAG_partial_unit)
    <d0>   DW_AT_stmt_list   : 0x0
    <d4>   DW_AT_comp_dir    : (indirect string, offset: 0x6f): /usr/src/debug/gdb-7.7.1/build-x86_64-redhat-linux-gnu/gdb
 <1><d8>: Abbrev Number: 9 (DW_TAG_typedef)
    <d9>   DW_AT_name        : (indirect string, offset: 0x827dc): size_t
    <dd>   DW_AT_decl_file   : 4
    <de>   DW_AT_decl_line   : 212
    <df>   DW_AT_type        : <0xae>

  Compilation Unit @ offset 0xe4:
 <0><ef>: Abbrev Number: 13 (DW_TAG_partial_unit)
    <f0>   DW_AT_stmt_list   : 0x0
    <f4>   DW_AT_comp_dir    : (indirect string, offset: 0x6f): /usr/src/debug/gdb-7.7.1/build-x86_64-redhat-linux-gnu/gdb
 <1><f8>: Abbrev Number: 45 (DW_TAG_typedef)
    <f9>   DW_AT_name        : (indirect string, offset: 0x251): __off_t
    <fd>   DW_AT_decl_file   : 3
    <fe>   DW_AT_decl_line   : 131
    <ff>   DW_AT_type        : <0x68>

  Compilation Unit @ offset 0x62d9f9:
 <0><62da04>: Abbrev Number: 20 (DW_TAG_compile_unit)
[...]
    <62da12>   DW_AT_low_pc	 : 0x807e10
    <62da1a>   DW_AT_high_pc     : 134
    <62da1c>   DW_AT_stmt_list   : 0xf557e
 <1><62da20>: Abbrev Number: 7 (DW_TAG_imported_unit)
    <62da21>   DW_AT_import	 : <0xcf>	[Abbrev Number: 17]
------------------------------------------------------------------------------

One can see all DW_TAG_partial_unit have DW_AT_stmt_list 0x0 which causes
repeated decoding of that .debug_line unit on each DW_TAG_imported_unit.

This was OK before as each DW_TAG_compile_unit has its own .debug_line unit.
But since the introduction of DW_TAG_partial_unit by DWZ one should cache
read-in DW_AT_stmt_list .debug_line units.

Fortunately one does not need to cache whole
        struct linetable *symtab->linetable
and other data from .debug_line mapping PC<->lines
------------------------------------------------------------------------------
 Line Number Statements:
  Extended opcode 2: set Address to 0x45c880
  Advance Line by 25 to 26
  Copy
------------------------------------------------------------------------------
as the only part of .debug_line which GDB needs for DW_TAG_partial_unit is:
------------------------------------------------------------------------------
 The Directory Table:
  ../../gdb
  /usr/include/bits
[...]
 The File Name Table:
  Entry Dir     Time    Size    Name
  1     1	0	0	gdb.c
  2     2	0	0	string3.h
[...]
------------------------------------------------------------------------------
specifically referenced in GDB for DW_AT_decl_file at a single place:
------------------------------------------------------------------------------
              fe = &cu->line_header->file_names[file_index - 1];
              SYMBOL_SYMTAB (sym) = fe->symtab;
------------------------------------------------------------------------------

This is because for some reason DW_TAG_partial_unit never contains PC-related
DWARF information.  I do not know exactly why, the compression ratio is a bit
lower due to it but thanksfully currently it is that way:
dwz.c:
------------------------------------------------------------------------------
        /* These attributes reference code, prevent moving
           DIEs with them.  */
        case DW_AT_low_pc:
        case DW_AT_high_pc:
        case DW_AT_entry_pc:
        case DW_AT_ranges:
          die->die_ck_state = CK_BAD;
+
  /* State of checksum computation.  Not computed yet, computed and
     suitable for moving into partial units, currently being computed
     and finally determined unsuitable for moving into partial units.  */
  enum { CK_UNKNOWN, CK_KNOWN, CK_BEING_COMPUTED, CK_BAD } die_ck_state : 2;
------------------------------------------------------------------------------
I have also verified also real-world Fedora debuginfo files really comply with
that assumption with dwgrep
	https://github.com/pmachata/dwgrep
using:
------------------------------------------------------------------------------
dwgrep -e 'entry ?DW_TAG_partial_unit child* ( ?DW_AT_low_pc , ?DW_AT_high_pc , ?DW_AT_ranges )' /usr/lib/debug/**
------------------------------------------------------------------------------

BTW I think GDB already does not support the whole DW_TAG_imported_unit and
DW_TAG_partial_unit usage possibilities as specified by the DWARF standard.
I think GDB would not work if DW_TAG_imported_unit was used in some inner
level and not at the CU level (readelf -wi level <1>) - this is how DWZ is
using DW_TAG_imported_unit.  Therefore I do not think further assumptions
about DW_TAG_imported_unit and DW_TAG_partial_unit usage by DWZ are a problem
for GDB.

One could save the whole .debug_line decoded PC<->lines mapping (and not just
the DW_AT_decl_file table) but:
 * there are some problematic corner cases so one could do it incorrectly
 * there are no real world data to really test such patch extension
 * such extension could be done perfectly incrementally on top of this patch

------------------------------------------------------------------------------

benchmark - on Fedora 20 x86_64 and FSF GDB HEAD:
echo -e 'thread apply all bt\nset confirm no\nq'|./gdb -p `pidof soffice.bin` -ex 'set pagination off' -ex 'maintenance set per-command
space' -ex 'maintenance set per-command symtab' -ex 'maintenance set per-command time'

FSF GDB HEAD ("thread apply all bt"):
Command execution time: 333.693000 (cpu), 335.587539 (wall)
                                          ---sec
Space used: 1736404992 (+1477189632 for this command)
                         ----MB
vs.
THIS PATCH ("thread apply all bt"):
Command execution time: 2.595000 (cpu), 2.607573 (wall)
                                        -sec
Space used: 340058112 (+85917696 for this command)
                        --MB

FSF GDB HEAD ("thread apply all bt full"):
Command execution time: 466.751000 (cpu), 468.345837 (wall)
                                          ---sec
Space used: 2330132480 (+2070974464 for this command)
                         ----MB
vs.
THIS PATCH ("thread apply all bt full"):
Command execution time: 18.907000 (cpu), 18.964125 (wall)
                                         --sec
Space used: 364462080 (+110325760 for this command)
                        ---MB

------------------------------------------------------------------------------

gdb/ChangeLog
2015-01-24  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix 100x slowdown regression on DWZ files.
	* dwarf2read.c (struct dwarf2_per_objfile): Add line_header_hash.
	(struct line_header): Add offset and offset_in_dwz.
	(dwarf_decode_lines): Add parameter decode_mapping to the declaration.
	(free_line_header_voidp): New declaration.
	(line_header_hash, line_header_hash_voidp, line_header_eq_voidp): New
	functions.
	(dwarf2_build_include_psymtabs): Update dwarf_decode_lines caller.
	(handle_DW_AT_stmt_list): Use line_header_hash.
	(free_line_header_voidp): New function.
	(dwarf_decode_line_header): Initialize offset and offset_in_dwz.
	(dwarf_decode_lines): New parameter decode_mapping, use it.
	(dwarf2_free_objfile): Free line_header_hash.
2015-01-24 15:44:52 +01:00
Mark Wielaard 743649fd80 Use GCC5/DWARF5 DW_AT_noreturn to mark functions that don't return normally.
Add a flag field is_noreturn to struct func_type. Make calling_convention
a small bit field to not increase the size of the struct. Set is_noreturn
if the new GCC5/DWARF5 DW_AT_noreturn is set on a DW_TAG_subprogram.
Use this information to warn the user before doing a finish or return from
a function that does not return normally to its caller.

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

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

gdb/ChangeLog

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

gdb/testsuite/ChangeLog

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

include/ChangeLog

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

The dwarf2.h addition and the code to emit the new attribute is already in
the gcc tree.
2015-01-23 17:29:19 +01:00
Doug Evans 005e54bb79 dwarf2read.c (compute_delayed_physnames): Use TYPE_FN_FIELD_PHYSNAME.
gdb/ChangeLog:

	* dwarf2read.c (compute_delayed_physnames): Use TYPE_FN_FIELD_PHYSNAME.
2015-01-11 16:39:46 -08:00