Author Topic: New project Wizard: Squirrel error  (Read 212 times)

Offline jimbo

  • Multiple posting newcomer
  • *
  • Posts: 25
New project Wizard: Squirrel error
« on: November 05, 2018, 05:39:51 pm »
My new project wizard produces a

sq_get*() failed (type error)

when it tries to complete. I am having great difficulty tracking the cause down. I aded some instrumentation to the throw that produces that error, but that just gave me sq_get*() at line 1912 in ../../../src/include/scripting/sqplus/sqplus.h which doesn't help.

Oddly, the work that the wizard does is then not updated in the project until I run the wizard again. Its as if its in an odd state tht is recovered by the next run of the wizard. Each subsequent run updates the previous project to the correct state.

So what is the best way to debug this sort of thing? Or indeed any sort of issues when running scripts?

TIA, Jimbo.


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2065
Re: New project Wizard: Squirrel error
« Reply #1 on: November 05, 2018, 06:30:59 pm »
Can you share the code? A image of the error message?

Some time ago i implemented an debugger for squirrel, but it does not apply to the current branch of codeblocks without problems...
https://github.com/bluehazzard/codeblocks_sf/commit/9ea66a9f3801511cda72ae1cf107c9e1d5c4e91c
and the plugin for debugging:
https://github.com/bluehazzard/cbSquirrelDebugger

But sadly you can not use this with the current code in trunk...

Quote
I am having great difficulty tracking the cause down
The easiest thing is to put a log output after every line of the code and observe where it fails... Or at least find the function where it fails
Error handling is terrible on the scripting side...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11200
    • Travis build status
Re: New project Wizard: Squirrel error
« Reply #2 on: November 05, 2018, 09:31:17 pm »
I think the view -> script console shows backtraces, but I might be wrong...

Generally printf style debugging is one of the best options. The next option if printf debugging doesn't work is debugging the whole codeblocks with a c++ debugger like gdb.
(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 BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2065
Re: New project Wizard: Squirrel error
« Reply #3 on: November 06, 2018, 12:04:04 am »
I updated the code in this branch: https://github.com/bluehazzard/codeblocks_sf/tree/test/squirrel/debuggerserver/1
This is up to date branch with the squirrel debug server. There is still a problem, that i do not get any frame info and watches. I do not know where the error is at the moment...
Only the project files for windows are updated at the moment. Probably because the debugger is written for squirrel 3.0 and we use 2.2 in codeblocks...

The same for the plugin. I updated the windows files.

Offline jimbo

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: New project Wizard: Squirrel error
« Reply #4 on: November 06, 2018, 11:27:30 am »
What is the printf equivilent in the script so I can add logging to the script itself.

Although, I suspect that the error somewhere in CB itself, as has commented out almost everything in the script, yet I still get the error!

I'm using a fairly recent development tree from svn (last week IIRC), running on recent Lubuntu.

Error message (with my mod to display line number and source file) attached.

« Last Edit: November 06, 2018, 11:42:36 am by jimbo »

Offline jimbo

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: New project Wizard: Squirrel error
« Reply #5 on: November 06, 2018, 12:39:27 pm »
Odd, reduced the script to the bare minium, still get this weird error. I wonder if I have accidentally changed something somewhere. Odd that other wizards.e.g. Arm, don't give the error though.  No xrc file  in this example.

Code: [Select]
////////////////////////////////////////////////////////////////////////////////
// Code::Blocks Project Wizard
////////////////////////////////////////////////////////////////////////////////

function BeginWizard()
{
    local wiz_type = Wizard.GetWizardType();

    if (wiz_type == wizProject)
    {
        // this is the text that will appear in the start (intro) page
        local intro_msg = _T("Welcome to the new application wizard!\n" +
                             "This wizard will guide you through the steps needed to create a new application.\n\n" +
                             "Please click \"Next\" to proceed.");

        // intro
        Wizard.AddInfoPage(_T("Intro"), intro_msg);

        // select project name and path
        Wizard.AddProjectPathPage();
    }
}


////////////////////////////////////////////////////////////////////////////////
// Final project setup
////////////////////////////////////////////////////////////////////////////////

function GetFilesDir()
{
    return _T("");
}

function SetupProject(project)
{
}

// Allows script generated files to be passed back to the project setup.
// Each time, return a string of the form "filename.ext;contents"
// you can change the return string based on <file_index>
// return an empty string to denote that no more files are to be generated
function GetGeneratedFile(file_index)
{
    return _T("");
}


Did wonder if I had some persistent setting for the project name, but renamed the directory, added the new one to config.script, but still failing. Most odd.
« Last Edit: November 06, 2018, 02:22:16 pm by jimbo »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2065
Re: New project Wizard: Squirrel error
« Reply #6 on: November 06, 2018, 03:15:33 pm »
Setup project has to return a value. If you return true it should work without error

Offline jimbo

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: New project Wizard: Squirrel error
« Reply #7 on: November 06, 2018, 03:17:35 pm »
Hurrah!!!

That was it, thanks!

Much appreciated. Although the error message could be clearer....

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2065
Re: New project Wizard: Squirrel error
« Reply #8 on: November 06, 2018, 03:33:05 pm »
All errors in squirrel could be more clearer...