Skip to main content

how to use (build) debugger

10 replies [Last post]
tcolakov
Offline
Joined: 2009-06-29

Hi guys,

I've been trying to make debugger working. I've read through the /docs/Debugger and used examples written there with no success. Can you direct me to document (or write me) how to debug program with squawk?
Thanks
Todor

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tcolakov
Offline
Joined: 2009-06-29

Hi,

so, now I have this error:

[translating suite translator [closed: false, parent: squawk] ...]
WARNING: Deferring LinkageError for class com.sun.squawk.io.j2me.classpath.Protocol: implements interface com.sun.squawk.io.connections.ClasspathConnection which is a suite-private interface from another suite. while translating com.sun.squawk.io.j2me.classpath.Protocol
[translating suite translator [closed: false, parent: translator] ...]
Assertion failed: (Suite.java:785): parent not found: suite translator [closed: false, parent: squawk]
Exception while running command romize
Exception while running command rom
build failed: error invoking public static void com.sun.squawk.Romizer.main(java.lang.String[]) throws java.io.IOException
caused by: java.lang.Error
at com.sun.squawk.VM.fatalVMError(VM.java:692)
at com.sun.squawk.util.Assert.always(Assert.java:355)
at com.sun.squawk.Suite.save(Suite.java:785)
at com.sun.squawk.Romizer.createImage(Romizer.java:794)
at com.sun.squawk.Romizer.access$100(Romizer.java:44)
at com.sun.squawk.Romizer$2.run(Romizer.java:407)
at com.sun.squawk.util.ComputationTimer.execute(ComputationTimer.java:127)
at com.sun.squawk.util.ComputationTimer.time(ComputationTimer.java:177)
at com.sun.squawk.Romizer.run(Romizer.java:405)
at com.sun.squawk.Romizer.main(Romizer.java:348)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.squawk.builder.Build.java(Build.java:3055)
at com.sun.squawk.builder.JavaCommand.run(JavaCommand.java:71)
at com.sun.squawk.builder.Build.run(Build.java:1656)
at com.sun.squawk.builder.Build.runCommand(Build.java:1612)
at com.sun.squawk.builder.commands.RomCommand.runRomizer(RomCommand.java:451)
at com.sun.squawk.builder.commands.RomCommand.run(RomCommand.java:324)
at com.sun.squawk.builder.Build.run(Build.java:1656)
at com.sun.squawk.builder.Build.runCommand(Build.java:1612)
at com.sun.squawk.builder.Build.mainProgrammatic(Build.java:2154)
at com.sun.squawk.builder.Build.main(Build.java:2114)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.squawk.builder.launcher.Launcher.main(Launcher.java:58)

Could that be problem of delegating platform?
Todor

derek_white
Offline
Joined: 2006-09-08

| [translating suite translator [closed: false, parent: squawk] ...]

The original documentation said to build the translator suite, but that is not required anymore (or suported it seems). I thought I removed all references to the translator suite from the doc.

Hopefully that will get you past this issue (and on to the next :-).

tcolakov
Offline
Joined: 2009-06-29

Hi,

ok, I'm through first stage :) The debugger is compiled. Now I'm at following problem:

At first I start this program under sda direction:

squawk com.sun.squawk.debugger.sda.SDA -log:info com.sun.squawk.Test

then, in new terminal i start this command
java -jar build.jar sdproxy -log:info -cp:j2me/j2meclasses:debugger/j2meclasses:samples/j2meclasses

but after it, I get this printout

Launcher: Found tools.jar in ~/jdk1.5.0_19/lib/tools.jar, by popping up a level from jre.
Builder.JDK: Looking for JDK in ~/jdk1.5.0_19, popped up a level from jre
Launcher: Found tools.jar in ~/jdk1.5.0_19/lib/tools.jar, by popping up a level from jre.
For vm2c tools.jar=~/jdk1.5.0_19/lib/tools.jar
PLATFORM_TYPE=DELEGATING
[running sdproxy...]
Trying to connect to VM on socket://localhost:2800
logging level: 1
logging to System.out
[Thread SDP] Establishing connection with socket://localhost:2800...
[Thread SDP] Connection with socket://localhost:2800 established
Established connection to VM (handshake took 40ms)
[Thread SDAListener] Started event loop
[Thread SDAListener] Received from SquawkVM: CommandPacket[id=-2147483645,size=57]:SDWP.ThreadStateChanged
[Thread SDAListener] Received from SquawkVM: CommandPacket[id=-2147483643,size=11404]:Event.Composite
IO error while loading: class java.lang.Object
javax.microedition.io.ConnectionNotFoundException: java/lang/Object.class
at com.sun.squawk.io.j2me.classpath.Protocol.openInputStream(Protocol.java:162)
at com.sun.squawk.translator.ci.ClassFileLoader.load(ClassFileLoader.java:139)
at com.sun.squawk.translator.Translator$1.run(Translator.java:664)
at com.sun.squawk.util.ComputationTimer.execute(ComputationTimer.java:125)
at com.sun.squawk.util.ComputationTimer.time(ComputationTimer.java:159)
at com.sun.squawk.translator.Translator.load(Translator.java:662)
at com.sun.squawk.translator.Translator.load(Translator.java:356)
at com.sun.squawk.Klass.loadReservedSystemClasses(Klass.java:3764)
at com.sun.squawk.Klass.initBootstrapClasses(Klass.java:3749)
at com.sun.squawk.Klass.(Klass.java:3674)
at com.sun.squawk.debugger.sdp.ProxyTypeManager.getClass(ProxyTypeManager.java:164)
at com.sun.squawk.debugger.sdp.ProxyTypeManager.addClass(ProxyTypeManager.java:66)
at com.sun.squawk.debugger.sdp.SDAListener$Event.Composite(SDAListener.java:286)
Waiting for connection from debugger on serversocket://:2900
[Thread SDP] Establishing connection with serversocket://:2900...
at com.sun.squawk.debugger.sdp.SDAListener$Event.dispatch(SDAListener.java:144)
at com.sun.squawk.debugger.JDWPListener$CommandSet.handle(JDWPListener.java:396)
at com.sun.squawk.debugger.sdp.SDPCommandSet.handle(SDPCommandSet.java:59)
at com.sun.squawk.debugger.sdp.SDAListener.processCommand(SDAListener.java:96)
at com.sun.squawk.debugger.JDWPListener.run(JDWPListener.java:132)
at java.lang.Thread.run(Thread.java:595)
java.lang.NoClassDefFoundError: java.lang.Object: javax.microedition.io.ConnectionNotFoundException: java/lang/Object.class
at com.sun.squawk.translator.ci.ClassFileLoader.load(ClassFileLoader.java:146)
at com.sun.squawk.translator.Translator$1.run(Translator.java:664)
at com.sun.squawk.util.ComputationTimer.execute(ComputationTimer.java:125)
at com.sun.squawk.util.ComputationTimer.time(ComputationTimer.java:159)
at com.sun.squawk.translator.Translator.load(Translator.java:662)
at com.sun.squawk.translator.Translator.load(Translator.java:356)
at com.sun.squawk.Klass.loadReservedSystemClasses(Klass.java:3764)
at com.sun.squawk.Klass.initBootstrapClasses(Klass.java:3749)
at com.sun.squawk.Klass.(Klass.java:3674)
at com.sun.squawk.debugger.sdp.ProxyTypeManager.getClass(ProxyTypeManager.java:164)
at com.sun.squawk.debugger.sdp.ProxyTypeManager.addClass(ProxyTypeManager.java:66)
at com.sun.squawk.debugger.sdp.SDAListener$Event.Composite(SDAListener.java:286)
at com.sun.squawk.debugger.sdp.SDAListener$Event.dispatch(SDAListener.java:144)
at com.sun.squawk.debugger.JDWPListener$CommandSet.handle(JDWPListener.java:396)
at com.sun.squawk.debugger.sdp.SDPCommandSet.handle(SDPCommandSet.java:59)
at com.sun.squawk.debugger.sdp.SDAListener.processCommand(SDAListener.java:96)
at com.sun.squawk.debugger.JDWPListener.run(JDWPListener.java:132)
at java.lang.Thread.run(Thread.java:595)
Exception in thread "SDAListener" java.lang.ExceptionInInitializerError
at com.sun.squawk.debugger.sdp.ProxyTypeManager.getClass(ProxyTypeManager.java:164)
at com.sun.squawk.debugger.sdp.ProxyTypeManager.addClass(ProxyTypeManager.java:66)
at com.sun.squawk.debugger.sdp.SDAListener$Event.Composite(SDAListener.java:286)
at com.sun.squawk.debugger.sdp.SDAListener$Event.dispatch(SDAListener.java:144)
at com.sun.squawk.debugger.JDWPListener$CommandSet.handle(JDWPListener.java:396)
at com.sun.squawk.debugger.sdp.SDPCommandSet.handle(SDPCommandSet.java:59)
at com.sun.squawk.debugger.sdp.SDAListener.processCommand(SDAListener.java:96)
at com.sun.squawk.debugger.JDWPListener.run(JDWPListener.java:132)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.RuntimeException: Klass initialization failed: java.lang.NoClassDefFoundError: java.lang.Object: javax.microedition.io.ConnectionNotFoundException: java/lang/Object.class
at com.sun.squawk.Klass.loadReservedSystemClasses(Klass.java:3773)
at com.sun.squawk.Klass.initBootstrapClasses(Klass.java:3749)
at com.sun.squawk.Klass.(Klass.java:3674)
... 9 more
[Thread SDP] Connection with serversocket://:2900 established

