Author Topic: Splitting debugger in two - specific debugger and common GUI  (Read 495073 times)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #60 on: September 12, 2009, 03:19:22 pm »
...just for the record: Everything compiles fine and seems to run fine on Windows XP. However - on Vista I get an immediate crash which has it's source in wxPropGrid. Not sure if it's a wxPropGrid bug or C::B...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #61 on: September 12, 2009, 08:30:45 pm »
No Vista around to test it :(
Can you post the backtrace?

By the way I've found, some little bugs... will provide patch at some point :)

Another thing, what is the master plan for the application of the patch?
Test it some more and put it in trunk or a separate branch?
Or it depends on the wxpropgrid's integration in C::B's tree?
« Last Edit: September 12, 2009, 08:32:55 pm by oBFusCATed »
(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!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #62 on: September 12, 2009, 09:13:15 pm »
Test it some more and put it in trunk or a separate branch?
Or it depends on the wxpropgrid's integration in C::B's tree?
We have discussed that already internally.
My proposal:
1.) integrate wxpropgrid into trunk
2.) Apply patches (already available and currently in testing phase) to update all components to new wxpropertygrid
3.) remove old one from wxsmith (to avoid conflicts)
4.) (in parallel) -> create a branch to test the new debugger stuff
5.) (if all devs agree) -> merge into trunk.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #63 on: September 12, 2009, 09:15:06 pm »
Can you post the backtrace?
The backtrace has only addresses, no source code. I did some mods already myself. Keep posting patches quickly to avoid conflicts, please. ;-) I'll post a screenshot of the debugger session once I am ready. I seem to be a null pointer access at initialisation phase of wxproptertygrid...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #64 on: September 12, 2009, 09:35:37 pm »
Patch 1 - RunToCursor goes to the correct line
Code
index e6a1e9a..475ae23 100644
--- a/src/sdk/debuggermenu.cpp
+++ b/src/sdk/debuggermenu.cpp
@@ -233,7 +233,7 @@ void DebuggerMenuHandler::OnRunToCursor(wxCommandEvent& event)
     if (!ed)
         return;
     const wxString &line_text = ed->GetControl()->GetLine(ed->GetControl()->GetCurrentLine());
-    m_activeDebugger->RunToCursor(ed->GetFilename(), ed->GetControl()->GetCurrentLine(), line_text);
+    m_activeDebugger->RunToCursor(ed->GetFilename(), ed->GetControl()->GetCurrentLine() + 1, line_text);
 }
 
 void DebuggerMenuHandler::OnToggleBreakpoint(wxCommandEvent& event)


Patch 2 - make writing debugger plugins easier
Code
diff --git a/src/include/cbplugin.h b/src/include/cbplugin.h
index 6f234ea..7237c07 100644
--- a/src/include/cbplugin.h
+++ b/src/include/cbplugin.h
@@ -498,6 +498,7 @@ class PLUGIN_EXPORT cbDebuggerPlugin: public cbPlugin
         virtual wxString GetEditorWordAtCaret();
     protected:
         void RemoveBreakpointFromEditor(const wxString& filename, int line);
+        void ClearActiveMarkFromAllEditors();
     private:
         wxToolBar *m_toolbar;
 };
diff --git a/src/plugins/debuggergdb/debuggergdb.cpp b/src/plugins/debuggergdb/debuggergdb.cpp
index 9b8c36d..9e34854 100644
--- a/src/plugins/debuggergdb/debuggergdb.cpp
+++ b/src/plugins/debuggergdb/debuggergdb.cpp
@@ -1774,20 +1774,6 @@ void DebuggerGDB::BringAppToFront()
         app->Raise();
 }
 
