bugGNU Octave - Bugs: bug #41126, dbstop should accept func.m or...


bug #41126: dbstop should accept func.m or @class/func.m as argument

Submitted by:  Michael C. Grant <mcgrant>
Submitted on:  Tue 07 Jan 2014 12:37:04 AM UTC  
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Michael C. Grant Open/Closed:  Closed
Release:  3.8.0 Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

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


( Jump to the original submission)

Fri 10 Jan 2014 04:39:40 PM UTC, comment #10: 

I filed a separate bug report about dbstatus clearing breakpoints set in @class files (bug #41190).

This bug has been fixed so I'm closing this report.

Rik <rik5>
Project Administrator
Fri 10 Jan 2014 04:23:46 AM UTC, comment #9: 

This actually looks like a separate bug that is also present in 3.6.4 with breakpoints on class functions, even without the .m file extension:

octave:1> version
ans = 3.6.4
octave:2> dbstop @ftp/ftp
ans =  29
octave:3> f = ftp("ftp.gnu.org")
stopped in /usr/share/octave/3.6.4/m/@ftp/ftp.m at line 29
29:   if (nargin == 0)
debug> dbcont
FTP Object
host: ftp.gnu.org
user: anonymous
  dir: /
mode: binary
octave:4> dbstatus
octave:5> f = ftp("ftp.gnu.org")
FTP Object
host: ftp.gnu.org
user: anonymous
  dir: /
mode: binary

Mike Miller <mtmiller>
Project Administrator
Thu 09 Jan 2014 05:29:26 PM UTC, comment #8: 

The class breakpoint seems to be deleted if the dbstatus command is used.  The following code works.

octave:1> dbstop @ftp/ftp.m
ans =  48
octave:2> F = ftp ('alpha.gnu.org')
stopped in /home/rik/wip/Projects_Mine/octave-stable/scripts/@ftp/ftp.m at line 48
48:   if (nargin == 1 && isa (host, "ftp"))
debug> dbcont

But if I use dbstatus after setting the breakpoint to check on it then 1) the breakpoint is not shown) and 2) it seems to be deleted because the command runs to completion.

octave:1> dbstop @ftp/ftp.m
ans =  48
octave:2> dbstatus
octave:3> F = ftp ('alpha.gnu.org')
FTP Object
host: alpha.gnu.org
user: anonymous
  dir: /
mode: binary

Rik <rik5>
Project Administrator
Tue 07 Jan 2014 09:11:03 PM UTC, comment #7: 

I checked in the following changesets:


With these, I'm able to set breakpoints in methods using the gui editor or at the command line using either dbstop @foo/fcn.m or dbstop @foo/fcn.

John W. Eaton <jwe>
Project Administrator
Tue 07 Jan 2014 03:31:47 PM UTC, comment #6: 

Mike, good questions.

Here's what I can see: if I have a function '@cvx/norm.m', all three of these commands successfully set a breakpoint to the first line:

dbstop @cvx/norm
dbstop @cvx/norm.m
dbstop @cvx/norm.p

Yes, that last one works, even if the '.p' file does not exist. These produce an error:

dbstop @cvx/norm.mex
dbstop @cvx/norm.mexmaci
dbstop @cvx/norm.mexmaci64

This extension behavior is identical for normal functions, scripts, and class functions.

The subdirectory approach does not work for non-class subdirectories in the path. To test this, I created a subdirectory 'test' and a script in my ~/Documents/MATLAB directory, which is in my path. The "edit" command below succeeds, but the "dbstop" command fails. If I try use the editor to set a breakpoint in test/command_test.m, I get the modal dialog.

>> cd ~/Documents/MATLAB
>> edit test/command_test.m
>> dbstop test/command_test.m
Error using dbstop
Cannot find function "test/command_test.m".

Michael C. Grant <mcgrant>
Tue 07 Jan 2014 12:31:18 PM UTC, comment #5: 

Yes, there is shadowing if you add the actual @ directory to the path.

Michael C. Grant <mcgrant>
Tue 07 Jan 2014 05:08:15 AM UTC, comment #4: 

Although Octave:shadowed-function is currently raised for class methods, I don't think it should be so -- your thoughts?  There's really no namespace conflict in this case.  Please let me know if I'm overlooking something.

Felipe G. Nievinski <fgnievinski>
Tue 07 Jan 2014 02:54:40 AM UTC, comment #3: 

Yes, there are a few missing features of dbstop, see e.g. bug #36874 for conditional breakpoints. I'm retitling this bug to reflect the compatibility bug you've stumbled on that the argument should be allowed to be a file with a .m extension.

It would be good to get some more information about what Matlab does with different argument types. Are "dbstop func" and "dbstop func.m" always the same? Do both "dbstop script" and "dbstop script.m" work also, where script.m is a Matlab script instead of a function file? Does it work with an m-file in a non-class subdirectory of a directory in the path?

Mike Miller <mtmiller>
Project Administrator
Tue 07 Jan 2014 01:43:55 AM UTC, comment #2: 

Ah, good. That works indeed:

dbstop @cvx/norm

With the GUI enabled, the editor pops up with the breakpoint in the proper place. And the interpreter does indeed stop when expected.

What's funny, however, is that clicking on a new breakpoint within the editor still brings up the modal dialog. But maybe this is a GUI issue primarily.

However, if MATLAB compatibility is desired here, "dbstop @cvx/norm.m" should work as well. Then again, so should "dbstop if error", "dbstop if warning", "dbstop if caught error", etc. So I understand that's a work in progress.

Thanks for showing me one option that works!

Michael C. Grant <mcgrant>
Tue 07 Jan 2014 01:18:06 AM UTC, comment #1: 

Can you try the same command but without the .m file extension?

For example the following works for me:

dbstop @ftp/ftp

Does dbstop with "@class/function.m" work both with and without the .m file extension?

Mike Miller <mtmiller>
Project Administrator
Tue 07 Jan 2014 12:37:04 AM UTC, original submission:  

In CVX I make heavy use of class functions, stored in directories beginning with '@'. These directories are not intended to be in the path, but are visible if their subdirectories are.

However, the debugging facility cannot seem to handle them. If I type

dbstop @cvx/norm.m

I get the error: "error: add_breakpoint: unable to find the requested function". If I then do

edit @cvx/norm.m

The file is loaded into the GUI editor (indicating that it is, indeed, seen on the path). If I then attempt to enable a breakpoint using the GUI, I get the following modal:

The file
/Users/mcgrant/Projects/CVX/trunk/builtins/@cvx/norm.m does
not exist in the load path. To debug the function you are editing,
you must either change to the directory
/Users/mcgrant/Projects/CVX/trunk/builtins/@cvx or add that
directory to the load path.

Of course, I cannot do either if I want the code to work properly, because many of these functions overload built-in Octave functions, and would now shadow them. So it would seem that it is impossible to set a breakpoint inside a class function.

Michael C. Grant <mcgrant>


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

Attach Files:

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 fgnievinski (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by mcgrant (Submitted the item)

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

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-10 rik5 StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2014-01-07 jwe StatusNeed Info => Ready For Test
    2014-01-07 mtmiller CategoryInterpreter => Octave Function
        Operating SystemMac OS => Any
        SummaryUnable to debug class functions => dbstop should accept func.m or @class/func.m as argument
    2014-01-07 mtmiller StatusNone => Need Info

    Back to the top

    Powered by Savane 3.5