Menu

#77 segfault with dim() in debug mode (snap/linux)

v1.0_(example)
closed
nobody
None
5
2024-04-03
2022-09-26
No

Stepping code in debug mode crashes basic256 with a SEGFAULT under x64-linux (snap version) as soon as I reach a "DIM var(size of array)"-statement in code, while just running the code works fine. This is reproducible for me, at different locations of the DIM in the code.

Is there a way to circumvent in debug mode? (like jump over DIMs)

Discussion

  • Jim Reneau

    Jim Reneau - 2022-09-27

    Can you upload a simple demo program that causes the fault. It will make it easier to reproduce.

     
  • Sascha Waidmann

    Sascha Waidmann - 2022-09-28

    print "This output is okay!"
    dim x(100) # segfault, when I reach this point and klick Step >|
    print "This is printed when I run the code, but not when I step across in debug mode."

     
  • Jacob Minsky

    Jacob Minsky - 2024-03-23

    I made a fix for this - it's a race condition which requires a check that a variable has been initialized before adding it to the watch window. This is the patch:

    Index: VariableWin.cpp
    ===================================================================
    --- VariableWin.cpp (revision 957)
    +++ VariableWin.cpp (working copy)
    @@ -218,7 +218,7 @@
                    for(int y = 0; y<v->data->arr->ydim;y++) {
                        DataElement *q = v->data->arrayGetData(x,y);
                        DataElement::getError(true);
    -                   if (q->type!=T_UNASSIGNED) {
    +                   if (q && q->type!=T_UNASSIGNED) {
                            varWinAssign(variables, varnum, level, x, y);
                        }
                    }  
    
     
  • Jim Reneau

    Jim Reneau - 2024-04-03

    Updated and committed to main # 958.

    Thanks for the diff.

     
  • Jim Reneau

    Jim Reneau - 2024-04-03
    • status: open --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.