From: Daniel Jacobowitz <drow@false.org>
To: Jeff Johnston <jjohnstn@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC]: java inferior function call support
Date: Thu, 25 Mar 2004 00:18:00 -0000 [thread overview]
Message-ID: <20040325001814.GA5707@nevyn.them.org> (raw)
In-Reply-To: <4060B653.2050400@redhat.com>
On Tue, Mar 23, 2004 at 05:12:35PM -0500, Jeff Johnston wrote:
> Daniel Jacobowitz wrote:
> >I'm not at all sure about the vtable changes. They should be
> >compatible, because gcj does try to follow the C++ ABI. If you'll send
> >a testcase, I'll take another look and see what I'm missing.
> >
>
> They are not compatible. I have been discussing this for a while with
> Andrew Haley who maintains gcj.
>
> I have included a unit-test case: Property.java.
>
> Compile it:
>
> gcj -g --main=Property Property.java
>
> run gdb:
>
> b Property.main (java.lang.String[])
> next (until you have passed the creation of x)
> call x.print(22)
> call x.dothat(23)
>
> print is a static member function
> dothat is a non-static member function
>
> I have included a similar C++ version of Property (test.cxx) and I have
> included the two debug info outputs. You will note in C++, the Property
> class has a _vptr entry. This _vptr entry does not exist in Java. Andrew
> suggested that gdb find the vtable for Java as I have implemented it.
No, Java just calls it something else:
<2><d7c>: Abbrev Number: 11 (DW_TAG_member)
DW_AT_name : vtable
DW_AT_type : <2323>
DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0; )
DW_AT_artificial : 1
DW_AT_accessibility: 3 (private)
That's the vtable for Object, and thus for classes deriving from Object also.
If you make the debug readers recognize this as the vtable for Java symbols,
then the existing machinery should work, without having to do all this
grubbing around in the v3 ABI code.
> >> * valarith.c (value_subscript_1): New function that takes
> >> c_style as argument.
> >> (value_subscript): Change to call value_subscript_1.
> >
> >
> >Why is this necessary? You're using a gdb-created type anyway, you
> >shouldn't need to change anything in value_subscript if you're
> >subscripting with the right indices.
> >
>
> When I create the array type, I need to give it a range. I specify -1 for
> the upper-bound as C++ does for the regular vtable. The problem is that
> C++ and C have the luxury of not doing range checking in value_subscript
> because they are "c-style" array languages. For Java, it checks the
> upper-bound and issues a warning message about "subscript out of range". I
> did not want the message to be issued in this particular case because I
> trust the voffset value. I attempted an experiment to give a large default
> value for the upper-bound but the call to value_subscript ends up
> allocating storage which is definitely not a good thing. The simplest
> answer was I wanted to eliminate range checking on the call which I do by
> specifying "c-style" arrays. I made that a parameter of value_subscript_1
> and had value_subscript call it with the language value.
OK, now I understand what you're doing. This should not happen if the
vtable is marked lazy... which it is. I spent some time tracing and
could not find out why this would happen.
Either that should be fixed (or at least understood better), or we
may want to allow -1 to indicate "unspecified upper bound" for
non-c-style languages also.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2004-03-25 0:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-23 19:03 Jeff Johnston
2004-03-23 19:10 ` Daniel Jacobowitz
2004-03-24 20:38 ` Tom Tromey
2004-03-24 21:33 ` Jim Blandy
[not found] ` <4060B653.2050400@redhat.com>
2004-03-25 0:18 ` Daniel Jacobowitz [this message]
2004-03-23 19:21 ` David Carlton
2004-03-23 22:35 ` Jeff Johnston
2004-03-23 22:48 ` David Carlton
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=20040325001814.GA5707@nevyn.them.org \
--to=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
--cc=jjohnstn@redhat.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