aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2010-11-23 01:03:54 +0000
committerJoel Brobecker <brobecker@gnat.com>2010-11-23 01:03:54 +0000
commit3a867c2212df1b93fbac759ba26093512949ff19 (patch)
treefe801cb54e01a788df2c17fac83f54b745560e57 /gdb
parentdf30368de152f204fb04f69281ab9e1e2c93cc56 (diff)
downloadgdb-3a867c2212df1b93fbac759ba26093512949ff19.zip
gdb-3a867c2212df1b93fbac759ba26093512949ff19.tar.gz
gdb-3a867c2212df1b93fbac759ba26093512949ff19.tar.bz2
infinite recursion with ada_check_typedef
When trying to resolve an incomplete type, if there is no complete version of that type available, GDB can go in an infinite loop. This is because ada_check_typedef makes a recursive call to itself, in an attempt to make sure that the returned type is never a typedef. However, when no complete type is found, the current logic causes us to keep going indefinitely through the same path... This patch fixes the problem by performing the recursive call to ada_check_typedef only when a TYPE_CODE_TYPDEF layer needs to be stripped. gdb/ChangeLog: * ada-lang.c (ada_check_typedef): Call ada_check_typedef only if type1 is a typedef.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/ada-lang.c10
2 files changed, 11 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 18de389..15ed81b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2010-11-22 Joel Brobecker <brobecker@adacore.com>
+ * ada-lang.c (ada_check_typedef): Call ada_check_typedef only
+ if type1 is a typedef.
+
+2010-11-22 Joel Brobecker <brobecker@adacore.com>
+
* ada-lang.h (ADA_KNOWN_AUXILIARY_FUNCTION_NAME_PATTERNS): Add
"_finalizer" to the list.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 76b20e7..15c96b7 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -7756,10 +7756,12 @@ ada_check_typedef (struct type *type)
/* TYPE1 might itself be a TYPE_CODE_TYPEDEF (this can happen with
stubs pointing to arrays, as we don't create symbols for array
- types, only for the typedef-to-array types). This is why
- we process TYPE1 with ada_check_typedef before returning
- the result. */
- return ada_check_typedef (type1);
+ types, only for the typedef-to-array types). If that's the case,
+ strip the typedef layer. */
+ if (TYPE_CODE (type1) == TYPE_CODE_TYPEDEF)
+ type1 = ada_check_typedef (type1);
+
+ return type1;
}
}