Skip to content
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

docs: added docs on debugging using breakpoints #4943

Merged
merged 5 commits into from
Mar 7, 2025

Conversation

LifeLex
Copy link
Contributor

@LifeLex LifeLex commented Feb 27, 2025

This PR aims to include docs on how to debug your rust code using breakpoints from python.
It also includes the setup for users of VSCode and an automatic setup for Jupyter Notebook users

Copy link
Contributor

@ngoldbaum ngoldbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't use vs code so I didn't look at that part but I have some suggestions for the lldb/gdb content.

Also maybe you can use a tab switcher so people don't have to see both versions? I'm not sure if the pyo3 docs system has a way to have a clickable tab switch between the gdb and lldb instructions.

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
@LifeLex
Copy link
Contributor Author

LifeLex commented Feb 27, 2025

@ngoldbaum For the tab switcher that will be nice but it will require adding the mdbook-tabs plugin, if you think it is the best option I am keen to do it, I just didn't want to add an extra dependency just for this

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, a useful collection of options!

I would be ok to add mdbook-tabs, are you happy to do it as part of this PR?

import sys


def update_launch_json(vscode_config_file_path=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 this is a pretty nice trick!

@LifeLex
Copy link
Contributor Author

LifeLex commented Feb 28, 2025

@davidhewitt yeah ofc ! More than happy to add it, I'll add it as part of the next commit

@LifeLex LifeLex requested a review from davidhewitt February 28, 2025 12:39
@ngoldbaum
Copy link
Contributor

The tab switcher looks great!

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant, thank you!

@davidhewitt davidhewitt added this pull request to the merge queue Mar 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 7, 2025
@davidhewitt davidhewitt added this pull request to the merge queue Mar 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 7, 2025
@LifeLex
Copy link
Contributor Author

LifeLex commented Mar 7, 2025

@davidhewitt There seems to be some kind of problem on the CI pipeline on the merge, specifically with Python3.7, not sure about this issue, is this something you might know why its happening ?

@davidhewitt
Copy link
Member

The 3.7 issues should not be blocking, I will fix those separately.

Looks like we have some CI bitrot on both test-debug and also graalpy, I will investigate those and try to unblock the pipeline...

@davidhewitt
Copy link
Member

It think like the graalpy issue was caused by github flakiness (I'm getting some timeouts from github releases API this morning, I think that's the likely root cause).

It looks like test-debug is a more general break on the jiff functionality, see #4959 (comment)

@LifeLex
Copy link
Contributor Author

LifeLex commented Mar 7, 2025

Makes sense thank you, I did check the Github status page and it looked like they had some issues today.
Perfect so I'm guessing we will be able to merge this when that is fixed, thanks again @davidhewitt !

@davidhewitt davidhewitt added this pull request to the merge queue Mar 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 7, 2025
@davidhewitt davidhewitt added this pull request to the merge queue Mar 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 7, 2025
@WSH032
Copy link

WSH032 commented Mar 7, 2025

@LifeLex, have you tested this on Windows?

As far as I know, there is an issue with debug symbols when using maturin on Windows PyO3/maturin#2213, and there might be a similar issue on MacOS.

@LifeLex
Copy link
Contributor Author

LifeLex commented Mar 7, 2025

@WSH032 I haven't because I don't have a windows machine at the moment, but I've tested it on both Linux and MacOS and I had no issues, if you are asking because of the CI issue it feels to me that that is related with something else

@WSH032
Copy link

WSH032 commented Mar 7, 2025

@WSH032 I haven't because I don't have a windows machine at the moment, but I've tested it on both Linux and MacOS and I had no issues, if you are asking because of the CI issue it feels to me that that is related with something else

No, this is not related to the CI issue.

On Windows, debug symbols are in separate .pdb files and need to be in the same directory as the dynamic library to work.

When using maturin, it only copies the .dll file without copying the .pdb file, so the debugger cannot find the breakpoints.

Until PyO3/maturin#2220 is merged, the best solution is to manually copy these .pdb files next to the .pyd (aka, .dll).

I think it would be best to document this.

@ngoldbaum
Copy link
Contributor

@WSH032 would you be willing to update these docs once we merge this PR? You're probably better suited to write any windows-specific instructions than @LifeLex

@WSH032
Copy link

WSH032 commented Mar 7, 2025

@ngoldbaum, sure. I'm happy to contribute to pyo3, it has really helped me a lot.

@davidhewitt davidhewitt added this pull request to the merge queue Mar 7, 2025
Merged via the queue into PyO3:main with commit c068831 Mar 7, 2025
48 checks passed
@davidhewitt
Copy link
Member

CI issue it feels to me that that is related with something else

Indeed, the cargo xwin download has been flaky on CI for some time. We cache it so in theory the download being flaky should not block merges, but we have a lot of caches and sometimes GitHub will gc the download. After that we have a little bit of pain until it gets repopulated.

There is probably some work due to improve the cache situation, I will try to write an issue about that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants