Author Topic: C::B crash (Settings-->Editor)  (Read 55749 times)

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: C::B crash (Settings-->Editor)
« Reply #15 on: April 14, 2006, 02:40:23 pm »
Quote
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1228880192 (LWP 13442)]
0xb7a05349 in wxStringBase::AllocBeforeWrite ()
   from /usr/lib/libwx_baseu-2.6.so.0
(gdb)

Michael,

Could you do that again. Then when the "(gdb)" prompt
occurs after the SIGSEGV could you issue a backtrace
command. "bt" so we can see who is entering the
AllocBeforeWrite() segfaulted routine. You may have
to issue a number of "bt"s to see the *cause* of the error.

I have got the following (quite a lot):

Quote
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1228597568 (LWP 1370)]
0xb7a4a349 in wxStringBase::AllocBeforeWrite ()
   from /usr/lib/libwx_baseu-2.6.so.0
(gdb) bt
#0  0xb7a4a349 in wxStringBase::AllocBeforeWrite ()
   from /usr/lib/libwx_baseu-2.6.so.0
#1  0xb7a4acb0 in wxStringBase::AssignCopy ()
   from /usr/lib/libwx_baseu-2.6.so.0
#2  0xb7a4ad34 in wxStringBase::operator= () from /usr/lib/libwx_baseu-2.6.so.0
#3  0x0806da16 in wxString::operator= (this=0x98db36c, psz=0xb5cd1210)
    at string.h:854
#4  0xb5cba35e in LoadDefaultSettings (languages=0x98db36c)
    at codestatconfig.cpp:224
#5  0xb5cbac3b in LoadSettings (languages=0x98db36c) at codestatconfig.cpp:297
#6  0xb5cbb3f4 in CodeStatConfigDlg (this=0x98db208, parent=0x879ebd0)
    at codestatconfig.cpp:42
#7  0xb5cb64ed in CodeStat::GetConfigurationPanel (this=0x87c7e00,
    parent=0x879ebd0) at codestat.cpp:80
#8  0xb7858504 in PluginManager::GetConfigurationPanels (this=0x9180228,
    group=4, parent=0x879ebd0, arrayToFill=@0xbfbbb34c)
    at sdk/pluginmanager.cpp:470
#9  0xb77feb1f in EditorConfigurationDlg::AddPluginPanels (this=0xbfbbb158)
    at sdk/editorconfigurationdlg.cpp:258
#10 0xb78039be in EditorConfigurationDlg (this=0xbfbbb158, parent=0x89aac08)
    at sdk/editorconfigurationdlg.cpp:234
#11 0xb7815ac3 in EditorManager::Configure (this=0x8b042c0)
    at sdk/editormanager.cpp:269
---Type <return> to continue, or q <return> to quit---
#12 0x0809128d in MainFrame::OnSettingsEditor (this=0x89aac08,
    event=@0xbfbbb730) at src/main.cpp:2975
#13 0xb79fa2c1 in wxAppConsole::HandleEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#14 0xb7a82edf in wxEvtHandler::ProcessEventIfMatches ()
   from /usr/lib/libwx_baseu-2.6.so.0
#15 0xb7a830b0 in wxEventHashTable::HandleEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#16 0xb7a83261 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#17 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#18 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#19 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#20 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#21 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#22 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#23 0xb7a83207 in wxEvtHandler::ProcessEvent ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib/libwx_baseu-2.6.so.0
#24 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#25 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#26 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#27 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#28 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#29 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#30 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#31 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#32 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#33 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#34 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
---Type <return> to continue, or q <return> to quit---
#35 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#36 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#37 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#38 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#39 0xb7a83207 in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#40 0xb7c7de45 in wxMenu::~wxMenu () from /usr/lib/libwx_gtk2u_core-2.6.so.0
#41 0xb6dfeab3 in g_cclosure_marshal_VOID__VOID ()
   from /usr/lib/libgobject-2.0.so.0
#42 0xb6df33a8 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#43 0xb6e01b13 in g_signal_stop_emission () from /usr/lib/libgobject-2.0.so.0
#44 0xb6e03150 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#45 0xb6e034c3 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#46 0xb7231f8d in IA__gtk_widget_activate (widget=0x8357a80)
    at gtkwidget.c:3766
#47 0xb715ec69 in IA__gtk_menu_shell_activate_item (menu_shell=0x8b02448,
    menu_item=0x8357a80, force_deactivate=1) at gtkmenushell.c:1057
#48 0xb715ef3d in gtk_menu_shell_button_release (widget=0x8b02448,
    event=0x83c20f0) at gtkmenushell.c:663
---Type <return> to continue, or q <return> to quit---
#49 0xb715566e in gtk_menu_button_release (widget=0x8b02448, event=0x98db36c)
    at gtkmenu.c:2571
#50 0xb715002c in _gtk_marshal_BOOLEAN__BOXED (closure=0x8141e60,
    return_value=0xbfbbbdf0, n_param_values=2, param_values=0xbfbbbedc,
    invocation_hint=0xbfbbbddc, marshal_data=0xb715561f) at gtkmarshalers.c:83
