diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 11 | ||||
-rw-r--r-- | gdb/cp-namespace.c | 47 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 45 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/namespace.exp | 5 | ||||
-rw-r--r-- | gdb/valops.c | 13 |
6 files changed, 72 insertions, 53 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b2718d1..1ad5a43 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,16 @@ 2003-11-11 David Carlton <carlton@kealia.com> + * valops.c: Tweak comments to match proposed patch. + (value_aggregate_elt): Use internal_error instead of error. + * dwarf2read.c: Tweak comments to match proposed patch. + (new_symbol): Use SYMBOL_LINKAGE_NAME or SYMBOL_NATURAL_NAME + instead of DEPRECATED_SYMBOL_NAME. + * cp-namespace.c: Tweak comments to match proposed patch. + (cp_set_block_scope): Remove #if 0. + (cp_lookup_nested_type): Use internal_error instead of error. + +2003-11-11 David Carlton <carlton@kealia.com> + * Merge with mainline; tag is carlton-dictionary-20031111-merge. 2003-11-10 Michael Chastain <mec.gnu@mindspring.com> diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index e48e9c3..f7ec530 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -33,18 +33,29 @@ #include "command.h" #include "frame.h" -/* When set, the file that we're processing seems to have debugging - info for C++ namespaces, so cp-namespace.c shouldn't try to guess - namespace info itself. */ +/* When set, the file that we're processing is known to have debugging + info for C++ namespaces. */ + +/* NOTE: carlton/2003-11-10: No currently released version of GCC (the + latest of which is 3.3.x at the time of this writing) produces this + debug info. */ unsigned char processing_has_namespace_info; -/* If processing_has_namespace_info is nonzero, this string should - contain the name of the current namespace. The string is - temporary; copy it if you need it. */ +/* This contains our best guess as to the name of the current + enclosing namespace(s)/class(es), if any. For example, if we're + within the method foo() in the following code: + + namespace N { + class C { + void foo () { + } + }; + } -/* FIXME: carlton/2003-06-12: This isn't entirely reliable: currently, - we get mislead by DW_AT_specification. */ + then processing_current_prefix should be set to "N::C". If + processing_has_namespace_info is false, then this variable might + not be reliable. */ const char *processing_current_prefix; @@ -219,12 +230,6 @@ cp_set_block_scope (const struct symbol *symbol, if (SYMBOL_CPLUS_DEMANGLED_NAME (symbol) != NULL) { -#if 0 - /* FIXME: carlton/2003-06-12: As mentioned above, - 'processing_has_namespace_info' currently isn't entirely - reliable, so let's always use demangled names to get this - information for now. */ - if (processing_has_namespace_info) { block_set_scope @@ -234,7 +239,6 @@ cp_set_block_scope (const struct symbol *symbol, obstack); } else -#endif { /* Try to figure out the appropriate namespace from the demangled name. */ @@ -503,13 +507,6 @@ lookup_symbol_file (const char *name, /* FIXME: carlton/2003-06-12: This is a hack and should eventually be deleted: see comments below. */ - /* FIXME: carlton/2003-01-06: Searching this seems a bit fishy if - anonymous_namespace is nonzero, since we might return a namespace - that's really a class that doesn't happen to be mentioned in the - current file. Sigh. Still, I don't think anything catastrophic - should happen in that case. Probably the right thing to do is to - move anonymous namespace symbols to files' static blocks. */ - if (domain == VAR_DOMAIN) { sym = lookup_possible_namespace_symbol (name, symtab); @@ -522,7 +519,7 @@ lookup_symbol_file (const char *name, /* Look up a type named NESTED_NAME that is nested inside the C++ class or namespace given by PARENT_TYPE, from within the context - given by BLOCK. */ + given by BLOCK. Return NULL if there is no such nested type. */ struct type * cp_lookup_nested_type (struct type *parent_type, @@ -560,8 +557,8 @@ cp_lookup_nested_type (struct type *parent_type, return SYMBOL_TYPE (sym); } default: - error ("\"%s\" is not defined as a compound type.", - TYPE_NAME (parent_type)); + internal_error (__FILE__, __LINE__, + "cp_lookup_nested_type called on a non-aggregate type."); } } diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index ffadd23..c848d0e 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1680,6 +1680,10 @@ add_partial_symbol (struct partial_die_info *pdi, struct objfile *objfile, objfile); } +/* Determine whether a die of type TAG living in the C++ namespace + NAMESPACE needs to have the name of the namespace prepended to the + name listed in the die. */ + static int pdi_needs_namespace (enum dwarf_tag tag, const char *namespace) { @@ -3146,7 +3150,11 @@ read_structure_scope (struct die_info *die, struct objfile *objfile, debug info. We could solve this by using the demangled name to get the prefix; if doing so, however, we'd need to be careful when reading a - class that's nested inside a template class. */ + class that's nested inside a template class. + That would also cause problems when trying to + determine RTTI information, since we use the + demangler to determine the appropriate class + name. */ char *actual_class_name = class_name_from_physname (dwarf2_linkage_name (child_die)); @@ -5017,8 +5025,8 @@ die_is_declaration (struct die_info *die) && ! dwarf_attr (die, DW_AT_specification)); } -/* Returns the die giving the specification for this one, or NULL if - none. */ +/* Return the die giving the specification for DIE, if there is + one. */ static struct die_info * die_specification (struct die_info *die) @@ -5686,13 +5694,13 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile, if (TYPE_TAG_NAME (type) != NULL) { - /* FIXME: carlton/2003-01-10: We're being a bit - profligate with memory names here. */ - DEPRECATED_SYMBOL_NAME (sym) + /* FIXME: carlton/2003-11-10: Should this use + SYMBOL_SET_NAMES instead? (The same problem also + arises a further down in the function.) */ + SYMBOL_LINKAGE_NAME (sym) = obsavestring (TYPE_TAG_NAME (type), strlen (TYPE_TAG_NAME (type)), &objfile->symbol_obstack); - gdb_assert (SYMBOL_DEMANGLED_NAME (sym) == NULL); } } @@ -5725,8 +5733,8 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile, SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN; if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) TYPE_NAME (SYMBOL_TYPE (sym)) = - obsavestring (DEPRECATED_SYMBOL_NAME (sym), - strlen (DEPRECATED_SYMBOL_NAME (sym)), + obsavestring (SYMBOL_NATURAL_NAME (sym), + strlen (SYMBOL_NATURAL_NAME (sym)), &objfile->type_obstack); add_symbol_to_list (typedef_sym, list_to_add); } @@ -5736,10 +5744,10 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile, if (processing_has_namespace_info && processing_current_prefix[0] != '\0') { - DEPRECATED_SYMBOL_NAME (sym) = obconcat (&objfile->symbol_obstack, - processing_current_prefix, - "::", - name); + SYMBOL_LINKAGE_NAME (sym) = obconcat (&objfile->symbol_obstack, + processing_current_prefix, + "::", + name); } SYMBOL_CLASS (sym) = LOC_TYPEDEF; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; @@ -5754,10 +5762,10 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile, if (processing_has_namespace_info && processing_current_prefix[0] != '\0') { - DEPRECATED_SYMBOL_NAME (sym) = obconcat (&objfile->symbol_obstack, - processing_current_prefix, - "::", - name); + SYMBOL_LINKAGE_NAME (sym) = obconcat (&objfile->symbol_obstack, + processing_current_prefix, + "::", + name); } attr = dwarf_attr (die, DW_AT_const_value); if (attr) @@ -6068,7 +6076,7 @@ read_type_die (struct die_info *die, struct objfile *objfile, do_cleanups (back_to); } -/* Determine the name of the namespace/class that DIE is defined +/* Return the name of the namespace/class that DIE is defined within, or NULL if we can't tell. The caller should xfree the result. */ @@ -6173,7 +6181,6 @@ class_name (struct die_info *die) return xstrdup (""); } - static struct type * dwarf_base_type (int encoding, int size, struct objfile *objfile) { diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 94354a5..7ce6bdd 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-11-11 David Carlton <carlton@kealia.com> + + * gdb.cp/namespace.exp: Remove doubled comment. + 2003-11-11 Nick Clifton <nickc@redhat.com> * gdb.base/shreloc.exp: Do not run for targets which do not diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp index 1eb24c1..742a3b9 100644 --- a/gdb/testsuite/gdb.cp/namespace.exp +++ b/gdb/testsuite/gdb.cp/namespace.exp @@ -84,11 +84,6 @@ gdb_test "up" ".*main.*" "up from marker1" # Access a data item inside a namespace using colons and # single quotes. :-( -# NOTE: carlton/2002-11-24: the quotes are becoming less necessary (or -# even desirable.) For tests where it should still work with quotes, -# I'm including versions both with and without quotes; for tests that -# shouldn't work with quotes, I'm only including one version. - # NOTE: carlton/2003-09-24: the quotes are becoming less necessary (or # even desirable.) For tests where it should still work with quotes, # I'm including versions both with and without quotes; for tests that diff --git a/gdb/valops.c b/gdb/valops.c index 4d53dc0..a946db2 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -2473,7 +2473,8 @@ value_aggregate_elt (struct type *curtype, case TYPE_CODE_NAMESPACE: return value_namespace_elt (curtype, name, noside); default: - error ("Internal error: non-aggregate type to value_aggregate_elt"); + internal_error (__FILE__, __LINE__, + "non-aggregate type in value_aggregate_elt"); } } @@ -2613,8 +2614,9 @@ value_struct_elt_for_reference (struct type *domain, int offset, return v; } - /* As a last chance, look it up using lookup_symbol_namespace: this - works for types. */ + /* As a last chance, pretend that CURTYPE is a namespace, and look + it up that way; this (frequently) works for types nested inside + classes. */ return value_maybe_namespace_elt (curtype, name, noside); } @@ -2638,7 +2640,10 @@ value_namespace_elt (const struct type *curtype, } /* A helper function used by value_namespace_elt and - value_struct_elt_for_reference. */ + value_struct_elt_for_reference. It looks up NAME inside the + context CURTYPE; this works if CURTYPE is a namespace or if CURTYPE + is a class and NAME refers to a type in CURTYPE itself (as opposed + to, say, some base class of CURTYPE). */ static struct value * value_maybe_namespace_elt (const struct type *curtype, |