Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Michael Haupt <michael.haupt@oracle.com>
Cc: "gdb\@sourceware.org" <gdb@sourceware.org>
Subject: Re: debugging custom array types
Date: Thu, 14 Feb 2013 16:51:00 -0000	[thread overview]
Message-ID: <87zjz6j0up.fsf@fleche.redhat.com> (raw)
In-Reply-To: <C76FFAFC-24F5-4355-BD2E-DEC8CB830112@oracle.com> (Michael	Haupt's message of "Thu, 14 Feb 2013 14:27:57 +0100")

>>>>> "Michael" == Michael Haupt <michael.haupt@oracle.com> writes:

Michael> OK. Is it safe to assume that the VLA work Jan keeps mentioning on
Michael> this thread will eventually make it into gdb "proper" (or FSF gdb or
Michael> whatever the correct name is)? Is there an idea of how long it might
Michael> take?

It will go in eventually, but probably in a different form.
I don't know how long it will take.  It really needs a rewrite.

It may help with the problem you are facing, but it won't solve it.
That's because the jv-* code in gdb will still be wrong.  There's no way
to avoid fixing this, unless you want to have arrays that are laid out
exactly the same way that gcj does it.

For example, see the BINOP_SUBSCRIPT case in
jv-lang.c:evaluate_subexp_java.  This is the code that handles
expressions like "x[5]":

	  address = value_as_address (arg1);
	  address += get_java_object_header_size (exp->gdbarch);
	  read_memory (address, buf4, 4);
	  length = (long) extract_signed_integer (buf4, 4, byte_order);
	  index = (long) value_as_long (arg2);
[...]
	  address = (address + 4) + index * TYPE_LENGTH (el_type);

This is all pretty bogus; as you can see it pretty much directly knows
about array class layout.  Gross.

I think this code is actually broken right now.  At least, a simple test
made it seem like array subscripting just doesn't work even for gcj any
more.

Tom


  reply	other threads:[~2013-02-14 16:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-11 16:51 Michael Haupt
2013-02-11 17:02 ` Jan Kratochvil
2013-02-13 10:50   ` Michael Haupt
2013-02-13 17:52     ` Tom Tromey
2013-02-14 13:27       ` Michael Haupt
2013-02-14 16:51         ` Tom Tromey [this message]
2013-02-13 17:59     ` Jan Kratochvil
2013-02-14 13:37       ` Michael Haupt
2013-02-14 13:44         ` Jan Kratochvil
2013-02-12 19:28 ` 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=87zjz6j0up.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=michael.haupt@oracle.com \
    /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