On Sun, Feb 21, 2010 at 2:45 PM, Leo Soto M. <leo.s...@gmail.com> wrote:
> Hi all,
>
> When running the Django server under the PyDev debugger there is a
> problem: Under Jython the server spawns a worker thread which do all
> the actual work while the main thread just keeps monitoring the
> filesystem for changes. But, AFAICS, the pydev debugger only monitors
> the main thread.
>
> I'm playing with monkey-patching thread.start_new_thread to set
> sys.settrace to the internal settrace function used with PyDev when
> executing the function in the new thread.
>
> Any obvious reason I'm missing why that may be a bad idea?

Actually, Pydev should already trigger debugging in any thread (it
sets the threading.settrace to do that).

I believe django creates a separate process to do that, which is the
reason the remote debugger must used for debugging django (a version
without the reload feature should already work for all threads).

What could be done is that the remote debugger is started and each new
process calls pydevd.settrace(suspend=False, traceAllThreads=True),
where traceAllThreads is a flag that is still not implemented, which
calls threading.settrace(debugger.trace_dispatch) for all new threads
-- not only the pydevd_tracing.SetTrace(debugger.trace_dispatch) --
and maybe pass the sys._current_frames to set the tracing for existing
threads.

If you think that'd be useful, I can create that option...

Cheers,

Fabio

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
pydev-code mailing list
pydev-code@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pydev-code

Reply via email to