mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 08:34:42 +08:00
Add test program for viewing stack.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
hellostack
|
||||
*.seer
|
||||
@@ -0,0 +1,10 @@
|
||||
.PHONY: all
|
||||
all: hellostack
|
||||
|
||||
hellostack: hellostack.c
|
||||
gcc -g -o hellostack hellostack.c
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f hellostack
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
https://jvns.ca/blog/2021/05/17/how-to-look-at-the-stack-in-gdb/
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user