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

Debugger crashes if running under CPython debug build (--with-pydebug) #152

Closed
patrickkidd opened this issue Apr 27, 2020 · 25 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@patrickkidd
Copy link

Environment data

  • PTVSD version: 4.3.2
  • OS and version: macOS 10.15.4, Windows 10 latest
  • Python version: 3.6.4
  • Using VS Code or Visual Studio: VS Code

Actual behavior

Crashes immediately when debugging via launch.

Expected behavior

Does not crash; can break at breakpoint.

Steps to reproduce:

  1. Build and install python from source with generic configure options.
  2. Set built python as interpreter.
  3. Set breakpoint in first line of python code.
  4. Launch debugger.
  5. Observe crash w/ crash report in OS.
@patrickkidd
Copy link
Author

Process: python3.6 [59748]
Path: /Users/USER/*/python3.6
Identifier: python3.6
Version: 0
Code Type: X86-64 (Native)
Parent Process: bash [24294]
Responsible: Terminal [18684]
User ID: 501

Date/Time: 2020-04-24 22:59:27.703 -0800
OS Version: Mac OS X 10.15.4 (19E287)
Report Version: 12
Bridge OS Version: 4.4 (17P4281)
Anonymous UUID: DE6007FC-8BDC-91D9-D093-77AE8648E82B

Sleep/Wake UUID: FD6DC031-C237-43FC-912C-FE77DB677041

Time Awake Since Boot: 130000 seconds
Time Since Wake: 660 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000020
Exception Note: EXC_CORPSE_NOTIFY

VM Regions Near 0x20:
-->
__TEXT 000000010ae9e000-000000010b200000 [ 3464K] r-x/r-x SM=COW /Users/USER//.6

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff72fc933a __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff73085e60 pthread_kill + 430
2 libsystem_c.dylib 0x00007fff72ee093e raise + 26
3 python3.6 0x000000010b1abf33 faulthandler_fatal_error + 307 (faulthandler.c:365)
4 libsystem_platform.dylib 0x00007fff7307a5fd _sigtramp + 29
5 ??? 0xcbcbcbcbcbcbcbcb 0 + 14685055086129564619
6 sip.so 0x000000011232e7a4 sip_api_get_pyobject + 36 (siplib.c:9132)
7 sip.so 0x000000011232e58a sip_api_convert_from_type + 362 (siplib.c:9619)
8 QtCore.so 0x000000010d668114 qtcore_do_find_children(QObject const*, _object*, QString const&, QFlagsQt::FindChildOption, _object*) + 132 (qobject.sip:136)
9 QtCore.so 0x000000010d667ca5 qtcore_FindChildren(QObject const*, _object*, QString const&, QFlagsQt::FindChildOption) + 101 (qobject.sip:179)
10 QtCore.so 0x000000010d664d0f meth_QObject_findChildren(_object*, _object*, _object*) + 399 (qobject.sip:480)
11 python3.6 0x000000010af5230a _PyCFunction_FastCallDict + 1290 (methodobject.c:231)
12 python3.6 0x000000010af526f5 _PyCFunction_FastCallKeywords + 501 (methodobject.c:294)
13 python3.6 0x000000010b09686d call_function + 637 (ceval.c:4824)
14 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
15 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
16 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
17 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
18 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
19 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
20 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
21 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
22 python3.6 0x000000010b099d27 _PyFunction_FastCallDict + 1431 (ceval.c:5057)
23 python3.6 0x000000010aeafc42 _PyObject_FastCallDict + 562 (abstract.c:2310)
24 python3.6 0x000000010aeaffc2 _PyObject_Call_Prepend + 370 (abstract.c:2373)
25 python3.6 0x000000010aee024a method_call + 106 (classobject.c:317)
26 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
27 python3.6 0x000000010af85640 slot_tp_init + 80 (typeobject.c:6407)
28 python3.6 0x000000010af7ba94 type_call + 468 (typeobject.c:915)
29 python3.6 0x000000010aeafcfc _PyObject_FastCallDict + 748 (abstract.c:2331)
30 python3.6 0x000000010aeb06c1 _PyObject_FastCallKeywords + 529 (abstract.c:2496)
31 python3.6 0x000000010b096a14 call_function + 1060 (ceval.c:4848)
32 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
33 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
34 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
35 python3.6 0x000000010b099d27 _PyFunction_FastCallDict + 1431 (ceval.c:5057)
36 python3.6 0x000000010aeafc42 _PyObject_FastCallDict + 562 (abstract.c:2310)
37 python3.6 0x000000010aeaffc2 _PyObject_Call_Prepend + 370 (abstract.c:2373)
38 python3.6 0x000000010aee024a method_call + 106 (classobject.c:317)
39 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
40 python3.6 0x000000010af85640 slot_tp_init + 80 (typeobject.c:6407)
41 python3.6 0x000000010af7ba94 type_call + 468 (typeobject.c:915)
42 python3.6 0x000000010aeafcfc _PyObject_FastCallDict + 748 (abstract.c:2331)
43 python3.6 0x000000010aeb06c1 _PyObject_FastCallKeywords + 529 (abstract.c:2496)
44 python3.6 0x000000010b096a14 call_function + 1060 (ceval.c:4848)
45 python3.6 0x000000010b08fa49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
46 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
47 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
48 python3.6 0x000000010b07c140 PyEval_EvalCodeEx + 400 (ceval.c:4174)
49 python3.6 0x000000010af0f12f function_call + 575 (funcobject.c:604)
50 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
51 python3.6 0x000000010b096e0c do_call_core + 508 (ceval.c:5093)
52 python3.6 0x000000010b09019e _PyEval_EvalFrameDefault + 81870 (ceval.c:3391)
53 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
54 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
55 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
56 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
57 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
58 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
59 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
60 python3.6 0x000000010b07c140 PyEval_EvalCodeEx + 400 (ceval.c:4174)
61 python3.6 0x000000010af0f12f function_call + 575 (funcobject.c:604)
62 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
63 python3.6 0x000000010b096e0c do_call_core + 508 (ceval.c:5093)
64 python3.6 0x000000010b09019e _PyEval_EvalFrameDefault + 81870 (ceval.c:3391)
65 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
66 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
67 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
68 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
69 python3.6 0x000000010b08fa49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
70 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
71 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
72 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
73 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
74 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
75 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
76 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
77 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
78 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
79 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
80 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
81 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
82 python3.6 0x000000010b099d27 _PyFunction_FastCallDict + 1431 (ceval.c:5057)
83 python3.6 0x000000010aeafc42 _PyObject_FastCallDict + 562 (abstract.c:2310)
84 python3.6 0x000000010aeaffc2 _PyObject_Call_Prepend + 370 (abstract.c:2373)
85 python3.6 0x000000010aee024a method_call + 106 (classobject.c:317)
86 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
87 python3.6 0x000000010af84531 slot_tp_call + 81 (typeobject.c:6194)
88 python3.6 0x000000010aeafcfc _PyObject_FastCallDict + 748 (abstract.c:2331)
89 python3.6 0x000000010aeb06c1 _PyObject_FastCallKeywords + 529 (abstract.c:2496)
90 python3.6 0x000000010b096a14 call_function + 1060 (ceval.c:4848)
91 python3.6 0x000000010b08fa49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
92 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
93 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
94 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
95 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
96 python3.6 0x000000010b08fa49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
97 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
98 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
99 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
100 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
101 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
102 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
103 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
104 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
105 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
106 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
107 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
108 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
109 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
110 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
111 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
112 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
113 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
114 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
115 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
116 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
117 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
118 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
119 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
120 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
121 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
122 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
123 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
124 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
125 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
126 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
127 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
128 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
129 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
130 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
131 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
132 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
133 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
134 python3.6 0x000000010b07c140 PyEval_EvalCodeEx + 400 (ceval.c:4174)
135 python3.6 0x000000010af0f12f function_call + 575 (funcobject.c:604)
136 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
137 python3.6 0x000000010b096e0c do_call_core + 508 (ceval.c:5093)
138 python3.6 0x000000010b09019e _PyEval_EvalFrameDefault + 81870 (ceval.c:3391)
139 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
140 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
141 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
142 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
143 python3.6 0x000000010b08fa49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
144 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
145 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
146 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
147 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
148 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
149 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
150 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
151 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
152 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
153 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
154 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
155 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
156 python3.6 0x000000010b099d27 _PyFunction_FastCallDict + 1431 (ceval.c:5057)
157 python3.6 0x000000010aeafc42 _PyObject_FastCallDict + 562 (abstract.c:2310)
158 python3.6 0x000000010aeaffc2 _PyObject_Call_Prepend + 370 (abstract.c:2373)
159 python3.6 0x000000010aee024a method_call + 106 (classobject.c:317)
160 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
161 python3.6 0x000000010af84531 slot_tp_call + 81 (typeobject.c:6194)
162 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
163 python3.6 0x000000010b096e0c do_call_core + 508 (ceval.c:5093)
164 python3.6 0x000000010b09019e _PyEval_EvalFrameDefault + 81870 (ceval.c:3391)
165 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
166 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
167 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
168 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
169 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
170 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
171 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
172 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
173 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
174 python3.6 0x000000010b08fa49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
175 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
176 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
177 python3.6 0x000000010b07c140 PyEval_EvalCodeEx + 400 (ceval.c:4174)
178 python3.6 0x000000010af0f12f function_call + 575 (funcobject.c:604)
179 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
180 python3.6 0x000000010b096e0c do_call_core + 508 (ceval.c:5093)
181 python3.6 0x000000010b09019e _PyEval_EvalFrameDefault + 81870 (ceval.c:3391)
182 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
183 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
184 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
185 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
186 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
187 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
188 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
189 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
190 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
191 python3.6 0x000000010b08fa49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
192 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
193 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
194 python3.6 0x000000010b07c140 PyEval_EvalCodeEx + 400 (ceval.c:4174)
195 python3.6 0x000000010af0f12f function_call + 575 (funcobject.c:604)
196 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
197 python3.6 0x000000010b096e0c do_call_core + 508 (ceval.c:5093)
198 python3.6 0x000000010b09019e _PyEval_EvalFrameDefault + 81870 (ceval.c:3391)
199 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
200 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
201 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
202 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
203 python3.6 0x000000010b08fa49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
204 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
205 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
206 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
207 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
208 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
209 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
210 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
211 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
212 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
213 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
214 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
215 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
216 python3.6 0x000000010b099d27 _PyFunction_FastCallDict + 1431 (ceval.c:5057)
217 python3.6 0x000000010aeafc42 _PyObject_FastCallDict + 562 (abstract.c:2310)
218 python3.6 0x000000010aeaffc2 _PyObject_Call_Prepend + 370 (abstract.c:2373)
219 python3.6 0x000000010aee024a method_call + 106 (classobject.c:317)
220 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
221 python3.6 0x000000010af84531 slot_tp_call + 81 (typeobject.c:6194)
222 python3.6 0x000000010aeafcfc _PyObject_FastCallDict + 748 (abstract.c:2331)
223 python3.6 0x000000010aeb06c1 _PyObject_FastCallKeywords + 529 (abstract.c:2496)
224 python3.6 0x000000010b096a14 call_function + 1060 (ceval.c:4848)
225 python3.6 0x000000010b08fa49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
226 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
227 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
228 python3.6 0x000000010b07c140 PyEval_EvalCodeEx + 400 (ceval.c:4174)
229 python3.6 0x000000010af0f12f function_call + 575 (funcobject.c:604)
230 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
231 python3.6 0x000000010b096e0c do_call_core + 508 (ceval.c:5093)
232 python3.6 0x000000010b09019e _PyEval_EvalFrameDefault + 81870 (ceval.c:3391)
233 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
234 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
235 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
236 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
237 python3.6 0x000000010b08fa49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
238 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
239 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
240 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
241 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
242 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
243 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
244 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
245 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
246 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
247 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
248 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
249 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
250 python3.6 0x000000010b099d27 _PyFunction_FastCallDict + 1431 (ceval.c:5057)
251 python3.6 0x000000010aeafc42 _PyObject_FastCallDict + 562 (abstract.c:2310)
252 python3.6 0x000000010aeaffc2 _PyObject_Call_Prepend + 370 (abstract.c:2373)
253 python3.6 0x000000010aee024a method_call + 106 (classobject.c:317)
254 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
255 python3.6 0x000000010af84531 slot_tp_call + 81 (typeobject.c:6194)
256 python3.6 0x000000010aeafcfc _PyObject_FastCallDict + 748 (abstract.c:2331)
257 python3.6 0x000000010aeb06c1 _PyObject_FastCallKeywords + 529 (abstract.c:2496)
258 python3.6 0x000000010b096a14 call_function + 1060 (ceval.c:4848)
259 python3.6 0x000000010b08fa49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
260 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
261 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
262 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
263 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
264 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
265 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
266 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
267 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
268 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
269 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
270 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
271 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
272 python3.6 0x000000010b07c140 PyEval_EvalCodeEx + 400 (ceval.c:4174)
273 python3.6 0x000000010af0f12f function_call + 575 (funcobject.c:604)
274 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
275 python3.6 0x000000010b096e0c do_call_core + 508 (ceval.c:5093)
276 python3.6 0x000000010b09019e _PyEval_EvalFrameDefault + 81870 (ceval.c:3391)
277 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
278 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
279 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
280 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
281 python3.6 0x000000010b08fa49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
282 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
283 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
284 python3.6 0x000000010b09976c fast_function + 1116 (ceval.c:4965)
285 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
286 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
287 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
288 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
289 python3.6 0x000000010b09954e fast_function + 574 (ceval.c:4941)
290 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
291 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
292 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
293 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
294 python3.6 0x000000010b099d27 _PyFunction_FastCallDict + 1431 (ceval.c:5057)
295 python3.6 0x000000010aeafc42 _PyObject_FastCallDict + 562 (abstract.c:2310)
296 python3.6 0x000000010aeaffc2 _PyObject_Call_Prepend + 370 (abstract.c:2373)
297 python3.6 0x000000010aee024a method_call + 106 (classobject.c:317)
298 python3.6 0x000000010aeaf89d PyObject_Call + 477 (abstract.c:2261)
299 python3.6 0x000000010af84531 slot_tp_call + 81 (typeobject.c:6194)
300 python3.6 0x000000010aeafcfc _PyObject_FastCallDict + 748 (abstract.c:2331)
301 python3.6 0x000000010aeb06c1 _PyObject_FastCallKeywords + 529 (abstract.c:2496)
302 python3.6 0x000000010b096a14 call_function + 1060 (ceval.c:4848)
303 python3.6 0x000000010b08fa49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
304 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
305 python3.6 0x000000010b099f72 _PyFunction_FastCall + 370 (ceval.c:4906)
306 python3.6 0x000000010b0995a8 fast_function + 664 (ceval.c:4948)
307 python3.6 0x000000010b0969f6 call_function + 1030 (ceval.c:4845)
308 python3.6 0x000000010b08f7a8 _PyEval_EvalFrameDefault + 79320
309 python3.6 0x000000010b07c1c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
310 python3.6 0x000000010b098600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
311 python3.6 0x000000010b07c140 PyEval_EvalCodeEx + 400 (ceval.c:4174)
312 python3.6 0x000000010b07bf9e PyEval_EvalCode + 94 (ceval.c:730)
313 python3.6 0x000000010b0eda8a run_mod + 106 (pythonrun.c:1025)
314 python3.6 0x000000010b0ec6e8 PyRun_FileExFlags + 264 (pythonrun.c:978)
315 python3.6 0x000000010b0eb3b5 PyRun_SimpleFileExFlags + 1061 (pythonrun.c:420)
316 python3.6 0x000000010b0eac5c PyRun_AnyFileExFlags + 140 (pythonrun.c:81)
317 python3.6 0x000000010b11d10c run_file + 332 (main.c:338)
318 python3.6 0x000000010b11bdb4 Py_Main + 4484 (main.c:809)
319 python3.6 0x000000010ae9f3d8 main + 472 (python.c:69)
320 libdyld.dylib 0x00007fff72e81cc9 start + 1

@int19h
Copy link
Contributor

int19h commented Apr 27, 2020

The repro steps say that the distro is Anaconda - are you rebuilding that from source, or is that actually the official CPython interpreter? Or is it some kind of mix?

Also, can you try this with debugpy? See microsoft/ptvsd#2104 for instructions.

@patrickkidd
Copy link
Author

The repro steps say that the distro is Anaconda - are you rebuilding that from source, or is that actually the official CPython interpreter? Or is it some kind of mix?

Also, can you try this with debugpy? See microsoft/ptvsd#2104 for instructions.

The reference to Anaconda was just from the bug report template. This is a generic python source build.

@fabioz
Copy link
Collaborator

fabioz commented Apr 27, 2020

From the crash, it seems that it's crashing inside of qt/sip... my current guess is that it's some incompatibility in your CPython version and qt.

Have you checked if it runs properly without the debugger?

@patrickkidd
Copy link
Author

From the crash, it seems that it's crashing inside of qt/sip... my current guess is that it's some incompatibility in your CPython version and qt.

Have you checked if it runs properly without the debugger?

I'm sorry, that was a bad example. This crashes when debugging a file with only one line like "print('here')". here is a better crash report that shows the crash in attach_x86_64.dylib

Process:               python3.6 [60459]
Path:                  /Users/USER/*/python3.6
Identifier:            python3.6
Version:               ???
Code Type:             X86-64 (Native)
Parent Process:        ??? [60455]
Responsible:           Electron [59329]
User ID:               501

