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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #435 on: February 16, 2011, 03:20:13 pm »
Pecan: Can you past the debugger's debug log?

p.s. Works here, gentoo linux 64bit, gcc 4.4.5, gdb 7.2
« Last Edit: February 16, 2011, 03:23: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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2770
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #436 on: February 17, 2011, 02:27:13 pm »
Pecan: Can you past the debugger's debug log?

p.s. Works here, gentoo linux 64bit, gcc 4.4.5, gdb 7.2

svn build  rev 6973 (2011-02-07 13:39:14)   gcc 4.3.1 Windows/unicode - 32 bit

Code
// ---------------------------------------------------------------------
Step Into log
// ---------------------------------------------------------------------
PATH=.;C:\Usr\mingw431\bin;C:\WINDOWS\system32;C:\WINDOWS;.;c:\usr\bin;c:\usr\bin\subversion\
Command-line: C:\Usr\mingw431\bin\gdb.exe -nx -fullname  -quiet -args ./debug/codetest.exe
Working dir : C:\temp\test\
> set prompt >>>>>>cb_gdb:
Reading symbols from C:\temp\test/./debug/codetest.exe...done.
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb (GDB) 7.0
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set print elements -1
>>>>>>cb_gdb:
> set debugevents on
>>>>>>cb_gdb:
> set new-console on
>>>>>>cb_gdb:
> set disassembly-flavor att
>>>>>>cb_gdb:
> source C:\Usr\Proj\cbDebug\trunk\src\output\share\codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> directory C:/temp/test/
>>>>>>cb_gdb:
> run
gdb: windows_init_thread_list
[New Thread 1120.0x454]
Error: dll starting at 0x77210000 not found.
Error: dll starting at 0x757e0000 not found.
Error: dll starting at 0x77210000 not found.
Error: dll starting at 0x77330000 not found.
Program exited normally.
>>>>>>cb_gdb:
> set debugevents off
>>>>>>cb_gdb:
> quit


// ---------------------------------------------------------------------
Run to Cursor Log
// ---------------------------------------------------------------------
PATH=.;C:\Usr\mingw431\bin;C:\WINDOWS\system32;C:\WINDOWS;.;c:\usr\bin;c:\usr\bin\subversion\
Command-line: C:\Usr\mingw431\bin\gdb.exe -nx -fullname  -quiet -args ./debug/codetest.exe
Working dir : C:\temp\test\
> set prompt >>>>>>cb_gdb:
Reading symbols from C:\temp\test/./debug/codetest.exe...done.
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb (GDB) 7.0
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set print elements -1
>>>>>>cb_gdb:
> set debugevents on
>>>>>>cb_gdb:
> set new-console on
>>>>>>cb_gdb:
> set disassembly-flavor att
>>>>>>cb_gdb:
> source C:\Usr\Proj\cbDebug\trunk\src\output\share\codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> directory C:/temp/test/
>>>>>>cb_gdb:
> tbreak "C:/temp/test/main.cpp:5"
Temporary breakpoint 1 at 0x401366: file C:\temp\test\main.cpp, line 5.
>>>>>>cb_gdb:
> run
gdb: windows_init_thread_list
[New Thread 4132.0x1200]
Error: dll starting at 0x77210000 not found.
Error: dll starting at 0x757e0000 not found.
Error: dll starting at 0x77210000 not found.
Error: dll starting at 0x77330000 not found.
Temporary breakpoint 1, main () at C:\temp\test\main.cpp:7
C:\temp\test\main.cpp:7:62:beg:0x401366
>>>>>>cb_gdb:
> set debugevents off
>>>>>>cb_gdb:

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #437 on: February 17, 2011, 02:52:56 pm »
Does this happen with simple "Hello world" console application?
Or the project is a bit different - native or gui?
(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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2770
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #438 on: February 17, 2011, 06:39:57 pm »
Does this happen with simple "Hello world" console application?
Or the project is a bit different - native or gui?

It's a simple Hello World created by the wizard.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #439 on: February 17, 2011, 08:34:56 pm »
Pecan: I should try it on windows... can you try the latest debugger's branch nightly?

Also next patch is here: http://smrt.is-a-geek.org/codeblocks/patches/dbg/dbg_refactor0019.2.patch

What it does:
1. Don't show the breakpoints for the inactive debuggers in the editor's margin. It is refreshed, when the active debugger changes;
2. Extract, some code from CompilerFinished, so it is simpler to implement and less error prone;
3. Document CompilerFinished;
4. Add some logging, when we try to interrupt the debugger;
5. Reorder the source files in the test project file (C::B wants to do it)
(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 dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #440 on: February 18, 2011, 03:38:33 am »
I need some help with the watches interface. How do I specify that a watch object is expandable without adding children? In python, everything is an object, so it should be possible to expand and see the child members of the object, but I don't want to actually add any children until the user expands the item.

Thx.

EDIT: Would also help if cbWatch included an easy way to recursively iterate through all children of a watch.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #441 on: February 18, 2011, 08:00:15 am »
I need some help with the watches interface. How do I specify that a watch object is expandable without adding children? In python, everything is an object, so it should be possible to expand and see the child members of the object, but I don't want to actually add any children until the user expands the item.
Implement:
Code
        virtual void ExpandWatch(cbWatch *watch) = 0;
        virtual void CollapseWatch(cbWatch *watch) = 0;
These are called when the user expands and collapses specific watch, see how it is done in the gdb/mi.
I think you should add dummy initial children (updating in progress for example)...

EDIT: Would also help if cbWatch included an easy way to recursively iterate through all children of a watch.
Patches welcome or please specify the requirement better :)
(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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #442 on: February 19, 2011, 11:56:41 pm »
Next patch: http://smrt.is-a-geek.org/codeblocks/patches/dbg/dbg_refactor0019.3.patch

What it does:
1. Removes "Debug-> Edit Watches...", it was unused;
2. Fixed the OnUpdateUI methods: if there was no active debugger all controls were active, now all controls are disabled;
(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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2770
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #443 on: February 24, 2011, 10:31:46 pm »
Pecan: I should try it on windows... can you try the latest debugger's branch nightly?

Also next patch is here: http://smrt.is-a-geek.org/codeblocks/patches/dbg/dbg_refactor0019.2.patch

What it does:
1. Don't show the breakpoints for the inactive debuggers in the editor's margin. It is refreshed, when the active debugger changes;
2. Extract, some code from CompilerFinished, so it is simpler to implement and less error prone;
3. Document CompilerFinished;
4. Add some logging, when we try to interrupt the debugger;
5. Reorder the source files in the test project file (C::B wants to do it)


RE: "Step Into" does not break the program as a means to start the debugging session.

I tried the latest nightly *and* the latest debugger branch with the same results. I.e., using Step Into to start the pgm and break on the first statement does not do so. It acts like "run" instead.

This is a simple console "Hello World" generated by the wizard.

svn build  rev 7017 (2011-02-19 13:44:32)   gcc 4.5.1 Windows/unicode - 32 bit

I should also mention that the same problem occurs for me in the regular SVN branch. (windows)

If starting the debugging session with "Step Into" was never intended to work, it should be disabled.

Debugger Log:
Code
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\temp\test\
Adding source dir: C:\temp\test\
Adding file: .\debug\StepIntoTest.exe
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.0
Child process PID: 5116
Program exited normally.
Debugger finished with status 0
Debuggers Debug Log:
Code
PATH=.;C:\Usr\mingw431\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Dell\Dell Wireless WLAN Card;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\usr\bin;C:\Program Files (x86)\CollabNet Subversion;C:\Program Files (x86)\TortoiseSVN\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Common Files\Adobe\AGL
Command-line: C:\Usr\mingw431\bin\gdb.exe -nx -fullname  -quiet -args ./debug/StepIntoTest.exe
Working dir : C:\temp\test\
> set prompt >>>>>>cb_gdb:
Reading symbols from C:\temp\test/./debug/StepIntoTest.exe...done.
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb (GDB) 7.0
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set print elements -1
>>>>>>cb_gdb:
> set debugevents on
>>>>>>cb_gdb:
> set new-console on
>>>>>>cb_gdb:
> set disassembly-flavor att
>>>>>>cb_gdb:
> source c:\temp\Nightly\share\codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> directory C:/temp/test/
>>>>>>cb_gdb:
> run
gdb: windows_init_thread_list
[New Thread 5116.0xca8]
Error: dll starting at 0x77440000 not found.
Error: dll starting at 0x75ff0000 not found.
Error: dll starting at 0x77440000 not found.
Error: dll starting at 0x77560000 not found.
Program exited normally.
>>>>>>cb_gdb:
> set debugevents off
>>>>>>cb_gdb:
> quit
« Last Edit: February 24, 2011, 10:57:42 pm by Pecan »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #444 on: February 28, 2011, 08:56:31 am »
Next patch (it doesn't apply for me, but should show you what should be done): http://smrt.is-a-geek.org/codeblocks/patches/dbg/dbg_refactor0019.4.patch

What it does: it removes the debuggertree.h/cpp from svn and the projects (unix only).

Next patch (main patch for the post): http://smrt.is-a-geek.org/codeblocks/patches/dbg/dbg_refactor0020.0.patch

What it does: Reimplement the settings GUI/API for the debuggers;
This patch is intended as a preview, to show the direction I'm going. Dmoore and Morten please take a look at it.
I'm applying it on my main build of C::B and will test it in the next few days then I'll write the complete commit message...

p.s. tested only on linux, so you should modify the windows project if you want C::B to compile :)
(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 dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #445 on: March 01, 2011, 08:12:31 pm »
Next patch (it doesn't apply for me, but should show you what should be done): http://smrt.is-a-geek.org/codeblocks/patches/dbg/dbg_refactor0019.4.patch
...
Next patch (main patch for the post): http://smrt.is-a-geek.org/codeblocks/patches/dbg/dbg_refactor0020.0.patch
...

I applied both patches, which applied with some weirdness (some of this stuff has been applied previously?). C::B builds fine and I can see the new dialog. Looks good, but I haven't spent much time testing the functionality. So what is the major breakage here? :)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #446 on: March 02, 2011, 12:11:50 am »
0019.4 seems applied by Morten.

The main breakage will probably be related to the new "Debug -> Active debuggers -> Target's default" feature.
Also most of the exotic embedded targets won't have correct default settings for the debugger...
(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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #447 on: March 03, 2011, 02:32:58 pm »
Two new patches:
1. http://smrt.is-a-geek.org/codeblocks/patches/dbg/dbg_refactor0019.5.patch
Fixes:
* Step into was not working on windows (the code was different on windows/mac and linux, not it is the same on all platforms)
* Marked on of the reg expressions to use the wxRE_ADVANCED

2. http://smrt.is-a-geek.org/codeblocks/patches/dbg/dbg_refactor0019.6.patch
Fixes:
* Refactored a bit the stack frame parsing code (extracted it in a function)
* Added tests for stack frame parsing
* Another case of stack frame output is parsed correctly ("#11  0x00406810 in main ()")
* Refactored a bit the debuggergdb test project

All development and testing is done on windows, I'll test it on linux later today. Probably patch 20.0 won't apply anymore, I'll fix that, too.

Morten, can I ask you to reject any patches (even made by me), which change a regexp and don't provide a test for it?
(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: 9694
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #448 on: March 03, 2011, 03:22:56 pm »
1. http://smrt.is-a-geek.org/codeblocks/patches/dbg/dbg_refactor0019.5.patch
Concerning this one: Hopefully you noticed that you've removed a work-around for windows, namely stated in this comment:
Code
    // under windows, 'start' segfaults with wx projects...
So either this is fixed in recent GDB's (did you try that functionality on all platforms?), or you might have overseen. Any comment on that?
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 dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Splitting debugger in two - specific debugger and common GUI
« Reply #449 on: March 03, 2011, 03:45:24 pm »
0019.4 seems applied by Morten.

The main breakage will probably be related to the new "Debug -> Active debuggers -> Target's default" feature.
Also most of the exotic embedded targets won't have correct default settings for the debugger...

Is that because of the various instances of this:

Code
-        m_Programs.DBG = _T("ppc-insight.exe");
+        m_Programs.DBGconfig = wxEmptyString; // _T("ppc-insight.exe");

not sure why you are setting them to empty strings...