Author Topic: Attention massive speed up of the debugger  (Read 34463 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Attention massive speed up of the debugger
« on: October 07, 2009, 11:53:31 pm »
Hello,
here is a patch that improves the performance of the debugger massively.

The patch: http://smrt.is-a-geek.org/codeblocks/dbg_refactor/dbg_speedup.patch
It is against the debugger branch, but should apply in trunk (I've tested it and it worked against r5853)

How to test:
1. open some project
2. start debugging
3. stop on a breakpoint
4. open as many dbg windows as possible (call stack, threads, watches)
5. add many watches, complex variables are better (vectors will be great)
6. single step, through the code and see how the debugger toolbar is disable while the debugger is processing things

Execute the test before and after you've applied the patch.

What the patch does:
It adds a flag to the PipeProcess class, that controls if we will get notifications for every line of output or a single notification with the whole output.
The default value is set to notification for every line (the old behaviour).
With the patch only the debugger will use the new behaviour.

It seems that event passing is not so cheap in wx after all.

Have fun, feadback is quite welcome

p.s. I'm using the patch for some days now and I've not seen any problems only benefits

(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: 13406
    • Travis build status
Re: Attention massive speed up of the debugger
« Reply #1 on: October 13, 2009, 12:21:02 pm »
No one interested?  :shock: :?  :P
(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 thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Attention massive speed up of the debugger
« Reply #2 on: October 13, 2009, 12:35:37 pm »
I tried to apply your patch, but it complains that debuggergdb.cpp and pipedprocess.h have some mismatching lines.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Attention massive speed up of the debugger
« Reply #3 on: October 13, 2009, 12:46:51 pm »
Can you post the output of the patch command?

I've tried to apply it on trunk and on the debugger branch and it works. (as I've written in my post)
(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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Attention massive speed up of the debugger
« Reply #4 on: October 13, 2009, 01:09:25 pm »
No one interested?  :shock: :?  :P
I thought it was already applied in the trunk. :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Attention massive speed up of the debugger
« Reply #5 on: October 14, 2009, 01:18:17 am »
Can you post the output of the patch command?

I've tried to apply it on trunk and on the debugger branch and it works. (as I've written in my post)
Right-clicked with TortoiseSVN, and it said "fetching revision... (some number)" and then it said "the line (blah blah) does not match, maybe the file is out of date?"
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Attention massive speed up of the debugger
« Reply #6 on: October 14, 2009, 10:08:45 am »
Can you try with command line patch tool, because it spits more output?
I'm using (when I'm on windows) the one from UnixUtils and it seems to 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 stahta01

  • Lives here!
  • ****
  • Posts: 7785
    • My Best Post
Re: Attention massive speed up of the debugger
« Reply #7 on: October 14, 2009, 02:50:44 pm »
Applying to trunk; as of yesterday SVN ???? Not on partition with full SVN Tools. It was updated yesterday sometime.

Tim S.
Code
patch --backup-if-mismatch --unified --strip=0 --ignore-whitespace --forward --input=..\Patches\temp\dbg_speedup-CRLF.patch
patching file src/plugins/compilergcc/compilergcc.cpp
patching file src/plugins/debuggergdb/debuggergdb.cpp
Hunk #1 succeeded at 1035 (offset 394 lines).
patching file src/sdk/pipedprocess.cpp
patching file src/sdk/toolsmanager.cpp
patching file src/include/pipedprocess.h
Hunk #2 succeeded at 35 with fuzz 1.
« Last Edit: October 14, 2009, 03:08:56 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Attention massive speed up of the debugger
« Reply #8 on: October 15, 2009, 02:13:00 pm »
 :D
F:\codeblocks src>patch --backup-if-mismatch --unified --strip=0 --ignore-whitespace --forward --input=dbg_speedup.patch
patching file `src/plugins/compilergcc/compilergcc.cpp'
Assertion failed: hunk, file patch.c, line 321

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: Attention massive speed up of the debugger
« Reply #9 on: October 15, 2009, 02:43:00 pm »
:D
F:\codeblocks src>patch --backup-if-mismatch --unified --strip=0 --ignore-whitespace --forward --input=dbg_speedup.patch
patching file `src/plugins/compilergcc/compilergcc.cpp'
Assertion failed: hunk, file patch.c, line 321

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

This usually means that the patch was created on Windows with CRLF ('\r\n', vim: ^M), just convert EOLs to LF ('\n')

Eran

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Attention massive speed up of the debugger
« Reply #10 on: October 18, 2009, 08:21:18 pm »
No one interested?  :shock: :?  :P
Stay tuned... I have it applied since day 0, but was on holiday. If unsure after a (longer) while, simply PM me as a reminder.
@Thomas: Looks good to me so far, it's indeed a speedup.
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: Attention massive speed up of the debugger
« Reply #11 on: October 18, 2009, 08:34:53 pm »
I've figured it out :)
Just wanted to make some noise...

For the record it works perfectly on linux - arch 32bits, gentoo 64 bits ...

p.s. maybe other users (the compiler plugin in particular) of PipeProcess should be modified, so they can take advantage of the speedup
(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: Attention massive speed up of the debugger
« Reply #12 on: November 03, 2009, 03:10:12 pm »
I've figured it out :)
Just wanted to make some noise...

For the record it works perfectly on linux - arch 32bits, gentoo 64 bits ...

p.s. maybe other users (the compiler plugin in particular) of PipeProcess should be modified, so they can take advantage of the speedup

Your patch accidently slipped in r5876 (scrollingdialog) and it breaks debugging on my XP-machine, linux still works fine.
Creating the debuggers pipedprocess with eatEOL set to true also works, but with eatEOL set to false, debugger always hangs.
"Tested" with gdb 6.8.50 and 7.0.2.
I will revert the patch and try to find the problem (if possible).

EDIT:
Done (r5898),

sorry for any problems that might have occurred.
« Last Edit: November 03, 2009, 03:17:50 pm by jens »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Attention massive speed up of the debugger
« Reply #13 on: November 03, 2009, 03:30:13 pm »
Your patch accidently slipped in r5876 (scrollingdialog) and it breaks debugging on my XP-machine, linux still works fine.
Huh? That works fine for me here (WinXP, too)...?! How do you "reproduce" the hang?
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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Attention massive speed up of the debugger
« Reply #14 on: November 03, 2009, 03:39:54 pm »
Your patch accidently slipped in r5876 (scrollingdialog) and it breaks debugging on my XP-machine, linux still works fine.
Huh? That works fine for me here (WinXP, too)...?! How do you "reproduce" the hang?

Create a console-project, compile, set a breakpoint, start the debugger and the bp is never reached.
I also can not stop the debug-process, only kill it via taskmanager.

gdb uses 0% of my CPU and only very moderate ram (just a simple hello-world-program).

gcc 4.4.1 TDM-2 (sjlj),
gdb either shipped with TDM's MinGW (6.8 ) or 7.0.2.

As written before:
Creating the debuggers pipedprocess with eatEOL set to true also works, but with eatEOL set to false, debugger always hangs.