Three steps to debugging:
1) Tooling (ASAN, UBSAN, etc.) are great for automatically detecting problems. I forgot to mention cppcheck, but that's also a good one I use all the time, which finds a lot of bugs at compile time.
2) Cout all the things. Much maligned, but can be a very fast way to hunt down a bug quickly.
3) Debugger. I showed today how to use GDB. There's a lot more to GDB (like... a lot), this was just a super brief overview of the most important steps I take within it.