Debug QNX target using Ubuntu host and gdb
Asked Answered
T

1

5

This is a question from an absolute beginner.

I have a Ubuntu 14.04 host, gdb 7.7.1 installed on it and a project cross-compiled for qnx. I also have a qnx target, that I want to debug my app on.

The instructions on the internet tell me to use either gdb on PC + gdbserver, but I don't have gdbserver installed and I don't think I can compile gdb for qnx. I have something called pdebug. Instructions for qnx tell me that gdb has to have the target qnx command, that it clearly does not posess.

Here's what I've done:

# Assuming that 255.255.255.255 is the target ip and 1234 is the port
# On target
pdebug 1234

On host
gdb
gdb> target remote 255.255.255.255:1234

Then I got a couple of warnings and the gdb> again, as it was normal.

I managed to install a connection between my host and target, but when I hit run in gdb, it tries to run my local copy of the app, instead of running it on target.

Tyche answered 1/3, 2017 at 15:29 Comment(0)
T
11

There is no way one can debug qnx apps with Ubuntu's gdb.

You have to use qnx's gdb built for the exact this purpose, that is able to run target qnx and many other commands you will need. You have to use qnx's gdb on your host and pdebug on your target and run the same commands you ran:

# on target
pdebug 1234

# on host
ntoarm-gdb
(gdb) file MyQnxApp
(gdb) target qnx 255.255.255.255:1234
(gdb) upload MyQnxApp /mnt/myWorkingDir/MyQnxApp
(gdb) b main
(gdb) r

Then you will see the info about your connection:

Remote debugging using 255.255.255.255:1234
Remote target is <your_endianness>

See this detailed instructions.

Tyche answered 1/3, 2017 at 15:29 Comment(2)
Could you please tell us what to do if the MyQnxApp is already present in the target? i.e. I do not want to upload the exe, rather just reference its location on the targetChickaree
Is there no way to build gdb to support QNX? Or can only QNX do it? (I'm tired of using QNX's gdb 8.3 and want to upgrade :) )Micromillimeter

© 2022 - 2024 — McMap. All rights reserved.