mirror of
https://github.com/Hizenberg469/GDB-tutorial.git
synced 2026-04-19 22:02:23 +03:00
process stack done - debugging technique begins
This commit is contained in:
5
debugging-techniques.txt
Normal file
5
debugging-techniques.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
DEBUGGING TECHNIQUES:
|
||||
---------------------
|
||||
|
||||
|
||||
|
||||
@@ -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 ./<program>
|
||||
|
||||
OR
|
||||
|
||||
$valgrind ./<program>
|
||||
|
||||
Reference in New Issue
Block a user