[issue35370] Provide API to set the tracing function to be used for running threads.

2020-03-13 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +18324
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18975

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35370] Provide API to set the tracing function to be used for running threads.

2020-03-13 Thread Fabio Zadrozny


Fabio Zadrozny  added the comment:

Maybe better would be the thread id so that the tstate structure is not needed 
there.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35370] Provide API to set the tracing function to be used for running threads.

2020-03-13 Thread Fabio Zadrozny


Fabio Zadrozny  added the comment:

>> Note: currently there is a way to achieve that by pausing all the threads 
>> then selectively switching to a thread to make it current and setting the 
>> tracing function using the C-API (see: 
>> https://github.com/fabioz/PyDev.Debugger/blob/master/pydevd_attach_to_process/dll/attach.cpp#L1224),
>>  but I believe this is very hacky and not portable to other Python 
>> implementations.

> I'm not sure that I understand your need. Do you need a variant of 
> PyEval_SetTrace() which accepts a tstate argument?

Yes

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35370] Provide API to set the tracing function to be used for running threads.

2020-03-13 Thread Fabio Zadrozny


Fabio Zadrozny  added the comment:

I'd like to, but it only sets the tracing to the currently running thread (the 
request is for setting the tracing for other threads).

Just for info, the problem I'm solving is that the debugger is multi-threaded, 
but the user can start the code without any tracing in place, and then, when it 
gets to an attach to process or a programmatic attach to the debugger, the 
debugger needs to set the tracing to threads that are already running (and any 
new thread created afterward) and Python doesn't really have any structure for 
that in place (so, I'm using the C-API as a workaround to do what 
PyEval_SetTrace does but targeting any thread).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35370] Provide API to set the tracing function to be used for running threads.

2020-03-13 Thread STINNER Victor


STINNER Victor  added the comment:

> Note: currently there is a way to achieve that by pausing all the threads 
> then selectively switching to a thread to make it current and setting the 
> tracing function using the C-API (see: 
> https://github.com/fabioz/PyDev.Debugger/blob/master/pydevd_attach_to_process/dll/attach.cpp#L1224),
>  but I believe this is very hacky and not portable to other Python 
> implementations.

I'm not sure that I understand your need. Do you need a variant of 
PyEval_SetTrace() which accepts a tstate argument?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35370] Provide API to set the tracing function to be used for running threads.

2020-03-13 Thread STINNER Victor


STINNER Victor  added the comment:

Can't you use PyEval_SetTrace()?
https://docs.python.org/dev/c-api/init.html#c.PyEval_SetTrace

--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35370] Provide API to set the tracing function to be used for running threads.

2020-03-13 Thread Fabio Zadrozny


Fabio Zadrozny  added the comment:

As a note, the workaround is now in 
https://github.com/fabioz/PyDev.Debugger/blob/pydev_debugger_1_9_0/pydevd_attach_to_process/common/py_settrace_37.hpp#L150

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35370] Provide API to set the tracing function to be used for running threads.

2018-12-01 Thread Fabio Zadrozny


New submission from Fabio Zadrozny :

Right now it's hard for debuggers to set the tracing function to be used for 
running threads.

This would be really handy for debuggers when attaching to a running program to 
debug all threads.

-- Note: currently there is a way to achieve that by pausing all the threads 
then selectively switching to a thread to make it current and setting the 
tracing function using the C-API (see: 
https://github.com/fabioz/PyDev.Debugger/blob/master/pydevd_attach_to_process/dll/attach.cpp#L1224),
 but I believe this is very hacky and not portable to other Python 
implementations.

--
components: Interpreter Core
messages: 330849
nosy: fabioz
priority: normal
severity: normal
status: open
title: Provide API to set the tracing function to be used for running threads.
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35370] Provide API to set the tracing function to be used for running threads.

2018-12-01 Thread Fabio Zadrozny


Change by Fabio Zadrozny :


--
type:  -> enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com