diff --git a/tests/hellostack/.gitignore b/tests/hellostack/.gitignore new file mode 100644 index 0000000..2645d29 --- /dev/null +++ b/tests/hellostack/.gitignore @@ -0,0 +1,2 @@ +hellostack +*.seer diff --git a/tests/hellostack/Makefile b/tests/hellostack/Makefile new file mode 100644 index 0000000..b3e0e14 --- /dev/null +++ b/tests/hellostack/Makefile @@ -0,0 +1,10 @@ +.PHONY: all +all: hellostack + +hellostack: hellostack.c + gcc -g -o hellostack hellostack.c + +.PHONY: clean +clean: + rm -f hellostack + diff --git a/tests/hellostack/README b/tests/hellostack/README new file mode 100644 index 0000000..eebb74b --- /dev/null +++ b/tests/hellostack/README @@ -0,0 +1,3 @@ + +https://jvns.ca/blog/2021/05/17/how-to-look-at-the-stack-in-gdb/ + diff --git a/tests/hellostack/hellostack.c b/tests/hellostack/hellostack.c new file mode 100644 index 0000000..feecf98 --- /dev/null +++ b/tests/hellostack/hellostack.c @@ -0,0 +1,19 @@ +#include +#include + +int main() { + char stack_string[10] = "stack"; + int x = 10; + char *heap_string; + + heap_string = malloc(50); + + printf("Enter a string for the stack: "); + gets(stack_string); + printf("Enter a string for the heap: "); + gets(heap_string); + printf("Stack string is: %s\n", stack_string); + printf("Heap string is: %s\n", heap_string); + printf("x is: %d\n", x); +} +