-void DebuggerGDB::ClearActiveMarkFromAllEditors()
-{
-    EditorManager* edMan = Manager::Get()->GetEditorManager();
-//  Plugins are destroyed prior to EditorManager, so this is guaranteed to be valid at all times
-//    if (!edMan)
-//        return;
-    for (int i = 0; i < edMan->GetEditorsCount(); ++i)
-    {
-        cbEditor* ed = edMan->GetBuiltinEditor(i);
-        if (ed)
-            ed->SetDebugLine(-1);
-    }
-}
-
 void DebuggerGDB::SyncEditor(const wxString& filename, int line, bool setMarker)
 {
     DebuggerManager::SyncEditorResult result;
diff --git a/src/plugins/debuggergdb/debuggergdb.h b/src/plugins/debuggergdb/debuggergdb.h
index 72703a9..ea9fa3f 100644
--- a/src/plugins/debuggergdb/debuggergdb.h
+++ b/src/plugins/debuggergdb/debuggergdb.h
@@ -116,7 +116,6 @@ class DebuggerGDB : public cbDebuggerPlugin
         void DoSwitchToDebuggingLayout();
         void DoSwitchToPreviousLayout();
         void ParseOutput(const wxString& output);
-        void ClearActiveMarkFromAllEditors();
         void DoWatches();
         wxString FindDebuggerExecutable(Compiler* compiler);
         int LaunchProcess(const wxString& cmd, const wxString& cwd);
diff --git a/src/sdk/cbplugin.cpp b/src/sdk/cbplugin.cpp
index 4f6a2e1..0650ea5 100644
--- a/src/sdk/cbplugin.cpp
+++ b/src/sdk/cbplugin.cpp
@@ -166,6 +166,20 @@ void cbDebuggerPlugin::RemoveBreakpointFromEditor(const wxString& filename, int
         ed->RemoveBreakpoint(line, false);
 }
 
+void cbDebuggerPlugin::ClearActiveMarkFromAllEditors()
+{
+    EditorManager* edMan = Manager::Get()->GetEditorManager();
+//  Plugins are destroyed prior to EditorManager, so this is guaranteed to be valid at all times
+//    if (!edMan)
+//        return;
+    for (int i = 0; i < edMan->GetEditorsCount(); ++i)
+    {
+        cbEditor* ed = edMan->GetBuiltinEditor(i);
+        if (ed)
+            ed->SetDebugLine(-1);
+    }
+}
+
 /////
 ///// cbToolPlugin
 /////


Patch 3 - the stop button behaviour has been broken  :roll:
Code
--- a/src/sdk/debuggermenu.cpp
+++ b/src/sdk/debuggermenu.cpp
@@ -190,7 +190,10 @@ void DebuggerMenuHandler::OnStart(wxCommandEvent& event)
 void DebuggerMenuHandler::OnStop(wxCommandEvent& event)
 {
     cbAssert(m_activeDebugger);
-    m_activeDebugger->Stop();
+    if(m_activeDebugger->IsStopped())
+        m_activeDebugger->Stop();
+    else
+        m_activeDebugger->Break();
 }
 
 void DebuggerMenuHandler::OnContinue(wxCommandEvent& event)

What are you changes?
(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!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #65 on: September 12, 2009, 10:03:37 pm »
Patch 1 [...] 3
Cool. Keep 'em coming...

What are you changes?
Only minor things. Please be patient, I am in the process of preparing a branch for this... just need a couple more clean-ups. It will be way easier then...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #66 on: September 13, 2009, 01:08:46 am »
I'm patient, just want to know what's going on, no rushing at all :)

I have no major things, to do ... just I need to implement some logic to remember last used debugger
At the moment, I'm working on my gdb/mi plugin

By the way: I've not tested the MS debugger (cdb?) at all.
Also, I've not modified the autotools files, so the build might not work :(
(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!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #67 on: September 13, 2009, 02:13:26 pm »
Also, I've not modified the autotools files, so the build might not work :(
i know. ;-)
Hopefully one of the linux devs will take care. Shouldn't be too hard though...

Here are major changes (FYI) that I did:
- changed the compiler #defines for wxPropGrid to make it work from within plugins, too
- changed SDK files to use sdk_precomp
- moved and integrated wxpropgrid into C::B SDK and build system
- (couple of missing includes...)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #68 on: September 16, 2009, 09:09:24 am »
Ok - first impression:
- it works partially :)
- it does not stop at a BP
- if I enabled "evaluation expression under cursor" C::B crashes
...digging into it. (Compiler: 4.4.0 TDM, Debugger 6.8-3.)
My second expression:
- it works flawlessly.
- BP's work
- (propgrid) views work
- evaluation under cursor works.
I'll try to commit the whole stuff today to the branch. I just need to update the update scripts... :lol:
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #69 on: September 16, 2009, 01:41:46 pm »
Whoever watches that topic: Try the wxpropgrid_debugger branch where all this is integrated and open for testing now!
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #70 on: September 16, 2009, 04:00:11 pm »
OK, tonight I'll try it.

Quote
- updated project files and makefile system accordingly (makefile system is incomplete and needs fixing!)

This is only for the changes related to the debugger or includes other problems with the make system?
I'll try to fix it, but my autofu is quite limited :(
(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!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #71 on: September 16, 2009, 04:05:57 pm »
OK, tonight I'll try it.

Quote
- updated project files and makefile system accordingly (makefile system is incomplete and needs fixing!)

This is only for the changes related to the debugger or includes other problems with the make system?
I'll try to fix it, but my autofu is quite limited :(

I'm working on it and will commit the fixes (most likely) this evening (UTC+2) .

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #72 on: September 16, 2009, 04:10:54 pm »
This is only for the changes related to the debugger or includes other problems with the make system?
Not only the debugger I'm afraid. And we are two now: My knowledge about autotools is limited, too as I am don'tuse Linux (Unix) very often.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

mariocup

  • Guest
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #73 on: September 16, 2009, 10:20:42 pm »
Hi Martin,

I am trying to build the debugger branch, but I get the following error:

Code
src\plugins\debuggergdb\debugger_defs.h:12:22: tr1/memory: No such file or directory

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #74 on: September 16, 2009, 10:23:05 pm »
Compiling the contrib-plugins workspace on linux at the moment, looks good so far.
Fix for autotolls comes, if compiling with C::B works.

By the way: if I close a project, the breakpointlist is not cleared.