Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

C::B crash svn9134 wx2.8.12 with IO.ExecuteAndGetOutputAndError in srcipt

(1/3) > >>

BlueHazzard:
hello,
i created a squirrel script who calls avrdude and extracts the necessary parameters from the Projectfile:
 in the script my final call is

--- Code: ---print(IO.ExecuteAndGetOutputAndError(execute_string,true));
--- End code ---

after the output to the scriptconsole c::b crashes.
the back trace (i can't really get a backtrace, because on every debug session the SIGSEV is on some other point):

--- Code: ---[debug]#0  0x0131feb8 in wxEventHashTable::InitHashTable() () from E:\Programmieren\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#1  0x0168f6bc in wxLongLongNative::operator+(long long) const () from E:\Programmieren\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#2  0x0028fb9c in ?? ()
[debug]#3  0x00000000 in ?? ()

--- End code ---

on previous sessions it was here:

--- Code: ---void MainFrame::OnFileMenuUpdateUI(wxUpdateUIEvent& event)
{
[...]
EditorBase*  sh   = Manager::Get()->GetEditorManager()->GetEditor(g_StartHereTitle);
[...]
}

--- End code ---

g_StartHereTitle pointed to some trash.

if i use IO.Execute(execute_string); in my script c::b doesn't crash

i appended the whole script, if someone is willing to test. He only needs avrdude. I think this crash happens also with other commands, but i didn't tried it...
(to test: create a project with the avr template and c&p the script in the script console then run AVR->Run Avrdude)

greetings

LETARTARE:
hello,
I looked at your script, just reading you write:

--- Code: ---print("Execute avrdude with: "+ execute_string);
--- End code ---
This is an error that causes a crash!
You must write the string constructor  :

--- Code: ---print(_T("Execute avrdude with: ")+ execute_string);
--- End code ---

I will try this script ...

LETARTARE:
I tested your script.
I think a problem "::print ()", see:
http://forums.codeblocks.org/index.php/topic,15853.0.html
I attach a script that works on my setup.

BlueHazzard:

--- Quote from: LETARTARE on June 13, 2013, 06:41:00 pm ---I tested your script.
I think a problem "::print ()", see:

--- End quote ---

i don't think that this is the reason... i thougth squirrel search first the local context for funktions (variables) and if it can't find them there it looks in the global context, and appends the :: automaticaly...  (http://www.squirrel-lang.org/doc/squirrel3.html#d0e599)

i tried to replace all print with ::print, but got anyway the crash with this bt:

--- Code: ---[debug]#0  0x61b06f0f in wxStringBase::length (this=0x4fd8c0 <g_StartHereTitle>) at wxWidgets-2.8.12/include/wx/string.h:412
[debug]#1  0x61b06ef3 in wxStringBase::empty (this=0x4fd8c0 <g_StartHereTitle>) at wxWidgets-2.8.12/include/wx/string.h:422
[debug]#2  0x61a84291 in wxStringBase::wxStringBase (this=0x28ef00, stringSrc=...) at wxWidgets-2.8.12/include/wx/string.h:354
[debug]#3  0x61af3739 in wxString::wxString (this=0x28ef00, stringSrc=...) at wxWidgets-2.8.12/include/wx/string.h:690
[debug]#4  0x6187b38f in realpath (path=...) at src\sdk\globals.cpp:1303
[debug]#5  0x6184d14a in EditorManager::IsOpen (this=0x3406458, filename=...) at src\sdk\editormanager.cpp:454
[debug]#6  0x004a7feb in EditorManager::GetEditor (this=0x3406458, filename=...) at src/include/editormanager.h:92
[debug]#7  0x00469ab4 in MainFrame::OnFileMenuUpdateUI (this=0x10e33c8, event=...) at src\src\main.cpp:3840
[debug]#8  0x012a1242 in wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const () from wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#9  0x0028fa4c in ?? ()
[debug]#10 0x00000000 in ?? ()
--- End code ---

But if I use your script, with the tostring() functions it works...
Thank you!

BlueHazzard:
I made a few test:
the problem is the length of the string to print.
if i split the string up line for line (as LETARTARE in his script does) and print it line for line c::b didn't crash.

I tested it with this script:

--- Code: --- local i = 20;
for( ;i <5400;i+=100)
{
local b = 0;
local test_string = ::wxString();
for(;b<i;b++)
{
test_string += _T("t");
}
test_string += _T("\n");
print(b.tostring());
print(" ");
print(test_string);
}
--- End code ---

and with ca 5300 characters c::b crashes. But unfortunately i can't locate where:

--- Code: ---[debug]Cannot access memory at address 0x2000005
[debug]#0  0x0131feb8 in wxEventHashTable::InitHashTable() () from \wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#1  0x0028ec80 in ?? ()
--- End code ---

a second problem i have, is a error Message i get at the end of the script if i use the line ExecuteAndGetOutputAndError:

--- Code: ---can't open file '' (error 3 the system can't find the file)
--- End code ---
i have no plan when or from where this msg get fired.... if i debug the code the ExecuteAndGetOutputAndError gets executed fine with no error, also the script terminates with no error, but after a few seconds the message box pops up... It seems this comes from the deep in wxWidgets?

btw this scripting is a powerful and funny thing :) i like it ( despite the bugs)!

greetings

Navigation

[0] Message Index

[#] Next page

Go to full version