From owner-freebsd-java@FreeBSD.ORG Thu Feb 26 22:39:02 2009 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FEAD106566B for ; Thu, 26 Feb 2009 22:39:02 +0000 (UTC) (envelope-from kurt@intricatesoftware.com) Received: from mail1.intricatesoftware.com (mail1.intricatesoftware.com [96.56.4.132]) by mx1.freebsd.org (Postfix) with ESMTP id 10FBC8FC19 for ; Thu, 26 Feb 2009 22:39:01 +0000 (UTC) (envelope-from kurt@intricatesoftware.com) Received: from seraph.intricatesoftware.com (relay@localhost.intricatesoftware.com [IPv6:::1]) by mail1.intricatesoftware.com (8.14.1/8.13.4) with ESMTP id n1QMSZOB029427; Thu, 26 Feb 2009 17:28:45 -0500 (EST) Received: from seraph.intricatesoftware.com (truk@localhost.intricatesoftware.com [127.0.0.1]) by seraph.intricatesoftware.com (8.14.3/8.14.3) with ESMTP id n1QMSYJR019160; Thu, 26 Feb 2009 17:28:34 -0500 (EST) Message-ID: <49A71791.4030601@intricatesoftware.com> Date: Thu, 26 Feb 2009 17:28:33 -0500 From: Kurt Miller User-Agent: Thunderbird 2.0.0.19 (X11/20090220) MIME-Version: 1.0 To: Swamy Venkataramanappa References: <49A6F84E.1080504@experts-exchange.com> <49A6FD5C.3070107@sun.com> <49A7017C.3020302@experts-exchange.com> <49A7068D.7050001@sun.com> In-Reply-To: <49A7068D.7050001@sun.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SMTP-Vilter-Version: 1.3.6 X-SMTP-Vilter-Virus-Backend: clamd X-SMTP-Vilter-Status: clean X-SMTP-Vilter-clamd-Virus-Status: clean X-Spamd-Symbols: ALL_TRUSTED,AWL,BAYES_00 X-SMTP-Vilter-Spam-Backend: spamd X-Spam-Score: -4.3 X-Spam-Threshold: 5.0 X-Spam-Probability: -0.9 X-SMTP-Vilter-Unwanted-Backend: attachment X-SMTP-Vilter-attachment-Unwanted-Status: clean Cc: Brian Gardner , bsd-port-dev@openjdk.java.net, freebsd-java@freebsd.org Subject: Re: gdb and java X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Feb 2009 22:39:02 -0000 Yes, that is the problem. Upon initial execution the java launcher checks to see if the LD_LIBRARY_PATH is setup correctly. If not it adjusts the env and execv's itself again. gdb can't follow beyond the execv. Setting the LD_LIBRARY_PATH to match what the launcher wants will avoid the execv and allow gdb to work as expected. -Kurt Swamy Venkataramanappa wrote: > Probably library path is not set correctly. So try this trick. > > public class PrintLibraryPath { > public static void main(String[] args) { > System.out.println(System.getProperty("java.library.path")); > } > } > > > env LD_LIBRARY_PATH=`java PrintLibraryPath` gdb java .. > > -swamy > > Brian Gardner wrote: >> Thanks Swamy, >> Same thing happens using java directly. >> >> Swamy Venkataramanappa wrote: >> >>> jmap is actually a java program. jmap executable is simple launcher >>> just like a java launcher. >>> It launches java program and runs JMap.class from sa-jdi.jar or runs >>> attach on demand >>> code and attaches to the running jvm. SA based jmap can be run like this >>> >>> java -classpath /sa-jdi.jar sun.jvm.hotspot.tools.JMap >>> -finalizerinfo >>> >>> -Swamy >>> >>> Brian Gardner wrote: >>> >>>> I've had success in debugging java using jdb, however this doesn't >>>> seem to support native debugging. I'd like to use gdb but this >>>> doesn't work with (the error is bellow). Currently I'm printing to >>>> stderr from native code but this is less than ideal and time >>>> consuming, any ideas? >>>> >>>> # gdb jmap >>>> (gdb) run -finalizerinfo 118 >>>> Starting program: >>>> /usr/home/brian/openjdk6/freshv2.2/bsd-port6.modified/build/bsd-amd64/j2sdk-image/bin/jmap >>>> -finalizerinfo 118 >>>> (no debugging symbols found)...(no debugging symbols found)...[New >>>> LWP 104363] >>>> (no debugging symbols found)...(no debugging symbols found)...[New >>>> Thread 0x800b01120 (LWP 104363)] >>>> [New LWP 104363] >>>> >>>> Program received signal SIGTRAP, Trace/breakpoint trap. >>>> [Switching to LWP 104363] >>>> Cannot remove breakpoints because program is no longer writable. >>>> It might be running in another process. >>>> Further execution is probably impossible. >>>> 0x000000080050d360 in ?? () from /libexec/ld-elf.so.1 >>>> (gdb) >>>> >>>> >>>> >>>> >>>> >>> >> > >