cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

J-Link - debugging

GaryHoffman
1-Newbie

J-Link - debugging

Has anyone had any luck attaching a debugger to a syschronous JLink application? I've tried the procedure outlinedin the J-Link User's Guide without success, changing the java command using

jlink_java_command jlink_java_command C:\j2sdk1.4.2_11\bin\java.exe -Xdebug -Xrunjdwp:transport=dt_shmem,address=jdbconn,server=y,suspend=n

Then I launched the command line debugger using: jdb -attach jdbconn

I also tried the Eclipse and NetBeans debuggers without luck. Just wondering if anybody has had success before I spend any more time trying.

thanks,

Gary Hoffman

Solar Turbines Inc

5 REPLIES 5
bfrandsen
6-Contributor
(To:GaryHoffman)

Gary,
I have never tried to get a real debug session running. Instead I just
redirect the standard out and error to a specific file and use simple
System.out.println() statements for debugging.
If you insert this code in your first started J-link application (I have
mine in the one that sets up the menu in ProE) all programs started
afterwards will use the defined file locations.

System.setOut(new PrintStream(new FileOutputStream(
"d:\protrail\jlink_system_out.txt")));
System.setErr(new PrintStream(new FileOutputStream(
"d:\protrail\jlink_system_err.txt")));
System.out.println("Java Runtime: "+System.getProperty("java.home"));

Regards,
Bjarne



"Gary Hoffman" <->
04-07-2008 00:02
Please respond to
"Gary Hoffman" <->


To
-
cc

Subject
[proecus] - J-Link - debugging






Has anyone had any luck attaching a debugger to a syschronous JLink
application?   I've tried the procedure outlined in the J-Link User's
Guide without success, changing the java command using
jlink_java_command  jlink_java_command C:\j2sdk1.4.2_11\bin\java.exe
-Xdebug -Xrunjdwp:transport=dt_shmem,address=jdbconn,server=y,suspend=n
Then I launched the command line debugger using:    jdb -attach jdbconn
I also tried the Eclipse and NetBeans debuggers without luck.   Just
wondering if anybody has had success before I spend any more time trying.
thanks,
Gary Hoffman
Solar Turbines Inc
----------

I use a socket connection instead of shared mem:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8004,suspend=n

Then I connect from netbeans on the specified port(8004). Works flawlessly. When debugging in NetBeans it is also possible to use the "Apply Code Changes" command to update the running code on the fly(in some extent).

Regards
Daniel Oldgren



_____

It's good to know that it can be done. However when I tried attaching the debugger (after setting the jlink_java_command) from both Eclipse and NetBeansI got an error message:

"Failed to connect to remote VM. Connection refused"

I'm using NetBeans 6.1 and Eclipse 3.2. Any ideas ?

Thanks,

Gary Hoffman

Solar Turbines Inc

In Reply to:

I use a socket connection instead of shared mem:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8004,suspend=n

Then I connect from netbeans on the specified port(8004). Works flawlessly. When debugging in NetBeans it is also possible to use the "Apply Code Changes" command to update the running code on the fly(in some extent).

Regards
Daniel Oldgren



_____

Gary,



I do this all the time in Eclipse, also using "transport=dt_socket" . In the past I would use asynchronous mode for debugging.Discovering how to do it in synchronous modehas beena huge timesaver.



I use :

jlink_java_command set PRO_JAVA_COMMAND=javaw.exe -Xnoagent -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

Then:
Select the appropriate project in the Package Explorer
Select the Run menu
Select Debug
Select Remote Java Application
Right Click > New
Within the Connect Tab accept the default for Connection Type: Standard (Socket Attach)
Leave the Host set to "localhost"
Use the default Port: 8000



Similar to Daniels mention of code replacement in NetBeans Eclipse offers "Hot code replace" which also works well with JLink.



Greg Montgomery

John DeereC&CE Division

Got it working - thanks Daniel and Greg !

It works beautifully in Eclipse, even the on-the-fly code changes. The only down side is the realization of how much time I could have saved if I had been using the debugger all along. Especially for all times JLink applications just did nothing - no error messages, just stopped doing anything.

thanks,

Gary Hoffman

Solar Turbines Inc

Announcements
Attention: Creo 7.0 Customers
Please consider upgrading
End of Life announcement here.

NEW Creo+ Topics:
PTC Control Center
Creo+ Portal
Real-time Collaboration