diff options
author | Daniel Jacobowitz <drow@false.org> | 2002-10-06 03:11:38 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2002-10-06 03:11:38 +0000 |
commit | d7eaf09a147530f325cbbb13d95d696a481e8d5b (patch) | |
tree | 63c2ab1b6eaf2e9d9818928fadb5ea1ad5eec106 | |
parent | db52de95a9aed9141782dbb55535edbecf2964e4 (diff) | |
download | gdb-d7eaf09a147530f325cbbb13d95d696a481e8d5b.zip gdb-d7eaf09a147530f325cbbb13d95d696a481e8d5b.tar.gz gdb-d7eaf09a147530f325cbbb13d95d696a481e8d5b.tar.bz2 |
* stabsread.c (read_member_functions): Update comment.
Set TYPE_NAME if possible.
-rw-r--r-- | gdb/ChangeLog.cplus | 5 | ||||
-rw-r--r-- | gdb/stabsread.c | 31 |
2 files changed, 36 insertions, 0 deletions
diff --git a/gdb/ChangeLog.cplus b/gdb/ChangeLog.cplus index 7f3f3db..ecca856 100644 --- a/gdb/ChangeLog.cplus +++ b/gdb/ChangeLog.cplus @@ -1,5 +1,10 @@ 2002-10-05 Daniel Jacobowitz <drow@mvista.com> + * stabsread.c (read_member_functions): Update comment. + Set TYPE_NAME if possible. + +2002-10-05 Daniel Jacobowitz <drow@mvista.com> + * c-typeprint.c (cp_type_print_method_args): Don't recursively expand classes in the arguments to methods. (c_type_print_base): Use the name of the method to figure out diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 4697b40..1522149 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -3116,6 +3116,9 @@ update_method_name_from_physname (char **old_name, char *physname) $ is the CPLUS_MARKER (usually '$'), `*' holds the place for an operator name (such as `+=') and `.' marks the end of the operator name. + If we read at least one method with a complete physname, set + TYPE_NAME (TYPE) appropriately. + Returns 1 for success, 0 for failure. */ static int @@ -3249,6 +3252,34 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type, new_sublist->fn_field.physname = savestring (*pp, p - *pp); *pp = p + 1; + /* For classes with qualified names (e.g. nested classes, classes + in namespaces, etc.) we can infer what the fully qualified name + should be. GCC doesn't output this information directly, + but it does output mangled names for methods: + - Every class will have debug information for at least one + constructor, either user specified or compiler-synthesized. + - For v3 there are no abbreviated physnames, so we can find the + fully qualified class name from such a constructor. + - For v2 constructors (related to the fact that the mangled name + for a constructor starts with a double underscore instead of + with the method name, as for ordinary methods) the full physname + will be included. + + So from a constructor we can infer the class's qualified name. */ + + if (TYPE_NAME (type) == NULL + && is_constructor_name (new_sublist->fn_field.physname)) + { + char *class_name + = class_name_from_physname (new_sublist->fn_field.physname); + + /* G++ anonymous structures have names starting with '.' or + '$'. */ + if (is_cplus_marker (class_name[0])) + TYPE_NAME (type) = obconcat (&objfile->type_obstack, "", + "", class_name); + } + /* Set this member function's visibility fields. */ switch (*(*pp)++) { |