1) plugin.cpp: expand variables in gdb file name
2) config.h/cpp: code to implement gdb.exe search button
Code shamelessly stolen from CB gdb debugger cli.
Yes, we all know that debbugger_gdbmi has one too many 'd's.
Index: debbugger_gdbmi/src/config.cpp
===================================================================
--- debbugger_gdbmi/src/config.cpp (revision 146)
+++ debbugger_gdbmi/src/config.cpp (working copy)
@@ -23,7 +23,8 @@
BEGIN_EVENT_TABLE(ConfigurationPanel,wxPanel)
//(*EventTable(ConfigurationPanel)
- //*)
+ //*)
+ EVT_BUTTON(ID_BUTTON_BROWSE, ConfigurationPanel::OnBrowse)
END_EVENT_TABLE()
ConfigurationPanel::ConfigurationPanel(wxWindow* parent)
Index: debbugger_gdbmi/src/config.h
===================================================================
--- debbugger_gdbmi/src/config.h (revision 146)
+++ debbugger_gdbmi/src/config.h (working copy)
@@ -2,9 +2,12 @@
#define _DEBUGGER_GDB_MI_GDB_CONFIG_H_
#include <debuggermanager.h>
+#include <macrosmanager.h>
//(*Headers(ConfigurationPanel)
-#include <wx/panel.h>
+#include <wx/panel.h>
+#include <wx/filedlg.h>
+
class wxTextCtrl;
class wxStaticBoxSizer;
class wxButton;
@@ -44,6 +47,24 @@
//(*Handlers(ConfigurationPanel)
//*)
+ void OnBrowse(wxCommandEvent &event)
+ {
+ wxString oldPath = m_exec_path->GetValue();
+ Manager::Get()->GetMacrosManager()->ReplaceEnvVars(oldPath);
+ wxFileDialog dlg(this, _("Select executable file"), wxEmptyString, oldPath,
+ wxFileSelectorDefaultWildcardStr, wxFD_OPEN | wxFD_FILE_MUST_EXIST);
+ PlaceWindow(&dlg);
+ if (dlg.ShowModal() == wxID_OK)
+ {
+ wxString newPath = dlg.GetPath();
+ m_exec_path->ChangeValue(newPath);
+ }
+ }
+
+ void OnTextChange(wxCommandEvent &event)
+ {
+ //? ValidateExecutablePath();
+ }
DECLARE_EVENT_TABLE()
};
Index: debbugger_gdbmi/src/plugin.cpp
===================================================================
--- debbugger_gdbmi/src/plugin.cpp (revision 146)
+++ debbugger_gdbmi/src/plugin.cpp (working copy)
@@ -572,7 +572,9 @@
// is gdb accessible, i.e. can we find it?
wxString debugger = GetActiveConfigEx().GetDebuggerExecutable();
- wxString debuggee, working_dir;
+ wxString debuggee, working_dir;
+ Manager::Get()->GetMacrosManager()->ReplaceEnvVars(debugger); // apply env vars)
+
if (!GetDebuggee(debuggee, working_dir, target))
{
m_hasStartUpError = true;