paulo-fernando-silva / vscOctaveDebugger

MIT License
35 stars 4 forks source link

Debugging doesn't work as expected #43

Closed EmilyGraceSeville7cf closed 3 years ago

EmilyGraceSeville7cf commented 3 years ago

Hello! I have the following launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "OctaveDebugger",
            "request": "launch",
            "name": "Octave",
            "program": "main.m",
            "octave": "octave-cli",
            "sourceFolder": "${workspaceFolder}",
            "autoTerminate": true
        }
    ]
}

and the this Octave script:

clear all

function z = l(xx, i, x)
    n = size(x);
    pr = 1;
    for j = [1:1:(i - 1) (i + 1):1:n(1)]
        pr = pr * (xx - x(j)) / (x(i) - x(j));
    end
    z = pr;
end

function z = L(xx, x, y)
    n = size(x);
    sum = 0;
    for i = 1:1:n(1)
        sum = sum + l(xx, i, x) * y(i);
    end
    z = sum;
end

n = 4;
x = [1 3 5 7]';
y = [2 2 4 4]';

L(2, x, y)
L(4, x, y)
L(6, x, y)
disp("Hello world!")

When I click Run > Start Debugging program runs instead of fall in debug mode. What am I missing?

image

Octave version: 6.2.0/6.1.0 VS Code version: 1.53.2

log20210213_165627.txt

paulo-fernando-silva commented 3 years ago

Hi! Unfortunately I wasn't able to reproduce your problem. It seems to work fine on my machine. Let's try to debug this... Try adding the following options to your launch configuration you posted above:

            "logFilename": "${workspaceFolder}/log",
            "verbose": true

Attach the log file to the bug. Also, tell me the version of octave you have installed.

Screen Shot 2021-03-13 at 15 49 59
EmilyGraceSeville7cf commented 3 years ago

@paulo-fernando-silva, logs and Octave/VS Code versions are added.

paulo-fernando-silva commented 3 years ago

Can you test with Octave version 6.1? Maybe something changed. I still didn't test with version 6.2. Will do so when I have time.

EmilyGraceSeville7cf commented 3 years ago

@paulo-fernando-silva, it fails to debug even with Octave 6.1.0: log20210213_175111.txt

paulo-fernando-silva commented 3 years ago

[07:51:11.864 UTC] Cannot find file at '..\lib\octave.portable\tools\octave\mingw64\bin\octave-cli.exe' (C:\ProgramData\chocolatey\lib\octave.portable\tools\octave\mingw64\bin\octave-cli.exe). This usually indicates a missing or moved file.

Probably you need to set the exe path using an absolute path. For example

"octave-cli": "c:/path/to/octave-cli.exe"

Either that or add that location to your PATH environment variables. Test that and let me know how it goes.

EmilyGraceSeville7cf commented 3 years ago

@paulo-fernando-silva, with launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "OctaveDebugger",
            "request": "launch",
            "name": "Octave",
            "program": "main.m",
            "octave": "\"C:\\Program Files\\GNU Octave\\Octave-6.1.0\\mingw64\\bin\\octave-cli.exe\"",
            "sourceFolder": "${workspaceFolder}",
            "autoTerminate": true,
            "logFilename": "${workspaceFolder}/log",
            "verbose": true
        }
    ]
}

it works properly.

paulo-fernando-silva commented 3 years ago

Fantastic. Might be better to just add C:\Program Files\GNU Octave\Octave-6.1.0\mingw64\bin\ to your path though. If all is working please close the bug.