Reply to topic

Debugging does not work properly

marmsoler
Registered Member
Posts
10
Karma
0

Debugging does not work properly

Thu Jun 28, 2018 4:29 pm
Hello,

I'm trying to import okular from git into KDevelop with cmake. Building the project with Ninja an Llvm works fine, but when I try to debug the project, lldb stops automatically without showing the window. When I set a breakpoint in the first line of the main, I'm able to go through step by step for one line. At the line with "QApplication app(argc, argv);" the debugger stops. In the debugging window is the following Message:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-martin'
qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.
*** Normal beendet ***

While debugging the breakpoints in the symbol column are not visible. Also when the debugging ends, the breakpoints are not visible but still are present which I see in the breakpoints tab.

I already tryed to build the project with gcc (-DCMAKE_CXX_COMPILER=g++) and debugging with lldb (did not find the option to change to gdb), but it does not change anything.

Best regards,

Martin
User avatar scummos
Global Moderator
Posts
1137
Karma
7
OS
I have heard this issue before. I have no idea what causes it though, it seems gdb changes something about the environment which makes graphical applications not work on some systems ... very strange. Does it work in gdb from command line?

Which kdevelop do you use, distro version or AppImage?


I'm working on the KDevelop IDE.
marmsoler
Registered Member
Posts
10
Karma
0
scummos wrote:I have heard this issue before. I have no idea what causes it though, it seems gdb changes something about the environment which makes graphical applications not work on some systems ... very strange. Does it work in gdb from command line?

Which kdevelop do you use, distro version or AppImage?

I use KDevelop Version 5.2.3. Its antergos distro version

I found out, that I can also set a breakpoint in shell.cpp which works with qtcreator, but in other files it does not work. When I make an edit in shell.cpp I see that in the compiled version, when I change another file it is not included in the compiled version.

Creating a breakpoint with gdb command line in shell.cpp is possible can step and run, but other files gdb does not find so I'm not able to set a Breakpoint there.
User avatar scummos
Global Moderator
Posts
1137
Karma
7
OS
Did you compile your application with debug symbols?


I'm working on the KDevelop IDE.
marmsoler
Registered Member
Posts
10
Karma
0
scummos wrote:Did you compile your application with debug symbols?

Yes, gdb and lldb work fine in the main and in shell.cpp
marmsoler
Registered Member
Posts
10
Karma
0
Do you know what I can try to solve this problem?
ashwind
Registered Member
Posts
2
Karma
0
Though I am late, I am writing this solution for others who might find this useful. I stumbled upon exactly same problem recently while importing okular from CMakeLists.txt file in qtcreator. I solved it simply by changing the working directory in projects tab of qtcreator. Just set the working directory one level above the shell directory. The problem occurs because qtcreator or in your case Kdevelop just works in the shell directory and not other directories. So setting working directory one level up just works. Changes are replicated properly and breakpoints are triggered.
ashwind
Registered Member
Posts
2
Karma
0
In qtcreator: Projects->Run
Previous working directory:
kde/src/kde/kdegraphics/okular-Desktop-Debug/shell

Set it to:
kde/src/kde/kdegraphics/okular-Desktop-Debug

And it should work

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], claydoh, DarkFoss1, davis, doranwen, Google [Bot], mperryman, Sogou [Bot], vinnywright