Chore: Configure debugging in vscode

This commit is contained in:
Dorian Zedler 2022-06-29 21:29:15 +02:00
parent 9f91eb3962
commit 387e7aad34
Signed by: dorian
GPG key ID: 989DE36109AFA354
8 changed files with 49 additions and 11 deletions

29
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,29 @@
{
// 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": [
{
"type": "cppdbg",
"request": "launch",
"name": "C/C++: gcc debug active file",
"program": "${workspaceFolder}/Implementierung/md2",
"args": [
"${workspaceFolder}/Implementierung/testfile"
],
"cwd": "${workspaceFolder}",
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: gcc build active file",
"miDebuggerPath": "/usr/bin/gdb"
}
]
}

13
.vscode/settings.json vendored
View file

@ -10,7 +10,14 @@
"string_view": "c",
"system_error": "c",
"variant": "c",
"array": "c"
"array": "c",
"md2.h": "c",
"io.h": "c"
},
"editor.formatOnSave": true
}
"editor.formatOnSave": true,
"C_Cpp.default.includePath": [
"./lib",
"./Implementierung/lib",
"../lib"
]
}

4
.vscode/tasks.json vendored
View file

@ -7,9 +7,9 @@
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"${fileDirname}/*.c",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
"${fileDirname}/../md2"
],
"options": {
"cwd": "${fileDirname}"

View file

@ -3,7 +3,7 @@
SRC = src/main.c src/helper.c src/io.c src/md2.c
OBJ = ${subst src,build,${SRC:.c=.o}}
CC = gcc
CFLAGS = -Ilib
CFLAGS = -Ilib -ggdb
LDFLAGS =
all: md2

View file

@ -1,6 +1,8 @@
#ifndef IO_H
#define IO_H
#define _XOPEN_SOURCE
#include <errno.h>
#include <stdbool.h>
#include <stdint.h>

View file

@ -1,4 +1,4 @@
#include "helper.h"
#include "../lib/helper.h"
int stringToInt(char *string) {
char *leftover = "";

View file

@ -1,4 +1,4 @@
#include "io.h"
#include "../lib/io.h"
bool read_file(const char* path, uint8_t** data, size_t* size) {
// Read the contents of the file specified by path into a heap-allocated

View file

@ -1,8 +1,8 @@
#include <stdbool.h>
#include "helper.h"
#include "io.h"
#include "md2.h"
#include "../lib/helper.h"
#include "../lib/io.h"
#include "../lib/md2.h"
// Returns true when val is approx. equal to exp.
static bool runTest(const char* message, const char* expectedHash) {