Debug in VS 2017 when running through task configuration

  • Thread starter Thread starter Ofir423342
  • Start date Start date
O

Ofir423342

Guest
I have this simple program called main.c:

#include <stdio.h>

int main(){
puts("hi");
puts("bye");
return 0;
}


and this makefile:

run: main.o
gcc main.o -o run

main.o: main.c
gcc -c -g $< -o $@

clean:
rm -f run main.o


Now I want to use it in VS 2017. So I opened the program folder in VS (main.c and the makefile are located there). Then I configured these tasks for it:

{
"version": "0.2.1",
"tasks": [
{
"taskName": "BUILD",
"appliesTo": "/",
"workingDirectory": "${workspaceRoot}",
"command": "make",
"type": "default"
},
{
"taskName": "RUN",
"appliesTo": "/",
"workingDirectory": "${workspaceRoot}",
"command": "run",
"type": "default"
}
]
}


What I tried to do next, is to put break point in the main function and then use the RUN task. I thought VS will stop the running on the break point but that didn't happen and the program run till the end of it.

How can I use the task configuration, so that when I click on RUN - it will stop on the break points that I put?
It's important for me to emphasize that I want to debug the program using the task configuration only and not via other ways that VS have.


Continue reading...
 
Back
Top