From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16811 invoked by alias); 12 May 2010 13:47:29 -0000 Received: (qmail 16803 invoked by uid 22791); 12 May 2010 13:47:28 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.152) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 May 2010 13:47:19 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o4CDlFa5004107 for ; Wed, 12 May 2010 15:47:16 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms3.u-strasbg.fr [IPv6:2001:660:2402:d::12]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id o4CDlFka094664 for ; Wed, 12 May 2010 15:47:15 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from d620muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o4CDlFWY088331 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Wed, 12 May 2010 15:47:15 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: Subject: [RFC] dwarf debug information: Handle Free Pascal virtual table indexes Date: Wed, 12 May 2010 13:47:00 -0000 Message-ID: <002701caf1d9$ab868ec0$0293ac40$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-05/txt/msg00259.txt.bz2 Free Pascal compiler uses for DW_AT_vtable_elem_location attribute a BLOCK consisting of a DW_OP_constu marker followed by a unsigned_leb128 value to indicate the offset within the virtual table of a virtual function. GDB doesn't handle this currently, and this creates errors in which attributes coming later, like DW_AT_low_pc and DW_AT_high_pc not be set correctly and thus generating lots of complaints. This patch allows to parse Free Pascal output correctly. Is this an acceptable patch? Pierre Muller Pascal language support maintainer for GDB 2010-05-12 Pierre Muller * dwarf2read.c (dwarf2_add_member_fn): Handle Free Pascal compiler method to give the offset of a virtual function in the virtual table. Index: src/gdb/dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.383 diff -u -p -r1.383 dwarf2read.c --- src/gdb/dwarf2read.c 8 May 2010 04:58:45 -0000 1.383 +++ src/gdb/dwarf2read.c 12 May 2010 12:51:20 -0000 @@ -4892,6 +4892,23 @@ dwarf2_add_member_fn (struct field_info fnp->voffset += 2; fnp->fcontext = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (this_type, 0)); } + /* Support for Free Pascal description of virtual methods. */ + else if (attr_form_is_block (attr) && DW_BLOCK (attr)->size > 0 + && DW_BLOCK (attr)->data[0] == DW_OP_constu) + { + struct dwarf_block blk; + int num_read; + + blk.size = DW_BLOCK (attr)->size - 1; + blk.data = DW_BLOCK (attr)->data + 1; + fnp->voffset = read_unsigned_leb128 (NULL, (gdb_byte *) blk.data, + &num_read); + if (num_read > blk.size) + dwarf2_invalid_attrib_class_complaint ("DW_AT_vtable_elem_location", + fieldname); + fnp->fcontext = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (this_type, 0)); + } + else dwarf2_complex_location_expr_complaint (); }