Skip to content

Instantly share code, notes, and snippets.

@pcuenca
Created August 11, 2024 12:58
Show Gist options
  • Save pcuenca/85f773a621edaf1dc930842dd2428d6b to your computer and use it in GitHub Desktop.
Save pcuenca/85f773a621edaf1dc930842dd2428d6b to your computer and use it in GitHub Desktop.
Debug Rust dylib from Python script in Visual Studio Code
{
// 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": [
{
// To debug a Rust dylib (tiktoken) from a Pyton script:
// - Launch the Python script with the Python debugger and stop at a breakpoint.
// - Get the process id (for example, `os.getpid()`)
// - Select the Attach target in the debugger and select that PID
"type": "lldb",
"request": "attach",
"name": "Attach",
"pid": "${command:pickMyProcess}" // use ${command:pickProcess} to pick other users' processes
},
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false
},
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment