Using gdb

Hi there. I had a huge C++ Ubuntu source file and I broke it in a few smaller pieces. Now the main with some source code has [b]#include "file.cpp"[\b] etc. It works, however now I need to debug it, I don't understand how I can set up breakpoints since the smaller source files are numbered out of the main sequence so to speak. Is there any way I can do it? I actually need to debug a separate source file of a smaller size but still considerable. How can it be done? Thanks.
When setting breakpoints, separate the filename and line number by a colon.

b filename.cxx:64
Or use the function name:
b function_name

Ideally, use an editor or IDE with debugger integration, so you don't have to type stuff manually.

I find this crib sheet so useful I have it taped to my wall:
http://www.st.ewi.tudelft.nl/~koen/ti2726-b/gdb_quickref.pdf

(Also, why are you including a source file?)
Last edited on
Thank you, @mbozzi. I am including source files because otherwise it is difficult to handle large source files. I found it convenient. Sometimes I don't remember clearly the name of a certain routine I am looking for, so I cannot use Ctrl+F to find it, but rolling the text down helps. You provided helpful information. Thank you, - A.
Topic archived. No new replies allowed.