bugGNU Octave - Bugs: bug #56860, Debugger can not enter functions...

 
 

bug #56860: Debugger can not enter functions declared in scripts

Submitter:  None
Submitted:  Wed 04 Sep 2019 08:48:59 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  3 - Low Item Group:  Unexpected Error or Warning
Status:  Confirmed Assigned to:  None
Originator Name:  Paul Fobbester Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 05 Sep 2019 04:33:53 PM UTC, comment #1: 

Confirmed.  I think there might be another bug report about this.

The way Octave parses scripts causes any embedded functions to be treated as command-line functions.  This is consistent with the notion that scripts are, in effect, a laundry list of commands that are each executed exactly as if you had typed them in to the interpreter.

This analogy appears to break down for the case of the debugger because the file name attribute, which should be blank for a command-line function since there is no file, appears to be NULL.

I can actually prove this by typing in the commands directly in to the interpreter.  See the transcript below.


octave:2> 1;
octave:3>
octave:3> function [sum]=add(a,b)
>   sum=a+b;
> endfunction
octave:4>
octave:4> c=4;
octave:5> d=5;
octave:6> result=add(c,d);
octave:7> disp(result);
 9
octave:8> dbstop add
ans =  2
octave:9> result2 = add (c,d);
stopped in add at line 2 []
2:   sum=a+b;
debug> dbnext
stopped in add at line 3 []
3: endfunction
debug> dbcont


When I am stopped in the debugger the filename (the value between '[' and ']') is blank, but apparently not NULL.

This issue is pretty obscure so I can't say when any fix might be developed.  I would simply work around it for now.

Rik <rik5>
Group administrator
Wed 04 Sep 2019 08:48:59 PM UTC, original submission:  

Given the input file:


#Script, not a function...
1;

function [sum]=add(a,b)
  sum=a+b;
endfunction

c=4;
d=5;
result=add(c,d);
disp(result);


then this will produce and display the correct result: 9.

However if you set a breakpoint in the function, should you wish to debug it, then the debugger then fails. For example with the above code in the file 'bug.m' the following output is produced:


>> dbstop("add")
ans =  5
>> bug
error: add: no such file, ''
error: called from
    add at line 5 column 6
    bug at line 10 column 7
>>


i.e. the breakpoint was correctly set at line 5 of the script but the debugger will not enter the function.

The same behavior is observed in linux and windows versions.

As a work around the debugger does work if every function is stored in its own individual function file, rather than a script.

If this is not a bug then the documentation could be improved to make this behavior clear. In any case, thank you for a fantastic product.


Anonymous

 

(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

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-10-30 pantxo Dependencies- bugs #57142 is dependent
    2019-09-05 rik5 CategoryNone Interpreter
        Priority5 - Normal 3 - Low
        StatusNone Confirmed
        Release5.1.0 dev
        SummaryDebugger can not enter functions in scripts Debugger can not enter functions declared in scripts

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code