CPP-Debug-Docker
CPP-Debug-Docker copied to clipboard
Debug C/C++ Programs In Docker
CPP Debug Docker
Introduction
These are examples of how to debug common C/C++ bugs, such as logic errors, segmentation faults, and memory leaks, using CMake, GDB and Valgrind in Docker container. A more comprehensive tutorial could be found on my website.
Docker
Create Docker Image
$ docker build -f cpp.Dockerfile -t cpp-debug:0.0.1 .
Start Docker Container
$ docker run -it --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v $(pwd):/mnt cpp-debug:0.0.1
Examples
Build Examples
$ mkdir build
$ cd build
$ cmake ..
$ make
Example Files
- Logical Error
- Core Dumped
- Memory Leak