From dde42f2bac322e04c9cc35b63c618270b17fd683 Mon Sep 17 00:00:00 2001 From: Hizenberg Date: Sun, 19 Oct 2025 09:41:53 +0000 Subject: [PATCH] process stack done - debugging technique begins --- debugging-techniques.txt | 5 ++++ process-stack.txt | 54 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 debugging-techniques.txt diff --git a/debugging-techniques.txt b/debugging-techniques.txt new file mode 100644 index 0000000..b726526 --- /dev/null +++ b/debugging-techniques.txt @@ -0,0 +1,5 @@ +DEBUGGING TECHNIQUES: +--------------------- + + + diff --git a/process-stack.txt b/process-stack.txt index 29e0c6c..17d1e17 100644 --- a/process-stack.txt +++ b/process-stack.txt @@ -131,3 +131,57 @@ Section 7: Foundation of Processes (Part A): We can also use Address-sanitizers + + * Stack Overflow: + ~~~~~~~~~~~~~~~ + + + When the size of any number of call stack crosses the + finite size of the allocated stack of the program, then + it leads to stack overflow. + + +---------------------------+ + | | + | stack | | + |---------------------------| | + | | | + | array[0] | | + | array[1] | | + | | | | + | | | | + | | | \|/ + | | | * + | array[99....] | + |---------------------------| + | array[10....0] | + | heap | + | | + |---------------------------| + | | + | data | + | | + | | + |---------------------------| + | | + | .text | + | | + +---------------------------+ + + + * Address Sanitizer: + ~~~~~~~~~~~~~~~~~~ + + To know about potential memory leaks, we can enable stanitizer flag + + Compiler flag: + -fsanitize=address + + + * To detect memory leak, we can use valgrind. + + Command: + $valgrind --leak-check=full ./ + + OR + + $valgrind ./