Skip to content

Commit

Permalink
Debugging python (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsmithtt authored Jul 22, 2024
1 parent 25bb6ae commit ccbcfbf
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/src/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,35 @@ git submodule foreach 'git lfs fetch --all && git lfs pull’
```
Then, try to build again.
## Common Runtime Errors
### Debugging python on macOS
When debugging python on macOS via lldb you may see an error like:
```
(lldb) r
error: process exited with status -1 (attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries, when the attach failed. The subsystem that denied t
he attach permission will likely have logged an informative message about why it was denied.))
```
For preinstalled macOS binaries you must manually codesign with debug entitlements.
Create file `debuggee-entitlement.xml`:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.get-task-allow</key>
<true/>
</dict>
</plist>
```
Sign the binary:
```bash
sudo codesign -f -s - --entitlements debuggee-entitlement.xml /opt/ttmlir-toolchain/venv/bin/python
```

0 comments on commit ccbcfbf

Please sign in to comment.