bugGNU Octave - Bugs: bug #65557, Byte-code interpreter does not...

 
 

bug #65557: Byte-code interpreter does not provide full (recursive) set of error information in some cases

Submitter:  Hendrik K <koerhen>
Submitted:  Fri 05 Apr 2024 04:43:09 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
Status:  In Progress Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * bytecode-evaluator Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 10 Apr 2024 05:57:14 PM UTC, comment #3: 

Thanks, OK, I've set Status to "In progress"

Philip Nienhuis <philipnienhuis>
Group Member
Tue 09 Apr 2024 09:08:40 PM UTC, comment #2: 

I've noticed this too and had already done a patch for it. The stack info is not set for the exception:s thrown (in the Octave sense, not C++ sense) by the bytecode interpreter itself, rather than by a call to C++ error().

However the patch is "stuck" between some wip-patches that addresses some design problems with how multiple return values are handled on the bytecode interpreter stack, so I think it could wait a bit to avoid some rebasing/rework and not put too many pending patches on the tracker.

I've attached the patch anyways to show the concept, however it shouldn't be apply-able straight off and is not tested that much.



(file #55932)

Petter <petter>
Fri 05 Apr 2024 06:12:51 PM UTC, comment #1: 

cc'ing Petter

Philip Nienhuis <philipnienhuis>
Group Member
Fri 05 Apr 2024 04:43:09 AM UTC, original submission:  

In certain cases the byte-code interpreter does not provide all information from a thrown error. Especially the line number of the root cause error may be missing (making debugging quite difficult).

Steps to reproduce with 2 function files

function ret = test1(in);
  in_1 = in * 2;
  if in_1 < 100
    ret = cos(in);
  else
    ret = cos(in(2)); # causes error if "in" is a scalar
  endif
endfunction



function ret = test2()
  ret = arrayfun(@(x) test1(x),1:200,'uni',false);
endfunction


The thrown error message(s) do not show where the root cause error occurs and in which line:

>> test2()
error: in(2): out of bound 1 (dimensions are 1x1)


When the byte-code interpreter is deactivated (do not forget to clear test1 + test2), one sees the root cause error + line:

__vm_enable__(0);
clear test1 test2;
test2()
error: in(2): out of bound 1 (dimensions are 1x1)
error: called from
    test1 at line 6 column 5
    test2>@<anonymous> at line 2 column 23
    test2 at line 2 column 3






Hendrik K <koerhen>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #55932:  33551.patch added by petter (14KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by petter (Updated the item)
  • -email is unavailable- added by philipnienhuis
  • -email is unavailable- added by koerhen (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-04-10 philipnienhuis StatusNone In Progress
    2024-04-09 petter Attached File- Added 33551.patch, #55932
    2024-04-05 philipnienhuis Carbon-Copy- Added petter

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code