Compile it with debugging symbols and run it with gdb in tui mode. This will let you place breakpoints in source files, view back traces, find the definitions of functions, structures, macros, etc. The learning curve is a tad steep, but this video is pretty good: