How to have change debugger setting in Eclipse for a launch file - eclipse

His,
I have been trying to find out why starting DevMode with Debugger from Eclipse was so slow and noticed in the list of processes on my machine the following line:
/usr/lib/jvm/jdk1.6.0_14/bin/java -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:47248 ...
Apparently the application is suspended to wait until the debugger is connected which takes about 2 minutes. I would like to set "suspend=n". Does anyone know where I could set this directive. The vm section in Eclipse launch configuration is empty and if I paste the updated debugger config there is a error telling that the values are entered twice.
As I understand it, Eclipse takes this config from somewhere and inserts it automatically when I run launch configurations in debugger mode.
Thanks

You can't remove that parameter and, if you could, it wouldn't make a difference. When you connect a new browser to the GWT OOPHM instance it has to compile the entire project for use in development mode. This is what takes time, not waiting for the debugger to attach.

Related

How to configure AND SAVE changes for Source-Look-up for the "Connecting debugger to port xxxx" item launched automatically by Eclipse?

Since I upgraded to Eclipse 2022-06 I noticed that a remote application debugger is automatically launched my the Eclipse m2e plugin when I launch a JVM in debug mode (in my case this happens as a result of a tomee-maven-plugin...).
This seems to be new feature of Eclipse m2E: https://github.com/eclipse-m2e/m2e-core/blob/master/RELEASE_NOTES.md#automatically-launch-and-attach-remote-application-debugger-when-maven-plug-in-starts-a-forked-jvm-that-waits-for-a-debugger.
The problem (a very big inconvenient) is that I cannot change the default Source Lookup for that remote application debugger. It's empty every time I have to re-start the debugging session.
How could I
a) save these changes to the Source Lookup
or
b) prevent this automatic launch from happening ?
Thank you.

Eclipse RCP Launcher ignores exit code EXIT_RELAUNCH

I have an RCP app which exposes the menu contribution for OpenWorkspaceAction which launches the workspace chooser dialog. I launch it as a stand-alone app (i.e. not from the IDE), use the workspace switcher to select another workspace, and the app exits and does not restart again.
My app runs application org.eclispe.ui.ide.workbench, which uses IDEApplication for its IApplication implementation. To see what's going on, I created my application with an IApplication instance that simply extends IDEApplication and duplicates the code from IDEApplication#start in the subclass. I verify that when restarting after selecting a new workspace, it returns exit code EXIT_RELAUNCH. I also verified that the system property eclipse.exitdata is set as expected, i.e. it has the original launch args with the value of -data replaced with the new workspace location. I also see that system property eclipse.exitcode is set to 24. This is all done in OpenWorkspaceAction, and I'm just verifying it before the app exits.
This seems to indicate that the launcher executable is defective. It comes from the eclipse IDE, I presume, as I selected the box to use native launcher artifacts in the product editor, and then I build the product in tycho using the tycho-p2-director plug-in. But I tried replacing the launcher executable with the launcher from my IDE (which handles relaunch properly), and also with the launcher executable from an RCP app made by someone else, which also handles relaunch properly.
I don't know where to go from here. All the system properties are being set properly to cause the launcher to re-launch, so it really seems to be a problem with the launcher. But then replacing the launcher with one that works in other apps doesn't help. I also tried replacing the launcher and native GTK launcher plug-ins with ones from the IDE and working RCP app. Nothing I do makes it relaunch.
I modified the exit code in IDEApplication.start() to return EXIT_RESTART, and the app does re-start. But then it doesn't respect the exit data, because it re-starts with the same args used originally, without replacing the -data value.
My app is based on Luna, and I tried replacing the launcher artifacts with files from from Luna as well as Mars installations. I'm running on CentOS 6.7
EDIT: to clarify what's happening, the launcher executable exits when IDEApplication returns EXIT_RELAUNCH from the start() method. The launcher program is supposed to invoke the JVM again with the args found in system property eclipse.exitdata, but it terminates execution instead. If start() returns EXIT_RESTART, the launcher invokes the JVM again, but with the original command arguments, without a new value for -data, as it's designed to do when it sees that exit status. So the problem is that the launcher terminates instead of re-launching the JVM when exit status is EXIT_RELAUNCH.

How can i know an application running in debug or run mode in eclipse

I do start/stop my application more than 15 to 20 times every day. Every time i start app in debug mode only. But some times the debug(break points) would not work, then i will get confuse that is my app running in debug or run mode.
Do you have any idea to find out.
Even some times, I started my app in debug mode and it runs in debug mode for some time, suddenly works as run mode, it would not consider my break points. so, if i restart my app in debug mode only, i can do debug again.
While the application is running, open the Debug view in Eclipse. If all that you see in the tree is a path to your Java distribution under the project name then you are in run mode. If you are in debug mode then you will see the above information plus all the threads that are currently running in your application.
When you launch your application, the mode into which it runs is indicated in the "server" panel, like this :
or
Sometimes, when the debug mode doesn't work(for example it can't start), I remove all the break points, then I set them again.
Make sure what you run 1st.
Debug mode should display you code with variables in debug tab in eclipse while program is running.
Is your application a standalone application or a server hosted application which you remote debug? In both cases as soon as the debugger is connected to whatever local or remote process the signs left to your debuger icon get enabled. Those are in a row a few arrows (Step back, Step into, Step over) a green Arrow for Resume, a Suspend Icon, one for Stop and one for Disconnect.
If you open the debug View (Window->Show View->Other... type in "Debug") you should as well see if your Debugger is currently connected to any process.

