docs: Added 'how to debug' page
This commit is contained in:
3
.github/workflows/docs_pages.yml
vendored
3
.github/workflows/docs_pages.yml
vendored
@@ -12,10 +12,11 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
python-version: '3.13'
|
||||
- run: |
|
||||
pip install mkdocs
|
||||
pip install "mkdocstrings[python]"
|
||||
pip install mkdocs-material
|
||||
pip install mkdocs-callouts
|
||||
pip install mkdocs-glightbox
|
||||
mkdocs gh-deploy --force
|
||||
47
docs/howto/localdebug.md
Normal file
47
docs/howto/localdebug.md
Normal file
@@ -0,0 +1,47 @@
|
||||
## Debug with VSCode
|
||||
|
||||
1. Install **debugpy** module
|
||||
|
||||
`pip install debugpy`
|
||||
|
||||
2. Add to your code listening to the default `5678` port with debug adapter
|
||||
|
||||
```python
|
||||
import debugpy
|
||||
debugpy.listen(5678, in_process_debug_adapter=True)
|
||||
```
|
||||
|
||||
3. Launch your G2O Server
|
||||
|
||||
4. In VSCode, go to your Python script, press **F5** and select **Attach using Process ID**
|
||||
|
||||

|
||||
|
||||
5. Find G2O Server process and select it
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
!!! warning
|
||||
Sometimes **debugpy** isn't terminating process even after server is closed. Keep an eye on process list while attaching, so you can terminate them manually.
|
||||
|
||||
## Debug with PDB
|
||||
|
||||
Python Debugger (PDB) is already implemented by default, so you can place breakpoints right away
|
||||
|
||||
```python
|
||||
@g2o.event('onTime')
|
||||
def evtTime(**kwargs):
|
||||
a = 5
|
||||
b = 246
|
||||
c = a * b
|
||||
|
||||
breakpoint()
|
||||
|
||||
print(kwargs)
|
||||
```
|
||||
|
||||
That way PDB interface will show up on breakpoint encounter, and you can use it [as usual](https://docs.python.org/3/library/pdb.html)
|
||||
|
||||

|
||||
@@ -6,11 +6,15 @@ markdown_extensions:
|
||||
- pymdownx.details
|
||||
- pymdownx.superfences
|
||||
- sane_lists
|
||||
- attr_list
|
||||
- md_in_html
|
||||
- pymdownx.blocks.caption
|
||||
|
||||
plugins:
|
||||
- mkdocstrings
|
||||
- search
|
||||
- callouts
|
||||
- glightbox
|
||||
|
||||
repo_url: https://github.com/AURUMVORXX/PyG2O.git
|
||||
|
||||
@@ -18,6 +22,8 @@ nav:
|
||||
- How to use: index.md
|
||||
- Comparing with Squirrel: comparing.md
|
||||
- QnA: qna.md
|
||||
- How To...:
|
||||
- ...debug?: howto/localdebug.md
|
||||
- Classes:
|
||||
- Game:
|
||||
- Daedalus: classes/game/Daedalus.md
|
||||
|
||||
Reference in New Issue
Block a user