Linux Debugging

Hi,
I have ubuntu 14 runing on my Host.
I am loking for a debugger for the cuda progrems.
Not the winwos debugging.
someone knows whare can i find it?

You might find nsight eclipse to do what you want:
[url]https://developer.nvidia.com/nsight-eclipse-edition[/url]

This was intended to add CUDA development and debugging support, so it combines an existing IDE with debugging which includes CUDA. If you want to add remote debugging nsight eclipse also has this.

how should I connect the jetson to the pc, so the pc could make the debugging?

Are you using the nsight eclipse tool?

THIS NEEDS EDITING…IT ISN"T ENTIRELY CORRECT…this is a work in progress

Assuming eclipse, just an ordinary network connection. Make sure no firewall or router issues prevent access, e.g., you probably want to check that the following ports work:

  • ssh
  • http
  • https
  • ftp
  • sftp
  • scp

If you run over a private or firewalled network you can use passwords for access…other variations may be possible, such as no-password ssh key-based authentication (which I have not set up, although JetPack may do this). Jetson is a full computer, and the ubuntu login name with ubuntu password is standard…if the outside world has access to the Jetson you absolutely must change this password. On a private network there is no need to change the password.

Slightly related note: Password files, network setup, and ssh keys are something you can customize your sample rootfs with before flashing so you don’t have to do this each time you flash. A cloned backup file has the same effect but can have updated system packages.

Go into preferences for nsight eclipse, remote systems, passwords, and fill in the details. When saving the remote system name and password, you will be prompted for the “master password for the secure storage”; this is a single password to create for reading stored passwords within eclipse, and is otherwise unrelated to the remote system.

For demonstration purposes, create file “hello.c” on the Jetson at “/home/ubuntu/tmp/hello.c” (a.k.a., “~/tmp/hello.c”). An example hello.c:

#include <stdio.h>

int
main(int argc, char** argv)
{
        printf("hello\n");
        return 0;
}

This would compile with debug symbols and run or debug normally on Jetson without nsight via:

gcc -g hello.c -o hello
# run...
./hello
# debug with just local gdb, break point main, run, list at break point, continue, quit...
gdb hello
b main
r
l
c
q

Note that the above could be considered equivalent of compiling using a cross-compiler on the host, copying the executable to the JTK1, and running gdb on the copied file directly from the Jetson. Nsight can create a new Hello World ANSI C Project (using the same source code as the above hello.c), and will want to know if you are using Cross GCC or Linux GCC. For compile on host for running on the host, use Linux GCC; for compile on host but copy to remote with running on remote, use Cross GCC. I do not know which Ubuntu packages on your host have the cross-compiler tool chain, but the package required will have a name reflecting host x86_64 Linux, and target ARMv7 linux hard float (or just “gnu-armhf”).

When creating the project you will get to a menu with “Advanced settings…”, “Build”, “Target Systems”. You can select remote system or manage remote system. You could click on “Project Path” button “Browse…”, and give the login information over ssh and set up the “/home/ubuntu/tmp/” directory for the project path. “Apply”.

Depending on your situation, you can set “Tool Chain Editor”. Because I hand installed gcc 4.9 snapshot of cross tools dated February of 2016 on my x86_64 Fedora desktop host for this case at “/usr/local/gcc-linaro-4.9-2016.02”, the Prefix and Path are “arm-linux-eabihf-” and “/usr/local/gcc-linaro-4.9-2016.02/bin”. Note that this is enough to compile code, but linking is tied to compatible ARMv7 (or just “armhf”) environment not normally installed on the x86_64 host (building via cross tools will be enough if linking is from the Jetson environment…linkers need something to link against, which implies either making available the Jetson’s environment or some runtime files using the same ABI…cross tools are often available as a tool package plus a runtime package for this purpose). Since I use a Fedora host and hand install tools this will differ for you…Ubuntu has pre-built packages available which I can’t use in Fedora.

You can explore from there, the remote Jetson hello.c file should show up in the editor and building should now work.