title: How to setup Visual Studio Code to debug C programs on Linux?
body: <p>I am trying to debug a <code>C</code> program in Visual Studio Code.<br>
  In my directory I have 2 files <code>test.c</code> and <code>Makefile</code> along with <code>.vscode</code> folder which contains <code>launch</code> and <code>tasks</code> json files.<br>
  I tried configuring these files for the last three hours searching various forums and blogs but nothing seems to work. </p>
  
  <p>I am able to compile and run using these two json files.<br>
  Program runs and displays output correctly but doesn't stop at breakpoints, during execution of the program I can't add breakpoints and already added breakpoints are disabled with following message.</p>
  
  <blockquote>
    <p>Module containing this breakpoint has not yet loaded or the breakpoint address could not be obtained.</p>
  </blockquote>
  
  <p>It seems that VSCode is not able to locate my <code>test.c</code> file during debugging phase even though it is in the same directory. It will be great if someone can show me the right way to do it.<br>
  Here, I am attaching contents of files in my folder.<br>
  <code>launch.json</code></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": "gcc build and debug active file",
              "type": "cppdbg",
              "request": "launch",
              "program": "${workspaceFolder}/test",
              "args": [],
              "stopAtEntry": true,
              "cwd": "${workspaceFolder}",
              "environment": [],
              "externalConsole": true,
              "MIMode": "gdb",
              "setupCommands": [
                  {
                      "description": "Enable pretty-printing for gdb",
                      "text": "-enable-pretty-printing",
                      "ignoreFailures": true
                  }
              ],
              "preLaunchTask": "tasks",
              "miDebuggerPath": "/usr/bin/gdb"
          }
      ]
  }
  </code></pre>
  
  <p><code>tasks.json</code></p>
  
  <pre><code>{
      // See https://go.microsoft.com/fwlink/?LinkId=733558
      // for the documentation about the tasks.json format
      "version": "2.0.0",
      "tasks": [
          {
              "label": "tasks",
              "type": "shell",
              "command": "make",
              "group": {
                  "kind": "build",
                  "isDefault": true
              }
          }
      ]
  }
  </code></pre>
  
  <p><code>Makefile</code></p>
  
  <pre><code>all:
      gcc test.c -o ./test
  </code></pre>
  
  <p><code>test.c</code></p>
  
  <pre class="lang-c prettyprint-override"><code>#include&lt;stdlib.h&gt;
  #include&lt;stdio.h&gt;
  
  int main(){
      printf("Mandar\n");
      printf("Sadye\n");
      return 0;
  }
  </code></pre>
  
  <p>Thank you.</p>