Author Topic: Debugger issues  (Read 5233 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11629
    • Travis build status
Debugger issues
« on: March 28, 2007, 12:49:26 pm »
Hello, I have some questions/problems about debugging with code::blocks:

1. Why it is not possible to set breakpoints when the debugger is started?
2. Is it possible to continue the program at different point? I found that gdb can do it here: http://sourceware.org/gdb/current/onlinedocs/gdb_15.html#SEC147

Have these been implemented or planned for implementation in near future? If not how hard will it be for a newbie(me) in c::b development to implement them?

3. When I make a change to the code and hit "debug start" button, c::b locks with 100% cpu usage and have to kill it :lol:

I'm using svn build (I don't remeber when updated, but it was soon enough) under gentoo 64bit linux (I think on win32 the behaviour was the same).



(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: 2119
Re: Debugger issues
« Reply #1 on: March 28, 2007, 03:29:57 pm »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9488
Re: Debugger issues
« Reply #2 on: March 28, 2007, 04:41:34 pm »
3. When I make a change to the code and hit "debug start" button, c::b locks with 100% cpu usage and have to kill it :lol:
Cannot reproduce. Do you have a minimalistic project to demonstrate and a more detailed step-by-step instruction?
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline mike__t

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Debugger issues
« Reply #3 on: March 28, 2007, 07:45:38 pm »
I've run into this problem with a cross-platform project that has backtick expressions for various settings, e.g. `wx-config --libs`.  Under Windows, these are evaluated ok during a normal build, but for some it hangs when the build is launched by a request to start the debugger. 

I traced it far enough to see that it appears the launched command process never completes, but once I saw what was going on, I used the handy new platform feature to mark this target for Unix only.  (Our Windows target only uses path names.)


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11629
    • Travis build status
Re: Debugger issues
« Reply #4 on: March 28, 2007, 08:47:39 pm »
I've run into this problem with a cross-platform project that has backtick expressions for various settings, e.g. `wx-config --libs`.  Under Windows, these are evaluated ok during a normal build, but for some it hangs when the build is launched by a request to start the debugger. 

I traced it far enough to see that it appears the launched command process never completes, but once I saw what was going on, I used the handy new platform feature to mark this target for Unix only.  (Our Windows target only uses path names.)


Hm, may be the crashes were on windows. I've just tested on linux and there is no problem, it runs ok.
My project is SDL project, so I use `sdl-config --cflags`. Thanks for the enlightening :)


1. Why it is not possible to set breakpoints when the debugger is started?
      Okay, I should have given more info on this here. But I was at work, so there was no code::blocks to refresh my memory :oops:
So, the real problem is that I can't set breakpoint when the application is running (to make it stop), only when it is stopped on a breakpoint, then I can set/unset what ever I want.
Is is possible to be implement this feature?

     Thank you for your responses, and keep up the good work   :wink:
(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 byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: Debugger issues
« Reply #5 on: March 28, 2007, 08:56:16 pm »

      Okay, I should have given more info on this here. But I was at work, so there was no code::blocks to refresh my memory :oops:
So, the real problem is that I can't set breakpoint when the application is running (to make it stop), only when it is stopped on a breakpoint, then I can set/unset what ever I want.
Is is possible to be implement this feature?

     Thank you for your responses, and keep up the good work   :wink:


That was a problem few weeks ago. Now C::B has feature to stop running program :D. When your debugged application is running, just click on X button in debugger toolbar. It will break into your program so you may set breakpoints and other stuff and continue execution after that. But be carefull with it. Once you've stopped running program, next click on X button will kill it ;)

Regards
  BYO

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11629
    • Travis build status
Re: Debugger issues
« Reply #6 on: March 28, 2007, 10:41:10 pm »

That was a problem few weeks ago. Now C::B has feature to stop running program :D. When your debugged application is running, just click on X button in debugger toolbar. It will break into your program so you may set breakpoints and other stuff and continue execution after that. But be careful with it. Once you've stopped running program, next click on X button will kill it ;)

Regards
  BYO

Good. I suppose you have considered the option to split this function in two separate functions :)
What problems will arise if setting new breakpoint in this situation automatically stops the application, sets the breakpoint and continues it?

2. Is it possible to continue the program at different point? I found that gdb can do it here: http://sourceware.org/gdb/current/onlinedocs/gdb_15.html#SEC147

