Debugging C++



Library dependencies


Using lldb (MacOS)



Using gdb (Linux)

gdb my_executable
break my_function_name
break 'hipo_output::writeHeader(outputContainer*, std::map<std::string, double>, gBank)'
break hipo_output.cc:<line_number>
break GOptions::getVerbosityFor if tag.size() == 0
set pagination off
set print thread-events off

catch throw
catch catch
run arg1 arg2 ...
backtrace       # Show call stack
bt full
thread apply all bt full
info threads
frame N         # Change focus to a stack frame
info locals     # Show local variables
info args       # Show function arguments
print var       # Print value of variable
print *ptr      # Dereference a pointer
list            # Show source around current line
step     # Step into the next line (enter function)
next     # Step over the next line (skip into function)
finish   # Step out of the current function