bugGNU Octave - Bugs: bug #65610, unable to set breakpoints within...

 
 

bug #65610: unable to set breakpoints within set or get functions of classdef classes

Submitter:  Liang Tang <lt1234>
Submitted:  Thu 18 Apr 2024 05:49:23 PM UTC
   
 
Category:  Classdef Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Ready For Test Assigned to:  None
Originator Name:  lt1234 Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  10.1.0 (current default)
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 11 May 2024 02:12:48 PM UTC, comment #11: 

I went ahead and pushed the change from comment #8 to the default branch:
https://hg.savannah.gnu.org/hgweb/octave/rev/742d8fc77688

We should probably handle how to set breakpoints in subfunctions in a different report. As part of that change (or as an independent change), we could maybe also try and return earlier when a line of .m file code is matched to the correct user function.

Marking as ready for test.

Markus Mützel <mmuetzel>
Group administrator
Thu 25 Apr 2024 06:59:00 AM UTC, comment #10: 

Thank you for the review. I'm happy I didn't misunderstand the classdef implementation completely.

I'd need to check that again. But IIRC, a user could try to set a breakpoint in a line without code (e.g., a line between function definitions of classdef files). In that case, the `get_method` function is expected to return the "closest" match. (ISTR that is the first valid one below the actually selected line.)

It might be possible to interrupt that search early (without missing a "closer" match). We could potentially also check against `beg_pos` instead of only against `end_pos` and break when the selected line is between those.
I haven't checked whether that would need additional logic for handling sub-functions that are defined in the body of a classdef method. (Maybe, they aren't handled correctly right now. Haven't checked.)

But it might be better to do that in follow-up changes if you agree.

Markus Mützel <mmuetzel>
Group administrator
Wed 24 Apr 2024 05:33:56 PM UTC, comment #9: 

Maybe I'm missing something, but in https://file.savannah.gnu.org/file/bug65610-breakpoints-in-set-or-get-methods-classdef-v2.patch?file_id=55968, shouldn't the get_method function return once it has found a match?  It seems that the original function also iterated over all members of the method map instead of returning once a match is found.

Otherwise, it seems fine to me.

John W. Eaton <jwe>
Group administrator
Wed 24 Apr 2024 04:53:08 PM UTC, comment #8: 

Attached is a slightly different version of the patch that avoids to make changes in public headers.


(file #55968)

Markus Mützel <mmuetzel>
Group administrator
Sat 20 Apr 2024 12:07:19 PM UTC, comment #7: 

For the moment, this is just a patch that has not been applied to any public repository. But even if the proposed change is ok, it will change the API of Octave (by adding new functions). So, the first version of Octave that could potentially have this is Octave 10.

When you are asking about nightly builds, I'm assuming you are referring to the builds from https://nightly.octave.org/#/download. Those are built from the stable branch of Octave (currently versions 9.x). So, the changes won't be included in those builds until probably late this year (after the current default branch will have been merged to the stable branch of the Octave repository).

Markus Mützel <mmuetzel>
Group administrator
Sat 20 Apr 2024 11:32:54 AM UTC, comment #6: 

Is the fix included in the nightly build? Thanks.

Liang Tang <lt1234>
Sat 20 Apr 2024 11:23:15 AM UTC, comment #5: 

The attached patch allows setting breakpoints in set or get methods of classdef properties for me.

I'm not very familiar with anything that relates to the implementation of classdef classes. So, I'll leave this for a couple of days for review before potentially pushing it to the default branch.


(file #55948)

Markus Mützel <mmuetzel>
Group administrator
Fri 19 Apr 2024 04:44:23 PM UTC, comment #4: 

With this change on the default branch, Octave should (correctly) emit an error when trying to add a breakpoint in a classdef method that doesn't exists:
https://hg.savannah.gnu.org/hgweb/octave/rev/69eb4c27d8c8

Markus Mützel <mmuetzel>
Group administrator
Thu 18 Apr 2024 07:09:04 PM UTC, comment #3: 

I pushed a change to the stable branch to avoid the segmentation fault:
https://hg.savannah.gnu.org/hgweb/octave/rev/af2b017a5a7a

It still doesn't behave correctly when trying to set a breakpoint in a non-existent classdef-method. It just sets a breakpoint in whatever is the first function in that classdef file (likely the constructor).

To fix that and to allow setting breakpoints in set or get methods will probably require larger changes. That should be done on the default branch.

Markus Mützel <mmuetzel>
Group administrator
Thu 18 Apr 2024 06:08:13 PM UTC, comment #2: 

While looking into this, I noticed that when trying to add a breakpoint to a method of a classdef class that doesn't exist, Octave crashes with a segmentation fault.
That shouldn't happen.

To reproduce:

dbstop @inputParser/baz


Markus Mützel <mmuetzel>
Group administrator
Thu 18 Apr 2024 05:59:40 PM UTC, comment #1: 

I can confirm that it is only possible to set breakpoints in "normal" methods of classdef classes.
It is not possible to set breakpoints in get or set methods of classdef classes.

Markus Mützel <mmuetzel>
Group administrator
Thu 18 Apr 2024 05:49:23 PM UTC, original submission:  

I downloaded a Nastran op2 reader from github.

https://github.com/GiMo84/mOP2

In gui editor, I would like to set a breakpoint at line 78 of mOP2block_OES.  The debugger does not respond and no breakpoint is set. 

Thanks.

Liang Tang <lt1234>

 

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

Attach Files:
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by nrjank (Updated the item)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by lt1234 (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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-05-11 mmuetzel StatusPatch Submitted Ready For Test
    2024-04-24 mmuetzel Attached File- Added bug65610-breakpoints-in-set-or-get-methods-classdef-v2.patch, #55968
    2024-04-23 nrjank CategoryInterpreter Classdef
    2024-04-20 mmuetzel Attached File- Added bug65610-breakpoints-in-set-or-get-methods-classdef.patch, #55948
        StatusConfirmed Patch Submitted
        Planned ReleaseNone 10.1.0 (current default)
    2024-04-18 mmuetzel StatusNone Confirmed
        Release9.1.0 dev
        Operating SystemMicrosoft Windows Any
        Summaryunable to set breakpoints within classdef classes unable to set breakpoints within set or get functions of classdef classes

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code