GDB в VScode не останавливается на точках
Пишу аналог math.h библиотеки. Для сборки проекта использую Makefile. Буквально день назад проект дебажился через VScode и не было проблем. Сегодня, без каких-либо изменений, GDB проскакивает точки останова и программа просто отрабатывает, будто точек и не было.
Делал клонирование того коммита, где все работало, но на удивление - нет, дебаггер также стал проскакивать точки и на нем.
Пытался компилировать с -g флагом все файлы, пытался переустанавливать полностью VScode, переустанавливать расширения отдельно - не помогло.
Заранее спасибо за уделенное время, так как я в растерянности из-за этого.
Структура каталога:
| Folder/
|-----------| .vscode/
|-----------| src/
|-------------------| functions/
|----------------------------------| функции типа s21_cos.c, s21_sin.c ...
|-------------------| obj/
|-------------------| s21_math.c
|-------------------| s21_math.h
|-------------------| Makefile
Makefile:
OBJ_DIR = ./obj
FUN_DIR = ./functions
GCC_COMPILE = gcc -c -I ./ -Wall -Wextra -Werror
OBJECT_FILES = $(OBJ_DIR)/*.o s21_math.o
GOALS = s21_abs s21_acos s21_asin s21_atan s21_ceil s21_cos s21_fabs s21_fact s21_sin s21_math.o
GCC_BUILD = gcc -g $(OBJECT_FILES) s21_math.h -lm
s21_math: $(GOALS)
rm -rf s21_math
$(GCC_BUILD) -o s21_math
s21_abs:
$(GCC_COMPILE) $(FUN_DIR)/[email protected] -o $(OBJ_DIR)/[email protected]
... (остальные функции собираются так-же)
s21_math.o:
$(GCC_COMPILE) s21_math.c -o s21_math.o
clean:
rm -rf *.txt
rm -fr $(OBJ_DIR)/*.o s21_math s21_math.o
tasks.json:
{
"tasks": [
{
"type": "shell",
"label": "Build",
"command": "make --directory=src/",
"group": "build"
},
],
"version": "2.0.0"
}
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/src/s21_math",
"args": [
"2"
],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "Build"
}
]
}
s21_math.c:
#include "s21_math.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
long double s21_tan(double x);
int main(int argc, char *argv[]) {
clock_t start_time = clock();
if (argc >= 2) {
if (argv[1][0] == '1') {
for (double a = -10; a < 10; a += 0.0001) {
printf("Значение: %f\n", a);
printf("%f\n", tan(a));
printf("\n");
}
} else if (argv[1][0] == '2') {
for (double a = -10; a < 10; a += 0.0001) {
printf("Значение: %f\n", a);
printf("%Lf\n", s21_tan(a));
printf("\n");
}
}
} else {
// another test programm
}
start_time = clock() - start_time;
printf("Время на работу программы: %ld", start_time);
return 0;
}
long double s21_tan(double x) {
x = fmod(x, S21_PI);
long double cos_res = s21_cos(x);
return !cos_res ? S21_NAN : s21_sin(x) / cos_res;
}