Instructions for using GDB to inspect memory and verify custom data structures for the Algorithmic Efficiency Lab.
Compile using the debug flag (-g):
g++ -g -Iinclude main.cpp -o lab_execgdb ./lab_execSet a breakpoint at the start of the data structure tests:
break testDataStructuresrunWhile at a breakpoint, use the following to inspect pointers and structures:
print ll.head
print *ll.head- n (next): Execute the next line.
- s (step): Step into a function (e.g.,
appendorinsert). - c (continue): Run until the next breakpoint.
If the program terminates unexpectedly (e.g., segment fault), use:
backtraceThis will identify the exact line in the memory management logic where the error occurred.