#  cuda-gdb CUDA debugging hangs when non-root

**URL:** <https://forums.developer.nvidia.com/t/cuda-gdb-cuda-debugging-hangs-when-non-root/72096>\
**Category:** Jetson AGX Xavier\
**Created:** [March 27, 2019, 9:06pm UTC](https://forums.developer.nvidia.com/t/cuda-gdb-cuda-debugging-hangs-when-non-root/72096 "2019-03-27T21:06:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![todd.allen](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/todd.allen/32/12166_2.png) [@todd.allen](https://forums.developer.nvidia.com/u/todd.allen)\
**Post date:** [March 27, 2019, 9:06pm UTC](https://forums.developer.nvidia.com/t/cuda-gdb-cuda-debugging-hangs-when-non-root/72096/1 "2019-03-27T21:06:10Z")

</div>

This happens any time I attempt to debug CUDA when I’m anything other than root. (In fact, I only thought to try this as root right before reporting this.) Anyway, here’s a small example. First, some trivial source code:

```auto
#include <stdio.h>
#include <unistd.h>

__global__ void Nil()
{
   printf("short and stout.\n");
}

int main(int argc, char** argv)
{
   printf("I'm a little teapot,\n");

   Nil<<<1, 1>>>();
   cudaError_t err = cudaGetLastError();
   if (err != cudaSuccess) {
      fprintf(stderr,
              "kernel launch failure: %s (%d)\n",
              cudaGetErrorString(err), err);
      exit(-1);
   }                                                             

   cudaThreadSynchronize();

   exit(0);
}

```

Next, the cuda-gdb session:

```auto
$ cuda-gdb
... banners ...
(cuda-gdb) b 6
Breakpoint 1 at 0x10fc: file cudanil.cu, line 6.
(cuda-gdb) r
Starting program: /some/path/cudanil 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
I'm a little teapot,
---HANG---

```

It appears that the cudbgprocess backend process crashes very soon after its creation, after it has created its pipe to communicate with cuda-gdb. And then cuda-gdb hangs indefinitely trying to open the pipe with no process on the other end.

I spotted this when testing our NightView debugger with our not-yet-released RedHawk kernel based on L4T R31.1 and with an L4T R31.1 userland. But I was able to reproduce it with the cuda-gdb on the vanilla L4T R31.1 kernel. And today I verified that it still happens with cuda-gdb on the vanilla L4T R32.1 too.

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [March 28, 2019, 8:18am UTC](https://forums.developer.nvidia.com/t/cuda-gdb-cuda-debugging-hangs-when-non-root/72096/2 "2019-03-28T08:18:44Z")

</div>

Hi,

This is a known issue.  
Due to some internal restrictions, you will need to execute all the tool _(cuda-gdb, cupti, nvprof…)_ as root.

Thanks.

---

<div class="post-metadata">

**Author:** ![TomNVIDIA](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/tomnvidia/32/14181_2.png) [@TomNVIDIA](https://forums.developer.nvidia.com/u/TomNVIDIA)\
**Post date:** [October 18, 2021, 6:24pm UTC](https://forums.developer.nvidia.com/t/cuda-gdb-cuda-debugging-hangs-when-non-root/72096/3 "2021-10-18T18:24:53Z")

</div>

Closed on October 18, 2021, 6:24pm UTC