#51 0xb6df2d75 in g_cclosure_new_swap () from /usr/lib/libgobject-2.0.so.0
#52 0xb6df33a8 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#53 0xb6e01c9f in g_signal_stop_emission () from /usr/lib/libgobject-2.0.so.0
#54 0xb6e02ec3 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#55 0xb6e034c3 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#56 0xb723216f in gtk_widget_event_internal (widget=0x8b02448, event=0x83c20f0)
    at gtkwidget.c:3735
#57 0xb714e767 in IA__gtk_propagate_event (widget=0x8b02448, event=0x83c20f0)
    at gtkmain.c:2169
#58 0xb714eba0 in IA__gtk_main_do_event (event=0x83c20f0) at gtkmain.c:1406
#59 0xb735cb2d in gdk_event_dispatch (source=0x98db36c, callback=0,
    user_data=0x0) at gdkevents-x11.c:2291
#60 0xb6d854ee in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#61 0xb6d884f6 in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#62 0xb6d887e3 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#63 0xb714de65 in IA__gtk_main () at gtkmain.c:985
#64 0xb7c0a2a7 in wxEventLoop::Run () from /usr/lib/libwx_gtk2u_core-2.6.so.0
#65 0xb7c99b6a in wxAppBase::MainLoop ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib/libwx_gtk2u_core-2.6.so.0
#66 0xb7c99c4f in wxAppBase::OnRun () from /usr/lib/libwx_gtk2u_core-2.6.so.0
#67 0x08069f40 in CodeBlocksApp::OnRun (this=0x8129de0) at src/app.cpp:470
#68 0xb7a2dad4 in wxEntry () from /usr/lib/libwx_baseu-2.6.so.0
#69 0xb7a2db88 in wxEntry () from /usr/lib/libwx_baseu-2.6.so.0
#70 0x080693d0 in main (argc=1, argv=0xbfbbc494) at src/app.cpp:96
(gdb)

Best wishes,
Michael

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B crash (Settings-->Editor)
« Reply #16 on: April 15, 2006, 01:35:14 am »
Code
#3  0x0806da16 in wxString::operator= (this=0x98db36c, psz=0xb5cd1210)
    at string.h:854
#4  0xb5cba35e in LoadDefaultSettings (languages=0x98db36c)
    at codestatconfig.cpp:224
#5  0xb5cbac3b in LoadSettings (languages=0x98db36c) at codestatconfig.cpp:297
#6  0xb5cbb3f4 in CodeStatConfigDlg (this=0x98db208, parent=0x879ebd0)
    at codestatconfig.cpp:42
#7  0xb5cb64ed in CodeStat::GetConfigurationPanel (this=0x87c7e00,
    parent=0x879ebd0) at codestat.cpp:80
#8  0xb7858504 in PluginManager::GetConfigurationPanels (this=0x9180228,
    group=4, parent=0x879ebd0, arrayToFill=@0xbfbbb34c)


My initial impression:

It appear to me that codestats is referencing an unallocated array(languages)in statement 224. Editor Settings calls codestate config routine which attempts to read in info into array "languages" which is only allocated locally in CodeStat::Execute() which has not been executed.

I'll try to get this error myself, but if I cannot, I'll ask Michael to do a "frame 5" then a "print languages" and see what happens.

Any comments?

thanks
pecan



Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B crash (Settings-->Editor)
« Reply #17 on: April 15, 2006, 03:31:36 am »
Code
int LoadSettings(LanguageDef languages[NB_FILETYPES_MAX])
{
    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("codestat"));
    int nb_languages = cfg->ReadInt(_T("/nb_languages"), 0);

    // If no comment styles exist, use and save default ones
    if (nb_languages == 0)
    {
       nb_languages = LoadDefaultSettings(languages);
    }
    // else, load the user settings


I've tried for a couple of hours to recreate the error, but have failed.
It appears to be happening when nb_languages == 0.
My system always gets an nb_languages = 7. So...
Yiannis may be right about corrupted resources. But the err should
not segfault CB.

I'll work on this some more when I have time. But for now...
It's Easter and I have to pay attention to family.

thanks
pecan

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: C::B crash (Settings-->Editor)
« Reply #18 on: April 15, 2006, 08:30:30 pm »
Code
int LoadSettings(LanguageDef languages[NB_FILETYPES_MAX])
{
    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("codestat"));
    int nb_languages = cfg->ReadInt(_T("/nb_languages"), 0);

    // If no comment styles exist, use and save default ones
    if (nb_languages == 0)
    {
       nb_languages = LoadDefaultSettings(languages);
    }
    // else, load the user settings


I've tried for a couple of hours to recreate the error, but have failed.
It appears to be happening when nb_languages == 0.
My system always gets an nb_languages = 7. So...
Yiannis may be right about corrupted resources. But the err should
not segfault CB.

Hello,

Thanks for your investigation :).

About corrupted resources, I am do not know. I always svn up, build C::B, ./update and then the contr. plugins... I think that the resources should be up tp date, or?

I will check about nb_languages. May be a additional check could be add to prevent nb_languages=0 problems.

