bugGNU Octave - Bugs: bug #60466, Wish: errors in built-in functions...

 
 

bug #60466: Wish: errors in built-in functions should provide debugging information pointing to m-file context

Submitter:  PIERRE LABRECHE <pierre5018>
Submitted:  Wed 28 Apr 2021 02:31:26 PM UTC
   
 
Category:  Interpreter Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Confirmed Assigned to:  None
Originator Name:  pierre5018 Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 06 Dec 2022 09:01:10 PM UTC, comment #5: 

adding (as mentioned over in bug #60264) that classes (classdef and old @style) also produce this same behavior, with the added caveat that the error stack also neglects to tell you what class the function/method belonged to.

is this request sufficiently distinct from bug #60264 to keep both open?

Nicholas Jankowski <nrjank>
Group Member
Thu 29 Apr 2021 03:00:06 PM UTC, comment #4: 

As I mentioned in my first comment, use debug_on_error (1) as a workaround until this is changed.

Rik <rik5>
Group administrator
Thu 29 Apr 2021 02:59:24 PM UTC, comment #3: 

I see what you mean.  This is a larger issue so I have re-titled the bug report and made it a feature request.

In Octave functions may be implemented either in m-files or in compiled files written in languages like C++.  The latter functions are referred to as built-in functions in Octave.

When an error occurs in an m-file, the interpreter reports the location of the error along with the function stack.  However, when an error occurs in a built-in function only the error message is printed without any additional information.  Changing this will be quite a project so I have changed the Release field to "dev" because this work will have to occur on the development branch.

For testing, I used this function


function tst_error
  error ('my error');
  [a,b,c] = ls ();
  tt = sprintf ("format string %s", { } ) ;
endfunction


The function is attached to this bug report as well.  When an error is explicitly thrown--using the error() function--the result is


error: my error
error: called from
    tst_error at line 2 column 3


If I comment out the first line of the function and re-execute I get


error: ls: function called with too many outputs
error: called from
    ls
    tst_error at line 3 column 11


Finally, if I comment out the ls() function call I get just


error: sprintf: wrong type argument 'cell'


Rik <rik5>
Group administrator
Wed 28 Apr 2021 11:19:22 PM UTC, comment #2: 


# sprintf test
function test_printf
 tt = sprintf("format string %s", { } ) ;
endfunction


PIERRE LABRECHE <pierre5018>
Wed 28 Apr 2021 09:57:40 PM UTC, comment #1: 

Can you post some sample code that we can use to reproduce the error?

Also, try setting


debug_on_error (1)


before debugging so that you aren't kicked out of the debugger when you encounter a second error.

Rik <rik5>
Group administrator
Wed 28 Apr 2021 02:31:26 PM UTC, original submission:  

Upon an error, such as :
error: printf: wrong type argument 'cell'

Execution stops, and the debugger quits. The user is left with no clue about the error location (no file, no line number, no debugging stack information)

PIERRE LABRECHE <pierre5018>

 

(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 nrjank (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pierre5018 (Submitted the item)
  • -email is unavailable- added by pierre5018
  •  

    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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-04-29 rik5 Severity3 - Normal 1 - Wish
        Item GroupNone Feature Request
        StatusNeed Info Confirmed
        Release6.2.0 dev
        Operating SystemMicrosoft Windows Any
        Summaryprintf error message without debugging context. Octave quits debugging with insufficient context display Wish: errors in built-in functions should provide debugging information pointing to m-file context
    2021-04-28 rik5 StatusNone Need Info
    2021-04-28 pierre5018 Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code