Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
__shuffle
Posts: 2
Registered: ‎06-28-2012
My Device: Playbook

Launching debugger without IDE

Hello,

 

I'm attempting to do some on-target debugging of an application built using the QNX toolchain directly (i.e. not using the QNX Momentics IDE) and I'm having trouble locating documentation on what to do.

 

The "A quick overview of starting the debugger" docs look straightforward; they say:

 

If you're debugging remotely, set the target:
target qnx com_port_specifier | host:smileytongue:ort | pty

 

But what should the target be? I guess 'host' should be the IP address of the USB network device but port is a bit of a mystery. The docs for "Setting the Target" say:



The devc-pty manager must be running on the machine that's running pdebug, and a ptyp/ttyp pair must be available.

 

Uh, OK? Digging into this rabbit hole, there's barely any info on either of those commands except to say they must be run as root. The same "simply set the target" sentiment is echoed in several other places such as "Starting your program" but all these docs appear to be missing this critical step.

 

Is there any complete set of docs which goes through how to debug a program?

 



 

BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Launching debugger without IDE

[ Edited ]

The debugger (pdebug) listens on port 8000.  You can avoid the pty portion with that.  More information on using targets with gdp can be found in the gdb docs here.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Contributor
__shuffle
Posts: 2
Registered: ‎06-28-2012
My Device: Playbook

Re: Launching debugger without IDE

Hi MSohm,

 

"You can avoid the pty portion with that"

 

Are you sure? This page on pdebug claims:

 

To use the pdebug agent, you must set up pty support (via devc-pty ) on your target.

 

That page also claims you can start 'pdebug' three different ways, but helpfully doesn't say what any of those methods are. I can't find any actual info on how to do this. It's certainly not running on the target now, as there's nothing listening on port 8000. The link you've posted doesn't seem relevant, either?

 

 

 

 

 

 

BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Launching debugger without IDE

devc-pty is running on the device, you don't need to start it.  Note that those docs refer to specifically to the QNX Neutrino Real Time Operating System (copied largely unchanged from QNX's main website).  It is the underlying OS being used, but you won't have root access to perform the admin tasks mentioned there.  Those docs are there mainly for architectural reference and still need some cleaning up to apply to PlayBook OS/BlackBerry 10.

 

Moving back to the PlayBook OS / BlackBerry 10, you will need to have blackberry-connect running on your computer and connected to the PlayBook or Dev Alpha before the debugging tools are made available by the device.  You can find out more information about that process here:

 

How to use blackberry-connect to Enable SSH Access

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Contributor
iiordanov
Posts: 5
Registered: ‎05-15-2012
My Device: Playbook

Re: Launching debugger without IDE

Hello!

 

I would like to debug a binary copied over to a Blackberry 10 device. Based on this discussion and some reading, I ran pdebug 8003 on the Blackberry 10 device, it backgrounded, and netstat -an showed that something is listening on port 8003. Also, connecting with netcat (/bin/nc) from a remote machine establishes a successful connection.

 

However, I cannot get gdb to work properly with the remote target. Here is what happens:

 

(gdb) target remote tcp:169.254.0.9:8003
Remote debugging using tcp:169.254.0.9:8003
file /bin/ls
run /
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
warning: Invalid remote reply: timeout

On a local target, as opposed to a remote target, this is what should and does happen:

(gdb) file /bin/ls
Reading symbols from /bin/ls...(no debugging symbols found)...done.
(gdb) run /
Starting program: /bin/ls /
[Thread debugging using libthread_db enabled]
accounts  dev          initrd.img.old  lost+found  proc       srv    var
bin      etc          lib          media      root       sys    vmlinuz
boot      home          lib32          mnt      sbin       tmp    vmlinuz.old
cdrom      initrd.img  lib64          opt      selinux  usr

Program exited normally.
(gdb)

 

Any help is appreciate, *especially* help in exactly how to connect to the remote target and how to issue commands.

 

Many thanks!

Iordan Iordanov

New Contributor
iiordanov
Posts: 5
Registered: ‎05-15-2012
My Device: Playbook

Re: Launching debugger without IDE

And naturally, a couple of minutes later, I did find the documentation related to debugging, and realized that I have to be running the gdb binary distributed with the blackberry NDK.

 

The docs:

http://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.neutrino.prog/topic/using_gdb_...

 

$ /path/to/bbndk/host_10_0_9_404/linux/x86/usr/bin/ntoarm-gdb
GNU gdb (GDB) 7.4 qnx (rev. 728)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-unknown-nto-qnx6.5.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) target qnx 169.254.0.9:8003
Remote debugging using 169.254.0.9:8003
Remote target is little-endian

ETCETERA.

 

I hope people find this helpful!

 

Cheers,

Iordan