0

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!

Community
  • 1
  • 1
bonchenko
  • 567
  • 1
  • 9
  • 21

1 Answers1

0

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

bonchenko
  • 567
  • 1
  • 9
  • 21