bugGNU Octave - Bugs: bug #64001, "clear all" removes...


bug #64001: "clear all" removes breakpoints while Matlab does not

Submitter:  None
Submitted:  Wed 05 Apr 2023 08:36:47 AM UTC
Category:  Octave Function Severity:  2 - Minor
Priority:  3 - Low Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  maxi Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Thu 01 Jun 2023 04:48:51 PM UTC, comment #8: 

I'm adding bug #64271 as a dependency.  If that bug (ability to save/restore breakpoints) were fixed then Octave could be modified to behave as Matlab does by the following pseudocode:

bp = dbstatus ();
clear all
dbstop (bp)

This is only pseudocode because the operations would need to take place in C++ code.

Rik <rik5>
Group administrator
Thu 01 Jun 2023 04:30:49 PM UTC, comment #7: 

Re-titling and re-categorizing this as a Matlab Compatibility item.  The issue is that "clear all" removes everything in Octave, including breakpoints.  In Matlab, the breakpoints are preserved.  This is not a severe issue as there are easy workarounds.

As a diagnosis, the issue is that "clear all" removes both variables and functions from the symbol table.  The functions in the symbol table store the breakpoints for the function and, hence, are removed when the function is removed.

Note, Matlab doesn't recommend using "clear all" at the beginning of scripts.  As with Octave, this throws out already interpreted and compiled functions which is a performance hit when they need to be reloaded.

It is much better to be targeted.  If you have a few variables that maintain state and therefore might influence re-running a script then just clear those using "clear VAR1 VAR2" or "clearvars VAR1 VAR2".  This can be useful because if you have spent time loading a gigabyte array into the variable "data" there is no reason to clear it each time you run the script since it doesn't maintain state.

If, however, you don't want to analyze your script to determine which variables are important you could just use "clear" by itself or "clearvars" by itself which will remove workspace variables, but not affect functions and their breakpoints.

Rik <rik5>
Group administrator
Fri 07 Apr 2023 12:51:19 PM UTC, comment #6: 

comment #3:

> I don't think that's expected behavior, but its not something I've noticed previously.  Which Octave versions have you seen this behavior in?

At least version 7.2. Before I did not use Octave frequently and not with this script, so I can not say how it was in older versions.
So far I just used my business PC with Matlab, so I just lived with it. But nowadays I also do some additional development on my private laptop, so it was getting disgusting to not be able to debug properly.

Wed 05 Apr 2023 02:18:46 PM UTC, comment #5: 

Breakpoint handling in Octave really needs to be completely overhauled.  Discussion of that job is probably best handled elsewhere.

John W. Eaton <jwe>
Group administrator
Wed 05 Apr 2023 01:52:04 PM UTC, comment #4: 

comment #2:

> Sorry for triple posting...

Thank you, fixed.  Please report such bugs in Savannah administration group.

Ineiev <ineiev>
Wed 05 Apr 2023 12:42:57 PM UTC, comment #3: 

I don't think that's expected behavior, but its not something I've noticed previously.  Which Octave versions have you seen this behavior in?

Nicholas Jankowski <nrjank>
Group Member
Wed 05 Apr 2023 10:28:25 AM UTC, comment #2: 

That's it :-P
You are my hero, it is working now... makes my life much easier ;-)

However, is that the expected behaviour? In Matlab this never cleared my breakpoints.

Btw: Sorry for triple posting... did't enter Orwells year in the first two attempts and thought it would not be submitted...

Wed 05 Apr 2023 10:13:55 AM UTC, comment #1: 

does your script start with `clear all?`

Wed 05 Apr 2023 08:36:47 AM UTC, original submission:  

I really love Octave as alternative to Matlab. But I have on strong issue which amkes it hard for me to develop scripts.

If I set a breakpoint in the main file and execute, Octave stops as expected. However, the breakpoints are lost always after execution.

Even worse, if I set a breakpoint in a function that is called in another file, it is dropped already after pressing the play button. So I can just debug in called functions if I step into it line by line from the main file.

As I could not find anyone else complaining about it, is it maybe some misunderstanding? Any option to set? I had this issue already in version 7.3 (not sure about before), but at that time I did not use it very often.



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

Attach Files:

No files currently attached


   bug dependencies.

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 nrjank (Posted a comment)

    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
    2023-06-01 rik5 Dependencies- Depends on bugs #64271
    2023-06-01 rik5 CategoryGUI Octave Function
        Severity3 - Normal 2 - Minor
        Priority5 - Normal 3 - Low
        Item GroupOther Matlab Compatibility
        StatusNone Confirmed
        Release8.1.0 dev
        Operating SystemMicrosoft Windows Any
        SummaryBreakpoints are lost after execution and immediately in called files "clear all" removes breakpoints while Matlab does not
    2023-04-05 ineiev Carbon-CopyRemoved 46355 -

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code