Giter Club home page Giter Club logo

vscoctavedebugger's People

Contributors

apjanke avatar dependabot[bot] avatar paulo-fernando-silva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vscoctavedebugger's Issues

Default launch configuration

Hi,
first, thanks for a great plugin - not having to switch between Octave GUI and VSCode is quite handy.

After some tinkering I've landed with the following launch configuration, which allows me to simply press F5 to launch the currently open file, even if it's using functions from other files in the same directory - similarly to how it works in the Octave GUI.
Additionally I've managed[1] to get the QT plots to mostly[2] work under Windows.

"launch": {
	"version": "0.2.0",
	"configurations": [{
		"type": "OctaveDebugger",
		"request": "launch",
		"name": "Octave Debugger",
		"program": "${fileBasename}",
		"octave": "\"C:/Program Files/GNU Octave/Octave-6.3.0/mingw64/bin/octave-gui\"",
		"sourceFolder": "${workspaceFolder}",
		"workingDirectory": "${fileDirname}",
		"autoTerminate": true
	}]
}

Would you consider updating the default values for program and workingDirectory of the automatically-populated launch configuration?
Additionally I think including this octave path example in the Readme would help other Windows users (the escaped inner quotes are crucial!).

I've seen the #51 but as it passes the whole filename along with the path to the program, I think it won't work if the program uses functions from neighboring files.

[1] After spending way too much time debugging and tinkering with environment variables - apparently simply calling octave-gui instead of octave-cli allows using QT without setting anything else (no env variables, no paths etc).
[2] With autoTerminate: true the plot windows close as soon as the program ends, with false they stay on but closing them doesn't work (only stopping the debug); also their contents is not updating (e.g. resising the window doesn't resize the graph) - I believe this is #24?

Add `reload` to README.md

Hello,

Note that I needed to reload my VSCode to work.

Maybe it can be great to put it in the README.md

multidimensional strings support

Currently stuff like char ("an apple", "two pears") isn't handled properly. These are visualized as a row vector, i.e. same as strcat ("an apple", "two pears").

Terminate on step beyond program end.

This is probably the most important remaining issue. For some reason octave doesn't print the termination tag or any other output if I step on the last program line. Therefore I can't know the program actually ended.

error: No such file or directory on Windows 10

Extension Info:
Name: Octave Debugger
Id: paulosilva.vsc-octave-debugger
Description: Debug Octave and Matlab code in Visual Studio Code.
Version: 0.4.7
Publisher: Paulo Silva
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=paulosilva.vsc-octave-debugger

Octave Info:
I have installed GNU Octave in E:\Octave-6.1.0 directory. octave-cli resides in E:\Octave-6.1.0\mingw64\bin.
I wrote a simple Hello World Script and named it "myscript.m" inside my folder: D:\Harsh\Study\Sem4\ITW-2.

Issue:
Every time I run the script using the debugger, it gives a warning and an error in Debug Console, that is as follows:

warning: addpath: D:HarshStudySem4ITW-2: No such file or directory
error: D:HarshStudySem4ITW-2: No such file or directory
Runtime: octave-cli exited with code: 1

Configuration:
My launch.json is configured as:

{
    // 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": "Run Octave",
            "program": "${fileBasename}",
            "octave": "octave-cli",
            "sourceFolder": "${workspaceFolder}",
            "autoTerminate": true
        }
    ]
}

Clearly, backslashes from path are removed; D:\Harsh\Study\Sem4\ITW-2 becomes D:HarshStudySem4ITW-2.

I need help regarding this. I am still very very new to octave. Please assist.

Can't inspect non-public properties in debugger.

It seems the properties access modifiers, private, protected, public, are also applied in debugging mode. This prevents the debugger from inspecting the value of those properties depending on scope.

'octave-cli' is not recognized as an internal or external command

I installed Octave 6.3.0 on my laptop which is running Windows 10. When I tried to debug my .m file, the sentence shown on the debug console.

image

What must I do to make octave-cli or octave-gui to be recognized as an internal or external command? Or what is the problem that I am facing? How to fix the problem?

Pressing return does not advance from pause

I'm sorry if I just don't understand how this should work, but I cannot seem to get pause to work with the debugger.

I'm using the following test code:
test.m

fprintf('hello\n');
pause;
fprintf('world\n');

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "OctaveDebugger",
            "request": "launch",
            "name": "test.m",
            "program": "test.m",
            "octave": "octave-cli",
            "sourceFolder": "${workspaceFolder}",
            "autoTerminate": true
        }
    ]
}

When I press F5, I only get "hello" in the Debug Console. Pressing enter only displays an arrow, and does not advance to "world".
I have no breakpoints set in the code.
I have also tried to type dbstep in the Debug Console and pressing enter, twice, with no luck.
Pausing only displays "Pausing..." in the Debug Console, and then the session seems to die.

This is the output after pressing return three times
image

debug with qt graphic toolkit windows

Hi,
first of all, thanks for providing this extension. :)

I like to use the qt toolkit for ploting an advanced figure with buttons and sliders. It's possible to start the octave-cli with qt, when using "octave-gui --no-gui" as cmd command.
https://octave.org/doc/v4.4.0/Command-Line-Options.html
Therefor I've tried the same with your tool:

"octave": "C:/Octave/Octave-5.1.0.0/mingw64/bin/octave-gui --no-gui"
Error Message:
Could not connect to 'C:/Octave/Octave-5.1.0.0/mingw64/bin/octave-gui --no-gui'! Check path.

only using "octave-gui"
"octave": "C:/Octave/Octave-5.1.0.0/mingw64/bin/octave-gui"
Error Message:
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

I've also tried to modify the Runtime.js to add this command parameter:
code snipped from Runtime.js:
start(program, workingDirectory) {
this._program = program;
this.addFolder(path_1.dirname(program));
this.cwd(workingDirectory);
// This is just like a deferred sync command.
// The program executes and then echoes the terminator tag.
const terminator = this.echo(Runtime.TERMINATOR);
this.execute(${fsutils_1.functionFromPath(program+" --no-gui")};${terminator});
Error Message:
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Is there an option to add command parameters? Or are there other methods to solve this issue?
Greetings

cant show any plot

If a try show a plot i cant, because i cant use pause or input and if a does the plot crashes

Question about compatibility of matlab debugging

Thank you for sharing this extension.

It seems that when I use matlab functions which do not exist in octave (e.g. a function from a matlab toolbox), the debugger issues an error.

Is my assumption correct, that the extension can only be used for functions which exist in octave?

command not found: octave-cli

Hi
I am running the debugger on a mac with high sierra.
I installed octave 4.4.1 via the app dmg installer from the web site.
In my app folder, I have
Octave-4.4.1.app
Octave-cli.app
Octave-gui.app

When I run debug, I get the above error.
Any thoughts on where I went wrong?

remove_all_breakpoint_in_file: unable to find function ex1

Hello,

  1. I have Andrew Ng's course files on my Mac:
    ~/Projects/HOME/Learn ML AndrewNg/machine-learning-ex1/ex1
    my ${workspaceFolder} is ~/Projects/HOME/Learn ML AndrewNg
  2. I open ex1.m file
  3. Create config as follows:
"configurations": [
        {
            "type": "OctaveDebugger",
            "request": "launch",
            "name": "Function or file to execute.",
            "program": "${file}",
            "octave": "octave-cli",
            "sourceFolder": "${workspaceFolder}",
            "autoTerminate": true
        }
    ]
  1. Set breakpoint at line 33 which is warmUpExercise()
  2. press the Run button
  3. Get the error message in the debug console:
    error: remove_all_breakpoint_in_file: unable to find function ex1
    Runtime: octave-cli exited with code: 1

If I follow the same steps WITHOUT setting a breakpoint, the ex1 file runs fine

Debugging doesn't work as expected

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

Why two stack requests?

Not sure if this is a bug or if it's working as expected. But it seems that stack calls always come in pairs and they ask for the same thing.

Process only the exact number of child variables requested by vscode.

Currently the entire contents of a variable are requested. This might be a CPU intensive operation for very large matrices for example. Ideally we should only get the number of variables asked by vscode.

Also need to decide when to resolve the contents of the children. At request time, only for leaf children, or maybe at the 2D level for a ND matrix. That changes how soon we can preview the matrix contents on hover.

Debugger gets stuck at `pause` statements

Ok I know the pause command causes issues with the debugger, but the readme states that the debugger will just skip over pause statements.

This doesn't seem to be happening to me with v0.3.14. The debugger get's stuck at the pause statement and doesn't even produce any output (even though there is a printf() right before the first pause).

For context, I'm trying to debug ex1.m from Andrew Ng's ML class.

can't make this work with VSCode 1.28.2

I was looking for Octave debugger and came across this pluging. However, I can't make it work on macOS with VSCode 1.28.2. Issues so far:

  • no red bullet points to set for each line in .m file
  • I setup a launch target
{
  // 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": "${workspaceFolder}/test",
      // "program": "${workspaceFolder}/${command:AskForProgramName}",
      "stopOnEntry": true,
      "octave": "/full/path/to/bin/octave-cli",
      "sourceFolder": "${workspaceFolder}"
    }
  ]
}

but trying to run debugger does not give anything. I don't see anything in logs either.

Merge scope fetch into a single command.

Just a general performance optimization. Right now each variable is fetched individually. That makes parsing simpler and less error prone, but it does make things orders or magnitude slower than fetching everything in as few inter-process messages as possible.

Show variables after executing files without setting breakpoints

Hi. I wish to watch my variables after executing my code just like MATLAB or Octave GUI.

I've set autoTerminate to false but it seems not working. My launch.json is as follows

	"configurations": [
		{
			"type": "OctaveDebugger",
			"request": "launch",
			"name": "Octave Debugger",
			"program": "${file}",
			"octave": "octave-cli",
			"autoTerminate": false
		}
	]

My simple test code is

a = 1:5;
b = a;

and if I set a breakpoint at the second line , I can see the local variable
image

But if I clear the breakpoints and run again, there is no variables any more.

Here's the log file. log20210802_161801.txt

Thank you.

Add feedback for error cases.

When the function or script fails to run due to a compile error, the debug session can't execute. Right now the session exits with no feedback.

local variables does not show dimensions?

I remember when I first started using this a few days the local variable shows the dimensions but now it doesn't .

Screen Shot 2020-04-18 at 12 18 37 AM

Any idea how i can get the local variables to show the dimensions?

Fails with quote in workspace path

Workspace paths with quotes, which are valid file paths, fail with error:

parse error:
  syntax error
>>> addpath('/path/with/quote/doesn't/work')

Runtime: octave-cli exited with code: 1

Note that I can use octave just fine running the octave command inside the directory in question.

Name-check Octave Hacking?

Hi Paulo,

I see that in your README you're recommending other Octave VS Code extensions for syntax highlighting and the like. Would you consider checking out my Octave Hacking extension and maybe including that in the list of recommendations?

Octave Hacking improves on the other Octave language support extensions in the VS Code Marketplace by:

  • adding Outline View navigation support
  • doing some customizations and improvements on the syntax definition beyond what the original TextMate language bundle provides (which is what the other extensions seem to be using, unmodified), and
  • providing some snippets for common code structures

Cheers, and thank you for writing this extension!

Andrew Janke

Handling multiroot breakpoints.

In multiroot workspaces, e.g. a c++ project together with a matlab project, if the user tries to run a debug session for the matlab project, vscode sends all set breakpoints including those set in the c++ project to the debugger extension being launched.

Seems like simply ignoring the non-matlab files or even sending back a breakpoint with unverified or verified flag still leaves vscode waiting for something, and configurationDoneRequest never gets called. Manually removing all breakpoints from the c++ project seems to work though.

https://stackoverflow.com/questions/53158385/how-to-properly-handle-breakpoints-in-multiroot-workspaces

Debugging Variables, stepping, watch

While trying out the extension for a class, I was happy to see this extension providing debugging support for Octave. I tried the example provided in the readme.md and was able to stop on the first breakpoint and continue using dbcont. However, I am unable to

  1. View variables in the debug view (or watch view)
  2. View variable values via hovering over the variable in the editor
  3. Use the stepping debugging provided by VSCode while on a breakpoint.

Are these features from another extension? If not, how may I enable them?

Thank you for your hard work making this extension, it has already been very useful!

MacOS Catalina

Extensions: Octave Hacking, Octave (Toasty Technologies), and Octave Debugger

octave-cli does exist at the location specified in launch.json.

Sample.m

function output = Sample(input)
	x = [-10:0.1:10];
	y = rand(size(x));
	output = [x' y'];
end

launch.json

{
	"version": "0.2.0",
	"configurations": [
		{
			"type": "OctaveDebugger",
			"request": "launch",
			"name": "Sample",
			"program": "Sample",
			"octave": "/usr/local/bin/octave-cli",
			"sourceFolder": "${workspaceFolder}",
		},
	]
}

All of the images are from the same time. (no interaction in between the pictures)

image
image
image

plot not working

When starting the code, no plot is displayed:

[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
mesh(X,Y,Z)

Works only if i add an pause to the end.

VS Code version: 1.28.2

Passing environment variables to octave

Hi,
until e37c0ee I could pass environment variables by prepending the "octave" setting with e.g. export DISPLAY=:22; octave.
With shell not set to true this doesn't work anymore.

Is there any other way to pass environment variables to octave? I couldn't find a working solution.

addpath on workingDirectory results in Invalid Path

When running the debugger, I receive a warning produced by the addpath that sets up the required path directories:

warning: addpath: c:\Users\...\Code\Homework:C:\Users\...\Code\MATLAB Scripts: No such file or directory

(note that ... has replaced long intermediate filepaths with identifying information)

The issue here is that the two paths are being separated by the : character rather than the pathsep() value. My octave installation returns ; when running pathsep(), which I suspect to be due to me running on a Windows OS. If I manually run addpath with the same string, but with the ; between the two paths, it works as it should, though I would prefer to not explicitly run addpath at the start of all my scripts.

I took at look at the source, but I don't know Typescript or VSC extensions at all, and couldn't see where this character was being added. The comment on this line however claims to separate explicitly with the :, so I will believe that.

// We can pass multiple directories here separated by :

If there is a configuration fix that I have overlooked that would address this problem, please let me know.

Support multiple sourceFolders?

Some larger Octave projects have their code split out into multiple directories. At least having one main source directory and a separate examples/test/scratch directory doesn't seem uncommon. Would you consider adding support for passing an array of multiple directories to the sourceFolder option in the debug configuration?

Sometimes program launch/debug fails with 4294967295 exit code

Octave version: 6.2.0/6.1.0
VS Code version: 1.53.2
Logs: log20210213_173042.txt
PATH variable: /cygdrive/c/Program Files/GNU Octave/Octave-6.2.0/mingw64/bin:/home/Alvin/.local/bin:/cygdrive/c/Program Files/Mono/bin:/usr/local/bin:/usr/bin:/usr/bin/python:/cygdrive/c/tools/ruby30/bin:/cygdrive/c/Python39/Scripts:/cygdrive/c/Python39:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/WINDOWS/System32/OpenSSH:/cygdrive/c/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static:/cygdrive/c/ProgramData/chocolatey/bin:/cygdrive/c/Program Files/Microsoft VS Code/bin:/cygdrive/c/Program Files (x86)/GtkSharp/2.12/bin:/cygdrive/c/Program Files/dotnet:/cygdrive/c/Program Files/nodejs:/cygdrive/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/cygdrive/c/Program Files/PowerShell/7:/cygdrive/c/ProgramData/chocolatey/lib/dotnet.script/dotnet.script:/cygdrive/c/Program Files/Git/cmd:/cygdrive/c/Program Files/Mono/bin:/usr/local/bin:/usr/bin:/usr/bin/python:/cygdrive/c/tools/ruby30/bin:/cygdrive/c/Python39/Scripts:/cygdrive/c/Python39:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/WINDOWS/System32/OpenSSH:/cygdrive/c/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static:/cygdrive/c/ProgramData/chocolatey/bin:/cygdrive/c/Program Files/Microsoft VS Code/bin:/cygdrive/c/Program Files (x86)/GtkSharp/2.12/bin:/cygdrive/c/Program Files/dotnet:/cygdrive/c/Program Files/Git/cmd:/cygdrive/c/Program Files/nodejs:/cygdrive/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/cygdrive/c/Program Files/PowerShell/7:/usr/bin/python:/cygdrive/c/tools/ruby30/bin:/cygdrive/c/Python39/Scripts:/cygdrive/c/Python39:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/WINDOWS/System32/OpenSSH:/cygdrive/c/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static:/cygdrive/c/ProgramData/chocolatey/bin:/cygdrive/c/Program Files/Microsoft VS Code/bin:/cygdrive/c/Program Files (x86)/GtkSharp/2.12/bin:/cygdrive/c/Program Files/dotnet:/cygdrive/c/Program File:/cygdrive/c/Users/Alvin/.dotnet/tools

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,
            "logFilename": "${workspaceFolder}/log",
            "verbose": true
        }
    ]
}

program:

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));
    endfor
    z = pr;
endfunction

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);
    endfor
    z = sum;
endfunction

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!")

But I can run octave-cli from any place via terminal directly without any problems. So I don't understand why it happens.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.