Author Topic: Documentation for Bug 13029; Wizard crashes CB  (Read 9446 times)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2874
Documentation for Bug 13029; Wizard crashes CB
« on: January 30, 2008, 02:43:20 pm »
Documentation for wizard console crashes CB; bug 13029

svn build  rev 4829 (2008-01-16T20:17:30.273085Z)   gcc 3.4.5 Windows/unicode




It looks like the 'new' statement at 1031 failed, but is unchecked.
Note also that m_pWizard is 0x0 as passed to the AddCompilerPage routine.

Code
(gdb) f 0
#0  0x63c427a0 in Wizards::operator[] (this=0x3f1ea60, uiIndex=3131961357)
    at c:/Usr/Proj/cbBeta/trunk/src/plugins/scriptedwizard/wiz.h:51
51      WX_DECLARE_OBJARRAY(WizardInfo, Wizards);
(gdb) l
46          wxBitmap templatePNG;
47          wxBitmap wizardPNG;
48          wxString xrc;
49      };
50
51      WX_DECLARE_OBJARRAY(WizardInfo, Wizards);
52      WX_DEFINE_ARRAY(wxWizardPageSimple*, WizPages);
53
54      class Wiz : public cbWizardPlugin
55      {
(gdb) f 1
#1  0x63c2197f in Wiz::AddCompilerPage (this=0x3f1ea30, compilerID=@0x3ffd628,
    validCompilerIDs=@0x40d5610, allowCompilerChange=true,
    allowConfigChange=true)
    at c:/Usr/Proj/cbBeta/trunk/src/plugins/scriptedwizard/wiz.cpp:1031
1031        m_pWizCompilerPanel = new WizCompilerPanel(compilerID, validCompiler
IDs, m_pWizard, m_Wizards[m_LaunchIndex].wizardPNG, allowCompilerChange, allowCo
nfigChange);
(gdb) l
1026
1027    void Wiz::AddCompilerPage(const wxString& compilerID, const wxString& va
lidCompilerIDs, bool allowCompilerChange, bool allowConfigChange)
1028    {
1029        if (m_pWizCompilerPanel)
1030            return; // already added
1031        m_pWizCompilerPanel = new WizCompilerPanel(compilerID, validCompiler
IDs, m_pWizard, m_Wizards[m_LaunchIndex].wizardPNG, allowCompilerChange, allowCo
nfigChange);
1032        if (!m_pWizCompilerPanel->SkipPage())
1033            m_Pages.Add(m_pWizCompilerPanel);
1034        else
1035        {
(gdb) p m_pWizCompilerPanel
[b]$1 = (class WizCompilerPanel *) 0x0[/b]
(gdb) p compilerID
$2 = (const wxString &) @0x3ffd628: {<wxStringBase> = {
    static npos = 4294967295, m_pchData = 0x1061324c}, <No data fields>}
(gdb) p validCompilerIDs
$3 = (const wxString &) @0x40d5610: {<wxStringBase> = {
    static npos = 4294967295, m_pchData = 0x41a91a4}, <No data fields>}
(gdb) p m_pWizard
$4 = (struct wxWizard *) 0x0
(gdb) p  m_Wizards[m_LaunchIndex].wizardPNG

Program received signal SIGSEGV, Segmentation fault.
0x63c427a0 in Wizards::operator[] (this=0x3f1ea60, uiIndex=3131961357)
    at c:/Usr/Proj/cbBeta/trunk/src/plugins/scriptedwizard/wiz.h:51
51      WX_DECLARE_OBJARRAY(WizardInfo, Wizards);
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on"
Evaluation of the expression containing the function (Wizards::operator[](unsign
ed int) const) will be abandoned.
(gdb) p allowCompilerChange
No symbol "allowCompilerChange" in current context.
(gdb)
Code
Program received signal SIGSEGV, Segmentation fault.
0x63c427a0 in Wizards::operator[] (this=0x3f1ea60, uiIndex=3131961357)
    at c:/Usr/Proj/cbBeta/trunk/src/plugins/scriptedwizard/wiz.h:51
51      WX_DECLARE_OBJARRAY(WizardInfo, Wizards);
Current language:  auto; currently c++
(gdb) bt
#0  0x63c427a0 in Wizards::operator[] (this=0x3f1ea60, uiIndex=3131961357)
    at c:/Usr/Proj/cbBeta/trunk/src/plugins/scriptedwizard/wiz.h:51
#1  0x63c2197f in Wiz::AddCompilerPage (this=0x3f1ea30, compilerID=@0x3ffd628,
    validCompilerIDs=@0x40d5610, allowCompilerChange=true,
    allowConfigChange=true)
    at c:/Usr/Proj/cbBeta/trunk/src/plugins/scriptedwizard/wiz.cpp:1031
#2  0x63c3d6d7 in SqPlus::ReturnSpecialization<void>::Call<Wiz, wxString const&,
 wxString const&, bool, bool> (callee=@0x3f1ea30, func=
      {__pfn = &Wiz::AddCompilerPage(wxString const&, wxString const&, bool, boo
l), __delta = 0}, v=0x1125620, index=2)
    at include/scripting/sqplus/sqplus.h:1024
#3  0x63c3f6e5 in SqPlus::Call<Wiz, void, wxString const&, wxString const&, bool
, bool> (callee=@0x3f1ea30, func=
      {__pfn = &Wiz::AddCompilerPage(wxString const&, wxString const&, bool, boo
l), __delta = 0}, v=0x1125620, index=2)
    at include/scripting/sqplus/sqplus.h:1163
#4  0x63c3ee0e in SqPlus::DirectCallInstanceMemberFunction<Wiz, void (Wiz::*)(wx
String const&, wxString const&, bool, bool)>::Dispatch (v=0x1125620)
    at include/scripting/sqplus/sqplus.h:1244
