aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPierre Muller <muller@sourceware.org>2010-10-14 15:18:54 +0000
committerPierre Muller <muller@sourceware.org>2010-10-14 15:18:54 +0000
commit5c3da5ea2ef28d1f272e737e5165d671149291a0 (patch)
treead75564aff027a2f98ec98d207b2555f512a5c66 /gdb
parentf8a5c266971d7b5b96f973805551c6e88669cada (diff)
downloadgdb-5c3da5ea2ef28d1f272e737e5165d671149291a0.zip
gdb-5c3da5ea2ef28d1f272e737e5165d671149291a0.tar.gz
gdb-5c3da5ea2ef28d1f272e737e5165d671149291a0.tar.bz2
* p-lang.c (is_pascal_string_type): Avoid crashes on structures
having fields without names.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/p-lang.c6
2 files changed, 10 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b5886dd..d440cb2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2010-10-14 Pierre Muller <muller@ics.u-strasbg.fr>
+
+ * p-lang.c (is_pascal_string_type): Avoid crashes on structures
+ having fields without names.
+
2010-10-13 Tom Tromey <tromey@redhat.com>
* language.h (LA_PRINT_ARRAY_INDEX): Fix argument name.
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 64d2e9f..232ce56 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -105,8 +105,10 @@ is_pascal_string_type (struct type *type,int *length_pos,
{
/* Old Borland type pascal strings from Free Pascal Compiler. */
/* Two fields: length and st. */
- if (TYPE_NFIELDS (type) == 2
+ if (TYPE_NFIELDS (type) == 2
+ && TYPE_FIELDS (type) [0].name
&& strcmp (TYPE_FIELDS (type)[0].name, "length") == 0
+ && TYPE_FIELDS (type) [1].name
&& strcmp (TYPE_FIELDS (type)[1].name, "st") == 0)
{
if (length_pos)
@@ -124,7 +126,9 @@ is_pascal_string_type (struct type *type,int *length_pos,
/* GNU pascal strings. */
/* Three fields: Capacity, length and schema$ or _p_schema. */
if (TYPE_NFIELDS (type) == 3
+ && TYPE_FIELDS (type) [0].name
&& strcmp (TYPE_FIELDS (type)[0].name, "Capacity") == 0
+ && TYPE_FIELDS (type) [1].name
&& strcmp (TYPE_FIELDS (type)[1].name, "length") == 0)
{
if (length_pos)