Valgrind in Eclipse Cannot Connect to X Server - eclipse

I am using Valgrind to debug an OpenCV application. My application often stops with Segmentation Fault error. I thought this is related to memory, so I debug it using Valgrind in Eclipse. Unfortunately, when I run the valgrind profile in Eclipse, it returns : cannot connect to X server and valgrind stops executing my application.
According to this post, I have set DISPLAY variable to 0.0, but same behavior still happened.
I also tried installing xorg and openbox, but still nothing happened.
The application runs until before I called "cvNamedWindow(WINDOW_TITLE, CV_WINDOW_AUTOSIZE);". On executing the line, Valgrind outputs : cannot connect to X server and then stops.
Based on my previous experience with Valgrind, I expect it will execute the application, and exits when memory problem happened/application terminated, because that is what happened if I run the application normally (Segmentation Fault). Also, thats how I debug multithreading in in an application, previously.
Any help is appreciated. Thanks!

I tried running the application with valgrind, root privilege in terminal:
`sudo valgrind --tool=memcheck <path-to-application>/myapp`
and it works. Seems like the Eclipse plugin do not have root access to X server/display. The problem is solved

Related

PTP fails to connect to debugger

I am writing this email to ask for help in setting up a debugging environment for openMPI-based applications. Currently, I am struggling with a problem that is hampering me from continuing the work. The problem is very similar to what has been posted on the stackoverflow (See: Link). Its symptom is that the debugging process hangs and the parallel debugging perspective shows a “Operation in progress…” message. It is caused by an error, namely “Cannot connect to debugger”. Meanwhile, an error message “getaddrinfo: Undefined error: 0” also appear in the debugging console.
I did some search on the internet and I found an instruction for trouble shooting (See: Link). I already verified that:
Launch script could work: non-debug launch works fine
Correct number of “sdm” processes
Routing file can be created
But I could not find one “sdm” process with argument “—master”.
Currently, I use the following software components with indicated versions:
Parallel Tools Platform including PTP Parallel Language Development Tools, etc. (9.0.1.201509091505)
ptp-sdm-9.0.0 (org.eclipse.ptp.macosx_9.0.0.201506101404)
GNU gdb (7.10)
The OS I am using is OS X Yosemite (10.10.5). And I run application on the local machine.
Did anyone encounter the similar problem and happen to know how to fix it? I would appreciate any hint or help from you.
I've got the similar problem under Ubuntu 16.04.2, but just “Cannot connect to debugger”. My solution is to run Eclipse with superuser privileges, i.e. sudo ./eclipse. Hope it is useful.
I found something that might be the cause. I ran Eclipse from a shell terminal so that I could see more text/log output. Then under Eclipse -> Preference -> Parallel Tools -> Parallel Language Development Tools I enabled the Show output from commands, and this is what I see in the parent shell (not within Eclipse):
Cleanup: rm -f routing_file
submit-interactive-debug: ac5df46b-c4f2-438a-9565-9b26818e880d: perl /Users/<username>/.eclipsesettings/rms/MPICH2/start_debug_job.pl mpiexec -np 4 /Users/<username>/.eclipsesettings/sdm --port=51347 --host=localhost --debugger=gdb-mi
SDM Master: /Users/<username>/.eclipsesettings/sdm -master --port=51347 --host=localhost --debugger=gdb-mi
SDM Master: sdm [--debugger=value] [--debugger_path=path]
SDM Master: [--proxy=proxy]
SDM Master: [--host=host_name] [--port=port]
SDM Master: [--master]
SDM Master: [--server=rank]
SDM Master: [--generate_routes=list]
SDM Master: [--routing_file=path]
SDM Master: [--debug[=level]]
This suggests that one of the argument inputs to sdm is invalid, and indeed I see that it is receiving -master instead of --master flag.
I tried to open the perl script at /Users/<username>/.eclipsesettings/rms/MPICH2/start_debug_job.pl but it's correct there, and any changes made only appear within Eclipse's output console, not the parent shell I ran eclipse from. Somewhere sdm is being sent the wrong -master flag, and maybe that is part of the problem. Unfortunately I don't have an answer beyond that.
Update: I have submitted a bug report: https://bugs.eclipse.org/bugs/show_bug.cgi?id=521975

Eclipse Juno- Suddenly “cannot run program 'make' : unknow reason”

