bugGNU Octave - Bugs: bug #40397, Scope is not changed with dbup /...

 
 

bug #40397: Scope is not changed with dbup / dbdown in debug mode

Submitter:  Markus Appel <mappel>
Submitted:  Mon 28 Oct 2013 06:09:40 PM UTC
   
 
Category:  Interpreter Severity:  5 - Blocker
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  jwe
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 01 Nov 2013 02:04:06 PM UTC, comment #7: 

I've re-tested the original reporter's code and this works for me now.  Closing report.

Rik <rik5>
Group administrator
Tue 29 Oct 2013 08:31:12 PM UTC, comment #6: 

I checked in the following change:

http://hg.savannah.gnu.org/hgweb/octave/rev/6b51f5f44aea

It seems to fix the problem for me, but could probably use more testing.

John W. Eaton <jwe>
Group administrator
Tue 29 Oct 2013 05:02:37 PM UTC, comment #5: 

Thanks.  I'm looking at it.

John W. Eaton <jwe>
Group administrator
Tue 29 Oct 2013 04:59:36 PM UTC, comment #4: 

Doesn't matter, I have seen the problem within one file and in two seperate files, as well as with copy&paste the function definitions to command line.

Markus Appel <mappel>
Tue 29 Oct 2013 04:21:02 PM UTC, comment #3: 

OK, I see the problem when functionA and functionB are in separate files.

John W. Eaton <jwe>
Group administrator
Tue 29 Oct 2013 04:08:39 PM UTC, comment #2: 

Is functionA a single .m file with a subfunction called functionB, or are these two separate .m files?

John W. Eaton <jwe>
Group administrator
Mon 28 Oct 2013 06:15:35 PM UTC, comment #1: 

Sorry, I messed up the markup for the web version, here is the example again (why is there no preview button...):

function functionA ()
 whereami = "functionA";
 A = 66;
 functionB();
endfunction

function functionB ()
 whereami = "functionB";
 B = 99;
 error("Debug here");
endfunction

Debugging the error:

octave-gui:7> debug_on_error(true);
octave-gui:8> functionA
error: Debug here
error: called from
    functionB at line 4 column 2
    functionA at line 4 column 2
stopped in functionB
debug> whereami
whereami = functionB
debug> dbup
stopped in functionB at line 4
debug> dbup
stopped in functionA at line 4
debug> whereami
whereami = functionB
debug> whos
Variables in the current scope:

   Attr Name          Size                     Bytes  Class
   ==== ====          ====                     =====  =====
        A             1x1                          8  double
        whereami      1x9                          9  char

Total is 10 elements using 17 bytes

debug> A
error: 'A' undefined near line 1 column 1
debug> NEW=666
NEW =  666
debug> whos
Variables in the current scope:

   Attr Name          Size                     Bytes  Class
   ==== ====          ====                     =====  =====
        A             1x1                          8  double
        whereami      1x9                          9  char

Total is 10 elements using 17 bytes

debug> dbdown
stopped in functionB at line 4
debug> whos
Variables in the current scope:

   Attr Name          Size                     Bytes  Class
   ==== ====          ====                     =====  =====
        B             1x1                          8  double
        NEW           1x1                          8  double
        whereami      1x9                          9  char

Total is 11 elements using 25 bytes


Additional minor problem: dbup needs two bumps to move up the stack from the lowest level when stopped due to an error, but only one when stopped with "keyboard". I think this has been like this for a long time, but the scope problem is new (to me).

Markus Appel <mappel>
Mon 28 Oct 2013 06:09:40 PM UTC, original submission:  

current tip (17780:8b353af4a1ca), built on Ubuntu 12.04.
When moving up and down the stack in debug mode, the variable scope is not properly changed. 'whos' lists the right scope, but debug commands are always executed at the lowest level.

Minimal example:


function functionA ()
 whereami = "functionA";
 A = 66;
 functionB();
endfunction

function functionB ()
 whereami = "functionB";
 B = 99;
 error("Debug here");
endfunction
+verbatim+

Debugging the error:

+verbatim+
octave-gui:7> debug_on_error(true);
octave-gui:8> functionA
error: Debug here
error: called from
    functionB at line 4 column 2
    functionA at line 4 column 2
stopped in functionB
debug> whereami
whereami = functionB
debug> dbup
stopped in functionB at line 4
debug> dbup
stopped in functionA at line 4
debug> whereami
whereami = functionB
debug> whos
Variables in the current scope:

   Attr Name          Size                     Bytes  Class
   ==== ====          ====                     =====  =====
        A             1x1                          8  double
        whereami      1x9                          9  char

Total is 10 elements using 17 bytes

debug> A
error: 'A' undefined near line 1 column 1
debug> NEW=666
NEW =  666
debug> whos
Variables in the current scope:

   Attr Name          Size                     Bytes  Class
   ==== ====          ====                     =====  =====
        A             1x1                          8  double
        whereami      1x9                          9  char

Total is 10 elements using 17 bytes

debug> dbdown
stopped in functionB at line 4
debug> whos
Variables in the current scope:

   Attr Name          Size                     Bytes  Class
   ==== ====          ====                     =====  =====
        B             1x1                          8  double
        NEW           1x1                          8  double
        whereami      1x9                          9  char

Total is 11 elements using 25 bytes

+verbatim+

Additional minor problem: dbup needs two bumps to move up the stack from the lowest level when stopped due to an error, but only one when stopped with "keyboard". I think this has been like this for a long time, but the scope problem is new (to me).

Markus Appel <mappel>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by mappel (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-11-01 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2013-10-29 jwe StatusIn Progress Ready For Test
    2013-10-29 jwe StatusConfirmed In Progress
        Assigned toNone jwe
    2013-10-29 jwe Severity3 - Normal 5 - Blocker
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code