This is the mail archive of the gdb-prs@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]

pascal/1477: gdb can not read DWARF-2 debug info about set types


>Number:         1477
>Category:       pascal
>Synopsis:       gdb can not read DWARF-2 debug info about set types
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 07 00:38:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     hebisch@math.uni.wroc.pl
>Release:        unknown-1.0
>Organization:
>Environment:
Gnu/Linux
>Description:
gdb can not read DWARF-2 debug info about set types.
gcc-3.x and Gnu Pascal based on gcc-3.x on many platforms
(including Gnu/Linux) defaults to DWARF-2 debug format.
AFAIK on 64-bit platforms DWARF-2 is considered the only
viable debug format. Gnu Pascal runtime uses sets and
non-trivial Pascal program is likely to use set. Inability
to read info about sets makes DWARF-2 debug format unusable
for Pascal.
>How-To-Repeat:
The following program:

program set1;
type
        a = (foo, bar, baz);
VAR
        dummy : set of a;
begin
  dummy := [bar];
  writeln('Hello')
end
.

Compiled as follows:
$ ../../gcc1/gpc-lin/gcc/xgpc -B../../gcc1/gpc-lin/gcc -g set3.p
$ ../../gcc1/gpc-lin/gcc/xgpc -v
Reading specs from /arc/pom/tt/i386/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs
Configured with: ../gcc-3.3.1/configure --disable-shared --prefix=/arc/pom/tt/i386
Thread model: posix
gpc version 20030830, based on gcc-3.3.1

Gives me:
$ ./gdb.orig a.out
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) break pascal_main_program
Die: DW_TAG_set_type (abbrev = 11, offset = 205)
        has children: FALSE
        attributes:
                DW_AT_type (DW_FORM_ref4) constant: 46
Dwarf Error: Cannot find type of die [in module /arc/pom/gcc_t/gdb/pp1/a.out]
(gdb)
>Fix:
The following patch fixes the problem:

diff -ru gdb-6.0.orig/gdb/dwarf2read.c gdb-6.0/gdb/dwarf2read.c
--- gdb-6.0.orig/gdb/dwarf2read.c       Tue Jul 22 17:44:10 2003
+++ gdb-6.0/gdb/dwarf2read.c    Sat Dec  6 20:39:01 2003
@@ -822,6 +822,9 @@
 static void read_enumeration (struct die_info *, struct objfile *,
                              const struct comp_unit_head *);

+static void read_set_type (struct die_info *, struct objfile *,
+                           const struct comp_unit_head *);
+
 static struct type *dwarf_base_type (int, int, struct objfile *);

 static CORE_ADDR decode_locdesc (struct dwarf_block *, struct objfile *,
@@ -2901,6 +2904,23 @@
     }
 }

+
+static void read_set_type (struct die_info * die, struct objfile *objfile, const struct comp_unit_head * cu_header)
+{
+  struct type *domain_type;
+
+  /* Return if we've already decoded this type. */
+  if (die->type)
+    {
+      return;
+    }
+
+  domain_type = die_type (die, objfile, cu_header);
+
+  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.

@@ -4540,11 +4560,13 @@
     case DW_LANG_Java:
       cu_language = language_java;
       break;
+    case DW_LANG_Pascal83:
+      cu_language = language_pascal;
+      break;
     case DW_LANG_Ada83:
     case DW_LANG_Ada95:
     case DW_LANG_Cobol74:
     case DW_LANG_Cobol85:
-    case DW_LANG_Pascal83:
     case DW_LANG_Modula2:
     default:
       cu_language = language_minimal;
@@ -5250,6 +5272,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;
          add_symbol_to_list (sym, list_in_scope);
@@ -5526,6 +5549,9 @@
       break;
     case DW_TAG_enumeration_type:
       read_enumeration (die, objfile, cu_header);
+      break;
+    case DW_TAG_set_type:
+      read_set_type (die, objfile, cu_header);
       break;
     case DW_TAG_subprogram:
     case DW_TAG_subroutine_type:
>Release-Note:
>Audit-Trail:
>Unformatted:


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