diff options
author | Daniel Jacobowitz <dan@debian.org> | 2002-10-06 03:11:38 +0000 |
---|---|---|
committer | Daniel Jacobowitz <dan@debian.org> | 2002-10-06 03:11:38 +0000 |
commit | e3bc8c99eff0fd7b5124e3abb36a58f78e6362fc (patch) | |
tree | 0bf3625a388dafe9107a4062b67f2e79b138451e | |
parent | a1e2d10a033a01c4192277371e3ffce1eda90ecb (diff) | |
download | gdb-e3bc8c99eff0fd7b5124e3abb36a58f78e6362fc.tar.gz |
* 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 7f3f3db4b7e..ecca856e9b6 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 4697b4067e7..15221490dfb 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)++) { |