No Java console output in Eclipse; works with PyDev

I have both a Java and a PyDev project in one workspace. When I run the PyDev project (either the main script with Run > Run As > Python Run or its associated unit test with Python unit-test), the console output looks fine. However, when I switch to the Java project, open the main class, make sure the cursor focus is in the main class, and run it with Run > Run as > [my run config], no output shows up in the console, stdout or stderr. I've tried with Run/Debug > Console > Fixed width console checked and unchecked, similarly for Limit console output. "Allocate console" is check in [my run config].
I have tried redirecting output to a file in my run configuration, but the log file is empty after a run; thus, I suspect stdout/stderr are being trapped somewhere. I suspect that it is PyDev causing the issue because when I run the Java project, this exception reliably shows up about 6 times in the error log:
Launch shortcut 'org.python.pydev.debug.ui.launchShortcut.python.unittest' enablement expression caused exception. Shortcut was removed.
stacktrace:
org.eclipse.core.runtime.CoreException: No property tester contributes a property org.python.pydev.debug.ui.python_type to type class org.eclipse.ui.part.FileEditorInput
at org.eclipse.core.internal.expressions.TypeExtensionManager.getProperty(TypeExtensionManager.java:123)
at org.eclipse.core.internal.expressions.TestExpression.evaluate(TestExpression.java:96)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateOr(CompositeExpression.java:68)
at org.eclipse.core.internal.expressions.OrExpression.evaluate(OrExpression.java:21)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
at org.eclipse.core.internal.expressions.AndExpression.evaluate(AndExpression.java:29)
(... and so on)
Additionally, printing from a Java program in a different workspace that only has Java projects works fine.
I tried uninstalling PyDev and restarting Eclipse, but I'm still having the same issue. I still have those errors after reinstalling PyDev, too.
Has anyone run into this issue before, or know of a way to fix it?
Well, I feel like an idiot; turns out, I had redirected stdout/err to a log file that I had long since forgotten about, and stuck somewhere difficult to find.
I ran into the same problem so I did some research. Seems like there was an old issue (2006-2008), but it was resolved by adding an option to the launch configurations to allocate a console. This is available from the Run -> Debug Configurations menu option, Common tab. Perhaps this is simply unchecked after the PyDev install?
If this is a new bug, there were two possible workarounds suggested:
Set up debug launch configuration that uses remote debugging instead of local debugging.
Use a buffered writer to System.out.
Here are the threads for reference:
Eclipse bug - https://bugs.eclipse.org/bugs/show_bug.cgi?id=122429
Workaround thread - java.io.Console support in Eclipse IDE

Whats the shortcut to Debug in PyDev using Eclipse

The shortcut key is F11 to start debugging. But issue is that I have to be on that file and then hit F11 to start debugging.
Eg.
my file to launch the application is "launch.py" and "example.py".
example.py is open in the editor whereas launch.py is not.
Now, if I hit F11 it will try to launch the application using "example.py" and terminates due to error (as expected).
So then I have to open the "launch.py" in the editor and then hit F11 to start debugging the application.
Is there any neater way to configure the debugging, so that it starts the application in single hit/key?
Edit: example.py is some other file (some module). It does not launch the application.
As this PyDev Eclipse Tutorial suggests:
After the first run, if you type Ctrl+F11, the last file ran is re-run. Or, if you type just F11, a debug session is started with your last run. Let's test this...
Note: This behavior changed in Eclipse 3.3 -- but it's generally recommended to restore it in the preferences at: window > preferences > Run/Debug > Launching and set the Launch Operation to Always launch the previously launched application.
This tutorial will always consider this as the default option.
So, did you have this option selected?
If you have launch at least once launch.py, then you can re-launch it easily.
Although this isn't strictly an answer to what was asked initially, it might help someone looking here that had the same problem as me...
I'm a Java developer mainly, so have the Java view open almost all the time. However, sometimes I want to run some python file to test something (or just create a quick python script, and run it)...
In the Java editor, if the current class has a main(String[] args) method, I run it with (and popup the dialog to ask me what exactly I'd like to run in the middle)
alt+shift+x, j
Unfortunately, that doesn't work in the Python view, and I've not found a similar solution - it just asks me if I'd like to run it as a Java app... however, as the VonC says, you can run the last run thing (provided you've set the preferences accordingly) with
ctrl+f11
and this seems work well with python run configurations too.
But... What if the last thing I ran was a Java program, but I now want to run the active .py file? Previously, to run the .py file, I'd have to go digging through the buttons on the toolbar with the mouse, and I tend to prefer keyboard shortcuts...
Solution! So, finally I come to the actual useful bit of this answer - I just discovered by accident (typing Ivan's suggested shortcut, but missing!), it appears that
f9
will run the currently active python file.
Hope that helps someone get just that little bit faster...
I use CTRL+SHIFT+F9 to relaunch the previous debug configuration in Pydev.