TensorRT Docker Container; Debugging Not Working with GDB

I have recently come across an issue with debugging any code from within the TensorRT docker container; I’ve posted an issue on the GitHub but I’m thinking maybe here is a more relevant place.

A minimal set of steps to reproduce the behaviour is given there. But to summarise; GDB does not work to debug any compiled C++ code from within the container. Trying to set a breakpoint and run the code results in the error

Starting program: /workspace/a.out 
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x11a9

The base Ubuntu 18.04 docker container works fine; as does the base of the the TensorRT container (nvidia/cuda:11.1-cudnn8-devel-ubuntu18.04).

I’ve tried a couple of different releases of the container (20.12, 20.09) to no avail; I have played around with the different options to docker run (again see the linked issue). I can find no clue as to what is preventing breakpoints being set on code except for the mysterious GDB error complaining that it can’t find the memory address of the breakpoints.

Any advice?
Thanks!

See also

I’m having the same problem. Have you found any solution so far?

I haven’t tried yet, but see

Apparently the image works if built from the dockerfiles (rather than using the pre-built one)

Thanks, I will try that.