PDA

View Full Version : Qt Creator remote debugging in Linux



sujithh
30th November 2015, 10:22
Hi All,

I was using Qt 5.3.2 (http://download.qt.io/archive/qt/5.3/5.3.2/qt-opensource-linux-x64-5.3.2.run). I never ran gdbserver on the target machine ( for remote debugging ). I tried running qt creator by opening a project, then tried to set break points and then debugged it by pressing F5. After debugging was finished the application was getting launched on the target and it was visible on the display. But when I tried with new version of Qt Creator 3.5 ( http://download.qt.io/official_releases/qtcreator/3.5/3.5.0/qt-creator-opensource-linux-x86_64-3.5.0.run), the problem I see is that debugging happens but nothing comes in the display. Though when I run ps command on the target I do see the output as follows:

-----
1379 root 5088 S sshd: root@notty
1387 root 2980 S sh -c test -f /etc/profile && . /etc/profile;test -f $HOME/.profile && . $HOME/.profile; DISPLAY=':0.0' gdbserver --multi :10000
1391 root 2248 S gdbserver --multi :10000
1394 root 236m S /home/root/qtwidget
1399 root 236m t /home/root/qtwidget
1400 root 3004 R ps
root@mx6q:~#
------

The application which I am trying to debug is qtwidget. With Qt 5.3.2's Qt Creator below was output for command ps

-----
599 root 4932 R sshd: root@pts/0
601 root 3060 S -sh
609 root 5732 S sshd: root@notty
623 root 2796 S sh -c test -f /etc/profile && . /etc/profile;test -f $HOME/.profile && . $HOME/.profile; DISPLAY=':0.0' gdbserver --once --multi :10000
627 root 2144 S gdbserver --once --multi :10000
628 root 223m S /home/root/qtwidget
639 root 2812 R ps
root@mx6q:~#
------

When I run gdbserver on the target and try to connect it with Qt Creator mentioned as per the doc (http://doc.qt.io/qtcreator/creator-debugger-operating-modes.html#remote-debugging), it works fine with version 3.5. What I am not able to understand is:
a) Is running gdbserver on the target, the right approach?
b) Why it worked for Qt 5.3.2 version without running gdbserver?

If anyone can help me understand it would be great help for me. By the way my kit is configured correctly to access target and deploy the application on the target. Let me know if more details required.

Thanks,
Sujith H

ChrisW67
6th December 2015, 21:03
Both are launching gdbserver on your behalf. The second has added the --once option (which seems to conflict with the --multi option). See if the gdbserver options are configurable and try adding/removing the extra option.

sujithh
7th December 2015, 13:34
Yah you are correct. Both are launching gdbserver on the target. The second one uses --once, but I found that it launches the application on the target and I am able to see the application displayed on the device. But with only --multi ( the first case ) that is not happening. I am wondering what could be the root cause for this? Or is it like we have to run gdbserver on the target and then connect to it using qt creator. Using this approach it all works fine. If I don't run gdbserver manually on the target, and allow Qt Creator to do it by itself, I cannot see application on the device. Let me know if more clarification is needed to understand the problem?

sujithh
9th December 2015, 11:15
Is it a bug, that 2 process get spawned while trying to debug? When kill the process which is in the "t" state, the application gets displayed on the screen.