I have written simple C++ program like this:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello.";
return 0;
}
now I want to debug it. so what will be the command for it so my control goes to every line. Plz help me.
I have written simple C++ program like this:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello.";
return 0;
}
now I want to debug it. so what will be the command for it so my control goes to every line. Plz help me.
You can use gdb
for this:
$ gdb hello
This will start gdb
and prompt you for what to do next. The next
command executes one line of source and stops at the next line.
I found a basic GDB tutorial that may be helpful.
Don't forget to compile your source code using -g option.
Like this: g++ -g helloWorld.cc
This is going to create an a.out executable file.
You'll be able to debug your a.out exe using gdb ./a.out
command.
Another tool you may use it's ddd basically a GUI for gdb.
Good luck
If you want some user-friendly debugger, you can use Kdbg, which is basically a gdb frontend for KDE. Perhaps not so powerful as ddd, but easier to start with.
I always thought emacs provided a pretty user-friendly front-end to gdb...
E.g.
(That should suffice to get you started. Emacs being emacs, there are always more features...)