Skip to content
Snippets Groups Projects
debug.md 784 B
Newer Older
  • Learn to ignore specific revisions
  • # Debug
    
    Running the target in an encapsulated environment is recommended.
    
    ## Debugging using Dockerfile.debug
    
    A Dockerfile for debugging (`Dockerfile.debug`) is provided within the
    repositories root.
    
    ### Usage:
    
    The following assumes that VSCode is used.
    
    1.  Extend `launch.json`:
    
    ```
    {
      "version": "0.2.0",
      "configurations": [
        ...
        {
          "name": "Go Containerized Debug",
          "type": "go",
          "request": "attach",
          "mode": "remote",
          "port": 4000,
          "host": "127.0.0.1"
        }
      ]
    }
    ```
    2. Build the debug container: `make container-debug`
    3.  Run the container: `docker run --rm --privileged -d -p 7030:7030 -p 4000:4000 gnmi-target-debug:latest`
    4.  Set breakpoints and attach to the running container by using the configuration added in step 1