debugging java with dbx, supposed to work?

I have no luck debugging java. When I attach to it it debugs it as a C program.

When trying to force it to interpret it as a java program by suppliing a jar or a class file whe nattacing, dbx crashes. When starting the program from dbx I get

signal SEGV (access to address exceeded protections) in ciEnv::register_method t@9 (l@9) signal SEGV (access to address exceeded protections) in ciEnv::register_method at 0xfea7d2f8

.

I have used both studio 11 and

Sun Dbx Debugger 7.6 SunOS_sparc Build35_2 2006/12/04

[549 byte] By [willocha] at [2007-11-26 20:53:24]
# 1

Something drastic's happening here... By all means dbx should not crash, so it's a bug. Can you provide stack trace (pstack core | c++filt) of dbx being crashed and OS and Java versions?

As for attaching to java app, be sure to read "Attaching dbx to a Running Java Application" section of dbx manual, since JVM needs to be started with special options that enable attaching of the debugger.

MaximKartasheva at 2007-7-10 2:19:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

% java -version

java version "1.5.0_06"

Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)

Java HotSpot(TM) Server VM (build 1.5.0_06-b05, mixed mode)

% uname -a

SunOS euler 5.10 Generic_118833-24 sun4u sparc SUNW,Sun-Fire

% ./SUNWspro/bin/dbx ~/lib/TRIACQ.jar `pgrep -f java.\*rc.gui`

..........

dbx: internal error: signal SIGSEGV (no mapping at the fault address)

dbx's coredump will appear in /tmp

detaching from process 26761

Abort (core dumped)

% ./SUNWspro/bin/dbx -V

Sun Dbx Debugger 7.6 SunOS_sparc Build40_1 2007/02/08

% stack /tmp/core | c++filt

core '/tmp/core' of 26918:/zfs/Local/./SUNWspro/bin/../prod/bin/sparcv9/dbx /triacq/lib/TRIACQ.j

ffffffff7e5ce520 _lwp_kill (6, 0, ffffffffffffffff, ffffffff7e6e4000, 0, 0) + 8

ffffffff7e548a6c abort (1, 1b8, 0, 19b6a0, 0, 0) + 118

00000001000bea38 ? (b, 100400, 1, 10051628c, 100522df8, 100624000)

ffffffff7e5cd424 __sighndlr (b, ffffffff7fffe750, ffffffff7fffe470, 1000be7c8, 0, a) + c

ffffffff7e5c17d4 call_user_handler (ffffffff7ea02000, ffffffff7ea02000, ffffffff7fffe470, 8, 0, 0) + 3e0

ffffffff7c7b5750 JdbxSurrogateSA::JdbxSurrogateSA #Nvariant 1(Notifier*,unsigned) (10224cf50, 10224cef0, 10, 1adcbc, 10050b730, ffffffff7c90b060) + 50

ffffffff7c7b26cc jvmdiSA::jvmdiSA #Nvariant 1() (10224be30, 10224cef0, 1f8, ffffffff7c90b060, 1589dc, 0) + 4c

ffffffff7c790ae0 jvmdiInterface*JDBContext::jvmdi_sa(JVMProxy*) (100685860, 102248670, 36e55e5, 1000, 101010100000000, 10224be30) + 18

ffffffff7c75776c void JdbxExtension::post_proc_init(Interp*,void*,bool) (100680f30, 102248670, ffffffff7fffeca8, ffffffff7c935cf8, ffffffff7c90b060, ffffffff7ffff09a) + 114

00000001000bece4 ? (100522df8, 1, ffffffff7fffeca8, 10053e648, 10053e000, 10053e)

00000001000c3628 main (3, ffffffff7fffedb8, 100653580, 100516f48, c202, 1000be7c8) + 824

00000001000b579c _start (0, 0, 0, 0, 0, 0) + 17c

willocha at 2007-7-10 2:19:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3

> As for attaching to java app, be sure to read

> "Attaching dbx to a Running Java Application" section

> of dbx manual, since JVM needs to be started with

> special options that enable attaching of the debugger.

Thanks. I manage to use dbx on java now on jar file.

But...

I think information be available in the debugger itself as a help topic.

(help debug, or help java, there is help c++ , help fortran)

Or in the man page.

willocha at 2007-7-10 2:19:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4

The SEGV in dbx happens because you inadvertandly ran into experimental

features of dbx which work with the java servicability agent (http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/jsadebugd.html).

This may happen if your pgrep returns more than one pid or because

using an explicit .class or .jar in an attach scenario confuses dbx. Try

[code]dbx - [i]explicit-pid[/i][/code].

There are helpfiles that provide info on java but you have to get dbx

into java mode to begin with:

[code]

$ dbx75 Frame.class

Will be debugging "Frame"

Reading -

(dbx) help -k java

command summary

jpkgs (Java only command)

jclasses (Java only command)

jon (Java only command)

joff (Java only command)

java (Java only command)

java-debugging (topic)

native (Java only command)

debug (command)

...

[/code]

IvanIgorovicha at 2007-7-10 2:19:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 5

>

> There are helpfiles that provide info on java but you

> have to get dbx

> into java mode to begin with:

>

So you need to know how to debug java in order to debug java !

Think you should change that.

And update the man page.

-T

willocha at 2007-7-10 2:19:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...