bugGNU Octave - Bugs: bug #65547, Byte-code machine working in debug...


bug #65547: Byte-code machine working in debug mode causes crash / core dump

Submitter:  Hendrik K <koerhen>
Submitted:  Tue 02 Apr 2024 06:15:37 AM UTC
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Patch Reviewed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * bytecode-evaluator Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Tue 09 Apr 2024 08:59:46 PM UTC, comment #5: 

Took a bit of unrelated effort (see bug #65573), but no more crash or errors on Windows either.

Setting status to "patch reviewed" but I didn't check syntax etc.

Philip Nienhuis <philipnienhuis>
Group Member
Sun 07 Apr 2024 03:12:14 PM UTC, comment #4: 

With the patch I get no crash or error message on Linux (Fedora 39). I'll try on Windows later today or tomorrow

Philip Nienhuis <philipnienhuis>
Group Member
Fri 05 Apr 2024 06:16:09 PM UTC, comment #3: 

Thanks Petter, I'll try it in a next build ...

Philip Nienhuis <philipnienhuis>
Group Member
Wed 03 Apr 2024 09:25:12 PM UTC, comment #2: 

It seems like the catch of any quit_debug_exception need to happen at a lot more places, when unwinding multiple stack frames, than added in https://savannah.gnu.org/bugs/?65056

I've made an patch that seems to address the issue. I can't recreate the problem after applying the patch.

Catch debug exit exceptions in nested bytecode contexts (bug #65547)

When debugging is aborted, and there are nested bytecode interpreters,
the exit debug exception would not be handled properly.

Also, add some missed handling of exit exceptions.

* pt-bytecode-vm-internal.h: Add CATCH_DEBUG_EXCEPTION macro def.
                             Wrap tries with the macro.
                             Add missing CATCH_EXIT_EXCEPTION.
* pt-bytecode-vm.cc: Wrap tries with the CATCH_DEBUG_EXCEPTION macro

(file #55918)

Petter <petter>
Tue 02 Apr 2024 09:01:27 PM UTC, comment #1: 

I can confirm it on Windows 10, but w/o crash:

>> test2
stopped in test1 at line 4 [C:\Users\philip\MyDocs\octave\tmp\test\test1.m]
4:     ret = sin (in);
error: quit debug exception escaping the vm
error: called from
    test2 at line 2 column 7

I have a home-made Windows build with some local mods that is basically at hg-id = 974e6fbb2d6a (Mar 30)
FTR, I have also the bytecode patches for bugs 65308, 65304 and 65240 in my builds.

cc-íng Petter

Philip Nienhuis <philipnienhuis>
Group Member
Tue 02 Apr 2024 06:15:37 AM UTC, original submission:  

In certain scenarios working in debug mode with the byte-code machine active causes a core dump/crash.
The version ID is 3cd264056d3a (from end of February 2024), so the patch for https://savannah.gnu.org/bugs/?65056 is included.

Steps to reproduce with two function files:

function ret = test1(in);
  in_1 = in * 2;
  if in_1 < 100
    ret = sin(in);
    ret = cos(in);

function ret = test2()
  ret = test1(3);

1) Set a breakpoint in test1 (line ret = sin(in);)
2) Run test2 (e.g. via test2() on the command line)
3) change the breakpoint line to ret = cos(in);
4) Quit debug mode (using the square icon in the GUI)
--> system crash / core dump

When the byte-code machine is disabled via _vm_enable_(0) and the same steps are executed, no crash occurs.

Hendrik K <koerhen>


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

Attach Files:

Attached Files
file #55918:  33535.patch added by petter (16KiB - text/plain)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by petter (Updated the item)
  • -email is unavailable- added by philipnienhuis
  • -email is unavailable- added by koerhen (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-04-09 philipnienhuis StatusPatch Submitted Patch Reviewed
    2024-04-07 philipnienhuis StatusConfirmed Patch Submitted
    2024-04-03 petter Attached File- Added 33535.patch, #55918
    2024-04-02 philipnienhuis StatusNone Confirmed
        Operating SystemGNU/Linux Any
        Carbon-Copy- Added petter

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code