#5  0x6197c9ba in SQVM::CallNative (this=0x1125620, nclosure=0x412a180,
    nargs=5, stackbase=187, tailcall=false, retval=@0x1125678,
    suspend=@0x22e84f)
    at c:/Usr/Proj/cbBeta/trunk/src/sdk/scripting/squirrel/sqvm.cpp:1108
---Type <return> to continue, or q <return> to quit---
#6  0x61979407 in SQVM::Execute (this=0x1125620, closure=@0x1125c98,
    target=185, nargs=1, stackbase=185, outres=@0x22e9d8, raiseerror=1,
    et=ET_CALL)
    at c:/Usr/Proj/cbBeta/trunk/src/sdk/scripting/squirrel/sqvm.cpp:748
#7  0x6197e457 in SQVM::Call (this=0x1125620, closure=@0x1125c98, nparams=1,
    stackbase=185, outres=@0x22e9d8, raiseerror=1)
    at c:/Usr/Proj/cbBeta/trunk/src/sdk/scripting/squirrel/sqvm.cpp:1373
#8  0x6196889e in sq_call (v=0x1125620, params=1, retval=1, raiseerror=1)
    at c:/Usr/Proj/cbBeta/trunk/src/sdk/scripting/squirrel/sqapi.cpp:906
#9  0x6195a140 in SquirrelVM::RunScript (o=@0x22eb88, _this=0x0)
    at c:/Usr/Proj/cbBeta/trunk/src/sdk/scripting/sqplus/SquirrelVM.cpp:127
#10 0x6190d8bd in ScriptingManager::LoadBuffer (this=0x10c3d30,
    buffer=@0x22ec68, debugName=@0x22ec58)
    at c:/Usr/Proj/cbBeta/trunk/src/sdk/scriptingmanager.cpp:175
#11 0x0044eb1f in ScriptConsole::OnbtnExecuteClick (this=0x4151078,
    event=@0x22eeb8) at c:/Usr/Proj/cbBeta/trunk/src/src/scriptconsole.cpp:131
#12 0x100c70d5 in wxEvtHandler::ProcessEventIfMatches ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#13 0x100c8321 in wxEvtHandler::SearchDynamicEventTable ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#14 0x100c83d8 in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#15 0x1025551b in wxWindowBase::TryParent ()
---Type <return> to continue, or q <return> to quit---
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#16 0x100c83ae in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#17 0x1025551b in wxWindowBase::TryParent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#18 0x100c83ae in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#19 0x10158f4b in wxControl::ProcessCommand ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#20 0x1014d9b0 in wxButton::SendClickEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#21 0x1014dace in wxButton::MSWCommand ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#22 0x101368c7 in wxWindow::HandleCommand ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#23 0x1013a0bf in wxWindow::MSWWindowProc ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#24 0x10131fd0 in wxWndProc () from c:\usr\bin\wxmsw28u_gcc_custom.dll
#25 0x77d48709 in USER32!GetDC () from C:\WINDOWS\system32\user32.dll
#26 0x00030464 in ?? ()
#27 0x00000111 in ?? ()
#28 0x0000026a in ?? ()
#29 0x00070498 in ?? ()
---Type <return> to continue, or q <return> to quit---
#30 0x10131f20 in wxWindowCreationHook::~wxWindowCreationHook ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#31 0x77d487eb in USER32!GetDC () from C:\WINDOWS\system32\user32.dll
#32 0x10131f20 in wxWindowCreationHook::~wxWindowCreationHook ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#33 0x77d4b743 in USER32!GetParent () from C:\WINDOWS\system32\user32.dll
#34 0x00000000 in ?? () from
#35 0x10131f20 in wxWindowCreationHook::~wxWindowCreationHook ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#36 0x77d4b7ab in USER32!SendMessageW () from C:\WINDOWS\system32\user32.dll
#37 0x00cfb8e8 in ?? ()
#38 0x00cea4d0 in ?? ()
#39 0x0000026a in ?? ()
#40 0x00070498 in ?? ()
#41 0x00000000 in ?? () from
#42 0x0027a928 in ?? ()
#43 0x0022f3f0 in ?? ()
#44 0x773f6ff6 in ImageList_Duplicate ()
   from C:\WINDOWS\WinSxS\X86_Microsoft.Windows.Common-Controls_6595b64144ccf1df
