From cb92e36c542e9127b2a9bdb7822bd526356c7ae0 Mon Sep 17 00:00:00 2001 From: Hizenberg Date: Sun, 19 Oct 2025 17:04:25 +0000 Subject: [PATCH] debugging technique --- debugging-techniques.txt | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/debugging-techniques.txt b/debugging-techniques.txt index b726526..e10883d 100644 --- a/debugging-techniques.txt +++ b/debugging-techniques.txt @@ -2,4 +2,74 @@ DEBUGGING TECHNIQUES: --------------------- +-> Delta Debugging: + ++++++++++++++++ + + + It is a technique like binary search, where we can decrease the section + under analysis to find bugs. + + Like, we can use multiple breakpoints to the program and see + where the program faces issue and when it faces. It could + face the issue before some breakpoint could be reached or + after some breakpoints are encountered. + This way we can reduce our search space and section of analysis. + + +-> Assertion: + ++++++++++ + + + assert(): It check if the assumption which is passed + as an argument is true. If it isn't, the + program will Abort and core dumped. + + This is for runtime check and the program + is part of C library. + + To use it we need #include statement + in C++ program. + + static_assert(): It check the assumption at compile time + and throw compilation error if the + assertion fails. + + + This is helpful where we can evaluate + variable as constant expression using + constexpr keywords, which could help + in static assertion failure. + + +-> Investigating Code by Calling functions within GDB: + +++++++++++++++++++++++++++++++++++++++++++++++++++ + + + * We can call a function from GDB when haven't reached + the point where we execute the function. + + We can do function call from GDB itself. + + We can use... + + Command: + (gdb)call ( .... ) + + +-> Attaching the Debugger to a Running Process: + ++++++++++++++++++++++++++++++++++++++++++++ + + To attach a running to process to a gdb. + + Command: + $gdb -p + + We can get the process id using below command: + + $ps aux | grep + + To Detach a process and let it run, we can use + command: + (gdb)detach +