Author Topic: When debugger plugin is disabled C::B crashes  (Read 9529 times)

Offline comsytec

  • Multiple posting newcomer
  • *
  • Posts: 58
    • www.comsytec.com
When debugger plugin is disabled C::B crashes
« on: September 03, 2013, 01:09:01 pm »
C::B 12.11 crashes when some edits are made in editor and "Debugger" plugin is disabled. Must this plugin always present ?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: When debugger plugin is disabled C::B crashes
« Reply #1 on: September 03, 2013, 01:27:33 pm »
It also happens with latest nightly, if you disable the plugin and do not close C::B before using the editor, C::B crashes immediately.

Quote
Error occured on Tuesday, September 3, 2013 at 13:22:22.

C:\Programme\CodeBlocks-12.11\codeblocks.exe caused an Access Violation at location 617deb2f in module C:\Programme\CodeBlocks-12.11\codeblocks.dll Reading from location 00000000.

Registers:
eax=00000000 ebx=0300e630 ecx=00e39b10 edx=0022ec28 esi=0022ede4 edi=617de818
eip=617deb2f esp=0022ebbc ebp=03087020 iopl=0         nv up ei pl nz ac po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010216

Call stack:
617DEB2F  C:\Programme\CodeBlocks-12.11\codeblocks.dll:617DEB2F  _ZN8cbEditor16OnEditorModifiedER16wxScintillaEvent


That's all I have in the crash-report.
No time and no development version here to dig into it deeper.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: When debugger plugin is disabled C::B crashes
« Reply #2 on: September 03, 2013, 02:00:36 pm »
I'll look at it tonight.

Just to clarify the steps to reproduce it:
1. plugins -> manage -> disable debuggergdb
2. type something in the editor?
(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: 7255
Re: When debugger plugin is disabled C::B crashes
« Reply #3 on: September 03, 2013, 02:30:48 pm »
I'll look at it tonight.

Just to clarify the steps to reproduce it:
1. plugins -> manage -> disable debuggergdb
2. type something in the editor?
Yes.
At least on windows, I did not try on linux, but I don't believe there's a difference.

Offline comsytec

  • Multiple posting newcomer
  • *
  • Posts: 58
    • www.comsytec.com
Re: When debugger plugin is disabled C::B crashes
« Reply #4 on: September 03, 2013, 04:15:27 pm »
Why do you have choosen the debugger to be the part of SDK  and not to continue in standalone debugger plugin with less SDK dependencies ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: When debugger plugin is disabled C::B crashes
« Reply #5 on: September 03, 2013, 04:26:37 pm »
Because this way you can have multiple plugins from different vendors and there will be no duplications of UI windows.

The other option was to allow the debugger plugin to have it's own plugins, which sounds ridicules... 
(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: 7255
Re: When debugger plugin is disabled C::B crashes
« Reply #6 on: September 03, 2013, 07:30:02 pm »
Just a quick info:
I get the crash in cbeditor.cpp:3207 because the pointer is null :
 
Quote
       cbBreakpointsDlg *dlg = Manager::Get()->GetDebuggerManager()->GetBreakpointDialog();
        dlg->Reload();
 
I think it should not even try to (re)load the (any) debuuger-dialog(s) if no plugin is available.
Or only reload sdk-stuff and nothing provided by a plugin.

I'm still not at home but now with my linux-laptop so I was able to run C::B through gdb.
So still no tme to look into it deeper, but I think you (oBFusCATed ) are much more familiar with the code and it should be not too hard (hopefully) to fix it.

Offline blauzahn

  • Almost regular
  • **
  • Posts: 153
Re: When debugger plugin is disabled C::B crashes
« Reply #7 on: September 03, 2013, 07:49:59 pm »
The crash occurs on linux too.

1) start freshly compiled and installed cb
2) open existing hello world project
3) disable debugger plugin
4) type some characters in the editor
5) hit enter-key
6) crash

svn build rev 9288 (2013-09-02 20:39:28) gcc 4.6.4 Linux/unicode - 64 bit
ubuntu 12.04

excerpt from crashlog:

Code
<report version="1.0" kind="exception">
  <system description="Linux 3.8.0-29-generic x86_64"/>
  ...
    <module path="/usr/local/bin/codeblocks" address="00400000" size="0013c000"/>
    <module path="/usr/local/bin/codeblocks" address="0074d000" size="00006000"/>
  ...
    <module path="/usr/local/lib/codeblocks/plugins/libdebugger.so" address="7fd96d792000" size="0008a000"/>
    <module path="/usr/local/lib/codeblocks/plugins/libdebugger.so" address="7fd96da1c000" size="00006000"/>
  ...