Add what about that? Is it possible or it is too hard to be done?
(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: 11629
    • Travis build status
Re: Debugger issues
« Reply #7 on: March 28, 2007, 11:41:16 pm »
Hm, some very old bug, I thought that was fixed, but no it is there :?

Code::Blocks is freshly built from svn...

The backtrace below is from a crash which happened when I started a debug session, the application stopped on the breakpoint, then I started clicking till C::B crashed. 100% reproducible

Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<report version="1.0" kind="exception">
  <system description="Linux 2.6.17-gentoo-r9 x86_64"/>
  <modules>
    <module path="/usr/bin/codeblocks" address="00400000" size="001b4000"/>
  </modules>
  <stack>
    <frame level="2" function="wxStackWalker::Walk(unsigned long)" offset="00000024"/>
    <frame level="3" function="wxDebugReport::AddContext(wxDebugReport::Context)" offset="00000a57"/>
    <frame level="4" function="EditorBase::CreateContextSubMenu(int)" offset="00000403"/>
    <frame level="5" function="wxFatalSignalHandler" offset="0000001c"/>
    <frame level="6"/>
    <frame level="7" function="wxListLineDataArray::DoEmpty()" offset="00000022"/>
    <frame level="8" function="wxListMainWindow::DoDeleteAllItems()" offset="0000020b"/>
    <frame level="9" function="wxListMainWindow::DeleteAllItems()" offset="00000009"/>
    <frame level="10" function="wxGenericListCtrl::DeleteAllItems()" offset="00000010"/>
    <frame level="11" function="SimpleListLog::Clear()" offset="00000020"/>
    <frame level="12" function="BreakpointsDlg::FillBreakpoints()" offset="00000031"/>
    <frame level="13" function="DebuggerGDB::AddBreakpoint(wxString const&amp;, int)" offset="00000091"/>
    <frame level="14" function="cbEditor::ToggleBreakpoint(int, bool)" offset="000000e6"/>
    <frame level="15" function="cbEditor::OnMarginClick(wxScintillaEvent&amp;)" offset="00000063"/>
    <frame level="16" function="wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&amp;, wxEvtHandler*, wxEvent&amp;)" offset="0000007f"/>
    <frame level="17" function="wxEvtHandler::SearchDynamicEventTable(wxEvent&amp;)" offset="00000052"/>
    <frame level="18" function="wxEvtHandler::ProcessEvent(wxEvent&amp;)" offset="00000095"/>
    <frame level="19" function="wxWindowBase::TryParent(wxEvent&amp;)" offset="00000045"/>
    <frame level="20" function="wxEvtHandler::ProcessEvent(wxEvent&amp;)" offset="00000063"/>
    <frame level="21" function="wxEvtHandler::ProcessEvent(wxEvent&amp;)" offset="00000050"/>
    <frame level="22" function="wxScintilla::NotifyParent(SCNotification*)" offset="00000081"/>
    <frame level="23" function="ScintillaWX::NotifyParent(SCNotification)" offset="00000015"/>
    <frame level="24" function="Editor::NotifyMarginClick(Point, bool, bool, bool)" offset="0000014a"/>
    <frame level="25" function="Editor::ButtonDown(Point, unsigned int, bool, bool, bool)" offset="000000a1"/>
    <frame level="26" function="wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&amp;, wxEvtHandler*, wxEvent&amp;)" offset="0000007f"/>
    <frame level="27" function="wxEventHashTable::HandleEvent(wxEvent&amp;, wxEvtHandler*)" offset="0000009e"/>
    <frame level="28" function="wxEvtHandler::ProcessEvent(wxEvent&amp;)" offset="000000c6"/>
    <frame level="29" function="wxEvtHandler::ProcessEvent(wxEvent&amp;)" offset="00000050"/>
    <frame level="30"/>
    <frame level="31"/>
    <frame level="32" function="g_closure_invoke" offset="0000010a"/>
    <frame level="33"/>
    <frame level="34" function="g_signal_emit_valist" offset="00000640"/>
    <frame level="35" function="g_signal_emit" offset="00000080"/>
    <frame level="36"/>
    <frame level="37" function="gtk_propagate_event" offset="000000ae"/>
    <frame level="38" function="gtk_main_do_event" offset="00000357"/>
    <frame level="39"/>
    <frame level="40" function="g_main_context_dispatch" offset="000001bc"/>
    <frame level="41"/>
    <frame level="42" function="g_main_loop_run" offset="00000196"/>
    <frame level="43" function="gtk_main" offset="000000a2"/>
    <frame level="44" function="wxEventLoop::Run()" offset="00000051"/>
    <frame level="45" function="wxAppBase::MainLoop()" offset="0000004b"/>
    <frame level="46"/>
    <frame level="47" function="wxEntry(int&amp;, wchar_t**)" offset="0000004c"/>
    <frame level="48" function="EditorBase::CreateContextSubMenu(int)" offset="000003c2"/>
  </stack>
</report>
(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: 9488
Re: Debugger issues
« Reply #8 on: March 28, 2007, 11:55:39 pm »
[...] then I started clicking till C::B crashed. 100% reproducible
Where did you start to click? Using which mouse button? Please be more detailed.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11629
    • Travis build status
Re: Debugger issues
« Reply #9 on: March 29, 2007, 09:31:05 am »
Where did you start to click? Using which mouse button? Please be more detailed.
With regards, Morten.

Sorry.
I was clicking on the red dot to set/unset the breakpoint where the debugger stopped.
There is also an arrow draw at that position. Hope this is enough to reproduce it yourself.
(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: 2119
Re: Debugger issues
« Reply #10 on: March 29, 2007, 04:06:29 pm »
Crashes clicking debugger breakpoint red dots have been reported many times and is reported in the berlios bug section.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9488
Re: Debugger issues
« Reply #11 on: March 29, 2007, 04:50:37 pm »
I was clicking on the red dot to set/unset the breakpoint where the debugger stopped.
There is also an arrow draw at that position. Hope this is enough to reproduce it yourself.
I'm sorry, but it isn't. :-( I clicked like hell but nothing happens... Could you provide me with a minimalistic project and a detailed step-by-step instruction?!
@pecan: which bug ID is it?
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2119
Re: Debugger issues
« Reply #12 on: March 29, 2007, 05:28:10 pm »
I was clicking on the red dot to set/unset the breakpoint where the debugger stopped.
There is also an arrow draw at that position. Hope this is enough to reproduce it yourself.
I'm sorry, but it isn't. :-( I clicked like hell but nothing happens... Could you provide me with a minimalistic project and a detailed step-by-step instruction?!
@pecan: which bug ID is it?
With regards, Morten.

My minimalist example is for Linux, but it happened to me about 3 times yesterday on MSW svn 3789.

http://developer.berlios.de/bugs/?func=detailbug&bug_id=9183&group_id=5358

I found where it's happening but never found its cause.
Forum thread:
http://forums.codeblocks.org/index.php/topic,5176.0.html

Though clicking like hell can cause it, it's not always necessary. Yesterday, I just clicked once on the red dot and CB crashed.
It doesn't always happen though. Maybe three times in 20 clicks.
« Last Edit: March 29, 2007, 05:31:30 pm by Pecan »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11629
    • Travis build status
Re: Debugger issues
« Reply #13 on: March 29, 2007, 06:53:45 pm »
Crashes clicking debugger breakpoint red dots have been reported many times and is reported in the berlios bug section.


Yes I see, I've made the wrong assumption that all debugger bugs goes to the Debugger category in the bug tracker.

I'm sorry, but it isn't. :-( I clicked like hell but nothing happens... Could you provide me with a minimalistic project and a detailed step-by-step instruction?!
With regards, Morten.

No clicking like hell is required 8) and I've tested with slow clicking 1/2 seconds interval between clicks, and with fast one, and the result 100% crashing. The number of clicks is not fixed.
That happend on all projects I've tested.
The minimalistic project is empty console application created with the project wizzard. Just copied the cout line because it didn't stop on the first line.

I'm on gcc 4.1.2 and gdb 6.6
(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: 9488
Re: Debugger issues
« Reply #14 on: March 29, 2007, 09:36:47 pm »
Though clicking like hell can cause it, it's not always necessary. Yesterday, I just clicked once on the red dot and CB crashed.
It doesn't always happen though. Maybe three times in 20 clicks.
Ok - I continued clicking in different frequencies, different number etc.... no crash at all. But: AFAIK this is hardly based on wxScintilla functionality, right? Because I'm not using the C::B's SVN version of wxScintitlla but a more recent (wxcode) one, v1.71.1. Maybe that's the reason why it works for me?
@pecan: You should have the knowledge - so do you mind to update your C::B's wxScintilla to that version and try if the crash still occurs, please?
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