Under Windows, it seems the GDB can't find it's mingw/share/gdb files, so as a workaround, I would like to start gdb using this command:
gdb --data-directory=e:/test/unix_gdb/install/mingw/share/gdb
the above code will tell gdb that absolute path of "share/gdb", currently, if you install a more recent G++ or GDB, you will find that under "share/gdb", there are python pretty printres for "std c++ library" and the "gdb command support for pretty printer".
In Codelblocks, we have no such way to run GDB, There is a "debugger initializtion commands" edit control, but it can't set the parameters when gdb started. what I want is something like:
gdb --data-directory=$(TARGET_COMPILER_DIR)/share/gdb
But I found that currently, the GDB start command is hard coded in file:
wxString GDB_driver::GetCommandLine(const wxString& debugger, const wxString& debuggee)
{
wxString cmd;
cmd << debugger;
cmd << _T(" -nx"); // don't run .gdbinit
cmd << _T(" -fullname "); // report full-path filenames when breaking
cmd << _T(" -quiet"); // don't display version on startup
cmd << _T(" -args ") << debuggee;
return cmd;
}
wxString GDB_driver::GetCommandLine(const wxString& debugger, int pid)
{
wxString cmd;
cmd << debugger;
cmd << _T(" -nx"); // don't run .gdbinit
cmd << _T(" -fullname "); // report full-path filenames when breaking
cmd << _T(" -quiet"); // don't display version on startup
cmd << _T(" -pid=") << wxString::Format(_T("%d"), pid);
return cmd;
}
So, is it possible to add an extra option on the start up command??
such as:
wxString GDB_driver::GetCommandLine(const wxString& debugger, const wxString& debuggee)
{
wxString cmd;
cmd << debugger;
cmd << _T(" -nx"); // don't run .gdbinit
cmd << _T(" -fullname "); // report full-path filenames when breaking
cmd << _T(" -quiet"); // don't display version on startup
cmd << extraStartupCommand; //************************************
cmd << _T(" -args ") << debuggee;
return cmd;
}
Then, I would simply add extraStartupCommand with below string
--data-directory=$(TARGET_COMPILER_DIR)/share/gdb
thanks.