diff options
author | Joel Brobecker <brobecker@gnat.com> | 2008-01-04 20:45:05 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2008-01-04 20:45:05 +0000 |
commit | 727e3d2e5ca581e75f2d8707c28c5cbd7ee34bb0 (patch) | |
tree | ad508980930ee4377049060846486a8520f65205 /gdb/ada-lang.c | |
parent | ecc7085baf3e1b677cbcaa84989cd3a48f13542d (diff) | |
download | gdb-727e3d2e5ca581e75f2d8707c28c5cbd7ee34bb0.zip gdb-727e3d2e5ca581e75f2d8707c28c5cbd7ee34bb0.tar.gz gdb-727e3d2e5ca581e75f2d8707c28c5cbd7ee34bb0.tar.bz2 |
* ada-lang.c (decode_packed_array_type): Avoid a seg fault
when the type is an anonymous pointer type.
(ada_check_typedef): Avoid a seg fault when the type is null.
* ada-typeprint.c (print_array_type): Add support for pointer
to packed arrays.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 134244f..198ef62 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1809,13 +1809,21 @@ decode_packed_array_type (struct type *type) { struct symbol *sym; struct block **blocks; - const char *raw_name = ada_type_name (ada_check_typedef (type)); - char *name = (char *) alloca (strlen (raw_name) + 1); - char *tail = strstr (raw_name, "___XP"); + char *raw_name = ada_type_name (ada_check_typedef (type)); + char *name; + char *tail; struct type *shadow_type; long bits; int i, n; + if (!raw_name) + raw_name = ada_type_name (desc_base_type (type)); + + if (!raw_name) + return NULL; + + name = (char *) alloca (strlen (raw_name) + 1); + tail = strstr (raw_name, "___XP"); type = desc_base_type (type); memcpy (name, raw_name, tail - raw_name); @@ -7269,6 +7277,9 @@ static_unwrap_type (struct type *type) struct type * ada_check_typedef (struct type *type) { + if (type == NULL) + return NULL; + CHECK_TYPEDEF (type); if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM || !TYPE_STUB (type) |