This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Read Dwarf2 info from Pascal


The patch below adds Pascal support to `dwarf2read.c':
 - reading Dwarf2 info about sets
 - recognizing the language as Pascal
 - allowing namespace declaration (modules) for Pascal

Without the patch gdb can not be used with new versions of Gnu Pascal
(at least in default mode): gpc based of gcc-3.x defaults to Dwarf2
debug info (and gdb stops working once a set is found).

The patch is against gdb-6.3, but applies to cvs version (from May 7):
I have tested it on Debian Woody and the patch coused no new test failures
(however, unpatched cvs version had 55 unexpected test failures).

The patch is an updated version of the patch I attached to PR 1477 (BTW,
is anybody looking at Pascal problems?).

If OK please apply, I have no CVS write access. The patch is small, so
I hope it can go in without legal problems, but if needed I will
fill the copyright assignment to FSF.

ChangeLog:

2005-05-04  Waldek Hebisch (hebisch@math.uni.wroc.pl)

	* dwarf2read.c: Add Pascal support.

--- gdb-6.3.orig/gdb/dwarf2read.c	2004-10-16 02:41:00.000000000 +0200
+++ gdb-6.3/gdb/dwarf2read.c	2005-05-06 20:28:41.000000000 +0200
@@ -913,6 +913,8 @@
 
 static void read_enumeration_type (struct die_info *, struct dwarf2_cu *);
 
+static void read_set_type (struct die_info *, struct dwarf2_cu *);
+
 static void process_enumeration_scope (struct die_info *, struct dwarf2_cu *);
 
 static struct type *dwarf_base_type (int, int, struct dwarf2_cu *);
@@ -2648,6 +2650,9 @@
       read_enumeration_type (die, cu);
       process_enumeration_scope (die, cu);
       break;
+    case DW_TAG_set_type:
+      read_set_type (die, cu);
+      break;
 
     /* FIXME drow/2004-03-14: These initialize die->type, but do not create
        a symbol or process any children.  Therefore it doesn't do anything
@@ -4009,6 +4014,24 @@
   return new_prefix;
 }
 
+static void
+read_set_type (struct die_info * die, struct dwarf2_cu *cu)
+{
+  struct type *domain_type;
+
+  /* Return if we've already decoded this type. */
+  if (die->type)
+    {
+      return;
+    }
+
+  domain_type = die_type (die, cu);
+
+  die->type = create_set_type (NULL, domain_type);
+
+}
+
+
 /* Given a pointer to a die which begins an enumeration, process all
    the dies that define the members of the enumeration, and create the
    symbol for the enumeration type.
@@ -6096,9 +6119,11 @@
     case DW_LANG_Ada95:
       cu->language = language_ada;
       break;
+    case DW_LANG_Pascal83:
+      cu->language = language_pascal;
+      break;
     case DW_LANG_Cobol74:
     case DW_LANG_Cobol85:
-    case DW_LANG_Pascal83:
     case DW_LANG_Modula2:
     default:
       cu->language = language_minimal;
@@ -6861,6 +6886,7 @@
 	case DW_TAG_structure_type:
 	case DW_TAG_union_type:
 	case DW_TAG_enumeration_type:
+        case DW_TAG_set_type:
 	  SYMBOL_CLASS (sym) = LOC_TYPEDEF;
 	  SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
 
@@ -7182,6 +7208,9 @@
     case DW_TAG_enumeration_type:
       read_enumeration_type (die, cu);
       break;
+    case DW_TAG_set_type:
+      read_set_type (die, cu);
+      break;
     case DW_TAG_subprogram:
     case DW_TAG_subroutine_type:
       read_subroutine_type (die, cu);
@@ -7239,7 +7268,8 @@
   struct die_info *parent;
 
   if (cu->language != language_cplus
-      && cu->language != language_java)
+      && cu->language != language_java
+      && cu->language != language_pascal)
     return NULL;
 
   parent = die->parent;


-- 
                              Waldek Hebisch
hebisch@math.uni.wroc.pl 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]