</modules>
  <stack>
    <frame level="0"/>
    <frame level="1" function="cbEditor::OnEditorModified(wxScintillaEvent&amp;)" offset="00000237"/>
    <frame level="2" function="wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&amp;, wxEvtHandler*, wxEvent&amp;)" offset="00000055"/>
    <frame level="3" function="wxEvtHandler::SearchDynamicEventTable(wxEvent&amp;)" offset="0000004f"/>
    <frame level="4" function="wxEvtHandler::ProcessEvent(wxEvent&amp;)" offset="00000092"/>
    <frame level="5" function="wxWindowBase::TryParent(wxEvent&amp;)" offset="00000039"/>
    <frame level="6" function="wxEvtHandler::ProcessEvent(wxEvent&amp;)" offset="00000050"/>
    <frame level="7" function="wxScintilla::NotifyParent(SCNotification*)" offset="00000078"/>
    <frame level="8" function="ScintillaWX::NotifyParent(SCNotification)" offset="00000015"/>
    <frame level="9" function="Editor::NotifyModified(Document*, DocModification, void*)" offset="0000051e"/>
    <frame level="10" function="Document::NotifyModified(DocModification)" offset="000000af"/>
    <frame level="11" function="Document::InsertString(int, char const*, int)" offset="0000027c"/>
    <frame level="12" function="Editor::NewLine()" offset="000000b0"/>
    <frame level="13" function="Editor::KeyCommand(unsigned int)" offset="00001315"/>
    <frame level="14" function="Editor::WndProc(unsigned int, unsigned long, long)" offset="00000512"/>
    <frame level="15" function="ScintillaWX::WndProc(unsigned int, unsigned long, long)" offset="00000058"/>
    <frame level="16" function="Editor::KeyDownWithModifiers(int, int, bool*)" offset="0000005d"/>
    <frame level="17" function="wxScintilla::OnKeyDown(wxKeyEvent&amp;)" offset="00000027"/>
    <frame level="18" function="wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&amp;, wxEvtHandler*, wxEvent&amp;)" offset="00000055"/>
    <frame level="19" function="wxEventHashTable::HandleEvent(wxEvent&amp;, wxEvtHandler*)" offset="000000ac"/>
    <frame level="20" function="wxEvtHandler::ProcessEvent(wxEvent&amp;)" offset="000000b4"/>
    <frame level="21" function="wxEvtHandler::ProcessEvent(wxEvent&amp;)" offset="00000050"/>
    <frame level="22"/>
    <frame level="23"/>
    <frame level="24" function="g_closure_invoke" offset="00000132"/>
    <frame level="25"/>
    <frame level="26" function="g_signal_emit_valist" offset="00000a5e"/>
    <frame level="27" function="g_signal_emit" offset="00000082"/>
    <frame level="28"/>
    <frame level="29" function="gtk_window_propagate_key_event" offset="000000eb"/>
    <frame level="30"/>
    <frame level="31"/>
    <frame level="32" function="g_closure_invoke" offset="00000132"/>
    <frame level="33"/>
    <frame level="34" function="g_signal_emit_valist" offset="00000a5e"/>
    <frame level="35" function="g_signal_emit" offset="00000082"/>
    <frame level="36"/>
    <frame level="37" function="gtk_propagate_event" offset="00000197"/>
    <frame level="38" function="gtk_main_do_event" offset="00000283"/>
    <frame level="39"/>
    <frame level="40" function="g_main_context_dispatch" offset="00000133"/>
    <frame level="41"/>
    <frame level="42" function="g_main_loop_run" offset="0000006a"/>
    <frame level="43" function="gtk_main" offset="000000a7"/>
    <frame level="44" function="wxEventLoop::Run()" offset="00000048"/>
    <frame level="45" function="wxAppBase::MainLoop()" offset="0000004b"/>
  </stack>
</report>

Full log availiable if necessary.

I hope, this helps.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: When debugger plugin is disabled C::B crashes
« Reply #8 on: September 03, 2013, 07:51:54 pm »
Yeah, I saw the backtrace, too.
It is not that simpler and it is not the only place that exhibits the problem, unfortunately.
It happens because if there are no debugger plugin, the debugger manager destroys
all debugger related UI objects. I'm not sure this is good idea, so it might change in the
future.

I'll try to fix it in the next couple of days...
(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 comsytec

  • Multiple posting newcomer
  • *
  • Posts: 58
    • www.comsytec.com
Re: When debugger plugin is disabled C::B crashes
« Reply #9 on: September 03, 2013, 09:34:14 pm »
So I think same can occur at every place in the SDK where
Code
 Manager::Get()->GetDebuggerManager()->GetBreakpointDialog();
is refered and the return value is not properly handled.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: When debugger plugin is disabled C::B crashes
« Reply #10 on: September 03, 2013, 10:09:34 pm »
I'm looking at it, but generally there is no need to do nullptr checks at every use of the GetBreakpointDialog.
Most of the times you can be sure that the value would be non-null.
(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: When debugger plugin is disabled C::B crashes
« Reply #11 on: September 03, 2013, 11:28:27 pm »
Hopefully all crashes should be fixed in HEAD.
(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!]