Commit Graph

411 Commits

Author SHA1 Message Date
Jan Kratochvil 60531b2469 gdb/
* dwarf2read.c (read_namespace_type): Use common "return set_die_type"
	code form.
2010-04-02 15:21:47 +00:00
Jan Kratochvil 8072405bd6 gdb/
Fix crash on reading wrong function declaration DWARF.
	* dwarf2read.c (read_subroutine_type): New variable void_type.
	Pre-fill all TYPE_FIELD_TYPEs.  Move nparams and iparams initialization
	more close to their use.

gdb/testsuite/
	* gdb.dwarf2/dw2-bad-parameter-type.exp,
	gdb.dwarf2/dw2-bad-parameter-type.S: New.
2010-03-31 18:13:38 +00:00
Ulrich Weigand 4a811a977f * dwarf2read.c (read_func_scope): Also scan specification DIEs
for DW_TAG_imported_module children.
2010-03-26 18:55:30 +00:00
Ulrich Weigand 907af001f7 ChangeLog:
* dwarf2read.c (dwarf2_name): Work around GCC bugzilla debug/41828 by
	ignoring spurious DW_AT_name attributes for unnamed structs or unions.
	* completer.c (add_struct_fields): Fix inverted logic.

testsuite/ChangeLog:

	* gdb.cp/inherit.exp (test_ptype_si): XFAIL test for GCC versions
	that do not provide the tagless_struct type name at all.
	(test_print_anon_union): Do not check value of uninitialized
	union member.  Do not use cp_test_ptype_class, so we can accept
	"long" as well as "long int".
2010-03-26 18:05:46 +00:00
Keith Seitz 418835ccec * dwarf2read.c (read_subroutine_type): If the compilation unit
language is Java, mark any formal parameter named "this" as
  artificial (GCC/43521).
  (dwarf2_name): Add special handling for Java constructors.
2010-03-25 22:13:15 +00:00
Daniel Jacobowitz a6c727b2f1 * dwarf2-frame.c (dwarf2_frame_find_quirks): Use producer_is_realview.
* dwarf2read.c (load_full_comp_unit): Read DW_AT_producer.
	(read_structure_type): For RealView, set TYPE_STUB on structures with
	no byte size and no children.
	(read_subroutine_type): Mark functions as prototyped by default.
	* symtab.c (producer_is_realview): New function.
	* symtab.h (expand_line_sal): Fix declaration formatting.
	(producer_is_realview): Declare.

	testsuite/
	* gdb.base/callfuncs.exp (do_function_calls): Add XFAILs for RealView.
	* gdb.base/ptype.exp (ptype_maybe_prototyped): Add overprototyped
	argument.  Handle "short" and "long".
	(Top level): Pass overprototyped output for old_fptr and xptr.
2010-03-24 21:06:33 +00:00
Ulrich Weigand acebe513da * dwarf2read.c (partial_die_parent_scope): Work around buggy
GCC 4.1 debug info generation (GCC PR c++/28460).
	(determine_prefix): Likewise.
2010-03-22 13:21:39 +00:00
Joel Brobecker e8d054800a [dwarf] Anonymous nested function causes SEGV during psymbol read
According to the DWARF3 standard, a function always has a name attribute
(Section 3.3 - Subroutine and Entry Point Entries).  The only exception
is when a DW_AT_abstract_origin attribute is provided, in which case
the name may be inherited from the referenced DIE.

The problem occured because our compiler generated a subprogram DIE
for a nested function where the name attribute was missing (and no
abstract-origin either).  Our code in add_partial_symbol is not
prepared to deal with the situation, and happily just tries  to compute
the length of the (NULL) function name.

This normally cannot happen, because there is already a guard in
scan_partial_symbols, where we (silently!) ignore anonymous dies,
including anonymous subprograms. Unfortunately, there is a flaw that
affects Ada and other languages that allow nested subprograms. For
nested subprograms, we do not go through scan_partial_symbols and
thus we are missing the name check.

This patch adds the name check in the nested subprogram case. It also
adds a complaint which is emitted during the psymtab->symtab conversion
phase.

gdb/ChangeLog:

        * dwarf2read.c (add_partial_subprogram): Make sure the subprogram
        DIE has a name before creating the associated partial symbol.
        (read_func_scope): Emit a complaint if the subprogram does not
        have a name or when we can't extract the subprogram PC bounds.

gdb/testsuite/ChangeLog:

        * gdb.dwarf2/dw2-anonymous-func.S: New file.
        * gdb.dwarf2/dw2-anonymous-func.exp: New testcase.