I'll work on this some more when I have time. But for now...
It's Easter and I have to pay attention to family.

Happy Easter :).

Best wishes,
Michael

« Last Edit: April 15, 2006, 08:32:11 pm by Michael »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B crash (Settings-->Editor)
« Reply #19 on: April 15, 2006, 11:00:46 pm »
Quote
I always svn up, build C::B, ./update and then the contr. plugins...

could you try to svn update; CB compile; contrib plugin compile, *then*
./update

see if that makes a difference...

thanks
pecan

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: C::B crash (Settings-->Editor)
« Reply #20 on: April 15, 2006, 11:19:00 pm »
Quote
I always svn up, build C::B, ./update and then the contr. plugins...

could you try to svn update; CB compile; contrib plugin compile, *then*
./update

see if that makes a difference...

Ok, I will give it a try.

Thanks for the suggestion.

Best wishes,
Michael

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: C::B crash (Settings-->Editor)
« Reply #21 on: April 15, 2006, 11:35:12 pm »
Quote
I always svn up, build C::B, ./update and then the contr. plugins...

could you try to svn update; CB compile; contrib plugin compile, *then*
./update

see if that makes a difference...

Ok, I will give it a try.

C::B still crashes when trying Settings-->Editor.

Best wishes,
Michael

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B crash (Settings-->Editor)
« Reply #22 on: April 16, 2006, 12:25:35 am »
Quote
from Michael....
C::B still crashes when trying Settings-->Editor.

Ok, thanks. It was just a stab in the dark.
I'm currently 200 miles from my Linux system,
so I'll pick up on this on Thursday next.

thanks
pecan


Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: C::B crash (Settings-->Editor)
« Reply #23 on: April 16, 2006, 12:29:31 am »
Quote
from Michael....
C::B still crashes when trying Settings-->Editor.

Ok, thanks. It was just a stab in the dark.
I'm currently 200 miles from my Linux system,
so I'll pick up on this on Thursday next.

Anyway, it was worth trying :).

I try to debug C::B/codestats too, but my Pentium III is so slow that is not really a pleasure to work with.

Best wishes,
Michael

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B crash (Settings-->Editor)
« Reply #24 on: April 16, 2006, 12:57:38 am »
EDIT: never mind.. nb_lanugages is in default.conf.
Code
	<codestat>

<NB_LANGUAGES int="7" />
Will someone explain the following statements in CodeStat
Code
291    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("codestat"));
292    int nb_languages = cfg->ReadInt(_T("/nb_languages"), 0);
evidently, my guess at what they're doing is incorrect. I cannot find a field "nb_languages"
in the resources.

thanks
pecan
« Last Edit: April 16, 2006, 01:04:54 am by Pecan »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B crash (Settings-->Editor)
« Reply #25 on: April 16, 2006, 01:06:17 am »
Michael,

would you look in default.conf (or which ever the one you're using)
and show us your <codestat> entry.

thanks
pecan

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: C::B crash (Settings-->Editor)
« Reply #26 on: April 16, 2006, 01:24:27 am »
Michael,

would you look in default.conf (or which ever the one you're using)
and show us your <codestat> entry.

Sorry, but where it is located on Linux? I have just <str>CodeStatistics</str> under <locale> and <CodeStatistics bool="1" /> under <plugins>.

I will try to delete it and see what happen.

Best wishes,
Michael
« Last Edit: April 16, 2006, 01:52:11 am by Michael »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B crash (Settings-->Editor)
« Reply #27 on: April 16, 2006, 01:42:33 am »
Michael,

would you look in default.conf (or which ever the one you're using)
and show us your <codestat> entry.

Sorry, but where it is located on Linux?

Best wishes,
Michael


I believe it's in your home directory under ".codeblocks"
named default.conf


thanks
pecan

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: C::B crash (Settings-->Editor)
« Reply #28 on: April 16, 2006, 02:03:32 am »
I believe it's in your home directory under ".codeblocks"
named default.conf

Thank you :). I though it was somewhere under /, But after 15 minutes I have found it :).

Anyway, deleting it does not solve the crash.

The problem seems in language (LoadDefaultSettings at codestatconfig.cpp:224):

Code
languages[0].name = _T("C/C++");

But I have not found exactly why. May be it depends on my configuration.

Best wishes,
Michael

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B crash (Settings-->Editor)
« Reply #29 on: April 16, 2006, 02:15:04 am »
Code
The problem seems in language (LoadDefaultSettings at codestatconfig.cpp:224):

Actually, I'm leaning toward the fact that "languages" in
"LoadSetting(languages)" in the following code has never been allocated. But I
can't prove it yet.

The only allocation of languages is in the routine Execute()
which is never executed when the Editor/Settings routines
invokes CodeStatConfigDlg

I've got to figure out why "LoadSettings(languages)" doesn't get an error
from the compiler.

Code
CodeStatConfigDlg::CodeStatConfigDlg(wxWindow* parent)
{
    wxXmlResource::Get()->LoadPanel(this, parent, _("dlgCodeStatConfig"));

    // Load the languages parameters
    nb_languages = LoadSettings(languages);

    ReInitDialog();
}