-
Notifications
You must be signed in to change notification settings - Fork 31
docs: add documentation on how to debug embedded app in linux using vscode #1574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d93f68d
f2ac749
56081f7
491634e
f698183
e1d69d6
9bcdd28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add documentation on how to debug embedded app in linux using vscode |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -46,6 +46,52 @@ | |||||
| - Running behind a VPN | ||||||
| - Missing dependencies | ||||||
|
|
||||||
| .. _debug-embedding-vscode-linux: | ||||||
|
|
||||||
| Debug with Visual Studio Code on Linux | ||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|
|
||||||
| On Linux, the Python debugger must see the same environment that ``mechanical-env`` sets when | ||||||
| On Linux, the Python debugger must see the same environment that the ``mechanical-env`` variable sets when | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| you run ``mechanical-env python``. You can capture that environment once, store it in a file, and | ||||||
dipinknair marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| point Visual Studio Code at it. | ||||||
|
|
||||||
| #. Install the `Python extension`_ for Visual Studio Code (provides the Debuggy debugger). | ||||||
|
Check failure on line 59 in doc/source/getting_started/troubleshooting.rst
|
||||||
|
|
||||||
| #. From your project root, write the prepared environment to ``.vscode/.env``. Use the same | ||||||
| ``-r`` or ``-p`` options you use for normal runs: | ||||||
|
|
||||||
| .. code:: shell | ||||||
|
|
||||||
| $ mechanical-env -r 261 env > .vscode/.env | ||||||
|
|
||||||
| #. Create ``.vscode/launch.json`` with a launch configuration that loads that file: | ||||||
|
|
||||||
| .. code-block:: json | ||||||
|
|
||||||
| { | ||||||
| "version": "0.2.0", | ||||||
| "configurations": [ | ||||||
| { | ||||||
| "name": "Python Debugger: Current File", | ||||||
| "type": "debugpy", | ||||||
| "request": "launch", | ||||||
| "program": "${file}", | ||||||
| "console": "integratedTerminal", | ||||||
| "envFile": "${workspaceFolder}/.vscode/.env" | ||||||
| } | ||||||
| ] | ||||||
| } | ||||||
|
|
||||||
| #. Start **Run and Debug**, choose **Python Debugger: Current File**, and run your script. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bold is used only to indicate UI options--is that the case here? |
||||||
|
|
||||||
| .. note:: | ||||||
|
|
||||||
| Regenerate ``.vscode/.env`` if you change the Ansys version, installation path, or ``mechanical-env`` | ||||||
| options. Consider adding ``.env`` to ``.gitignore`` if the file should not be shared. | ||||||
|
|
||||||
| .. _`Python extension`: https://marketplace.visualstudio.com/items?itemName=ms-python.python | ||||||
|
|
||||||
|
|
||||||
| Licensing issues | ||||||
| ----------------- | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -50,3 +50,10 @@ Run a Python script using a specific version: | |||||
| .. code-block:: bash | ||||||
| mechanical-env -r 261 python my_script.py | ||||||
| Debugging with Visual Studio Code | ||||||
| --------------------------------- | ||||||
|
|
||||||
| To debug embedded PyMechanical scripts in VS Code on Linux, export the environment that | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ``mechanical-env`` would set and attach the debugger to it. See | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe "
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @klmcadams I was just trying to put a noun after to indicate what type of entity it was. Script is fine with me. I do think I made the same "variable" change elsewhere though so I'd recommend a search. (I can make to see that you found that edit of mine and also recommended script there. Way to go!) |
||||||
| :ref:`debug-embedding-vscode-linux` in :doc:`/getting_started/running_mechanical`. | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.