How can I remote debug my rcp application?
Asked Answered
T

3

6

Because my RCP eclipse application fails when run outside of eclipse, but works correctly when running inside of eclipse, I am attempting to use eclipse to remotely debug my application as it's running outside of the eclipse environment.

I am using 32 bit Eclipse 3.6.1 on a 64 bit Windows 7 machine. I am using 32 bit Java 1.6 update 37. I use the Eclipse Product export wizard to package the app, and I end up with an eclipse.exe. I have created a Remote Debug Configuration and set it to use port 8765 (random number). For debugging purposes, I start the app from the command line using this line:
eclipse.exe -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:8765

Depending on whether I am attaching or listening via my Eclipse debugger, I will add the server=[y/n] option to this command line but it seems not to make any difference.

For the configuration Connection Type I have tried both Standard (Socket Listen) and Standard (Socket Attach). When I try Socket Listen, my debugger will start listening - "Waiting for vm to connect at port 8765", but when I start my app through the command line, the app starts fine but the debugger never attaches.

When I try Socket Attach, I start the app first using the command line, then when I attempt to attach using eclipse, I get the message "Failed to connect to remote VM. Connection refused"

I've tried all the various combinations of address: localhost, 127.0.0.1, and my local IP address. I get the same result each time.

Thanks for any help!

Toadstool answered 14/11, 2012 at 19:5 Comment(0)
H
10

You are missing the -vmargs parameter. Try "eclipse.exe -vmargs -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:8765"

I was searching for the same thing and found the answer in this helpful post http://blog.ankursharma.org/2010/05/remote-debugging-eclipse.html

Hic answered 10/5, 2013 at 23:23 Comment(2)
Wow it's finally working! Thanks a lot for your help; I'd just about given up on this technique.Toadstool
I also needed the additional server and suspend args seen on Ankura's blog: -vmargs -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044Capture
W
1

Another way of debugging your RCP application is to launch it with "-console" "-consolelog". This gives you the osgi console, where you can examine which bundles did (not) start, the services that are exported etc. Type help to get a list of commands available.

Willwilla answered 27/11, 2012 at 1:44 Comment(2)
I appreciate your reply. I modified my command line to include the options you suggested. Checking the status of the bundles and services return values like "lazy", "active", and "resolved", and I currently don't understand what that means, so it sounds like I have some research ahead of me. From what I can see, it all looks normal.Toadstool
You can use the diag command to see if your bundles' dependencies where resolved correctly. If so, try to start the bundles with the start command.Willwilla
A
1

this is better:

http://exploreeclipse.blogspot.com/2016/05/eclipse-rcp-remote-debugging.html

Defining the server and suspend arguments

$./TOS_BD-macosx-cocoa -vmargs -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8989
Astonishing answered 12/4, 2018 at 14:5 Comment(1)
While this code snippet may solve the question, including an explanation helps to improve the quality of your response. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.Herwick

© 2022 - 2024 — McMap. All rights reserved.