Before yesterday, I always debug for one sources using gdb. It is easy. But I try to make program using gtkmm library and glade. Because of that, I got a lot of sources. My question is:
How can you debug in this case?
If I say gdb the_binary_that_I_want_to_debug: it will go to the main file which is just like this simple:
Code:
int main(int argc, char **argv)
{
Gtk::Main m(&argc, &argv);
window1 *window1 = new class window1();
m.run(*window1);
delete window1;
return 0;
}
What I want to watch is this function:
Code:
void window1::on_file_clicked()
{
const int mp3 = 1, ogg = 2, no = 0;
Glib::ustring song = input->get_text(), outputsong( song, 0, song.length()-4 );
Glib::ustring s1( song, song.length()-3, 3 );
int j = 0, i = 0, type;
//Check whether ogg files or mp3 files
outputsong = outputsong + ".wav";
if(s1=="mp3") {
type = mp3;
}
else if(s1=="ogg") {
type = ogg;
}
else {
type = no;
}
char* in = new char[song.length()+1];
char* out = new char[outputsong.length()+1];
char* arg_list[10];
switch(type) {
case mp3: strcpy(arg_list[0],"mpg321");
strcpy(arg_list[1],in);
strcpy(arg_list[2],"-w");
strcpy(arg_list[3],out);
arg_list[4] = NULL;
spawn("mpg321", arg_list);
strcpy(arg_list[0],"oggenc");
strcpy(arg_list[1],outputsong.c_str());
arg_list[2] = NULL;
spawn("oggenc", arg_list);
strcpy(arg_list[0],"rm");
strcpy(arg_list[1],outputsong.c_str());
spawn("rm", arg_list);
break;
case ogg: strcpy(arg_list[0],"oggdec");
strcpy(arg_list[1],in);
arg_list[2] = NULL;
spawn("oggdec", arg_list);
strcpy(arg_list[0],"lame");
strcpy(arg_list[1],outputsong.c_str());
spawn("lame", arg_list);
strcpy(arg_list[0],"rm");
strcpy(arg_list[1],outputsong.c_str());
spawn("rm", arg_list);
break;
default:
break;
}
}
That function is in window1.cc file. Ok, in main file, I put the breakpoint in this statement
After stop in that statement, I try to step but I got this error/warning:
Gtk::Main::run(Gtk::Window&) (window=@0x807d4d0) at main.cc:422
422 main.cc: No such file or directory.
in main.cc
Step again, got this error:
Gtk::Widget::show() (this=0x807d4d0) at widget.h:312
312 widget.h: No such file or directory.
in widget.h
And the error goes on.......
Help me, Guru and buddy!!!!!