Author Topic: Patches for debbugger_gdbmi  (Read 2791 times)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2195
Patches for debbugger_gdbmi
« on: April 10, 2012, 02:44:09 am »
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.

Code: [Select]
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;
« Last Edit: April 10, 2012, 02:47:18 am by Pecan »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12246
    • Travis build status
Re: Patches for debbugger_gdbmi
« Reply #1 on: April 10, 2012, 08:00:44 am »
Thanks, I've seen this was missing few day ago and would have implemented it:)

I'll look at it tonight.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]