o
    i                     @   sL   d Z ddlZddlZddlZddlZddlZddlmZ dd Zdd Z	dS )zFProvides facilities to dump all stacks of all threads in the process.
    N)logc               	   C   s   t  j} t }td| t 	 D ]3\}}|| krqt 
 D ]}|j| kr1|j}|j} nq"d }}dt|}td||||| qtd| dS )zJDump stacks of all threads in this process, except for the current thread.z!Dumping stacks for process {0}...z	<unknown> z8Stack of thread {0} (tid={1}, pid={2}, daemon={3}):

{4}z(Finished dumping stacks for process {0}.N)	threadingcurrent_threadidentosgetpidr   infosys_current_framesitems	enumeratenamedaemonjoin	tracebackformat_stack)tidpidt_identframett_namet_daemonstack r   P/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/debugpy/common/stacks.pydump   s.   

	r   c                    s*    fdd}t j|d}d|_|  dS )zKInvokes dump() on a background thread after waiting for the specified time.c                      s,   t   zt  W d S    t  Y d S )N)timesleepr   r   swallow_exceptionr   secsr   r   dumper5   s
   
zdump_after.<locals>.dumper)targetTN)r   Threadr   start)r"   r#   threadr   r!   r   
dump_after2   s   r(   )
__doc__r   r
   r   r   r   debugpy.commonr   r   r(   r   r   r   r   <module>   s   !