Date/Time:             2020-04-27 09:31:06.115 -0800
OS Version:            Mac OS X 10.15.4 (19E287)
Report Version:        12
Bridge OS Version:     4.4 (17P4281)
Anonymous UUID:        DE6007FC-8BDC-91D9-D093-77AE8648E82B


Time Awake Since Boot: 53000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x000000010a817af8
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Bus error: 10
Termination Reason:    Namespace SIGNAL, Code 0xa
Terminating Process:   exc handler [60459]

VM Regions Near 0x10a817af8:
    VM_ALLOCATE            000000010a7ac000-000000010a7ec000 [  256K] rw-/rwx SM=PRV  
--> VM_ALLOCATE            000000010a7ec000-000000010a82c000 [  256K] rw-/rwx SM=COW  
    VM_ALLOCATE            000000010a82c000-000000010a86c000 [  256K] rw-/rwx SM=PRV  

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   ???                           	0x000000010a817af8 0 + 4471225080
1   attach_x86_64.dylib           	0x000000010a86e3cd InternalCallTrampoline(PyObject*, PyFrameObject*, int, PyObject*) + 141
2   attach_x86_64.dylib           	0x000000010a86e255 InternalTraceTrampoline(PyObject*, PyFrameObject*, int, PyObject*) + 101
3   python                        	0x0000000108c110c7 call_trace + 103 (ceval.c:4509)
4   python                        	0x0000000108c0d897 maybe_call_line_trace + 247 (ceval.c:4557)
5   python                        	0x0000000108bf6c43 _PyEval_EvalFrameDefault + 2675 (ceval.c:1224)
6   python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
7   python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
8   python                        	0x0000000108c1376c fast_function + 1116 (ceval.c:4965)
9   python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
10  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
11  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
12  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
13  python                        	0x0000000108c1376c fast_function + 1116 (ceval.c:4965)
14  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
15  python                        	0x0000000108c09a49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
16  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
17  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
18  python                        	0x0000000108c1376c fast_function + 1116 (ceval.c:4965)
19  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
20  python                        	0x0000000108c09a49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
21  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
22  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
23  python                        	0x0000000108bf6140 PyEval_EvalCodeEx + 400 (ceval.c:4174)
24  python                        	0x0000000108a8912f function_call + 575 (funcobject.c:604)
25  python                        	0x0000000108a2989d PyObject_Call + 477 (abstract.c:2261)
26  python                        	0x0000000108c10e0c do_call_core + 508 (ceval.c:5093)
27  python                        	0x0000000108c0a19e _PyEval_EvalFrameDefault + 81870 (ceval.c:3391)
28  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
29  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
30  python                        	0x0000000108bf6140 PyEval_EvalCodeEx + 400 (ceval.c:4174)
31  python                        	0x0000000108a8912f function_call + 575 (funcobject.c:604)
32  python                        	0x0000000108a2989d PyObject_Call + 477 (abstract.c:2261)
33  python                        	0x0000000108c10e0c do_call_core + 508 (ceval.c:5093)
34  python                        	0x0000000108c0a19e _PyEval_EvalFrameDefault + 81870 (ceval.c:3391)
35  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
36  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
37  python                        	0x0000000108bf6140 PyEval_EvalCodeEx + 400 (ceval.c:4174)
38  python                        	0x0000000108a8912f function_call + 575 (funcobject.c:604)
39  python                        	0x0000000108a2989d PyObject_Call + 477 (abstract.c:2261)
40  python                        	0x0000000108c10e0c do_call_core + 508 (ceval.c:5093)
41  python                        	0x0000000108c0a19e _PyEval_EvalFrameDefault + 81870 (ceval.c:3391)
42  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
43  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
44  python                        	0x0000000108c1376c fast_function + 1116 (ceval.c:4965)
45  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
46  python                        	0x0000000108c09a49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
47  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
48  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
49  python                        	0x0000000108bf6140 PyEval_EvalCodeEx + 400 (ceval.c:4174)
50  python                        	0x0000000108a8912f function_call + 575 (funcobject.c:604)
51  python                        	0x0000000108a2989d PyObject_Call + 477 (abstract.c:2261)
52  python                        	0x0000000108c10e0c do_call_core + 508 (ceval.c:5093)
53  python                        	0x0000000108c0a19e _PyEval_EvalFrameDefault + 81870 (ceval.c:3391)
54  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
55  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
56  python                        	0x0000000108c1376c fast_function + 1116 (ceval.c:4965)
57  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
58  python                        	0x0000000108c09a49 _PyEval_EvalFrameDefault + 79993 (ceval.c:3338)
59  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
60  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
61  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
62  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
63  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
64  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
65  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
66  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
67  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
68  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
69  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
70  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
71  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
72  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
73  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
74  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
75  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
76  python                        	0x0000000108bf6140 PyEval_EvalCodeEx + 400 (ceval.c:4174)
77  python                        	0x0000000108bf5f9e PyEval_EvalCode + 94 (ceval.c:730)
78  python                        	0x0000000108bf1dc4 builtin_exec_impl + 532 (bltinmodule.c:983)
79  python                        	0x0000000108beee16 builtin_exec + 118 (bltinmodule.c.h:283)
80  python                        	0x0000000108acc321 _PyCFunction_FastCallDict + 1313 (methodobject.c:234)
81  python                        	0x0000000108acc6f5 _PyCFunction_FastCallKeywords + 501 (methodobject.c:294)
82  python                        	0x0000000108c1086d call_function + 637 (ceval.c:4824)
83  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
84  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
85  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
86  python                        	0x0000000108c1376c fast_function + 1116 (ceval.c:4965)
87  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
88  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
89  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
90  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
91  python                        	0x0000000108bf6140 PyEval_EvalCodeEx + 400 (ceval.c:4174)
92  python                        	0x0000000108a8912f function_call + 575 (funcobject.c:604)
93  python                        	0x0000000108a2989d PyObject_Call + 477 (abstract.c:2261)
94  python                        	0x0000000108c968ed RunModule + 1021 (main.c:213)
95  python                        	0x0000000108c96efb RunMainFromImporter + 123 (main.c:277)
96  python                        	0x0000000108c95b99 Py_Main + 3945 (main.c:764)
97  python                        	0x0000000108a193d8 main + 472 (python.c:69)
98  libdyld.dylib                 	0x00007fff6969ccc9 start + 1

Thread 1:
0   libsystem_kernel.dylib        	0x00007fff697e0882 __psynch_cvwait + 10
1   libsystem_pthread.dylib       	0x00007fff698a1425 _pthread_cond_wait + 698
2   python                        	0x0000000108c9257e PyThread_acquire_lock_timed + 574 (thread_pthread.h:499)
3   python                        	0x0000000108c9c727 acquire_timed + 135 (_threadmodule.c:68)
4   python                        	0x0000000108c9c38c lock_PyThread_acquire_lock + 76 (_threadmodule.c:151)
5   python                        	0x0000000108acc30a _PyCFunction_FastCallDict + 1290 (methodobject.c:231)
6   python                        	0x0000000108acc6f5 _PyCFunction_FastCallKeywords + 501 (methodobject.c:294)
7   python                        	0x0000000108c1086d call_function + 637 (ceval.c:4824)
8   python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
9   python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
10  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
11  python                        	0x0000000108c1376c fast_function + 1116 (ceval.c:4965)
12  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
13  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
14  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
15  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
16  python                        	0x0000000108c1376c fast_function + 1116 (ceval.c:4965)
17  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
18  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
19  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
20  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
21  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
22  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
23  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
24  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
25  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
26  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
27  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
28  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
29  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
30  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
31  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
32  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
33  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
34  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
35  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
36  python                        	0x0000000108c13997 _PyFunction_FastCallDict + 519 (ceval.c:5008)
37  python                        	0x0000000108a29c42 _PyObject_FastCallDict + 562 (abstract.c:2310)
38  python                        	0x0000000108a29fc2 _PyObject_Call_Prepend + 370 (abstract.c:2373)
39  python                        	0x0000000108a5a24a method_call + 106 (classobject.c:317)
40  python                        	0x0000000108a2989d PyObject_Call + 477 (abstract.c:2261)
41  python                        	0x0000000108c132bc PyEval_CallObjectWithKeywords + 316 (ceval.c:4744)
42  python                        	0x0000000108c9d791 t_bootstrap + 113 (_threadmodule.c:998)
43  libsystem_pthread.dylib       	0x00007fff698a1109 _pthread_start + 148
44  libsystem_pthread.dylib       	0x00007fff6989cb8b thread_start + 15

Thread 2:
0   libsystem_kernel.dylib        	0x00007fff697e13a6 __recvfrom + 10
1   _socket.cpython-36dm-darwin.so	0x0000000109629f5a sock_recv_impl + 58 (socketmodule.c:3003)
2   _socket.cpython-36dm-darwin.so	0x0000000109627df3 sock_call_ex + 547 (socketmodule.c:837)
3   _socket.cpython-36dm-darwin.so	0x000000010962768f sock_call + 63 (socketmodule.c:889)
4   _socket.cpython-36dm-darwin.so	0x0000000109629eee sock_recv_guts + 94 (socketmodule.c:3035)
5   _socket.cpython-36dm-darwin.so	0x00000001096252f7 sock_recv + 279 (socketmodule.c:3066)
6   python                        	0x0000000108acc321 _PyCFunction_FastCallDict + 1313 (methodobject.c:234)
7   python                        	0x0000000108acc6f5 _PyCFunction_FastCallKeywords + 501 (methodobject.c:294)
8   python                        	0x0000000108c1086d call_function + 637 (ceval.c:4824)
9   python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
10  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
11  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
12  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
13  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
14  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
15  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
16  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
17  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
18  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
19  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
20  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
21  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
22  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
23  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
24  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
25  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
26  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
27  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
28  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
29  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
30  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
31  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
32  python                        	0x0000000108c13997 _PyFunction_FastCallDict + 519 (ceval.c:5008)
33  python                        	0x0000000108a29c42 _PyObject_FastCallDict + 562 (abstract.c:2310)
34  python                        	0x0000000108a29fc2 _PyObject_Call_Prepend + 370 (abstract.c:2373)
35  python                        	0x0000000108a5a24a method_call + 106 (classobject.c:317)
36  python                        	0x0000000108a2989d PyObject_Call + 477 (abstract.c:2261)
37  python                        	0x0000000108c132bc PyEval_CallObjectWithKeywords + 316 (ceval.c:4744)
38  python                        	0x0000000108c9d791 t_bootstrap + 113 (_threadmodule.c:998)
39  libsystem_pthread.dylib       	0x00007fff698a1109 _pthread_start + 148
40  libsystem_pthread.dylib       	0x00007fff6989cb8b thread_start + 15

Thread 3:
0   libsystem_kernel.dylib        	0x00007fff697e0882 __psynch_cvwait + 10
1   libsystem_pthread.dylib       	0x00007fff698a1425 _pthread_cond_wait + 698
2   python                        	0x0000000108c9257e PyThread_acquire_lock_timed + 574 (thread_pthread.h:499)
3   python                        	0x0000000108c9c727 acquire_timed + 135 (_threadmodule.c:68)
4   python                        	0x0000000108c9c38c lock_PyThread_acquire_lock + 76 (_threadmodule.c:151)
5   python                        	0x0000000108acc30a _PyCFunction_FastCallDict + 1290 (methodobject.c:231)
6   python                        	0x0000000108acc6f5 _PyCFunction_FastCallKeywords + 501 (methodobject.c:294)
7   python                        	0x0000000108c1086d call_function + 637 (ceval.c:4824)
8   python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
9   python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
10  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
11  python                        	0x0000000108c1376c fast_function + 1116 (ceval.c:4965)
12  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
13  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
14  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
15  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
16  python                        	0x0000000108c1376c fast_function + 1116 (ceval.c:4965)
17  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
18  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
19  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
20  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
21  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
22  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
23  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
24  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
25  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
26  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
27  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
28  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
29  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
30  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
31  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
32  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
33  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
34  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
35  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
36  python                        	0x0000000108c13997 _PyFunction_FastCallDict + 519 (ceval.c:5008)
37  python                        	0x0000000108a29c42 _PyObject_FastCallDict + 562 (abstract.c:2310)
38  python                        	0x0000000108a29fc2 _PyObject_Call_Prepend + 370 (abstract.c:2373)
39  python                        	0x0000000108a5a24a method_call + 106 (classobject.c:317)
40  python                        	0x0000000108a2989d PyObject_Call + 477 (abstract.c:2261)
41  python                        	0x0000000108c132bc PyEval_CallObjectWithKeywords + 316 (ceval.c:4744)
42  python                        	0x0000000108c9d791 t_bootstrap + 113 (_threadmodule.c:998)
43  libsystem_pthread.dylib       	0x00007fff698a1109 _pthread_start + 148
44  libsystem_pthread.dylib       	0x00007fff6989cb8b thread_start + 15

Thread 4:
0   libsystem_kernel.dylib        	0x00007fff697e0882 __psynch_cvwait + 10
1   libsystem_pthread.dylib       	0x00007fff698a1425 _pthread_cond_wait + 698
2   python                        	0x0000000108c9257e PyThread_acquire_lock_timed + 574 (thread_pthread.h:499)
3   python                        	0x0000000108c9c727 acquire_timed + 135 (_threadmodule.c:68)
4   python                        	0x0000000108c9c38c lock_PyThread_acquire_lock + 76 (_threadmodule.c:151)
5   python                        	0x0000000108acc30a _PyCFunction_FastCallDict + 1290 (methodobject.c:231)
6   python                        	0x0000000108acc6f5 _PyCFunction_FastCallKeywords + 501 (methodobject.c:294)
7   python                        	0x0000000108c1086d call_function + 637 (ceval.c:4824)
8   python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
9   python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
10  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
11  python                        	0x0000000108c1376c fast_function + 1116 (ceval.c:4965)
12  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
13  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
14  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
15  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
16  python                        	0x0000000108c1376c fast_function + 1116 (ceval.c:4965)
17  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
18  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
19  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
20  python                        	0x0000000108c12600 _PyEval_EvalCodeWithName + 5216 (ceval.c:4153)
21  python                        	0x0000000108c1376c fast_function + 1116 (ceval.c:4965)
22  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
23  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
24  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
25  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
26  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
27  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
28  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
29  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
30  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
31  python                        	0x0000000108c1354e fast_function + 574 (ceval.c:4941)
32  python                        	0x0000000108c109f6 call_function + 1030 (ceval.c:4845)
33  python                        	0x0000000108c097a8 _PyEval_EvalFrameDefault + 79320
34  python                        	0x0000000108bf61c0 PyEval_EvalFrameEx + 80 (ceval.c:753)
35  python                        	0x0000000108c13f72 _PyFunction_FastCall + 370 (ceval.c:4906)
36  python                        	0x0000000108c13997 _PyFunction_FastCallDict + 519 (ceval.c:5008)
37  python                        	0x0000000108a29c42 _PyObject_FastCallDict + 562 (abstract.c:2310)
38  python                        	0x0000000108a29fc2 _PyObject_Call_Prepend + 370 (abstract.c:2373)
39  python                        	0x0000000108a5a24a method_call + 106 (classobject.c:317)
40  python                        	0x0000000108a2989d PyObject_Call + 477 (abstract.c:2261)
41  python                        	0x0000000108c132bc PyEval_CallObjectWithKeywords + 316 (ceval.c:4744)
42  python                        	0x0000000108c9d791 t_bootstrap + 113 (_threadmodule.c:998)
43  libsystem_pthread.dylib       	0x00007fff698a1109 _pthread_start + 148
44  libsystem_pthread.dylib       	0x00007fff6989cb8b thread_start + 15

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x000000010a817af8  rbx: 0x0000000000000000  rcx: 0x000000010a82bb98  rdx: 0x0000000000000000
  rdi: 0x00007fde4bc28f00  rsi: 0x000000010a82bb98  rbp: 0x00007ffee71cae20  rsp: 0x00007ffee71cad88
   r8: 0xe9e363ea9f3f0000   r9: 0x0000000000000000  r10: 0x0000000000000156  r11: 0x000000010a454474
  r12: 0x00007ffee71ca770  r13: 0x0000000000000000  r14: 0x0000000000000000  r15: 0x0000000000000000
  rip: 0x000000010a817af8  rfl: 0x0000000000010202  cr2: 0x000000010a817af8
  
Logical CPU:     2
Error Code:      0x00000015 (invalid protections for user instruction read)
Trap Number:     14

@int19h
Copy link
Contributor

int19h commented Apr 27, 2020

Oh, are you using attach-by-PID? If so, it's not entirely surprising that it doesn't work with a custom interpreter, depending on how exactly it was customized - it needs to access many Python internals, so changes to layout of built-in Python types (PyObject etc) break it.

@patrickkidd
Copy link
Author

I am using ”request”: “launch” in launch.json. Everything works just fine with “request”: “attach” if that’s what you are asking about.

Or are you talking about some additional option in ”request”: “launch”? Or something else entirely?

@fabioz
Copy link
Collaborator

fabioz commented Apr 27, 2020

Actually, we may use that library without the attach (to set the tracing to different threads as Python can only set the tracing to the current thread).

You can try to recompile it locally to see if it fixes your problem. To do that, you can run:

debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_mac.sh

@patrickkidd
Copy link
Author

Actually, we may use that library without the attach (to set the tracing to different threads as Python can only set the tracing to the current thread).

You can try to recompile it locally to see if it fixes your problem. To do that, you can run:

debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_mac.sh

I'm confused. Is this for some python package other than ptvsd?

@int19h
Copy link
Contributor

int19h commented Apr 27, 2020

Actually, we may use that library without the attach

But then the same caveat applies to "launch" as well - we do not support CPython builds that aren't ABI-compatible with stock CPython, basically. If it has any changes to structs in Python headers, or if compilation flags that affect type layout differ from platform defaults (e.g. --enable-unicode / Py_UNICODE_SIZE)

@int19h
Copy link
Contributor

int19h commented Apr 27, 2020

@patrickkidd This is for debugpy, which is basically the next version of ptvsd: microsoft/ptvsd#2104

Please give it a try, as it contains a more recent version of pydevd, with more fixes in it.

@patrickkidd
Copy link
Author

patrickkidd commented Apr 27, 2020 via email

@fabioz
Copy link
Collaborator

fabioz commented Apr 27, 2020

@int19h maybe we could have a flag not to do that (we just use it to set tracing to different threads in that context, so, it could be optional -- in fact, it doesn't work for PyPy, but we check for the cases where we know we can support it, but we don't take into account custom builds where using it can crash the interpreter).

@patrickkidd, until we actually make that optional, another option could be changing def load_python_helper_lib(): in debugpy/_vendored/pydevd/pydevd_tracing.py to always return None.

@patrickkidd
Copy link
Author

patrickkidd commented Apr 27, 2020

You can try to recompile it locally to see if it fixes your problem. To do that, you can run:

debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_mac.sh

I'm sorry, I'm a little lost here. After following the instructions at microsoft/ptvsd#2104, I found compile_mac.sh in ~/.vscode/extensions/ms-python.python-2020.5.76036-dev/pythonFiles/lib/python/debugpy/no_wheels/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_mac.sh. Upon running it from the relative path you pasted, I get:

turin:no_wheels patrick$ sh debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_mac.sh
'lang: error: no such file or directory: 'attach.cpp
clang: error: no input files
clang: error: no such file or directory: 'attach_x86_64.o'
rm: attach_x86_64.o\r: No such file or directory
mv: rename attach_x86_64.dylib to ../attach_x86_64.dylib\r: No such file or directory
: command not foundydevd/pydevd_attach_to_process/linux_and_mac/compile_mac.sh: line 5: 
: command not foundydevd/pydevd_attach_to_process/linux_and_mac/compile_mac.sh: line 6: 
'lang: error: no such file or directory: 'attach.cpp
clang: error: no input files
clang: error: no such file or directory: 'attach_x86.o'
rm: attach_x86.o\r: No such file or directory
mv: rename attach_x86.dylib to ../attach_x86.dylib\r: No such file or directory
: command not foundydevd/pydevd_attach_to_process/linux_and_mac/compile_mac.sh: line 11:

Is there some step I am missing for how to move from ptvsd to debugpy?

@fabioz
Copy link
Collaborator

fabioz commented Apr 27, 2020

You current working dir must be debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/ for it to work.

@patrickkidd
Copy link
Author

patrickkidd commented Apr 27, 2020 via email

@patrickkidd
Copy link
Author

I should add that the current ptvsd debugger was working quite well until about a month ago.

@fabioz
Copy link
Collaborator

fabioz commented Apr 28, 2020

That's weird, you mean that when you're in that directory and execute that .sh, it gives a no such file or directory: 'attach.cpp? (that's the first error, others are just noise afterwards) -- can you double check if attach.cpp is actually there?

@patrickkidd
Copy link
Author

Yes, the file is there. I have no idea what's going on with this script. It looks simple enough but I'm getting strange output from it, for example bad spelling of English words and small errors in the characters of the output. I am running a standard macOS command line tools on the latest macOS. The only non-standard thing I am using is a homebred-installed bash b/c Catalina complains about deprecating its own bash in favor of zsh.

turin:~ patrick$ cd /Users/patrick/.vscode/extensions/ms-python.python-2020.5.76036-dev/pythonFiles/lib/python/debugpy/wheels/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/
turin:linux_and_mac patrick$ ls -la
total 40
drwxr-xr-x   7 patrick  staff   224 Apr 28 06:08 .
drwxr-xr-x  30 patrick  staff   960 Apr 28 06:07 ..
-rw-r--r--   1 patrick  staff    86 Apr 27 09:19 .gitignore
-rw-r--r--   1 patrick  staff  3814 Apr 27 09:19 attach.cpp
-rw-r--r--   1 patrick  staff   451 Apr 27 09:19 compile_linux.sh
-rw-r--r--   1 patrick  staff   456 Apr 28 06:08 compile_mac.sh
-rw-r--r--   1 patrick  staff  1745 Apr 27 09:19 lldb_prepare.py
turin:linux_and_mac patrick$ sh compile_mac.sh 
: command not founde 1: 
'lang: error: no such file or directory: 'attach.cpp
clang: error: no input files
clang: error: no such file or directory: 'attach_x86_64.o'
rm: attach_x86_64.o\r: No such file or directory
mv: rename attach_x86_64.dylib to ../attach_x86_64.dylib\r: No such file or directory
: command not founde 6: 
: command not founde 7: 
'lang: error: no such file or directory: 'attach.cpp
clang: error: no input files
clang: error: no such file or directory: 'attach_x86.o'
rm: attach_x86.o\r: No such file or directory
mv: rename attach_x86.dylib to ../attach_x86.dylib\r: No such file or directory
: command not founde 12: 
turin:linux_and_mac patrick$ 

Each command runs just fine when I copy and paste them into the terminal separately.

@patrickkidd
Copy link
Author

It looks like compile_mac.sh has DOS line endings. I changed them and now get undefined symbols:

turin:linux_and_mac patrick$ sh compile_mac.sh 
In file included from attach.cpp:15:
In file included from ./../common/py_settrace.hpp:7:
./../common/py_custom_pyeval_settrace.hpp:98:5: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds]
    reinterpret_cast<PyTupleObject *>(args)->ob_item[1] = stack[1];
    ^                                                ~
./../common/python.h:474:5: note: array 'ob_item' declared here
    PyObject *ob_item[1];
    ^
In file included from attach.cpp:15:
In file included from ./../common/py_settrace.hpp:7:
./../common/py_custom_pyeval_settrace.hpp:99:5: warning: array index 2 is past the end of the array (which contains 1 element) [-Warray-bounds]
    reinterpret_cast<PyTupleObject *>(args)->ob_item[2] = stack[2];
    ^                                                ~
./../common/python.h:474:5: note: array 'ob_item' declared here
    PyObject *ob_item[1];
    ^
In file included from attach.cpp:15:
In file included from ./../common/py_settrace.hpp:7:
./../common/py_custom_pyeval_settrace.hpp:204:29: warning: comparison of function 'InternalTraceTrampoline' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^~~~~~~~~~~~~~~~~~~~~~~    ~~~~
./../common/py_custom_pyeval_settrace.hpp:204:29: note: prefix with the address-of operator to silence this warning
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^
                            &
./../common/py_custom_pyeval_settrace.hpp:204:29: warning: comparison of function 'InternalTraceTrampoline' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^~~~~~~~~~~~~~~~~~~~~~~    ~~~~
./../common/py_custom_pyeval_settrace.hpp:213:9: note: in instantiation of function template specialization 'InternalPySetTrace_Template<PyThreadState_25_27 *>' requested here
        InternalPySetTrace_Template<PyThreadState_25_27*>(reinterpret_cast<PyThreadState_25_27*>(curThread), traceFunc, isDebug);
        ^
./../common/py_custom_pyeval_settrace.hpp:204:29: note: prefix with the address-of operator to silence this warning
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^
                            &
./../common/py_custom_pyeval_settrace.hpp:204:29: warning: comparison of function 'InternalTraceTrampoline' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^~~~~~~~~~~~~~~~~~~~~~~    ~~~~
./../common/py_custom_pyeval_settrace.hpp:215:9: note: in instantiation of function template specialization 'InternalPySetTrace_Template<PyThreadState_30_33 *>' requested here
        InternalPySetTrace_Template<PyThreadState_30_33*>(reinterpret_cast<PyThreadState_30_33*>(curThread), traceFunc, isDebug);
        ^
./../common/py_custom_pyeval_settrace.hpp:204:29: note: prefix with the address-of operator to silence this warning
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^
                            &
./../common/py_custom_pyeval_settrace.hpp:204:29: warning: comparison of function 'InternalTraceTrampoline' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^~~~~~~~~~~~~~~~~~~~~~~    ~~~~
./../common/py_custom_pyeval_settrace.hpp:217:9: note: in instantiation of function template specialization 'InternalPySetTrace_Template<PyThreadState_34_36 *>' requested here
        InternalPySetTrace_Template<PyThreadState_34_36*>(reinterpret_cast<PyThreadState_34_36*>(curThread), traceFunc, isDebug);
        ^
./../common/py_custom_pyeval_settrace.hpp:204:29: note: prefix with the address-of operator to silence this warning
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^
                            &
./../common/py_custom_pyeval_settrace.hpp:204:29: warning: comparison of function 'InternalTraceTrampoline' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^~~~~~~~~~~~~~~~~~~~~~~    ~~~~
./../common/py_custom_pyeval_settrace.hpp:219:9: note: in instantiation of function template specialization 'InternalPySetTrace_Template<PyThreadState_37_38 *>' requested here
        InternalPySetTrace_Template<PyThreadState_37_38*>(reinterpret_cast<PyThreadState_37_38*>(curThread), traceFunc, isDebug);
        ^
./../common/py_custom_pyeval_settrace.hpp:204:29: note: prefix with the address-of operator to silence this warning
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^
                            &
7 warnings generated.
In file included from attach.cpp:15:
In file included from ./../common/py_settrace.hpp:7:
./../common/py_custom_pyeval_settrace.hpp:98:5: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds]
    reinterpret_cast<PyTupleObject *>(args)->ob_item[1] = stack[1];
    ^                                                ~
./../common/python.h:474:5: note: array 'ob_item' declared here
    PyObject *ob_item[1];
    ^
In file included from attach.cpp:15:
In file included from ./../common/py_settrace.hpp:7:
./../common/py_custom_pyeval_settrace.hpp:99:5: warning: array index 2 is past the end of the array (which contains 1 element) [-Warray-bounds]
    reinterpret_cast<PyTupleObject *>(args)->ob_item[2] = stack[2];
    ^                                                ~
./../common/python.h:474:5: note: array 'ob_item' declared here
    PyObject *ob_item[1];
    ^
In file included from attach.cpp:15:
In file included from ./../common/py_settrace.hpp:7:
./../common/py_custom_pyeval_settrace.hpp:204:29: warning: comparison of function 'InternalTraceTrampoline' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^~~~~~~~~~~~~~~~~~~~~~~    ~~~~
./../common/py_custom_pyeval_settrace.hpp:204:29: note: prefix with the address-of operator to silence this warning
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^
                            &
./../common/py_custom_pyeval_settrace.hpp:204:29: warning: comparison of function 'InternalTraceTrampoline' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^~~~~~~~~~~~~~~~~~~~~~~    ~~~~
./../common/py_custom_pyeval_settrace.hpp:213:9: note: in instantiation of function template specialization 'InternalPySetTrace_Template<PyThreadState_25_27 *>' requested here
        InternalPySetTrace_Template<PyThreadState_25_27*>(reinterpret_cast<PyThreadState_25_27*>(curThread), traceFunc, isDebug);
        ^
./../common/py_custom_pyeval_settrace.hpp:204:29: note: prefix with the address-of operator to silence this warning
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^
                            &
./../common/py_custom_pyeval_settrace.hpp:204:29: warning: comparison of function 'InternalTraceTrampoline' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^~~~~~~~~~~~~~~~~~~~~~~    ~~~~
./../common/py_custom_pyeval_settrace.hpp:215:9: note: in instantiation of function template specialization 'InternalPySetTrace_Template<PyThreadState_30_33 *>' requested here
        InternalPySetTrace_Template<PyThreadState_30_33*>(reinterpret_cast<PyThreadState_30_33*>(curThread), traceFunc, isDebug);
        ^
./../common/py_custom_pyeval_settrace.hpp:204:29: note: prefix with the address-of operator to silence this warning
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^
                            &
./../common/py_custom_pyeval_settrace.hpp:204:29: warning: comparison of function 'InternalTraceTrampoline' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^~~~~~~~~~~~~~~~~~~~~~~    ~~~~
./../common/py_custom_pyeval_settrace.hpp:217:9: note: in instantiation of function template specialization 'InternalPySetTrace_Template<PyThreadState_34_36 *>' requested here
        InternalPySetTrace_Template<PyThreadState_34_36*>(reinterpret_cast<PyThreadState_34_36*>(curThread), traceFunc, isDebug);
        ^
./../common/py_custom_pyeval_settrace.hpp:204:29: note: prefix with the address-of operator to silence this warning
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^
                            &
./../common/py_custom_pyeval_settrace.hpp:204:29: warning: comparison of function 'InternalTraceTrampoline' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^~~~~~~~~~~~~~~~~~~~~~~    ~~~~
./../common/py_custom_pyeval_settrace.hpp:219:9: note: in instantiation of function template specialization 'InternalPySetTrace_Template<PyThreadState_37_38 *>' requested here
        InternalPySetTrace_Template<PyThreadState_37_38*>(reinterpret_cast<PyThreadState_37_38*>(curThread), traceFunc, isDebug);
        ^
