]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2002-05-02 Pierre Muller <muller@ics.u-strasbg.fr>
authorPierre Muller <muller@sourceware.org>
Thu, 2 May 2002 11:18:07 +0000 (11:18 +0000)
committerPierre Muller <muller@sourceware.org>
Thu, 2 May 2002 11:18:07 +0000 (11:18 +0000)
* p-lang.h (is_pascal_string_type): Declaration changed,
new sixth argument of type char ** added.
* p-lang.c (is_pascal_string_type): Implementation
changed. Args length_pos, length_size, string_pos, char_size
can now be NULL. New argument arrayname set to the field
name of the char array. Return value set to char array
field index plus one.
* p-valprint.c (pascal_val_print): Adapt to new declaration of
is_pascal_string_type function.

gdb/ChangeLog
gdb/p-lang.c
gdb/p-lang.h
gdb/p-valprint.c

index 89792d49bc28d4a295cae2e01a0ae2b5be1503fb..63512ac9748484d9d0827d6d960fbeb4021174f5 100644 (file)
@@ -1,3 +1,15 @@
+2002-05-02  Pierre Muller  <muller@ics.u-strasbg.fr>
+
+       * p-lang.h (is_pascal_string_type): Declaration changed,
+       new sixth argument of type char ** added.
+       * p-lang.c (is_pascal_string_type): Implementation 
+       changed. Args length_pos, length_size, string_pos, char_size
+       can now be NULL. New argument arrayname set to the field
+       name of the char array. Return value set to char array
+       field index plus one.
+       * p-valprint.c (pascal_val_print): Adapt to new declaration of 
+       is_pascal_string_type function.
+
 2002-05-02  Andrew Cagney  <cagney@redhat.com>
 
        * gdbarch.sh (gdbarch_update_p): Revert 2002-05-02 Andrew Cagney
index 62c8a641a7c82b5f8e333dfbd0a698f858209217..6d518ee951ff89e2d4f49a170de1bd969d1577cc 100644 (file)
@@ -44,7 +44,8 @@ extern void _initialize_pascal_language (void);
    but this does not happen for Free Pascal nor for GPC.  */
 int
 is_pascal_string_type (struct type *type,int *length_pos,
-                       int * length_size, int *string_pos, int *char_size)
+                       int *length_size, int *string_pos, int *char_size,
+                      char **arrayname)
 {
   if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
     {
@@ -54,11 +55,17 @@ is_pascal_string_type (struct type *type,int *length_pos,
           && strcmp (TYPE_FIELDS (type)[0].name, "length") == 0 
           && strcmp (TYPE_FIELDS (type)[1].name, "st") == 0)
         {
-          *length_pos = TYPE_FIELD_BITPOS (type, 0) / TARGET_CHAR_BIT;
-          *length_size = TYPE_FIELD_TYPE (type, 0)->length;
-          *string_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
-          *char_size = 1;
-          return 1;
+          if (length_pos)
+           *length_pos = TYPE_FIELD_BITPOS (type, 0) / TARGET_CHAR_BIT;
+          if (length_size)
+           *length_size = TYPE_FIELD_TYPE (type, 0)->length;
+          if (string_pos)
+           *string_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
+          if (char_size)
+           *char_size = 1;
+         if (arrayname)
+           *arrayname = TYPE_FIELDS (type)[1].name;
+         return 2;
         };
       /* GNU pascal strings.  */
       /* Three fields: Capacity, length and schema$ or _p_schema.  */
@@ -66,12 +73,18 @@ is_pascal_string_type (struct type *type,int *length_pos,
           && strcmp (TYPE_FIELDS (type)[0].name, "Capacity") == 0
           && strcmp (TYPE_FIELDS (type)[1].name, "length") == 0)
         {
-          *length_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
-          *length_size = TYPE_FIELD_TYPE (type, 1)->length;
-          *string_pos = TYPE_FIELD_BITPOS (type, 2) / TARGET_CHAR_BIT;
+          if (length_pos)
+           *length_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
+          if (length_size)
+           *length_size = TYPE_FIELD_TYPE (type, 1)->length;
+          if (string_pos)
+           *string_pos = TYPE_FIELD_BITPOS (type, 2) / TARGET_CHAR_BIT;
           /* FIXME: how can I detect wide chars in GPC ?? */
-          *char_size = 1;
-          return 1;
+          if (char_size)
+           *char_size = 1;
+         if (arrayname)
+           *arrayname = TYPE_FIELDS (type)[2].name;
+         return 3;
         };
     }
   return 0;
index ca8a0a9de6664a3cbd60b9b5f78606dfc39d07d1..39eb0435f09c0e9a03e8ea2d124656ccb8c0d2a4 100644 (file)
@@ -38,7 +38,8 @@ extern void pascal_type_print_method_args (char *, char *,
 
 /* These are in p-lang.c: */
 
-extern int is_pascal_string_type (struct type *, int *, int *, int *, int*);
+extern int 
+  is_pascal_string_type (struct type *, int *, int *, int *, int *, char **);
 
 extern void pascal_printchar (int, struct ui_file *);
 
index 0b89c727e88750163fb11625b21ed11b74ff7872..c8060a237ac6aad005a6e98e837cff7f0ed13bc3 100644 (file)
@@ -190,8 +190,8 @@ pascal_val_print (struct type *type, char *valaddr, int embedded_offset,
             as GDB does not recognize stabs pascal strings
             Pascal strings are mapped to records
             with lowercase names PM  */
-          if (is_pascal_string_type (elttype, &length_pos,
-                                     &length_size, &string_pos, &char_size)
+          if (is_pascal_string_type (elttype, &length_pos, &length_size,
+                                     &string_pos, &char_size, NULL)
              && addr != 0)
            {
              ULONGEST string_length;
@@ -320,7 +320,7 @@ pascal_val_print (struct type *type, char *valaddr, int embedded_offset,
       else
        {
           if (is_pascal_string_type (type, &length_pos, &length_size,
-                                     &string_pos, &char_size))
+                                     &string_pos, &char_size, NULL))
            {
              len = extract_unsigned_integer (valaddr + embedded_offset + length_pos, length_size);
              LA_PRINT_STRING (stream, valaddr + embedded_offset + string_pos, len, char_size, 0);