4 ms·
I'm really interested as to how they inspect Python applications without slowing it down. I know the PyDev debugger adds significant overhead, which is due to i
by orf 11y ago
I'm really interested as to how they inspect Python applications without slowing it down. I know the PyDev debugger adds significant overhead, which is due to it's use of stackframe inspection/function call hooks (as far as I know).
How can they put a breakpoint/inspect objects at arbitrary locations without this slowdown? Maybe they have a modified cPython interpreter?
Edit: lots of C code is the answer[1]
1. https://github.com/GoogleCloudPlatform/cloud-debug-python/tree/master/src/googleclouddebugger https://github.com/GoogleCloudPlatform/cloud-debug-python/tr...
- erezhaba 11y agoThey Python Cloud Debugger uses a combination of line trace debugging (which is very slow) and the profiling callback (fast) to inspect the line of interest. The Cloud Debugger is different from your tradition debugger as it optimizes for application speed. For example, it would capture values, let the thread continue and run, and only then serialize is back to the Cloud Debugger server.
- erezhaba 11y agoVlad is right, now it does codebyte rewrite. using the trace and profiling interface was the old way.
- vlflnd 11y agoThe Python Cloud Debugger works with the standard (unmodified) CPython 2.7.x. Breakpoints are implemented by rewriting Python bytecode at runtime. The debugger inserts a method call at the breakpoint location in a code object. This method tells the debugger that the code reached a particular point. Generator functions are particularly tricky because they need to maintain correct offsets at "yield" points. This source file implements all of it: https://github.com/GoogleCloudPlatform/cloud-debug-python/blob/master/src/googleclouddebugger/bytecode_manipulator.cc https://github.com/GoogleCloudPlatform/cloud-debug-python/bl...