Tested on x86_64-linux, no regression.  Note that the testcase also
verifies that the psymtab->symtab conversion does not crash (this is
the purpose of the "list file1.txt:1" test.
2010-03-18 18:35:55 +00:00
Tom Tromey a3b2a86bb7 * dwarf2read.c (dwarf2_get_section_info): Handle case where no
DWARF data is available.
2010-03-17 19:16:02 +00:00
Jan Kratochvil bbb0eef699 gdb/
* dwarf2read.c (read_subrange_type): Set TYPE_HIGH_BOUND_UNDEFINED.
	* valarith.c (value_subscripted_rvalue): Suppress error if
	TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED.
2010-03-16 20:51:23 +00:00
Tom Tromey 1054b214e2 * dwarf2read.c (die_needs_namespace): Also return 0 for
DW_TAG_subprogram.
2010-03-15 20:49:53 +00:00
Sami Wagiaalla 13387711b2 2010-03-15 Sami Wagiaalla <swagiaal@redhat.com>
PR c++/7936:
        * cp-support.h: Added char *declaration element to using_direct
        data struct.
        (cp_add_using): Added char *declaration argument.
        (cp_add_using_directive): Ditto.
        (cp_lookup_symbol_imports): made extern.
        * cp-namespace.c: Updated with the above changes.
        * dwarf2read.c (read_import_statement): Ditto.
        (read_namespace): Ditto.
        (read_import_statement): Support import declarations.
        * cp-namespace.c (cp_lookup_symbol_imports): Check for imported
        declarations.
        Added support for 'declaration_only' search.
        (cp_lookup_symbol_namespace): Attempt to search for the name as
        is before consideration of imports.
        * symtab.c (lookup_symbol_aux_local): Added a 'declaration_only'
        search at every block level search.
        Now takes language argument.
        (lookup_symbol_aux): Updated.

    2010-03-15  Sami Wagiaalla  <swagiaal@redhat.com>

        * gdb.cp/shadow.exp: Removed kfail; test has been fix.
        * gdb.cp/nsusing.exp: Ditto.
2010-03-15 17:29:36 +00:00
Tom Tromey 1c809c6883 gdb
PR c++/9708:
	* dwarf2read.c (die_needs_namespace) <DW_TAG_variable>: A variable
	in a lexical block does not need a namespace.
	(new_symbol) <DW_TAG_variable>: Put extern variables on
	list_in_scope in all cases.
gdb/testsuite
	PR c++/9708:
	* gdb.cp/m-static.exp: Add regression test.
	* gdb.cp/m-static.cc (method): New method.
	(main): Call it.
2010-03-13 00:27:12 +00:00
Tom Tromey d146bf1edc * dwarf2read.c (struct pubnames_header): Remove.
(_PUBNAMES_HEADER): Remove.
	(_ACTUAL_PUBNAMES_HEADER_SIZE): Remove.
	(struct aranges_header): Remove.
	(_ARANGES_HEADER, _ACTUAL_ARANGES_HEADER_SIZE): Remove.
	(struct dwarf2_per_objfile) <pubnames, aranges>: Remove.
	(PUBNAMES_SECTION): Remove.
	(ARANGES_SECTION): Remove.
	(dwarf2_locate_sections): Don't handle pubnames or aranges.
	(dwarf2_build_psymtabs): Remove dead code.
	(dwarf2_build_psymtabs_easy): Remove.
2010-03-10 18:41:37 +00:00
Tom Tromey be391dcafc * elfread.c (elf_symfile_read): Don't call
dwarf2_build_frame_info.
	* dwarf2read.c (struct dwarf2_section_info) <readin>: New field.
	(struct dwarf2_per_objfile) <objfile>: New field.
	(dwarf2_has_info): Now idempotent.  Set objfile field.
	(dwarf2_read_section): Check and set readin field.  Call
	posix_madvise.
	(dwarf2_build_psymtabs): Don't read all sections.
	(read_type_comp_unit_head): Read types section.
	(create_debug_types_hash_table): Likewise.
	(init_cu_die_reader): Add asserts.
	(process_type_comp_unit): Add assert.
	(dwarf2_build_psymtabs_hard): Read info section.
	(load_partial_comp_unit): Add assert.
	(create_all_comp_units): Read info section.
	(load_full_comp_unit): Likewise.
	(dwarf2_ranges_read): Read ranges section.
	(dwarf2_record_block_ranges): Add assert.
	(dwarf2_read_abbrevs): Read abbrev section.
	(read_indirect_string): Read str section.
	(dwarf_decode_line_header): Read line section.
	(read_signatured_type_at_offset): Read types section.
	(dwarf_decode_macros): Read macinfo section.
	(dwarf2_symbol_mark_computed): Read loc section.
	* dwarf2-frame.c (dwarf2_frame_find_fde): Call
	dwarf2_build_frame_info.
	(dwarf2_build_frame_info): Unconditionally set
	dwarf2_frame_objfile_data on the objfile.
	* configure.ac: Check for posix_madvise.
	* config.in, configure: Rebuild.
2010-03-10 18:37:24 +00:00
Tom Tromey e38df1d074 * xcoffread.c (xcoff_start_psymtab): Update.
(xcoff_end_psymtab): Update.
	* psymtab.c (allocate_psymtab): Remove dead code.
	* psympriv.h (struct partial_symtab) <read_symtab_private>: Now
	void*.
	* mdebugread.c (parse_partial_symbols): Update.
	(new_psymtab): Likewise.
	* dwarf2read.c (process_psymtab_comp_unit): Update.
	(psymtab_to_symtab_1): Update.
	* dbxread.c (start_psymtab): Update.
	(end_psymtab): Likewise.
2010-03-10 18:27:00 +00:00
Tom Tromey ccefe4c44c gdb
* xcoffread.c: Include psymtab.h.
	(xcoff_sym_fns): Update.
	* symtab.h (struct partial_symbol): Remove.
	(PSYMBOL_DOMAIN, PSYMBOL_CLASS): Remove.
	(struct partial_symtab): Remove.
	(PSYMTAB_TO_SYMTAB): Remove.
	(lookup_partial_symbol, lookup_partial_symtab, find_pc_psymtab)
	(find_pc_sect_psymtab): Remove.
	(find_pc_sect_symtab_via_partial): Declare.
	(find_pc_psymtab, find_pc_sect_psymbol, psymtab_to_symtab)
	(find_main_psymtab): Remove.
	(find_main_filename): Declare.
	(fixup_psymbol_section): Remove.
	(fixup_section): Declare.
	* symtab.c: Include psymtab.h.
	(lookup_symtab): Use lookup_symtab method.
	(lookup_partial_symtab): Remove.
	(find_pc_sect_psymtab_closer): Remove.
	(find_pc_sect_psymtab): Remove.
	(find_pc_sect_symtab_via_partial): New function.
	(find_pc_psymtab, find_pc_sect_psymbol, find_pc_psymbol): Remove.
	(fixup_section): No longer static.
	(fixup_psymbol_section): Remove.
	(lookup_symbol_aux): Use lookup_symbol_aux_quick.
	(lookup_global_symbol_from_objfile): Likewise.
	(lookup_symbol_aux_psymtabs): Remove.
	(lookup_symbol_aux_quick): New function.
	(lookup_symbol_global): Use lookup_symbol_aux_quick.
	(lookup_partial_symbol): Remove.
	(basic_lookup_transparent_type_quick): New function.
	(basic_lookup_transparent_type): Use it.
	(find_main_psymtab): Remove.
	(find_main_filename): New function.
	(find_pc_sect_symtab): Use find_pc_sect_symtab method.
	(find_line_symtab): Use expand_symtabs_with_filename method.
	(output_partial_symbol_filename): New function.
	(sources_info): Use map_partial_symbol_filenames.
	(struct search_symbols_data): New type.
	(search_symbols_file_matches): New function.
	(search_symbols_name_matches): Likewise.
	(search_symbols): Use expand_symtabs_matching method.
	(struct add_name_data): Rename from add_macro_name_data.
	(add_macro_name): Update.
	(add_partial_symbol_name): New function.
	(default_make_symbol_completion_list): Use
	map_partial_symbol_names.
	(struct add_partial_symbol_name): New type.
	(maybe_add_partial_symtab_filename): New function.
	(make_source_files_completion_list): Use
	map_partial_symbol_filenames.
	(expand_line_sal): Use expand_symtabs_with_filename method.
	* symmisc.c: Include psymtab.h.
	(print_objfile_statistics): Use print_stats method.
	(dump_objfile): Use dump method.
	(dump_psymtab, maintenance_print_psymbols)
	(maintenance_info_psymtabs, maintenance_check_symtabs)
	(extend_psymbol_list): Remove.
	* symfile.h (struct quick_symbol_functions): New struct.
	(struct sym_fns) <qf>: New field.
	(sort_pst_symbols): Remove.
	(increment_reading_symtab): Declare.
	* symfile.c: Include psymtab.h.
	(compare_psymbols, sort_pst_symbols): Remove.
	(psymtab_to_symtab): Remove.
	(increment_reading_symtab): New function.
	(symbol_file_add_with_addrs_or_offsets): Use expand_all_symtabs
	method.
	(set_initial_language): Use find_main_filename.
	(allocate_psymtab, discard_psymtab, cashier_psymtab): Remove.
	(free_named_symtabs): Remove unused code.
	(start_psymtab_common, add_psymbol_to_bcache)
	(append_psymbol_to_list, add_psymbol_to_list, init_psymbol_list):
	Remove.
	* stack.c: Include psymtab.h, symfile.h.
	(backtrace_command_1): Use find_pc_sect_symtab_via_partial.
	* source.h (psymtab_to_fullname): Don't declare.
	* source.c: Include psymtab.h.
	(select_source_symtab): Use find_last_source_symtab method.
	(forget_cached_source_info): Use forget_cached_source_info
	method.
	(find_and_open_source): No longer static.
	(psymtab_to_fullname): Remove.
	* somread.c: Include psymtab.h.
	(som_sym_fns): Update.
	* psympriv.h: New file.
	* psymtab.h: New file.
	* psymtab.c: New file.
	* objfiles.h: (ALL_OBJFILE_PSYMTABS): Remove.
	(ALL_PSYMTABS, ALL_PSPACE_PSYMTABS): Likewise.
	* objfiles.c: Include psymtab.h.
	(objfile_relocate1): Use relocate method.
	(objfile_has_partial_symbols): Use has_symbols method.
	* mipsread.c: Include psymtab.h.
	(ecoff_sym_fns): Update.
	* mi/mi-cmd-file.c: Include psymtab.h.
	(print_partial_file_name): New function.
	(mi_cmd_file_list_exec_source_files): Use
	map_partial_symbol_filenames.
	* mdebugread.c: Include psympriv.h.
	* machoread.c: Include psympriv.h.
	(macho_sym_fns): Update.
	* m2-exp.y (yylex): Use lookup_symtab.
	* elfread.c: Include psympriv.h.
	(elf_sym_fns): Update.
	* dwarf2read.c: Include psympriv.h.
	* dbxread.c: Include psympriv.h.
	(aout_sym_fns): Update.
	* cp-support.c: Include psymtab.h.
	(read_in_psymtabs): Remove.
	(make_symbol_overload_list_qualified): Use
	expand_symtabs_for_function method.
	* coffread.c: Include psympriv.h.
	(coff_sym_fns): Update.
	* blockframe.c: Include psymtab.h.
	(find_pc_partial_function): Use find_pc_sect_symtab method.
	* ada-lang.h (ada_update_initial_language): Update.
	* ada-lang.c: Include psymtab.h.
	(ada_update_initial_language): Remove 'main_pst' argument.
	(ada_lookup_partial_symbol): Remove.
	(struct ada_psym_data): New type.
	(ada_add_psyms): New function.
	(ada_add_non_local_symbols): Use map_ada_symtabs method.
	(struct add_partial_datum): New type.
	(ada_add_partial_symbol_completions): New function.
	(ada_make_symbol_completion_list): Use map_partial_symbol_names.
	(ada_exception_support_info_sniffer): Update.
	* Makefile.in (SFILES): Add psymtab.c.
	(COMMON_OBS): Add psymtab.o.
	(HFILES_NO_SRCDIR): Add psymtab.h, psympriv.h.
gdb/doc
	* gdbint.texinfo (Symbol Handling): Update.
2010-03-10 18:20:08 +00:00
Sami Wagiaalla c0cc3a7670 2010-03-09 Sami Wagiaalla <swagiaal@redhat.com>
PR C++/11236:
	* cp-namespace.c (cp_add_using): Deleted.
	(cp_add_using_directive): Use obstack allocations.
	Merged the function cp_add_using into this one.
	Added 'struct obstack *' argument.
	(cp_scan_for_anonymous_namespaces): Updated.
	* cp-support.h: Updated.
	* dwarf2read.c (read_import_statement): Updated.
	(read_namespace): Updated.
2010-03-10 16:22:29 +00:00
Joel Brobecker af6b7be16a Adjust handling of Ada DIEs after dwarf2_physname patch.
* dwarf2read.c (dwarf2_compute_name): Add handling of Ada DIEs.
2010-03-10 08:08:46 +00:00
Keith Seitz 94af9270db dwarf2_physname patchset:
Based on work from Daniel Jacobowitz  <dan@codesourcery.com>
	* c-typeprint.c (cp_type_print_method_args): For non-static methods,
	print out const or volatile qualifiers, too.
	(c_type_print_args): Add parameters show_artificial and language.
	Skip artificial parameters when requested.
	Use the appropriate language printer.
	(c_type_print_varspec): Tell c_type_print_args to skip artificial
	parameters and pass language_c.
	* dwarf2read.c (die_list): New file global.
	(struct partial_die_info): Update comments for name field.
	(pdi_needs_namespace): Renamed to ...
	(die_needs_namespace): ... this. Rewrite.
	(dwarf2_linkage_name): Remove.
	(add_partial_symbol): Do not predicate the call to
	partial_die_full_name based on pdi_needs_namespace.
	Remove call to cp_check_possible_namespace_symbols and associated
	outdated comments.
	(guess_structure_name): Do not inspect child subprogram DIEs.
	(dwarf2_fullname): Update comments.
	Use die_needs_namespace to assist in computing the name.
	(read_func_scope): Use dwarf2_name to get the DIE's name.
	Use dwarf2_physname to get the "linkage name" of the DIE.
	(dwarf2_add_member_field): Use dwarf2_physname instead of
	dwarf2_linkage_name.
	(read_structure_type): For structs and classes, set TYPE_NAME, too.
	(determine_class): Remove.
	(read_partial_die): Ignore DW_AT_MIPS_linkage_name for all languages
	except Ada.
	(new_symbol): Unconditionally call dwarf2_name.
	Compute the "linkage name" using dwarf2_physname.
	Use dwarf2_name instead of dwarf2_full_name for enumerator DIEs.
	When determining to scan for anonymous C++ namespaces, ignore
	the linkage name.
	(dwarf2_physname): New function.
	(dwarf2_full_name): Move content to new function and call
	that.
	(dwarf2_compute_name): "New" function.
	(_initialize_dwarf2_read): Initialize die_list.
	* gnu-v3-eabi.c (gnu_v3_find_method_in): Remove unused variable
	physname.
	(gnu_v3_print_method_ptr): Use the physname for virtual methods
	without a demangled name.
	Print out type information for non-virtual methods.
        * linespec.c (decode_line_1): Force ANY string using "::" (or
	"." for java) to use decode_compound, and clean up any stray quoting.
        If we found a file symtab, re-evaluate whether the remainder is_quoted.
        (decode_compound): Stop consuming at an open parenthesis.
        Keep template parameters.
        Keep any overload information.
        Keep keywords like "const".
        Remove paren_pointer.
        Move is_quoted check from set_flags to here.
        Remove #if 0 code from 2000. Ten years is long enough.
        (find_method): Before comparing symbol names, canonicalize the string
        from the user.
        If a specific overload is requested, find it. Otherwise throw an error.
	(find_method_overload_end): New function.
	(set_flags): Remove.
        (decode_compound): Assume that parentheses are matched.
        It's a lot easier.
	* symtab.c (symbol_find_demangled_name): Add DMGL_VERBOSE flag
	to cplus_demangle.
	* linespec.c (decode_line_1): Keep important keywords like
	"const" and "volatile".
	* symtab.h (SYMBOL_CPLUS_DEMANGLED_NAME): Remove.
	* typeprint.h (c_type_print_args): Add declaration.
	* ui-file.c (do_ui_file_obsavestring): New function.
	(ui_file_obsavestring): New function.
	* ui-file.h (ui_file_obsavestring): Add declaration.
	* valops.c (find_overload_match): Resolve the object to
	a non-pointer type.
	If the object is a data member, search the object for the member
	and return with staticp set.
	Use SYMBOL_NATURAL_NAME instead of SYMBOL_CPLUS_DEMANGLED_NAME.
	Do not attempt to extract a function name from non-function types.
	If the extracted function name and the original name are the same,
	we don't have a C++ method.

	From Jan Kratochvil  <jan.kratochvil@redhat.com>:
    	* dwarf2read.c (new_symbol <DW_TAG_enumerator>): Call dwarf2_full_name.

	* ada-lang.c (ada_lookup_symbol): Remove linkage_name parameters
	and arguments from symbol lookups.
	* ax-gdb.c (gen_expr): Likewise.
	* cp-namespace.c (cp_lookup_symbol_nonlocal, lookup_namespace_scope,
	cp_lookup_symbol_namespace, lookup_symbol_file, lookup_nested_type,
	lookup_possible_namespace_symbol): Likewise.
	* cp-support.c (read_in_psymtabs): Likewise.
	* cp-support.h (cp_lookup_symbol_nonlocal): Likewise.
	* language.h (la_lookup_symbol_nonlocal): Likewise.
	* scm-valprint.c (scm_inferior_print): Likewise.
	* solib-darwin.c (darwin_relocate_section_addresses): Likewise.
	* solib-svr.c (elf_lookup_lib): Likewise.
	* solib.c (show_auto_solib_add): Likewise.
	* solist.h (lookup_lib_global, solib_global_lookup): Likewise.
	* symmisc.c (maintenance_check_symtabs): Likewise.
	* symtab.c (lookup_symbol_in_language, lookup_symbol_aux,
	lookup_symbol_aux_local, lookup_symbol_aux_block,
	lookup_symbol_from_objfile, lookup_symbol_aux_symtabs,
	lookup_symbol_aux_psymtabs,basic_lookup_symbol_nonlocal,
	lookup_symbol_static, lookup_symbol_global, symbol_matches_domain,
	basic_lookup_transparent_type, find_main_psymtab,
	lookup_block_symbol): Likewise.
	* symtab.h (basic_lookp_symbol_nonlocal, lookup_symbol_static,
	lookup_symbol_global, lookup_symbol_aux_block,
	lookup_symbol_partial_symbol, lookup_block_symbol,
	lookup_global_symbol, value_maybe_namespace_elt): Likewise.
2010-03-09 18:09:08 +00:00
Tom Tromey ae41149729 * dwarf2read.c (skip_one_die) <DW_FORM_ref_addr>: Use offset size
in DWARF 3 and later.
	(read_attribute_value) <DW_FORM_ref_addr>: Likewise.
2010-03-04 22:01:10 +00:00
Doug Evans 01637564ba * dwarf2read.c (add_partial_subprogram): Add missing baseaddr to
lowpc,highpc args to addrmap_set_empty.
2010-03-02 17:19:58 +00:00
Tom Tromey a9854bd511 * dwarf2read.c (guess_structure_name): Allocate name on the
objfile obstack.
2010-02-15 20:48:57 +00:00
Sami Wagiaalla 8285698016 2010-02-05 Sami Wagiaalla <swagiaal@redhat.com>
PR c++/7935:
	* gdb.cp/namespace-using.exp: Removed kfail; bug has been fixed.

2010-02-05  Sami Wagiaalla  <swagiaal@redhat.com>

	PR c++/7935:
	* cp-support.h: Added char* alias element to using_direct data
	struct.
	(cp_add_using): Added char* alias argument.
	(cp_add_using_directive): Ditto.
	* cp-namespace.c: Updated with the above changes.
	(cp_lookup_symbol_imports): Check for aliases.
	* dwarf2read.c (read_import_statement): Figure out local alias
	for the import and pass it on to cp_add_using.
	(read_namespace): Pass alias argument to cp_add_using.
2010-02-05 19:03:42 +00:00
Tristan Gingold ac8035ab9e 2010-02-03 Tristan Gingold <gingold@adacore.com>
* symfile.h (struct sym_fns): Add sym_relocate field.
	(default_symfile_relocate): New prototype.
	(symfile_relocate_debug_section): First argument is now an objfile.
	* symfile.c (default_symfile_relocate): Rename from
	symfile_relocate_debug_section, first argument is now an objfile.
	(symfile_relocate_debug_section): New function.
	* coffread.c (coff_sym_fns): Set sym_relocate field.
	* somread.c (som_sym_fns): Ditto.
	* mipsread.c (ecoff_sym_fns): Ditto.
	* machoread.c (macho_sym_fns): Ditto.
	* elfread.c (elf_sym_fns): Ditto.
	* dwarf2read.c (dwarf2_read_section): Ditto.
	* xcoffread.c (xcoff_sym_fns): Ditto.
	* dbxread.c (aout_sym_fns): Ditto.
	(dbx_psymtab_to_symtab): Adjust call to symfile_relocate_debug_section.
	(elfstab_build_psymtabs): Ditto.
2010-02-03 14:13:16 +00:00
Tom Tromey 0cc2414c91 gdb
* m2-typeprint.c (m2_record_fields): Don't use
	TYPE_DECLARED_TYPE.
	* gdbtypes.h (TYPE_DECLARED_CLASS): New macro.
	(struct main_type) <flag_declared_class>: New field.
	(struct cplus_struct_type) <declared_type>: Remove.
	<ntemplate_args>: Move earlier.
	(DECLARED_TYPE_CLASS, DECLARED_TYPE_UNION, DECLARED_TYPE_STRUCT)
	(DECLARED_TYPE_TEMPLATE): Remove.
	(TYPE_DECLARED_TYPE): Remove.
	* gdbtypes.c (lookup_union): Don't use TYPE_DECLARED_TYPE.
	* dwarf2read.c (read_structure_type): Set TYPE_DECLARED_CLASS.
	* c-typeprint.c (c_type_print_base): Use TYPE_DECLARED_CLASS, not
	TYPE_DECLARED_TYPE.
gdb/testsuite
	* gdb.dwarf2/member-ptr-forwardref.exp: Update expected result for
	type-printing change.
2010-02-02 16:47:14 +00:00
Sami Wagiaalla 8540c487c6 2010-01-26 Sami Wagiaalla <swagiaal@redhat.com>
* gdb.cp/namespace-using.exp: Add test for printing of namespaces
	imported into file scope.
	Marked test as xfail.
	* gdb.cp/namespace-using.cc (marker5): New function.
	* gdb.cp/shadow.exp: New test.
	* gdb.cp/shadow.cc: New test program.
	* gdb.cp/nsimport.exp: New test.
	* gdb.cp/nsimport.cc: New test program.

2010-01-26  Sami Wagiaalla  <swagiaal@redhat.com>

	PR gdb/10929:
	* dwarf2read.c (read_lexical_block_scope): Create blocks for
	scopes which contain using directives even if they contain no
	declarations.
	* symtab.c (lookup_symbol_aux): Pass lowest level block to
	la_lookup_symbol_nonlocal.
	* cp-namespace.c (cp_lookup_symbol_nonlocal): call
	cp_lookup_symbol_namespace.
	(cp_lookup_symbol_namespace): Perform an import lookup at every
	block level.
	(cp_lookup_symbol_imports): New function.
	(cp_lookup_symbol_in_namespace): New function.
2010-01-26 15:48:25 +00:00
Tom Tromey 0b92b5bb46 gdb
PR symtab/11199:
	* dwarf2read.c (quirk_gcc_member_function_pointer): Change return
	type and arguments.  Use smash_to_methodptr_type.
	(read_structure_type): Call quirk_gcc_member_function_pointer
	later.
	* gdbtypes.h (smash_to_methodptr_type): Declare.
	* gdbtypes.c (smash_to_methodptr_type): New function.
	(lookup_methodptr_type): Use it.
gdb/testsuite
2010-01-22  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR symtab/11199:
	* gdb.dwarf2/member-ptr-forwardref.exp,
	gdb.dwarf2/member-ptr-forwardref.S: New.
2010-01-22 17:06:49 +00:00
Tom Tromey 95519e0ee9 PR c++/11026:
* dwarf2read.c (read_partial_die): Allocate partial DIE's name on
	objfile obstack.
2010-01-20 02:05:03 +00:00
Tom Tromey ceeb3d5ab6 gdb
PR c++/8000:
	* dwarf2read.c (partial_die_parent_scope): Put enumeration type
	into parent scope, and enumerator into grandparent scope.
gdb/testsuite
	PR c++/8000:
	* gdb.cp/namespace.exp: Use new enum.  Fix line numbers in
	existing tests.
	* gdb.cp/namespace.cc (AAA::SomeEnum): New enum.
	(main): Use AAA::SomeEnum.
2010-01-19 18:11:19 +00:00
Joel Brobecker b74845da58 Delete free_named_symtabs and associated cleanup.
* symfile.h (free_named_symtabs): Delete declaration.
        * symfile.c: Remove some commented out code (clear_symtab_users_once).
        (cashier_psymtab): Comment function out.
        Delete declaration.
        (free_named_symtabs): Delete.
        * coffread.c (coff_end_symtab): Remove call to free_named_symtabs.
        * dbxread.c (end_psymtab): Likewise.
        * dwarf2read.c (process_psymtab_comp_unit): Ditto.
        * exec.c (exec_close_1): Ditto.
        * xcoffread.c (xcoff_end_psymtab): Likewise.
2010-01-19 09:47:47 +00:00
Joel Brobecker b4ba55a181 gdb/ChangeLog:
Add support for DW_AT_GNAT_descriptive_type.
        * gdbtypes.h (enum type_specific_kind): New enum.
        (struct main_type) [type_specific_field]: New component.
        [type_specific]: Add new component "gnat_stuff".
        (struct gnat_aux_type): New type.
        (INIT_CPLUS_SPECIFIC): Also set TYPE_SPECIFIC_FIELD (type).
        (HAVE_CPLUS_STRUCT): Also check TYPE_SPECIFIC_FIELD (type).
        (gnat_aux_default, allocate_gnat_aux_type): Add declaration.
        (INIT_GNAT_SPECIFIC, ALLOCATE_GNAT_AUX_TYPE, HAVE_GNAT_AUX_INFO)
        (TYPE_SPECIFIC_FIELD): New macros.
        (TYPE_CPLUS_SPECIFIC): Return cplus_struct_default if the given
        type does not hold any cplus-specific data.
        (TYPE_RAW_CPLUS_SPECIFIC): New macro.
        (TYPE_GNAT_SPECIFIC, TYPE_DESCRIPTIVE_TYPE): New macros.
        (TYPE_IS_OPAQUE): Use HAVE_CPLUS_STRUCT to check if type has
        cplus-specific data.
        * gdbtypes.c (allocate_cplus_struct_type): Minor stylistic rewrite.
        Set new component TYPE_SPECIFIC_FIELD (type).
        (gnat_aux_default): New constant.
        (allocate_gnat_aux_type): New function.
        (init_type): Add initialization the type-specific stuff for
        TYPE_CODE_FLT and TYPE_CODE_FUNC types.
        (print_gnat_stuff): New function.
        (recursive_dump_type): Use HAVE_CPLUS_STRUCT to check for cplus-
        specific data.  Adjust code that prints the contents of the
        type-specific union using the TYPE_SPECIFIC_FIELD value.
        * dwarf2read.c (dwarf2_attach_fields_to_type): Do not allocate
        the type cplus stuff for Ada types.
        (dwarf2_add_member_fn, dwarf2_attach_fn_fields_to_type):
        Error out if these routines are called with an Ada type.
        (read_structure_type, read_array_type, read_subrange_type):
        Add call to set_descriptive_type.
        (set_die_type): Initialize the gnat-specific data if necessary.
        (need_gnat_info, die_descriptive_type, set_descriptive_type):
        New functions.
        * ada-lang.c (decode_constrained_packed_array_type): Use
        decode_constrained_packed_array_type instead of doing a standard
        lookup to locate a parallel type.
        (find_parallel_type_by_descriptive_type): New function.
        (ada_find_parallel_type_with_name): New function.
        (ada_find_parallel_type): Reimplement using
        ada_find_parallel_type_with_name.
        * ada-valprint.c (print_field_values): Use HAVE_CPLUS_STRUCT
        to check if type has a cplus stuff.
        * linespec.c (total_number_of_methods): Likewise.
        * mdebugread.c (new_type): Likewise.

gdb/testsuite/ChangeLog:

        * gdb.base/maint.exp: Adjust the expected output for the
        "maint print type" test. Use gdb_test_multiple instead of
        gdb_sent/gdb_expect.
2010-01-12 05:49:00 +00:00
Joel Brobecker 4c38e0a4fc Update copyright year in most headers.
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Daniel Jacobowitz 0fe7935b33 * NEWS: Document "info variables" change.
* dwarf2read.c (new_symbol): Add file-scope external unresolved
	symbols to global_symbols.
	* symtab.c (search_symbols): Skip LOC_UNRESOLVED symbols.

	doc/
	* gdb.texinfo (Symbols): "info variables" prints definitions, not
	declarations.
2009-12-28 21:29:53 +00:00
Gaius Mulley 76c10ea2bb * dwarf2read.c (read_subroutine_type): Add the subroutine type to the
die immediately to allow a parameter type to be the same subroutine type.
2009-12-16 15:09:43 +00:00
Paul N. Hilfinger 43bbcdc2bc * dwarf2read.c (struct attribute): Increase sizes of unsnd and snd
fields to allow larger integer sizes.
(read_subrange_type): Increase size of bound values.
Add logic to determine signedness based on base-type size, signedness.
(read_attribute_value): Change format for bad byte size in message.
(read_8_bytes): Increase size of result type.
(dump_die_shallow): Change format for value.
(dwarf2_get_attr_constant_value): Increase size of return type.
Correct comment.
* gdbtypes.c (create_range_type): Change API to increase size of
bounds. struct field -> union field.
Always take signedness from base type.
(check_typedef): Use new API for TYPE_LOW_BOUND, TYPE_HIGH_BOUND.
(recursive_dump_type, copy_type_recursive): Adjust to new
representation of range types.
* gdbtypes.h (fields_or_bounds): New union containing struct field and
new struct range_bounds, used for range types.
(TYPE_RANGE_DATA): New macro to access range_bounds member.
(TYPE_LOW_BOUND, TYPE_HIGH_BOUND): Represent with new TYPE_RANGE_DATA.
(TYPE_LOW_BOUND_UNDEFINED, TYPE_HIGH_BOUND_UNDEFINED): New macros,
taking over the job of TYPE_FIELD_ARTIFICIAL for range bounds.
(SET_TYPE_LOW_BOUND, SET_TYPE_HIGH_BOUND, SET_TYPE_LOW_BOUND_DEFINED)
(SET_TYPE_HIGH_BOUND_DEFINED): New macros.
(TYPE_FIELDS, TYPE_BASECLASS, TYPE_BASECLASS_NAME, TYPE_FIELD)
(TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED)
(TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED, TYPE_ARRAY_UPPER_BOUND_VALUE)
(TYPE_ARRAY_LOWER_BOUND_VALUE):	Adjust to new representation.
(create_range_type): Adjust API.
* ada-lang.c (ada_modulus): Use new extended bound values.
(discrete_type_low_bound): Rename to...
(ada_discrete_type_low_bound): ... and make external.
(discrete_type_high_bound): Rename to...
(ada_discrete_type_high_bound): ... and make external.
(ada_value_slice_from_ptr, ada_array_bound_from_type)
(ada_evaluate_subexp, to_fixed_range_type):
Use ada_discrete_type_low_bound, ada_discrete_type_high_bound.
* ada-typeprint.c (print_range): Use ada_discrete_type_low_bound,
ada_discrete_type_high_bound.  Don't look at field count, which
is no longer meaningful.  Print bounds whenever argument is a range
or enumeration.
* ada-lang.h (ada_discrete_type_low_bound,ada_discrete_type_high_bound):
Declare.
* varobj.c (c_describe_child): Adjust to render larger values.
* mdebugread.c (parse_type): Use proper abstractions for range types:
TYPE_RANGE_DATA, SET_TYPE_LOW_BOUND_DEFINED,
SET_TYPE_HIGH_BOUND_DEFINED.
* p-typeprint.c (pascal_type_print_varspec_prefix): Use larger format
for bounds.
2009-12-14 06:19:13 +00:00
Tristan Gingold f29dff0a09 2009-12-02 Tristan Gingold <gingold@adacore.com>
* symfile.h (dwarf2_build_psymtabs): Remove mainline parameter in
	prototype.
	* dwarf2read.c (dwarf2_build_psymtabs): Remove mainline paramter in
	definition, simplify code assuming it is always 0.
	* coffread.c (coff_symfile_read): Adjust call.
	* elfread.c (elf_symfile_read): Ditto.
	* machoread.c (macho_symfile_read): Explicitely calls
	init_psymbol_list if mainline is set.
2009-12-02 11:44:35 +00:00
Tristan Gingold c67a9c901a 2009-12-02 Tristan Gingold <gingold@adacore.com>
* dwarf2read.c (dwarf2_build_psymtabs_easy): Remove mainline parameter.
	(dwarf2_build_psymtabs_hard): Ditto.
	(dwarf2_build_psymtabs): Ajust calls.
	* stabsread.h (elfstab_build_psymtabs): Remove mainline parameter on
	the prototype.
	(coffstab_build_psymtabs): Ditto.
	(stabsect_build_psymtabs): Ditto.
	* dbxread.c (coffstab_build_psymtabs): Remove mainline parameter on
	the definition.
	(elfstab_build_psymtabs): Ditto.
	(stabsect_build_psymtabs): Ditto.
	* coffread.c (coff_symfile_read): Adjust call.
	* elfread.c (elf_symfile_read): Ditto.
	* somread.c (som_symfile_read): Ditto.
2009-12-02 11:34:37 +00:00
Tom Tromey 85d9bd0e05 2009-11-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* dwarf2read.c [HAVE_MMAP] (MAP_FAILED): Define if missing.
2009-11-23 22:08:01 +00:00
Tom Tromey 53d72f980c * dwarf2read.c (find_partial_die): Don't reassign to 'back_to'. 2009-11-23 22:06:04 +00:00
Tom Tromey 04a679b8f5 * xcoffread.c (scan_xcoff_symtab): Update.
* symfile.h (add_psymbol_to_list): Update prototype.
	* symfile.c (add_psymbol_to_bcache): Add copy_name argument.
	(add_psymbol_to_list): Likewise.
	* stabsread.c (define_symbol): Update.
	* mdebugread.c (parse_partial_symbols): Update.
	(handle_psymbol_enumerators): Update.
	(new_symbol): Update.
	* dbxread.c (read_dbx_symtab): Update.
	* coffread.c (process_coff_symbol): Update.
	* symtab.h (prim_record_minimal_symbol_full): Declare.
	(SYMBOL_SET_NAMES): Add copy_name argument.
	* symtab.c (struct demangled_name_entry): New struct.
	(hash_demangled_name_entry): New function.
	(eq_demangled_name_entry): Likewise.
	(create_demangled_names_hash): Use new functions.
	(symbol_set_names): Use struct demangled_name_entry.  Add
	copy_name argument.
	* minsyms.c (prim_record_minimal_symbol_full): New function.
	(prim_record_minimal_symbol_and_info): Use it.
	* elfread.c (record_minimal_symbol): Add name_len and copy_name
	arguments.  Call prim_record_minimal_symbol_full.
	(elf_symtab_read): Add copy_names argument.
	(elf_symfile_read): Update calls to elf_symtab_read.
	* dwarf2read.c (add_partial_symbol): Don't copy symbol names.
	(load_partial_dies): Likewise.
	(new_symbol): Likewise.
	* cp-namespace.c (check_one_possible_namespace_symbol): Don't save
	name on the obstack.  Update call to SYMBOL_SET_NAMES.
2009-11-16 18:40:23 +00:00
Daniel Jacobowitz d48cc9dd6f 2009-11-12 Daniel Jacobowitz <dan@codesourcery.com>
Paul Brook  <paul@codesourcery.com>

	* c-typeprint.c (c_type_print_base): Skip artificial fields.
	Use get_vptr_fieldno to skip the vtable pointer.
	* dwarf2read.c (dwarf2_add_field): Set FIELD_ARTIFICIAL on artificial
	fields.
	(dwarf2_add_member_fn): Complain about virtual member functions
	without DW_AT_vtable_elem_location and force TYPE_CPLUS_DYNAMIC.
	* gdbtypes.c (get_vptr_fieldno): Update comment.
	* gdbtypes.h (struct cplus_struct_type): Add is_dynamic.
	(TYPE_CPLUS_DYNAMIC): New macro.
	* gnu-v3-abi.c (gnuv3_dynamic_class): New.
	(gnuv3_get_vtable): Rewrite to use gnuv3_dynamic_class.  Move higher.
	(gnuv3_rtti_type, gnuv3_get_virtual_fn, gnuv3_baseclass_offset): Use
	gnuv3_get_vtable.
	* varobj.c (cplus_class_num_children, cplus_describe_child): Skip
	artificial fields.  Use get_vptr_fieldno to skip the vtable pointer.
2009-11-12 19:47:25 +00:00
Daniel Jacobowitz ba950e4de5 Correct whitespace in previous patch. 2009-11-12 19:29:04 +00:00
Daniel Jacobowitz 0d564a3135 2009-11-12 Paul Brook <paul@codesourcery.com>
Daniel Jacobowitz  <dan@codesourcery.com>

	* dwarf2read.c (dwarf2_add_member_fn): Calculate virtual function
	offset for classes without DW_AT_containing_type.
2009-11-12 19:10:06 +00:00
Daniel Jacobowitz 7d0ccb6133 2009-11-12 Paul Brook <paul@codesourcery.com>
Daniel Jacobowitz  <dan@codesourcery.com>

	* dwarf2read.c (struct field_info): Add baseclasses.
	(dwarf2_add_field): Add base classes to a separate list.
	(dwarf2_attach_fields_to_type): Merge base classes and fields.
2009-11-12 19:05:28 +00:00
Daniel Jacobowitz 328c9494f5 * dwarf2read.c (process_psymtab_comp_unit): Initialize per_cu backlink
at the same time as the forward link.
	(load_partial_comp_unit): Initialize per_cu links before calling
	init_cu_die_reader.
2009-11-12 18:59:40 +00:00
Cary Coutant de4affc9ce * dwarf2read.c (read_import_statement): Don't clobber original cu. 2009-11-09 21:39:40 +00:00
Daniel Jacobowitz d85a05f07f * dwarf2read.c (struct dwarf2_cu): Remove ranges_offset and
has_ranges_offset.
	(struct partial_die_info): Remove language, has_stmt_list, dirname,
	and line_offset.
	(dwarf2_build_include_psymtabs): Take a die_info.  Handle a missing
	line table.
	(dwarf2_get_pc_bounds): Take PST argument.  Pass it
	to dwarf2_ranges_read.  Update all callers.
	(init_cu_die_reader): Move earlier.
	(dwarf2_find_base_address): New function.
	(process_psymtab_comp_unit): Rewrite to use a full DIE for the
	compilation unit.  Use dwarf2_get_pc_bounds and
	dwarf2_find_base_address.
	(load_comp_unit): Rewrite to use a full DIE for the compilation unit.
	(process_full_comp_unit): Use dwarf2_find_base_address.
	(read_partial_die): Remove support for attributes only used
	in the compilation unit DIE.
	* symfile.c (allocate_psymtab): Make FILENAME const.
	(start_psymtab_common): Likewise.
	* symfile.h (allocate_psymtab, start_psymtab_common): Update
	prototypes.
2009-11-05 23:18:01 +00:00
Cary Coutant 1256eeda7d 2009-10-14 Cary Coutant <ccoutant@google.com>
* dwarf2read.c (read_import_statement): Call follow_die_ref_or_sig.
2009-10-14 23:48:01 +00:00
Keith Seitz 72f2769e82 * dwarf2read.c (dwarf2_const_value): Fix order of arguments to
store_unsigned_integer.
2009-10-14 22:50:32 +00:00