diff options
author | Joel Brobecker <brobecker@gnat.com> | 2008-01-01 07:21:59 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2008-01-01 07:21:59 +0000 |
commit | 73fb9985686f8ed65ac02a63256918ce755a46b4 (patch) | |
tree | c480a5512a7adb8a93b17ad645e80bab470cfa5c /gdb/ada-lang.c | |
parent | 636265b635ab32dbe17e3ddfc17969ac359d1ede (diff) | |
download | gdb-73fb9985686f8ed65ac02a63256918ce755a46b4.zip gdb-73fb9985686f8ed65ac02a63256918ce755a46b4.tar.gz gdb-73fb9985686f8ed65ac02a63256918ce755a46b4.tar.bz2 |
Implement support for Ada interface types.
* ada-lang.c (ada_is_dispatch_table_ptr_type): New function.
(ada_is_ignored_field): Ignore fields that are a dispatch table
of a tagged type.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index d614762..9493506 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -5277,6 +5277,24 @@ ada_add_block_symbols (struct obstack *obstackp, /* Field Access */ +/* Return non-zero if TYPE is a pointer to the GNAT dispatch table used + for tagged types. */ + +static int +ada_is_dispatch_table_ptr_type (struct type *type) +{ + char *name; + + if (TYPE_CODE (type) != TYPE_CODE_PTR) + return 0; + + name = TYPE_NAME (TYPE_TARGET_TYPE (type)); + if (name == NULL) + return 0; + + return (strcmp (name, "ada__tags__dispatch_table") == 0); +} + /* True if field number FIELD_NUM in struct or union type TYPE is supposed to be invisible to users. */ @@ -5285,12 +5303,30 @@ ada_is_ignored_field (struct type *type, int field_num) { if (field_num < 0 || field_num > TYPE_NFIELDS (type)) return 1; - else - { - const char *name = TYPE_FIELD_NAME (type, field_num); - return (name == NULL - || (name[0] == '_' && strncmp (name, "_parent", 7) != 0)); - } + + /* Check the name of that field. */ + { + const char *name = TYPE_FIELD_NAME (type, field_num); + + /* Anonymous field names should not be printed. + brobecker/2007-02-20: I don't think this can actually happen + but we don't want to print the value of annonymous fields anyway. */ + if (name == NULL) + return 1; + + /* A field named "_parent" is internally generated by GNAT for + tagged types, and should not be printed either. */ + if (name[0] == '_' && strncmp (name, "_parent", 7) != 0) + return 1; + } + + /* If this is the dispatch table of a tagged type, then ignore. */ + if (ada_is_tagged_type (type, 1) + && ada_is_dispatch_table_ptr_type (TYPE_FIELD_TYPE (type, field_num))) + return 1; + + /* Not a special field, so it should not be ignored. */ + return 0; } /* True iff TYPE has a tag field. If REFOK, then TYPE may also be a |