From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: <gdb-patches@sourceware.org>
Subject: [RFC] dwarf debug information: Handle Free Pascal virtual table indexes
Date: Wed, 12 May 2010 13:47:00 -0000 [thread overview]
Message-ID: <002701caf1d9$ab868ec0$0293ac40$@muller@ics-cnrs.unistra.fr> (raw)
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 <muller@ics.u-strasbg.fr>
* 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 ();
}
next reply other threads:[~2010-05-12 13:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-12 13:47 Pierre Muller [this message]
[not found] <23651.5388860882$1273672053@news.gmane.org>
2010-05-12 21:24 ` Tom Tromey
2010-05-13 7:59 ` Pierre Muller
[not found] ` <11064.3996195451$1273708856@news.gmane.org>
2010-05-13 17:29 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='002701caf1d9$ab868ec0$0293ac40$@muller@ics-cnrs.unistra.fr' \
--to=pierre.muller@ics-cnrs.unistra.fr \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox