-
Notifications
You must be signed in to change notification settings - Fork 319
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
debug adapter fails with Python 3.12/homebrew/MacOS arm64 due to 3.12 regression, works with 3.11/homebrew (VSC-1339) #1177
Comments
after some more trial and error, the following seems a less painful path which works for me:
|
We are working on migrating to a new debug adapter that is more stable that our current python one in this PR: You are welcome to test it with the PR vsix installer if you like. |
I did in fact use the #1131 vsix version but forgot to mention this in the current issue report meaining: this issue applies to #1131 as well since the underlying issue is present on Windows as well (and hence likely linux too) debugging using this extension is likely broken for all platforms as long as your debug adapter permits 3.12 and imports threading.py which the #1131 vsix also does and since the #1131 vsix uses threading it evades me how this code is supposed to fix a problem introduced by permitting a combination of Python3.12 and threading.py ? iow: the #1131 extension PR cannot possibly fix the issue reported here what will fix it is avoiding either Python3.12 and/or `threading`` the tricky part is: esp-idf installs and works just fine with Python3.12 - it ONLY breaks this extension at runtime leading users to believe all prerequisites are fullfilled this really should be made an install time error until 3.12 or later and/or threading.py is fixed |
The thing is, the new debug adapter doesn't use Python. If you are is because probably you are still using {
"configurations": [
{
"type": "gdbtarget",
"request": "attach",
"name": "Eclipse CDT Remote",
"program": "${workspaceFolder}/build/${command:espIdf.getProjectName}.elf",
"initCommands": [
"set remote hardware-watchpoint-limit 2",
"mon reset halt",
"maintenance flush register-cache",
"thb app_main",
],
"gdb": "${command:espIdf.getXtensaGdb}",
"target": {
"port": "3333"
},
}
]
} |
well using your above launch.json fragment finally worked with the new debug adapter so for others to follow:
and debugging starts to work reasonably well. let me understand what the best practice is for debugging:
I noticed at least on MacOS
but it seems to do no harm as the debugger comes up nevertheless |
above I wrote:
correction: it does harm. scenario:
this needs fixing as well - hard to figure a leftover openocd in the background is at fault |
For a new project, you can create a new project using the With regards to openOCD, how are you running openOCD, are you using the extension openOCD Server ? Are you stopping the debugger before closing the vscode window or just closing the window ? Any output related to openOCD not closing properly ? I ask because I have tested on macOS and openOCD seems to close normally after I stop the debug session. |
just leaving VSCode during a debug session leaves openocd running - this could have been the cause will have a closer eye on that exactly when it happens |
oh I see, if I wipe the .vscode directory and restart VSCode, it creates {
"idf.adapterTargetName": "esp32c3"
} for debugging to work, I need a {
"idf.adapterTargetName": "esp32c3",
"idf.port": "/dev/cu.usbmodem2131301",
"idf.flashType": "UART",
"idf.openOcdConfigs": [
"board/esp32c3-builtin.cfg" // <---- add this, then things work
]
} it is unclear to me how I get from the former to the latter other than editing, is this the proper way to do it? I guess what I'm trying to do is an idiots recipe for going from hello_world to a working debug session given a piece of hardware next hop: extend towards the Multiple Build Configurations Example for working with different targets then: add Arduino as component without bringing down the house, and have debugging still work. |
AHA. launch.json with Eclipse CDT Remote config is only added by |
You can check the tutorial documentation should provide most of extension functionality. |
sorry, after spending a disordinate amount of time trying to work with this extension I give up. I have decided to stay with Platformio for the easy cases and command line debug for hard cases. |
If it not to much to ask, could you describe which issues you faced with this extension and what cases you think we could improve ? |
OS
MacOS
Operating System version
Sonoma 14.4.1 (23E224)
Visual Studio Code version
Version: 1.88.0 (Universal) Commit: 5c3e652f63e798a5ac2f31ffd0d863669328dc4c
ESP-IDF version
5.2.1
Python version
3.12.2_1 (broken), 3.11.9 (works), both homebrew
Doctor command output
doctor output for 3.11 and 3.12
doctor-3.12.txt
doctor-3.11.txt
esp_idf_vsc_ext.log
Extension
esp_idf_vsc_ext.log attached above (for failed 3.12 debug attempt towards end)
Description
when debugging using a homebrew Python 3.12 install:
Explorer->Debug Console shows:
Debug adapter -> Extension: DEBUG_ADAPTER_STARTED
Debug adapter -> Extension: DEBUG_ADAPTER_READY2CONNECT
Debug Adapter initialized
2
can't create new thread at interpreter shutdown <----------------- this is the cause
when debugging using a homebrew Python 3.11 install:
Explorer->Debug Console does NOT show the above error message!
the cause is very likely the 3.12 regression described here:
https://stackoverflow.com/questions/77631477/runtimeerror-cant-create-new-thread-at-interpreter-shutdown-python-3-12
This is at program startup - debugger stops at app_main():
this is after setting the breakpoint:


Debug Message
Other Steps to Reproduce
I hit an attachment size limit above and cannot add more text
The third image above shows the behaviour after hitting the continue icon
NB the yellow caret did NOT move, see the 'can't create new thread at interpreter shutdown' error message in the Debug console
Summary:
the following sequence worked for me
.vscode/extensions/espressif.esp-idf-extension-1.7.1
export PATH=$(brew --prefix python@3.11)/libexec/bin:$PATH
code --install-extension esp-idf-extension.vsix
can't create new thread at interpreter shutdown
error message in Debug ConsoleRecommendation:
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: