aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2007-08-14 20:16:18 +0000
committerJoel Brobecker <brobecker@gnat.com>2007-08-14 20:16:18 +0000
commit64a1bf195752a461f0e44b853a1e2769d182de3b (patch)
treea1bfe22e3811586e594814495e74f320a1a1468b
parente933291e4c6bdf8dfce7d78740568122a8fd19c3 (diff)
downloadgdb-64a1bf195752a461f0e44b853a1e2769d182de3b.zip
gdb-64a1bf195752a461f0e44b853a1e2769d182de3b.tar.gz
gdb-64a1bf195752a461f0e44b853a1e2769d182de3b.tar.bz2
* ada-lang.c (field_alignment): Guard against NULL.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/ada-lang.c10
2 files changed, 14 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 581c8d5..b8d2139 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,9 @@
2007-08-14 Joel Brobecker <brobecker@adacore.com>
+ Michael Snyder <msnyder@access-company.com>
+
+ * ada-lang.c (field_alignment): Guard against NULL.
+
+2007-08-14 Joel Brobecker <brobecker@adacore.com>
* MAINTAINERS (Global Maintainers): Add self.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 0a27ba0..4b1e292 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -6116,9 +6116,17 @@ static unsigned int
field_alignment (struct type *type, int f)
{
const char *name = TYPE_FIELD_NAME (type, f);
- int len = (name == NULL) ? 0 : strlen (name);
+ int len;
int align_offset;
+ /* The field name should never be null, unless the debugging information
+ is somehow malformed. In this case, we assume the field does not
+ require any alignment. */
+ if (name == NULL)
+ return 1;
+
+ len = strlen (name);
+
if (!isdigit (name[len - 1]))
return 1;