I'm using an Allwinner A33 (Quad core ARM) development kit from Olimex. It is running an Ubuntu 16.04 root filesystem. My host PC is running 64-bit Kubuntu 16.04. I'm using GCC 6.1.1 (Linaro build) as cross-compiler and QT v5.5. Only pre-build .deb packages via the package manager is used. Nothing was build myself from source.
I have tested a simple QT application (Main window with one label, no other application code) using the scenarios described below. Of all the scenarios it is only debugging from QT Creator that is causing a problem:
I ssh into the remote target with X11 forwarding (-X). The main window appears on my host PC and functions correctly, even though these warnings are present:
libEGL warning: DRI2: failed to authenticate
QXcbConnection: XCB error: 1 (BadRequest), sequence: 380, resource id:
102760451, major code: 154 (Unknown), minor code: 1
QXcbShmImage: shmget() failed (38) for size 480000 (400x300)
1) Launching the application manually from the command line on the remote target
2) Launching a command line gdb session directly on the remote target (gdb) info threads
Id Target Id Frame
1 Thread 0xb6ff1220 (LWP 984) "DemoApp" 0xb635da50 in poll () at
../sysdeps/unix/syscall-template.S:84
2 Thread 0xb3c2c440 (LWP 988) "QXcbEventReader" 0xb635da50 in poll ()
at ../sysdeps/unix/syscall-template.S:84
3 Thread 0xb0c42440 (LWP 989) "llvmpipe-0" __libc_do_syscall () at
../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
4 Thread 0xb0442440 (LWP 990) "llvmpipe-1" __libc_do_syscall () at
../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
5 Thread 0xafc42440 (LWP 991) "llvmpipe-2" __libc_do_syscall () at
../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
6 Thread 0xaf442440 (LWP 992) "llvmpipe-3" __libc_do_syscall () at
../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
3) Running GDB server on the remote host and connecting to it from the host PC, using command line gdb
Remote target
$ gdbserver :5555 DemoApp
Process DemoApp created; pid = 4265
Listening on port 5555
Remote debugging from host 192.168.7.2
libEGL warning: DRI2: failed to authenticate
Detaching from process 4272
QXcbConnection: XCB error: 1 (BadRequest), sequence: 380, resource id:
10485763, major code: 154 (Unknown), minor code: 1
QXcbShmImage: shmget() failed (38) for size 480000 (400x300)
Host side
Contents of .gdbinit
set debug-file-directory /opt/arm-linux-gnueabihf-rootfs/usr/lib/debug
set sysroot /opt/arm-linux-gnueabihf-rootfs
target remote 192.168.7.1:5555
$ /opt/arm-linux-gnueabihf-v6.1.1/bin/arm-linux-gnueabihf-gdb DemoApp
Reading symbols from DemoApp...done.
0xb6fd7a40 in _start () from /opt/arm-linux-gnueabihf-rootfs/lib/ld-
linux-armhf.so.3
(gdb)
(gdb) continue
Continuing.
Cannot parse expression `.L966 4@r4'.
warning: Probes-based dynamic linker interface failed.
Reverting to original interface.
(gdb) info threads
Id Target Id Frame
1 Thread 999.999 "DemoApp2" 0xb635da50 in poll () at
../sysdeps/unix/syscall-template.S:84
2 Thread 999.1001 "QXcbEventReader" 0xb635da50 in poll () at
../sysdeps/unix/syscall-template.S:84
3 Thread 999.1002 "llvmpipe-0" __libc_do_syscall () at
../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
4 Thread 999.1003 "llvmpipe-1" __libc_do_syscall () at
../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
5 Thread 999.1004 "llvmpipe-2" __libc_do_syscall () at
../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
6 Thread 999.1005 "llvmpipe-3" __libc_do_syscall () at
../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
4) Launching the application from within QT creator using the 'run' button works correctly. Process list on remote target:
978 pts/8 S 0:00 dbus-launch --autolaunch
e0b04e02d3bd48f29553fcf6f7149394 --binary-syntax --close-stderr
979 ? Ss 0:00 /usr/bin/dbus-daemon --fork --print-pid 5 --print-
address 7 --session
1033 ? Ss 0:00 bash -c test -f /etc/profile && . /etc/profile;test -f
$HOME/.profile && . $HOME/.profile; DISPLAY=':10.0' /DemoApp ''
1034 ? Sl 0:00 /DemoApp
5) Debug session from within QT Creator The only scenario that does not work is launching remote debugging from within QT Creator itself. There are now 7 threads running in QT Creator instead of 6 as in the previous scenarios.
Thread #1: DemoApp2: _dbus_read
Thread #2: DemoApp2: __libc_fork, __libc_do_syscall <<-- Extra
Thread #3: QXcbEventReader: poll
Single stepping and variable watching works correctly. The main window isn't created. The debugger hangs at MainWindow::MainWindow(QWidget *parent), entering ui->setupUi(this) --> retranslateUi() --> MainWindow->setWindowTitle()
The Application output in QTCreator:
Debugging starts
Listening on port 10000
Remote debugging from host 192.168.7.2
Process /opt/cellair/DemoApp created; pid = 4300
Probes-based dynamic linker interface failed.
Reverting to original interface.
libEGL warning: DRI2: failed to authenticate
Note: These errors doesn't appear anymore: QXcbConnection: XCB error: 1 or QXcbShmImage: shmget() failed (38)
Process list on remote target
877 ? Ss 0:00 bash -c test -f /etc/profile && .
/etc/profile;test -f $HOME/.profile && . $HOME/.profile;
DISPLAY=':10.0' gdbserver --multi :10000
878 ? S 0:00 gdbserver --multi :10000
881 ? Sl 0:00 /DemoApp
888 ? t 0:00 /DemoApp
Two copies of the application is running on the remote target.