From owner-freebsd-java@FreeBSD.ORG Thu Feb 26 21:34:12 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 B1E4E106566B for ; Thu, 26 Feb 2009 21:34:12 +0000 (UTC) (envelope-from cdennis@terracottatech.com) Received: from mail01.terracottatech.com (mail01.terracottatech.com [64.95.112.230]) by mx1.freebsd.org (Postfix) with ESMTP id 916AF8FC18 for ; Thu, 26 Feb 2009 21:34:12 +0000 (UTC) (envelope-from cdennis@terracottatech.com) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail01.terracottatech.com (Postfix) with ESMTP id 907994780DB; Thu, 26 Feb 2009 13:18:48 -0800 (PST) X-Virus-Scanned: amavisd-new at mail01.terracottatech.com Received: from mail01.terracottatech.com ([127.0.0.1]) by localhost (mail01.terracottatech.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6IaD44yp-X+H; Thu, 26 Feb 2009 13:18:42 -0800 (PST) Received: from host-25-7-0-remote-terracotta.lan (pnapgw.terracottatech.com [64.95.112.232]) by mail01.terracottatech.com (Postfix) with ESMTP id 2883111E8004; Thu, 26 Feb 2009 13:18:42 -0800 (PST) Message-Id: From: Chris Dennis To: Brian Gardner In-Reply-To: <49A7017C.3020302@experts-exchange.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Thu, 26 Feb 2009 16:18:40 -0500 References: <49A6F84E.1080504@experts-exchange.com> <49A6FD5C.3070107@sun.com> <49A7017C.3020302@experts-exchange.com> X-Mailer: Apple Mail (2.930.3) Cc: Swamy Venkataramanappa , 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 21:34:13 -0000 I've not tried launching a java process directly from gdb recently, but I have attached to running java processes numerous times with various VMs (OpenJDK and not) and I've never had any problems doing simple things (backtraces, stackdumps etc...). Perhaps you could try attaching dynamically once everything is up and running (albeit with some modification so that your java process waits for you)? Chris On Feb 26, 2009, at 3:54 PM, 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) >>> >>> >>> >>> >> >> >