Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* PATCH: Read Dwarf2 info from Pascal
@ 2005-05-12 13:37 Waldek Hebisch
  2005-05-12 13:44 ` Pierre Muller
  2005-05-18  2:23 ` Daniel Jacobowitz
  0 siblings, 2 replies; 4+ messages in thread
From: Waldek Hebisch @ 2005-05-12 13:37 UTC (permalink / raw)
  To: gdb-patches

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 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PATCH: Read Dwarf2 info from Pascal
  2005-05-12 13:37 PATCH: Read Dwarf2 info from Pascal Waldek Hebisch
@ 2005-05-12 13:44 ` Pierre Muller
  2005-05-12 14:37   ` Waldek Hebisch
  2005-05-18  2:23 ` Daniel Jacobowitz
  1 sibling, 1 reply; 4+ messages in thread
From: Pierre Muller @ 2005-05-12 13:44 UTC (permalink / raw)
  To: hebisch; +Cc: gdb-patches


Waldek Hebisch said:
> 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 seems fine to me,
but I have no DWARF experience at all,
thus I am just supposing that the code is good.
This patch needs to be approved by the dwarf maintainer,
not by me.

> 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).

  What test are you talking about?
I think that there are no pascal specific tests in
the gdb testsuite (unless I missed much more
that what I thought).
  Are you talking about a GPC testsuite?

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

  I am still officially maintainer of
the pascal language support,
but I didn't have much time the last year.
I just read the subject of the gdb mailing lists,
thattís why I answer to your email.

  I did not look at the problem database for ages...


> 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.

  I don't know about this issue, maybe Andrew or Eli can answer this?

> ChangeLog:
>
> 2005-05-04  Waldek Hebisch (hebisch@math.uni.wroc.pl)
>
> 	* dwarf2read.c: Add Pascal support.

This should probably be more detailed...

> --- 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


Pierre Muller

on stay at UMR 166
Complex Fluids Laboratory
Rhodia Research Center, Cranbury, New Jersey
mailto:muller@ics.u-strasbg.fr
Phone : 1-609-860-4757



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PATCH: Read Dwarf2 info from Pascal
  2005-05-12 13:44 ` Pierre Muller
@ 2005-05-12 14:37   ` Waldek Hebisch
  0 siblings, 0 replies; 4+ messages in thread
From: Waldek Hebisch @ 2005-05-12 14:37 UTC (permalink / raw)
  To: muller; +Cc: hebisch, gdb-patches

Pierre Muller wrote:
> 
> Waldek Hebisch said:
> > 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).
> 
>   What test are you talking about?
> I think that there are no pascal specific tests in
> the gdb testsuite (unless I missed much more
> that what I thought).
>   Are you talking about a GPC testsuite?
> 

I an talking about gdb testsuite. I can not see how the patch could
break anything, but for extra safety I did `make check'. I tested
Pascal support by hand, just debugging actual programs. There
are other problems with Pascal support, but set info is a critical
problem, unpatched gdb gets stuck repeatedly trying (and failing)
to read a set type. With the patch it is possible to do usefull
debugging.

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PATCH: Read Dwarf2 info from Pascal
  2005-05-12 13:37 PATCH: Read Dwarf2 info from Pascal Waldek Hebisch
  2005-05-12 13:44 ` Pierre Muller
@ 2005-05-18  2:23 ` Daniel Jacobowitz
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2005-05-18  2:23 UTC (permalink / raw)
  To: Waldek Hebisch; +Cc: gdb-patches

On Thu, May 12, 2005 at 03:26:21PM +0200, Waldek Hebisch wrote:
> 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.

Pierre's right; the ChangeLog needs to be more detailed (and please use
the NAME[space][space]<email@address> style used in the rest of the
ChangeLog).  There's at least one place where you used spaces and the
surrounding code used tabs; you can see this very easily by looking at
the diff, where it won't line up properly.  And there are some useless
blank lines and braces in the patch - yes, I realize dwarf2read.c has a
lot of these already, but please don't add more.

The patch itself looks sane but Elena would need to review it.


-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-05-18  1:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-12 13:37 PATCH: Read Dwarf2 info from Pascal Waldek Hebisch
2005-05-12 13:44 ` Pierre Muller
2005-05-12 14:37   ` Waldek Hebisch
2005-05-18  2:23 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox