pascal/2232: Patch to print Pascal type names of parent classes with dwarf-2

jonas@freepascal.org jonas@freepascal.org
Sun Feb 18 14:08:00 GMT 2007


>Number:         2232
>Category:       pascal
>Synopsis:       Patch to print Pascal type names of parent classes with dwarf-2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 18 14:08:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     jonas@freepascal.org
>Release:        GNU gdb 6.3.50.20050815-cvs+Apple patches and CVS head 2007/02/18
>Organization:
>Environment:
Mac OS X 10.4.8
>Description:
When compiling an FPC Object Pascal program with dwarf-2 debug info, gdb does not print the type names of the ancestor classes when printing the value of a class instance (see the <> on lines 2 and 3 of what gdb prints):

***
(gdb) p d^
$1 = {
  <> = {
    <> = {
      _vptr$TOBJECT = 0x20c7c
    }, 
    members of TC: 
    L = 5
  }, 
  members of TD: 
  S = {
    Length = 5, 
    Data = 'hello', #0 <repeats 250 times>
  }
}
***

This works when compiling with stabs:

***
(gdb) p d^
$2 = {
  <TC> = {
    <TOBJECT> = {
      _vptr$ = {0x20ca4, 0x5}
    }, 
    members of TC: 
    L = 5
  }, 
  members of TD: 
  S = 'hello'
}
***

The supplied patch fixes this so it also works for dwarf-2.
>How-To-Repeat:
Compile the supplied program with a recent (at least as recent as this bug report) 2.1.1 version of FPC with -gw2, set a breakpoint on line 17 of the program and type "p d^"
>Fix:
Index: p-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/p-valprint.c,v
retrieving revision 1.47
diff -u -r1.47 p-valprint.c
--- p-valprint.c        8 Feb 2007 14:20:56 -0000       1.47
+++ p-valprint.c        18 Feb 2007 13:44:42 -0000
@@ -827,7 +827,7 @@
     {
       int boffset;
       struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
-      char *basename = TYPE_NAME (baseclass);
+      char *basename = type_name_no_tag (baseclass);
       const gdb_byte *base_valaddr;
 
       if (BASETYPE_VIA_VIRTUAL (type, i))
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="class.pp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="class.pp"

eyRtb2RlIG9iamZwY30KdHlwZQogIHRjID0gY2xhc3MKICAgIGw6IGxvbmdpbnQ7CiAgZW5kOwoK
ICB0ZCA9IGNsYXNzKHRjKQogICAgczogc2hvcnRzdHJpbmc7CiAgZW5kOwoKdmFyCiAgZDogdGQ7
CmJlZ2luCiAgZCA6PSB0ZC5jcmVhdGU7CiAgZC5sOj01OwogIGQuczo9J2hlbGxvJzsKICBkLmZy
ZWU7CmVuZC4K



More information about the Gdb-prs mailing list