./../common/py_custom_pyeval_settrace.hpp:204:29: note: prefix with the address-of operator to silence this warning
    tstate->use_tracing = ((InternalTraceTrampoline != NULL)
                            ^
                            &
7 warnings generated.
ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libc++.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libc++.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libc.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libc.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd
Undefined symbols for architecture i386:
  "__Unwind_Resume", referenced from:
      InternalSetSysTraceFunc(void*, bool, bool, PyObjectHolder*, PyObjectHolder*, unsigned int, PyObjectHolder*) in attach_x86.o
      _DoAttach in attach_x86.o
      _AttachDebuggerTracing in attach_x86.o
  "std::terminate()", referenced from:
      ___clang_call_terminate in attach_x86.o
  "operator new(unsigned long)", referenced from:
      InternalSetSysTraceFunc(void*, bool, bool, PyObjectHolder*, PyObjectHolder*, unsigned int, PyObjectHolder*) in attach_x86.o
  "___cxa_begin_catch", referenced from:
      ___clang_call_terminate in attach_x86.o
  "___gxx_personality_v0", referenced from:
      InternalSetSysTraceFunc(void*, bool, bool, PyObjectHolder*, PyObjectHolder*, unsigned int, PyObjectHolder*) in attach_x86.o
      _DoAttach in attach_x86.o
      _AttachDebuggerTracing in attach_x86.o
      GilHolder::~GilHolder() in attach_x86.o
      PyObjectHolder::~PyObjectHolder() in attach_x86.o
      Dwarf Exception Unwind Info (__eh_frame) in attach_x86.o
  "___stack_chk_fail", referenced from:
      InternalCallTrampoline(PyObject*, PyFrameObject*, int, PyObject*) in attach_x86.o
  "___stack_chk_guard", referenced from:
      InternalCallTrampoline(PyObject*, PyFrameObject*, int, PyObject*) in attach_x86.o
  "_dlopen", referenced from:
      _hello in attach_x86.o
      _DoAttach in attach_x86.o
      _AttachDebuggerTracing in attach_x86.o
  "_dlsym", referenced from:
      InternalSetSysTraceFunc(void*, bool, bool, PyObjectHolder*, PyObjectHolder*, unsigned int, PyObjectHolder*) in attach_x86.o
      GetPythonVersion(void*) in attach_x86.o
      _hello in attach_x86.o
      _DoAttach in attach_x86.o
  "_printf", referenced from:
      InternalPySetTrace(PyThreadState*, PyObjectHolder*, bool, PythonVersion) in attach_x86.o
      InternalSetSysTraceFunc(void*, bool, bool, PyObjectHolder*, PyObjectHolder*, unsigned int, PyObjectHolder*) in attach_x86.o
      _hello in attach_x86.o
      _DoAttach in attach_x86.o
  "_strlen", referenced from:
      GetPythonVersion(void*) in attach_x86.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
mv: attach_x86.dylib: No such file or directory
turin:linux_and_mac patrick$ 

It looks like this stuff is pre-alpha. is there a more stable way to approach simple python debugging with VS Code?

@patrickkidd
Copy link
Author

Now just calling ptvsd.wait_for_attach() is immediately crashing at the same place. That was working fine yesterday. So now there is no way for me to debug python code at all! Removing the optinto entry from settings.json did not help. How can I reset everything to get back to a working system?? I'm dead in the water!

Process:               python3.7 [98460]
Path:                  /Users/USER/*/python3.7
Identifier:            python3.7
Version:               ???
Code Type:             X86-64 (Native)
Parent Process:        ??? [98447]
Responsible:           Terminal [90870]
User ID:               501

Date/Time:             2020-04-29 13:15:07.453 -0800
OS Version:            Mac OS X 10.15.4 (19E287)
Report Version:        12
Bridge OS Version:     4.4 (17P4281)
Anonymous UUID:        DE6007FC-8BDC-91D9-D093-77AE8648E82B

Sleep/Wake UUID:       FD6C4106-D79B-4838-96FC-6E3CDE4C68F2

Time Awake Since Boot: 28000 seconds
Time Since Wake:       840 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x00000001122fe538
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Bus error: 10
Termination Reason:    Namespace SIGNAL, Code 0xa
Terminating Process:   exc handler [98460]

VM Regions Near 0x1122fe538:
    VM_ALLOCATE            00000001122b3000-00000001122f3000 [  256K] rw-/rwx SM=PRV  
--> VM_ALLOCATE            00000001122f3000-0000000112333000 [  256K] rw-/rwx SM=COW  
    __TEXT                 0000000112333000-0000000112336000 [   12K] r-x/rwx SM=COW  /Users/USER/*/*.dylib

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   ???                           	0x00000001122fe538 0 + 4600096056
1   attach_x86_64.dylib           	0x000000011233569d InternalCallTrampoline_37(PyObject*, PyFrameObject*, int, PyObject*) + 141
2   attach_x86_64.dylib           	0x0000000112333ac5 InternalTraceTrampoline_37(PyObject*, PyFrameObject*, int, PyObject*) + 101
3   python                        	0x000000010518d357 call_trace + 103 (ceval.c:4252)
4   python                        	0x000000010518925c maybe_call_line_trace + 236 (ceval.c:4302)
5   python                        	0x00000001051720c6 _PyEval_EvalFrameDefault + 2726 (ceval.c:1022)
6   python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
7   python                        	0x000000010518eae7 _PyEval_EvalCodeWithName + 5815 (ceval.c:3930)
8   python                        	0x0000000104fb97ec _PyFunction_FastCallKeywords + 1500 (call.c:433)
9   python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
10  python                        	0x0000000105185223 _PyEval_EvalFrameDefault + 80899 (ceval.c:3093)
11  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
12  python                        	0x000000010518eae7 _PyEval_EvalCodeWithName + 5815 (ceval.c:3930)
13  python                        	0x0000000104fb97ec _PyFunction_FastCallKeywords + 1500 (call.c:433)
14  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
15  python                        	0x0000000105185766 _PyEval_EvalFrameDefault + 82246 (ceval.c:3139)
16  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
17  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
18  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
19  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
20  python                        	0x000000010518546a _PyEval_EvalFrameDefault + 81482
21  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
22  python                        	0x000000010518eae7 _PyEval_EvalCodeWithName + 5815 (ceval.c:3930)
23  python                        	0x0000000104fb97ec _PyFunction_FastCallKeywords + 1500 (call.c:433)
24  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
25  python                        	0x0000000105185766 _PyEval_EvalFrameDefault + 82246 (ceval.c:3139)
26  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
27  python                        	0x000000010518eae7 _PyEval_EvalCodeWithName + 5815 (ceval.c:3930)
28  python                        	0x0000000104fb97ec _PyFunction_FastCallKeywords + 1500 (call.c:433)
29  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
30  python                        	0x000000010518546a _PyEval_EvalFrameDefault + 81482
31  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
32  python                        	0x000000010518eae7 _PyEval_EvalCodeWithName + 5815 (ceval.c:3930)
33  python                        	0x0000000104fb97ec _PyFunction_FastCallKeywords + 1500 (call.c:433)
34  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
35  python                        	0x0000000105185766 _PyEval_EvalFrameDefault + 82246 (ceval.c:3139)
36  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
37  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
38  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
39  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
40  python                        	0x0000000105185223 _PyEval_EvalFrameDefault + 80899 (ceval.c:3093)
41  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
42  python                        	0x000000010518eae7 _PyEval_EvalCodeWithName + 5815 (ceval.c:3930)
43  python                        	0x0000000104fb97ec _PyFunction_FastCallKeywords + 1500 (call.c:433)
44  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
45  python                        	0x0000000105185223 _PyEval_EvalFrameDefault + 80899 (ceval.c:3093)
46  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
47  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
48  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
49  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
50  python                        	0x000000010518546a _PyEval_EvalFrameDefault + 81482
51  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
52  python                        	0x000000010518eae7 _PyEval_EvalCodeWithName + 5815 (ceval.c:3930)
53  python                        	0x0000000105171590 PyEval_EvalCodeEx + 352 (ceval.c:3959)
54  python                        	0x000000010517141e PyEval_EvalCode + 94 (ceval.c:524)
55  python                        	0x00000001051f3e2a run_mod + 106 (pythonrun.c:1035)
56  python                        	0x00000001051f2a22 PyRun_FileExFlags + 258 (pythonrun.c:988)
57  python                        	0x00000001051f1586 PyRun_SimpleFileExFlags + 1046 (pythonrun.c:429)
58  python                        	0x00000001051f0de9 PyRun_AnyFileExFlags + 137 (pythonrun.c:84)
59  python                        	0x000000010522eb62 pymain_run_file + 338 (main.c:427)
60  python                        	0x000000010522e310 pymain_run_filename + 192 (main.c:1627)
61  python                        	0x000000010522b0c3 pymain_run_python + 163
62  python                        	0x000000010522a150 pymain_main + 48 (main.c:3039)
63  python                        	0x000000010522a1dc _Py_UnixMain + 76 (main.c:3072)
64  python                        	0x0000000104f78e32 main + 34 (python.c:15)
65  libdyld.dylib                 	0x00007fff684e4cc9 start + 1

Thread 1:
0   libsystem_pthread.dylib       	0x00007fff686e4b68 start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib       	0x00007fff686e4b68 start_wqthread + 0

Thread 3:
0   libsystem_kernel.dylib        	0x00007fff6862c3be __accept + 10
1   _socket.cpython-37dm-darwin.so	0x00000001115de213 sock_accept_impl + 67 (socketmodule.c:2505)
2   _socket.cpython-37dm-darwin.so	0x00000001115de90c sock_call_ex + 540 (socketmodule.c:880)
3   _socket.cpython-37dm-darwin.so	0x00000001115de1bf sock_call + 63 (socketmodule.c:932)
4   _socket.cpython-37dm-darwin.so	0x00000001115dae5a sock_accept + 202 (socketmodule.c:2537)
5   python                        	0x0000000104fbb0fb _PyMethodDef_RawFastCallKeywords + 811 (call.c:629)
6   python                        	0x0000000104fc7ac1 _PyMethodDescr_FastCallKeywords + 385 (descrobject.c:288)
7   python                        	0x000000010518cd14 call_function + 1540 (ceval.c:4593)
8   python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
9   python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
10  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
11  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
12  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
13  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
14  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
15  python                        	0x000000010518eae7 _PyEval_EvalCodeWithName + 5815 (ceval.c:3930)
16  python                        	0x0000000104fb8817 _PyFunction_FastCallDict + 1975 (call.c:376)
17  python                        	0x0000000104fb9cd9 PyObject_Call + 441 (call.c:226)
18  python                        	0x000000010518d2df do_call_core + 511 (ceval.c:4645)
19  python                        	0x0000000105185edd _PyEval_EvalFrameDefault + 84157 (ceval.c:3191)
20  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
21  python                        	0x000000010518eae7 _PyEval_EvalCodeWithName + 5815 (ceval.c:3930)
22  python                        	0x0000000104fb97ec _PyFunction_FastCallKeywords + 1500 (call.c:433)
23  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
24  python                        	0x000000010518546a _PyEval_EvalFrameDefault + 81482
25  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
26  python                        	0x000000010518eae7 _PyEval_EvalCodeWithName + 5815 (ceval.c:3930)
27  python                        	0x0000000104fb8817 _PyFunction_FastCallDict + 1975 (call.c:376)
28  python                        	0x0000000104fb9cd9 PyObject_Call + 441 (call.c:226)
29  python                        	0x000000010518d2df do_call_core + 511 (ceval.c:4645)
30  python                        	0x0000000105185edd _PyEval_EvalFrameDefault + 84157 (ceval.c:3191)
31  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
32  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
33  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
34  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
35  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
36  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
37  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
38  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
39  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
40  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
41  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
42  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
43  python                        	0x0000000104fb82c6 _PyFunction_FastCallDict + 614 (call.c:322)
44  python                        	0x0000000104fb7d93 _PyObject_FastCallDict + 467 (call.c:98)
45  python                        	0x0000000104fbbd92 _PyObject_Call_Prepend + 434 (call.c:904)
46  python                        	0x0000000104fbf30a method_call + 106 (classobject.c:309)
47  python                        	0x0000000104fb9dc9 PyObject_Call + 681 (call.c:245)
48  python                        	0x0000000105295116 t_bootstrap + 118 (_threadmodule.c:994)
49  python                        	0x000000010520b2de pythread_wrapper + 62 (thread_pthread.h:174)
50  libsystem_pthread.dylib       	0x00007fff686e9109 _pthread_start + 148
51  libsystem_pthread.dylib       	0x00007fff686e4b8b thread_start + 15

Thread 4:
0   libsystem_kernel.dylib        	0x00007fff68628882 __psynch_cvwait + 10
1   libsystem_pthread.dylib       	0x00007fff686e9425 _pthread_cond_wait + 698
2   python                        	0x000000010520b89a PyThread_acquire_lock_timed + 570 (thread_pthread.h:544)
3   python                        	0x0000000105294019 acquire_timed + 137 (_threadmodule.c:61)
4   python                        	0x0000000105293c7c lock_PyThread_acquire_lock + 76 (_threadmodule.c:144)
5   python                        	0x0000000104fbb2be _PyMethodDef_RawFastCallKeywords + 1262 (call.c:690)
6   python                        	0x0000000104fc7ac1 _PyMethodDescr_FastCallKeywords + 385 (descrobject.c:288)
7   python                        	0x000000010518cd14 call_function + 1540 (ceval.c:4593)
8   python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
9   python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
10  python                        	0x000000010518eae7 _PyEval_EvalCodeWithName + 5815 (ceval.c:3930)
11  python                        	0x0000000104fb97ec _PyFunction_FastCallKeywords + 1500 (call.c:433)
12  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
13  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
14  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
15  python                        	0x000000010518eae7 _PyEval_EvalCodeWithName + 5815 (ceval.c:3930)
16  python                        	0x0000000104fb97ec _PyFunction_FastCallKeywords + 1500 (call.c:433)
17  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
18  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
19  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
20  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
21  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
22  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
23  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
24  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
25  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
26  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
27  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
28  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
29  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
30  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
31  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
32  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
33  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
34  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
35  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
36  python                        	0x0000000104fb82c6 _PyFunction_FastCallDict + 614 (call.c:322)
37  python                        	0x0000000104fb7d93 _PyObject_FastCallDict + 467 (call.c:98)
38  python                        	0x0000000104fbbd92 _PyObject_Call_Prepend + 434 (call.c:904)
39  python                        	0x0000000104fbf30a method_call + 106 (classobject.c:309)
40  python                        	0x0000000104fb9dc9 PyObject_Call + 681 (call.c:245)
41  python                        	0x0000000105295116 t_bootstrap + 118 (_threadmodule.c:994)
42  python                        	0x000000010520b2de pythread_wrapper + 62 (thread_pthread.h:174)
43  libsystem_pthread.dylib       	0x00007fff686e9109 _pthread_start + 148
44  libsystem_pthread.dylib       	0x00007fff686e4b8b thread_start + 15

Thread 5:
0   libsystem_kernel.dylib        	0x00007fff6862681e read + 10
1   python                        	0x00000001052201d7 _Py_read + 231 (fileutils.c:1407)
2   python                        	0x0000000105242981 os_read_impl + 257 (posixmodule.c:8021)
3   python                        	0x0000000105239098 os_read + 88 (posixmodule.c.h:3625)
4   python                        	0x0000000104fbb183 _PyMethodDef_RawFastCallKeywords + 947 (call.c:651)
5   python                        	0x0000000104fb990d _PyCFunction_FastCallKeywords + 253 (call.c:730)
6   python                        	0x000000010518c9e3 call_function + 723 (ceval.c:4568)
7   python                        	0x0000000105185223 _PyEval_EvalFrameDefault + 80899 (ceval.c:3093)
8   python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
9   python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
10  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
11  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
12  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
13  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
14  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
15  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
16  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
17  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
18  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
19  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
20  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
21  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
22  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
23  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
24  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
25  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
26  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
27  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
28  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
29  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
30  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
31  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
32  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
33  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
34  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
35  python                        	0x0000000104fb82c6 _PyFunction_FastCallDict + 614 (call.c:322)
36  python                        	0x0000000104fb7d93 _PyObject_FastCallDict + 467 (call.c:98)
37  python                        	0x0000000104fbbd92 _PyObject_Call_Prepend + 434 (call.c:904)
38  python                        	0x0000000104fbf30a method_call + 106 (classobject.c:309)
39  python                        	0x0000000104fb9dc9 PyObject_Call + 681 (call.c:245)
40  python                        	0x0000000105295116 t_bootstrap + 118 (_threadmodule.c:994)
41  python                        	0x000000010520b2de pythread_wrapper + 62 (thread_pthread.h:174)
42  libsystem_pthread.dylib       	0x00007fff686e9109 _pthread_start + 148
43  libsystem_pthread.dylib       	0x00007fff686e4b8b thread_start + 15

Thread 6:
0   libsystem_kernel.dylib        	0x00007fff6862e0fe __select + 10
1   python                        	0x000000010529163a pysleep + 106 (timemodule.c:1812)
2   python                        	0x000000010529005f time_sleep + 111 (timemodule.c:354)
3   python                        	0x0000000104fbb158 _PyMethodDef_RawFastCallKeywords + 904 (call.c:644)
4   python                        	0x0000000104fb990d _PyCFunction_FastCallKeywords + 253 (call.c:730)
5   python                        	0x000000010518c9e3 call_function + 723 (ceval.c:4568)
6   python                        	0x0000000105185223 _PyEval_EvalFrameDefault + 80899 (ceval.c:3093)
7   python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
8   python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
9   python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
10  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
11  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
12  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
13  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
14  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
15  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
16  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
17  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
18  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
19  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
20  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
21  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
22  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
23  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
24  python                        	0x0000000104fb82c6 _PyFunction_FastCallDict + 614 (call.c:322)
25  python                        	0x0000000104fb7d93 _PyObject_FastCallDict + 467 (call.c:98)
26  python                        	0x0000000104fbbd92 _PyObject_Call_Prepend + 434 (call.c:904)
27  python                        	0x0000000104fbf30a method_call + 106 (classobject.c:309)
28  python                        	0x0000000104fb9dc9 PyObject_Call + 681 (call.c:245)
29  python                        	0x0000000105295116 t_bootstrap + 118 (_threadmodule.c:994)
30  python                        	0x000000010520b2de pythread_wrapper + 62 (thread_pthread.h:174)
31  libsystem_pthread.dylib       	0x00007fff686e9109 _pthread_start + 148
32  libsystem_pthread.dylib       	0x00007fff686e4b8b thread_start + 15

Thread 7:
0   libsystem_kernel.dylib        	0x00007fff6862e0fe __select + 10
1   python                        	0x000000010529163a pysleep + 106 (timemodule.c:1812)
2   python                        	0x000000010529005f time_sleep + 111 (timemodule.c:354)
3   python                        	0x0000000104fbb158 _PyMethodDef_RawFastCallKeywords + 904 (call.c:644)
4   python                        	0x0000000104fb990d _PyCFunction_FastCallKeywords + 253 (call.c:730)
5   python                        	0x000000010518c9e3 call_function + 723 (ceval.c:4568)
6   python                        	0x0000000105185223 _PyEval_EvalFrameDefault + 80899 (ceval.c:3093)
7   python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
8   python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
9   python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
10  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
11  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
12  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
13  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
14  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
15  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
16  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
17  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
18  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
19  python                        	0x0000000104fb94ac _PyFunction_FastCallKeywords + 668 (call.c:408)
20  python                        	0x000000010518cebb call_function + 1963 (ceval.c:4616)
21  python                        	0x000000010518529d _PyEval_EvalFrameDefault + 81021 (ceval.c:3110)
22  python                        	0x000000010517160c PyEval_EvalFrameEx + 76 (ceval.c:547)
23  python                        	0x0000000104fba0ed function_code_fastcall + 381 (call.c:283)
24  python                        	0x0000000104fb82c6 _PyFunction_FastCallDict + 614 (call.c:322)
25  python                        	0x0000000104fb7d93 _PyObject_FastCallDict + 467 (call.c:98)
26  python                        	0x0000000104fbbd92 _PyObject_Call_Prepend + 434 (call.c:904)
27  python                        	0x0000000104fbf30a method_call + 106 (classobject.c:309)
28  python                        	0x0000000104fb9dc9 PyObject_Call + 681 (call.c:245)
29  python                        	0x0000000105295116 t_bootstrap + 118 (_threadmodule.c:994)
30  python                        	0x000000010520b2de pythread_wrapper + 62 (thread_pthread.h:174)
31  libsystem_pthread.dylib       	0x00007fff686e9109 _pthread_start + 148
32  libsystem_pthread.dylib       	0x00007fff686e4b8b thread_start + 15

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x00000001122fe538  rbx: 0x0000000000000000  rcx: 0x00000001053d8ff8  rdx: 0x0000000000000000
  rdi: 0x00007f92cec670d8  rsi: 0x00000001122e10d0  rbp: 0x00007ffeeac75610  rsp: 0x00007ffeeac75588
   r8: 0x1f9e2966c6810000   r9: 0x0000000000000000  r10: 0x000000000000019e  r11: 0x0000000111d7adac
  r12: 0x00007ffeeac74fd0  r13: 0x0000000000000000  r14: 0x0000000000000000  r15: 0x0000000000000000
  rip: 0x00000001122fe538  rfl: 0x0000000000010283  cr2: 0x00000001122fe538
  
Logical CPU:     6
Error Code:      0x00000015 (invalid protections for user instruction read)
Trap Number:     14



@int19h
Copy link
Contributor

int19h commented Apr 29, 2020

Building the debugger from source will probably work better if you do it from an enlistment, rather than trying to build the bundled copy. It can probably be made to build, but we never specifically arranged it to be buildable nor tested for it. This will also take care of newline issues.

If you're using ptvsd.enable_attach(), that means that you're running ptvsd rather than debugpy. To reiterate, ptvsd is not developed further, and it hasn't been developed for a while. We haven't made any changes to it since January, and that was in the 5.0 beta branch (that eventually became debugpy). If you're using the most recent stable version from PyPI, then you're running ptvsd 4.3.2, which shipped in August last year. So if ptvsd.enable_attach() is crashing for you, there are no recent changes that could cause it - if it only just started crashing now, then either something changed in the environment to enable it (e.g. the interpreter itself), or it is an inconsistent crash that has always been there, but just started to happen more consistently, e.g. due to some timing changes caused by the environment.

In general, please keep in mind that we don't support just any random Python interpreter - it would be too long of a list. We support official CPython builds from python.org, and OS-specific Python packages (Store on Windows, Brew on macOS, distro repos on Linux). If the same repro steps don't crash for you using stock prebuilt Python, you need to figure out how to build your custom interpreter such that it's ABI-compatible with stock builds.

@patrickkidd
Copy link
Author

patrickkidd commented Apr 30, 2020 via email

@int19h
Copy link
Contributor

int19h commented Apr 30, 2020

Ah, that explains it - --with-pydebug is very much ABI-breaking, because it #defines Py_TRACE_REFS among other things. That causes every PyObject to get two extra fields inserted at the very beginning, changing offsets of all the other fields in every Python object, including the refcount.

It's quite possible that this is the only thing about debug builds that makes a difference. If so, you can try to disable it by cherry-picking specific debug flags, as discussed in the special builds guide. Of note is that only Py_TRACE_REFS gets an ABI compatibility warning in that doc:

Note that because the fundamental PyObject layout changes, Python modules
compiled with Py_TRACE_REFS are incompatible with modules compiled without it.

So hopefully omitting that flag will do the trick, although of course that's also one of the more useful things about Python debug builds...

The reason why it might have worked before, and stopped working now, is that we use a bunch of native code to speed up the debugger, which is only compatible with some Python versions. So it's selectively enabled if a supported Python version is detected, but it falls back to pure Python otherwise. I suspect you were hitting the pure Python path before, and at some point either you upgraded to a newer version, or we added another optimization that affected the version you were using. As @fabioz noted above, you can try disabling those optimizations by editing the source code of the package:

until we actually make that optional, another option could be changing def load_python_helper_lib() in debugpy/_vendored/pydevd/pydevd_tracing.py to always return None.

On our side, it sounds like we should check for a debug build of Python (or maybe just Py_TRACE_REFS? it can be feature-tested via sys.getobjects()...), and disable native code optimizations in that case. I think it might also be useful to provide some way to explicitly opt out, as an escape hatch for custom builds or alternate implementations that we don't know how to detect. There are some features that inherently require native code - attach-to-PID, in particular - so I don't think we'll ever formally commit to fully supporting debug Python builds. But it sounds like we can make them work in practice in most common scenarios with little effort, which is worthwhile.

@int19h int19h changed the title Debugger crashes immediately with python built from source code Debugger crashes if running under CPython debug build (--with-pydebug) Apr 30, 2020
@int19h int19h transferred this issue from microsoft/ptvsd Apr 30, 2020
@int19h int19h added the enhancement New feature or request label May 2, 2020
@fabioz
Copy link
Collaborator

fabioz commented May 8, 2020

Note: I'm currently taking a look at this issue.

From what I searched, it seems that the best way to find out if it is a debug build is using:

hasattr(sys, 'gettotalrefcount')

i.e.: python itself seems to use that: https://github.com/python/cpython/blob/e3dfb9b967c560f4d094092dcae4a16fc9634681/Lib/test/pythoninfo.py#L128

@fabioz fabioz self-assigned this May 21, 2020
fabioz added a commit to fabioz/debugpy that referenced this issue May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants