0

Octave の一部の内部ライブラリ関数でエラーが発生しました。呼び出し元の関数をデバッグしたいのですが、やり方がわかりません。

  • スタック トレースを表示するにはどうすればよいですか?

  • フレーム間を移動するにはどうすればよいですか?

4

2 に答える 2

1

編集- dbup()dbdown()、およびdbstack()は、Octave 3.2 以降で使用できます。http://www.gnu.org/software/octave/doc/interpreter/Debugging.html#Debugging

古い答え

コールスタックを表示する方法がわかりません。デバッグ モードに入ったら、 and を使用dbstep()dbnext()て、それぞれ次の行にステップ インおよびステップ オーバーし、呼び出しを記述します。dbwhere()また、とで近くのコード行を確認できますdbtype()。これは間違いなく、MATLAB が Octave よりも進んでいる領域の 1 つです。

于 2010-03-16T20:48:32.277 に答える
1

To this day, the octave GUI (5.2.0 at least) still does not show the call stack. You can run the octave debugger in VS code though, and see the stack trace there. I have used it and it works great. There are actually two octave debugger plugins available for VS code at present. I found the Silva one to work slightly better, the other one seemed not to close down the debugger process always. Use something like this in the launch.json:

    "version": "0.2.0",
    "configurations": [
        {
            "type": "OctaveDebugger",
            "request": "launch",
            "name": "octave debug",
            "octave": "octave-cli",
            "sourceFolder": "${workspaceFolder}:/home/username/src/octave",
            "workingDirectory": "${workspaceFolder}",
            "program": "yourprogram('stringarg')"
        }
    ]

ie the octave cli debugger executable should be on the unix path as well. Even with the Silva plugin I think there is some mechanism by which the octave-cli doesn't always shut down. If you try to start the debugger in VS code and nothing happens, check processes and kill if necessary.

于 2021-02-22T14:25:52.810 に答える