From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30673 invoked by alias); 11 Feb 2013 16:32:54 -0000 Received: (qmail 30646 invoked by uid 22791); 11 Feb 2013 16:32:50 -0000 X-SWARE-Spam-Status: No, hits=-7.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_GC X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Feb 2013 16:32:40 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1BGWdbT023727 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 11 Feb 2013 11:32:39 -0500 Received: from zebedee.pink (ovpn-113-141.phx2.redhat.com [10.3.113.141]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r1BGWcUE012003; Mon, 11 Feb 2013 11:32:38 -0500 Message-ID: <51191D25.20407@redhat.com> Date: Mon, 11 Feb 2013 16:32:00 -0000 From: Andrew Haley User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Michael Haupt CC: "java@gcc.gnu.org" Subject: Re: gcj and debugging References: <87y5f0ufko.fsf@fleche.redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2013-02/txt/msg00006.txt.bz2 On 02/11/2013 04:26 PM, Michael Haupt wrote: > Tom, > > thank you very much for your reply. > > Am 07.02.2013 um 19:47 schrieb Tom Tromey : >> Michael> in a research project, I'm generating DWARF debugging info for machine >> Michael> code generated from Java. I looked at some of the DWARF debug info >> Michael> generated by gcj (including that contained in libgcj.so). >> >> I think the first thing to realize is that the gdb support for Java was >> all written to target gcj specifically, and also written long ago and >> then barely updated. >> >> It isn't very general or done the way it would be done now. >> It was never updated for the gcj binary compatibility ABI. > > Would you suggest to generate DWARF info with the language set to C89 then, to avoid misleading gdb? > >> I thought things like "print array[0]" used to work, but even that seems >> to fail for me now. There is definitely some code for this in gdb, see >> jv-valprint.c:java_value_print. It seems to know a bit about array >> layout and then goes from there (though the code looks somewhat bogus to >> me...). See also jv-lang.c:evaluate_subexp_java for the code that tries >> to do array subscripting. > > If gdb's Java language support is really tailored to gcj, it surely assumes internal layout details about arrays. I cannot guarantee that "my" arrays have the same internal representation. :-) > >> gdb has special code for this. It looks for a type named >> "java.lang.String" and then knows what fields it has. >> >> Yucky. > > Indeed. The Right Way to do it, as is done with the thread library, is to have a target library that GDB opens which contains accessor methods for all of the VM's structures. Andrew.