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

Submitted by:  PIERRE LABRECHE <pierre5018>
Submitted on:  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

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project 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 pierrelabreche@gmail.com

    Back to the top


    Powered by Savane 3.6