Re: PATCH: Read Dwarf2 info from Pascal

Pierre Muller
2005-05-12T13:37:45Z

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