And when I start jdb

jdb -connect com.sun.jdi.SocketAttach:port=2900

In terminal with sdpproxy dots start to go on to forever with no change to jdb terminal.

Synchronizing debug state with VM........................................

Thanks for help
Todor

derek_white
Offline
Joined: 2006-09-08

Hi Todor,

I think you'll have much better luck if you get the latest version of the documentation:

http://fisheye4.atlassian.com/browse/~raw,r=397/squawk/trunk/doc/Debugge...

tcolakov
Offline
Joined: 2009-06-29

Yep, that is much better :) Thanks for your help man - it's working fine now.
Todor

tcolakov
Offline
Joined: 2009-06-29

I forgot to write I'm using the squawk-native and I'm able to compile/run it in delegating mode.

derek_white
Offline
Joined: 2006-09-08

The Debugger documentation is out of date I'm afraid (updating now...)

Replace "j2me" in the command line with "cldc" and you should get farther. Let me know how it goes.

derek_white
Offline
Joined: 2006-09-08

Ok, updated doc in both the trunk and squawk-native builds.

derek_white
Offline
Joined: 2006-09-08

Can you tell us how far you've gotten and what errors you see?

tcolakov
Offline
Joined: 2009-06-29

Hi,

so after I run this command:
java -jar build.jar -prod -o2 -mac rom j2me debugger -- translator

I get this error:

Launcher: Found tools.jar in /home/elf/jdk1.5.0_19/lib/tools.jar, by popping up a level from jre.
Builder.JDK: Looking for JDK in /home/elf/jdk1.5.0_19, popped up a level from jre
Launcher: Found tools.jar in /home/elf/jdk1.5.0_19/lib/tools.jar, by popping up a level from jre.
For vm2c tools.jar=/home/elf/jdk1.5.0_19/lib/tools.jar
PLATFORM_TYPE=DELEGATING
[running rom...]
Exception while running command rom
build failed: 'j2me' module is not a jar/zip file and does not have a 'j2meclasses' subdirectory

Is this somethink I can solve by classpaths?
Todor