Lab cheat sheet
C
To compile with extra warnings, debug symbols:gcc -Wall -Wextra -g yourProgram.c -o yourProgram
gcc -Wall -Wextra -g -fsanitize=address -fsanitize=leak -fsanitize=undefined yourProgram.c -o yourProgram
valgrind --leak-check=full --track-origins=yes ./yourProgram with args
compiler_flags=-Wall -Wextra -g -fsanitize=address -fsanitize=leak -fsanitize=undefined
exercise_sources=$(wildcard lab_?/*.c)
exercise_executables=$(patsubst %.c,%,${exercise_sources})
$(exercise_executables): %: %.c
gcc $(compiler_flags) $< -o $@
clean:
rm $(exercise_executables)
Assembly
To assemble and link (Compile):as --gstabs 1.s -o 1.o
as --gstabs utils.s -o utils.o
ld 1.o utils.o -o 1.out
./1.out
gdb ./1.out
git add my_file.txt
git commit -m "Wrote some stuff in my_file.txt"
git push -u origin master