I'm using Eclipse JUNO for developing C applications. It runs on Ubuntu 12.04 inside a 3-CPU, 1GiB RAM virtual machine.
Everything works perfectly, but sometimes, I cannot build my application any more and the following error occurs:"cannot run program make; unknown reason".
Any idea on how to fix this?
Apparently this error is due to low memory conditions. It mostly occurs after searching in files within Eclipse (a search that returns a large result set). If the error occurs again:
Re-start Eclipse and try again
If it does not fix the problem, you need to completely reboot the OS

Eclipse debugger stops working randomly

I have been working on a project that requires rigorous debugging at each step and I notice that my debugger just randomly stops working from time to time and does not respond to any of the breakpoints.
I tried restarting eclipse and unplugging my device over and over. Any particular reason this might be happening? Its extremely frustrating and I couldn't think of a better place to post this query.
Many a thanks in advance!
I know this is an old question. But I had that eclipse suddenly stopped working, i.e. died before even executing one line. I restarted VM and eclipse multiple time. Then I stumbled here. Thank you, it got my mind thinking.
For all major issues with eclipse, not loading, freezing or debugger fuck up (that is not because of your code :D ). Try the following line:
./eclipse -clean -clearPersistedState -refresh
First I would make sure your eclipse is not running out of heap space memory. If necessary increase the heap memory using the -mx Java command line flag. Running out of memory can cause various instability problems such as the one you describe.
-xms is the start memory (at the VM start), -xmx is the maximum memory for the VM
eclipse.ini : the memory for the VM running eclipse
jre setting : the memory for java programs run from eclipse
catalina.sh : the memory for your tomcat server

Eclipse does not find Valgrind

I installed Valgrind on SUSE Linux SLES 11SP2 under my home directory and added it to the path. I then installed eclipse Juno for C/C++ Service Release 2 Build id: 20130225-0426 and installed the Valgrind plugin.
When I try to create a profile configuration with Valgrind I get an error message:
"[Valgrind Options]: Couldn't determine version of Valgrind", and though it allows me to make the configuration it prevents me from proceeding by greying out all buttons except for the close button.
I know I am missing something trivial like defining the location of the Valgrind executable in eclipse, but I was unable to find it, not in the project properties nor in the window preferences.
I will appreciate your help.
Ok, I figured it out.
I moved the Valgrind installation to a new shared location, and tried it out with a new computer (same architecture).
It did not affect the original computer I installed it on, but Valgrind had a problem with the new one, as indicated in the README (and I meanwhile forgot):
“Important! Do not move the valgrind installation into a place different from that specified by --prefix at build time. This will cause things to break in subtle ways, mostly when Valgrind handles fork/exec calls.”.
This caused Valgrind to break when run standalone with the message:
“valgrind: failed to start tool 'memcheck' for platform 'amd64-linux': No such file or directory”,
however when running Valgrind from eclipse it probably translated it to the message:
"[Valgrind Options]: Couldn't determine version of Valgrind".
In short: Do not move the Valgrind installation but re-install it. And this message from eclipse indicates that something bad happened with the installed Valgrind and not that it cannot find it.
I am getting the same error but its not caused by the explanation you have given.
You can get this error if you are using valgrind on mac os x because valgrind is usually not installed in the directory eclipse is looking for. In order to fix the issue on mac, you need to make a symbolic link to the valgrind location by
typing ln -s valgrind_location /usr/bin/valgrind. Note this differs from what are in the directions on eclipse's site http://wiki.eclipse.org/Linux_Tools_Project/Valgrind/User_Guide. For some reason they have the call backwards on their site. Once I made this correction valgrind worked correctly from within Eclipse.
So on macs at least the error that it can't determine the version of valgrind at least matches up with eclipse not being able to find the file.

Memory allocation for external process in JBoss

We are using ImageMagick launched by a JBoss EJB by the way of im4Java, to produce image files. im4Java is an Java interface to imagemagick, launching external process with java.lang.ProcessBuilder. After few successfull runs, we are blocked by a :
java.io.IOException: Cannot run program "/usr/local/bin/convert": java.io.IOException: error=12, Cannot allocate memory
It seems not to be an ImageMagick issue, because if we launch the same process from command line, it runs perfectly. But more a Jboss memory allocation for an external process.
Any idea ?
Finally solved, but maybe not the best way. Indeed , we have used the solution of the overcommit_memory variable in Linux indicated by Ivan, and no problem any more. But we are not sure changing that this memory global settings would not affect the whole behavior of the system later, as it seems to allocate a lot more memory. Hopefully we do not run so often imagemagick from java code, so memory is released once imagemagick did his job.