title: Debugging with Bazel in Visual Studio Code with Ubuntu
body: <p>I read <a href="https://shanee.io/blog/2019/05/28/bazel-with-visual-studio-code/" rel="noreferrer">this</a> Bazel VS Code tutorial.</p>
  
  <p>Currently, I have a problem with reproducing the tutorial on my system.
  I am using Ubuntu 18.04 and bazel 0.27.0 and Visual Studio Code (Version 1.35.1)</p>
  
  <p>My files:</p>
  
  <p><em>tasks.json</em>:</p>
  
  <pre><code>{
      "version": "2.0.0",
      "tasks": [
          {
              "label": "Build Example (Debug)",
              "type": "shell",
              "command": "bazel build :example -c dbg",
              "linux": {
                  "command": "bazel build :example -c dbg --spawn_strategy=standalone",
              },
              "group": {
                  "kind": "build",
                  "isDefault": true
              },
          }
      ]
  }
  </code></pre>
  
  <p>My <em>launch.json</em>:</p>
  
  <pre><code>{
      // Use IntelliSense to learn about possible attributes.
      // Hover to view descriptions of existing attributes.
      // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
      "version": "0.2.0",
      "configurations": [
          {
              "name": "Example",
              "type": "cppdbg",
              "request": "launch",
              "preLaunchTask": "Build Example (Debug)",
              "program": "${workspaceFolder}/bazel-out/k8-dbg/bin/example",
              "args": [],
              "stopAtEntry": false,
              "cwd": "${workspaceFolder}/bazel-out/k8-dbg/bin/example.runfiles/__main__/",
              "environment": [],
              "externalConsole": true,
              "MIMode": "gdb",
              "setupCommands": [
                  {
                      "description": "Enable pretty-printing for gdb",
                      "text": "-enable-pretty-printing",
                      "ignoreFailures": true
                  }
              ],
              "sourceFileMap": {
                  "/home/newton/.cache/bazel/_bazel_newton/7a12d285425fc99da0ce87e2a08f2f36/execroot/__main__/": "${workspaceFolder}"
              }
          }
      ]
  }
  </code></pre>
  
  <p>The following screenshot shows in the lower left corner that an error is reported when I try to start debugging: "Unable to read file (Error: File not found..." </p>
  
  <p><a href="https://i.stack.imgur.com/of7wJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/of7wJ.png" alt="Error reported by VSCode"></a></p>
  
  <p>I am looking for any suggestion on how to fix this and to make it work.</p>