Date: Mon, 9 Mar 1998 14:58:40 +1100 (EST) From: "Simon J. Gerraty" <sjg@quick.com.au> To: Stephen Wynne <stevemw@northwest.com> Cc: freebsd-java@FreeBSD.ORG, sjg@quick.com.au Subject: Re: VM Debugging: Problem with GDB and Shared Libs Message-ID: <199803090358.OAA29401@gate.quick.com.au> References: <199803082219.OAA09770@northwest.com>
next in thread | previous in thread | raw e-mail | index | archive | help
>script), and then invoking gdb on java_g. I've been doing a bit of this recently (on NetBSD which I'll assume is close enough), so this should point you in the right direction. >I fail to set a breakpoint in java_main (even after running once). you need to let the prog run til main() has been entered before you can access java_main() as in: GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is absolutely no warranty for GDB; type "show warranty" for details. GDB 4.16 (i386-netbsd), Copyright 1996 Free Software Foundation, Inc... (gdb) b main Breakpoint 1 at 0x17f4: file ../../../../src/netbsd/java/javai/java.c, line 30. (gdb) r t Starting program: /u0/javasrc/buildbin/bin/i386/green_threads/java_g t Breakpoint 1, main (argc=2, argv=0xefbfd2b8, envp=0xefbfd2c4) at ../../../../src/netbsd/java/javai/java.c:30 30 ENVP = envp; (gdb) b java_main Breakpoint 2 at 0x40074a70: file ../../../../src/netbsd/java/javai/javai.c, line 261. (gdb) c Continuing. Breakpoint 2, java_main (argc=2, argv=0xefbfd2b8) at ../../../../src/netbsd/java/javai/javai.c:261 261 char *sourcefile = 0; (gdb) Then assuming you want to set a break point in awt_util_reshape() which is in libawt.so you need to set a break point in sysAddDLSegment() which you can do now, and wait for libawt.so to be loaded... (gdb) b sysAddDLSegment Breakpoint 3 at 0x40077b48: file ../../../../src/netbsd/java/runtime/linker_md.c, line 142. (gdb) c Continuing. Breakpoint 3, sysAddDLSegment (fn=0xefbfc15c "libawt.so") at ../../../../src/netbsd/java/runtime/linker_md.c:142 142 if (!linkerinitialized) { (gdb) finish Run till exit from #0 sysAddDLSegment (fn=0xefbfc15c "libawt.so") at ../../../../src/netbsd/java/runtime/linker_md.c:142 0x40069438 in java_lang_Runtime_loadFileInternal (Hlinker=0x40457398, Hfilename=0x40457f70) at ../../../../src/share/java/lang/runtime.c:92 92 return sysAddDLSegment(fname); Value returned is $1 = 1 (gdb) Now libawt.so is loaded into the VM but you cannot access any functions because gdb has not loaded the symbols. Your gdb should support the following (with the correct path of course): (gdb) sharedlibrary /u0/javasrc/buildbin/lib/i386/green_threads/libawt_g.so Reading symbols from /u0/javasrc/buildbin/lib/i386/green_threads/libawt_g.so... done. (gdb) b awt_util_reshape Breakpoint 4 at 0x4128993b: file ../../../../src/netbsd/sun/awt_util.c, line 96. (gdb) c Continuing. ... ... Breakpoint 4, awt_util_reshape (w=0x27cc00, x=0, y=0, wd=0, ht=0) at ../../../../src/netbsd/sun/awt_util.c:96 96 Boolean move = False; (gdb) and there you have it. Hope that helps. --sjg As an example, lets say you want to set a breapoint somewhere in libawt.so you do: gdb java_g (gdb) b main (gdb) r Hello To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803090358.OAA29401>