_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll
#45 0x00030464 in ?? ()
#46 0x00000111 in ?? ()
#47 0x0000026a in ?? ()
---Type <return> to continue, or q <return> to quit---
#48 0x00070498 in ?? ()
#49 0x00000001 in ?? ()
#50 0x0027a928 in ?? ()
#51 0x0022f40c in ?? ()
#52 0x773f70d8 in ImageList_Duplicate ()
   from C:\WINDOWS\WinSxS\X86_Microsoft.Windows.Common-Controls_6595b64144ccf1df
_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll
#53 0x0027a928 in ?? ()
#54 0x00000000 in ?? () from
#55 0x0010002f in ?? ()
#56 0x0027a928 in ?? ()
#57 0x00000001 in ?? ()
#58 0x0022f49c in ?? ()
#59 0x773f93dd in ImageList_Duplicate ()
   from C:\WINDOWS\WinSxS\X86_Microsoft.Windows.Common-Controls_6595b64144ccf1df
_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll
#60 0x0027a928 in ?? ()
#61 0x00000001 in ?? ()
#62 0x0022f504 in ?? ()
#63 0x773f8b56 in ImageList_Duplicate ()
   from C:\WINDOWS\WinSxS\X86_Microsoft.Windows.Common-Controls_6595b64144ccf1df
_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll
#64 0x00000000 in ?? () from
---Type <return> to continue, or q <return> to quit---
#65 0x00070498 in ?? ()
#66 0x0022f558 in ?? ()
#67 0x0022f450 in ?? ()
#68 0x1058f380 in _Unwind_SjLj_Unregister ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
Previous frame inner to this frame (corrupt stack?)
(gdb)
« Last Edit: January 30, 2008, 02:52:36 pm by Pecan »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Documentation for Bug 13029; Wizard crashes CB
« Reply #1 on: January 30, 2008, 08:35:42 pm »
To me, that dump rather looks like m_LaunchIndex which is used to dereference m_Wizards is invalid, that's where frame 0 points to (Wizards::operator[]).

Also, operator new as such cannot fail unnoticed. If operator new fails, it throws. The problem must therefore be elsewhere.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Documentation for Bug 13029; Wizard crashes CB
« Reply #2 on: January 31, 2008, 08:23:56 am »
Documentation for wizard console crashes CB; bug 13029
I guess I'm missing something here - it really does *not* crash for me. What do I have to do to reproduce?! And how could the screenshot be made without crashing, too (obviously)?! :?:
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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Documentation for Bug 13029; Wizard crashes CB
« Reply #3 on: January 31, 2008, 09:04:35 am »
...I don't get all this at all. What's the point of creating a compiler page for a wizard that is non-existent in the script console at all?
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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2874
Re: Documentation for Bug 13029; Wizard crashes CB
« Reply #4 on: January 31, 2008, 01:56:15 pm »
Documentation for wizard console crashes CB; bug 13029
I guess I'm missing something here - it really does *not* crash for me. What do I have to do to reproduce?! And how could the screenshot be made without crashing, too (obviously)?! :?:

The screen shot *is* a crashed CB. Look at the background DOS box from which I ran CB.
It shows the segfault caught by GDB.

I tried to use the script console to learn more about the script wizard.
It should not have crashed CB no matter what dumb statement I typed in.

But, if it doesnt crash for you, maybe it's something on my system. It's not that important. Forget it. If it happens more often, it may be worth investigating. I thought it worth documenting the crash.

For now, it's just something that's going to rarely happen to novice console users. I've already found another way to test scripts.
« Last Edit: January 31, 2008, 02:27:17 pm by Pecan »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Documentation for Bug 13029; Wizard crashes CB
« Reply #5 on: January 31, 2008, 05:41:32 pm »
But, if it doesnt crash for you, maybe it's something on my system.
It crashes on my system too, and I don't see how it could not crash on Martin's box. I don't see that because I'm quite sure that this crash is a perfectly normal condition, it really has to crash. :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Documentation for Bug 13029; Wizard crashes CB
« Reply #6 on: January 31, 2008, 06:07:12 pm »
I don't see that because I'm quite sure that this crash is a perfectly normal condition, it really has to crash. :)
In fact - it was *not* crashing. Anyways - I do know why: Simply because I had used a wizard before. You can try: If you run a wizard and then enter the script command it works. If you don't, C::B will crash (mine, too). I didn't thought it would be important to have a "clean " C::B for testing... my fault.

It's obvious why that is... ;-)
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 thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Documentation for Bug 13029; Wizard crashes CB
« Reply #7 on: January 31, 2008, 06:26:52 pm »
I had used a wizard before.
Yeah, well... that would of course make it work, accidentially.
Unless of course, incidentially, the freed memory block that wxArray points to is overwritten again by something else :P

In either case, a crash in this situation is to be considered a normal condition rather than surprising :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."