HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-160-generic #170-Ubuntu SMP Wed Oct 1 10:06:56 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/share/gdb/python/gdb/__pycache__/__init__.cpython-310.pyc
o

��nb��@sHddlZddlZddlZddlZddlmZejdkr"ddlmZn
ejddkr/ddl	mZddlTGdd�de
�ZGd	d
�d
e�Ze�e_
Gdd�de�Ze�e_dZd
ge_gZgZgZiZgZdd�Zdd�Zej�ej�e��agd�Zdd�Ze�dd�Zdd�Z dd�Z!dd�Z"dd�Z#dd �Z$d!d"�Z%ed#d$��Z&dS)%�N)�contextmanager)��)�reload�)�*c@s4eZdZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)�_GdbFilezUTF-8�strictcCsdS�N���selfrr�%/usr/share/gdb/python/gdb/__init__.py�close$sz_GdbFile.closecCsdS)NFrrrrr�isatty(sz_GdbFile.isattycCs|D]}|�|�qdSr
)�write)r
�iterable�linerrr�
writelines+s�z_GdbFile.writelinescCs
t�dSr
)�flushrrrrr/s
z_GdbFile.flushN)	�__name__�
__module__�__qualname__�encoding�errorsrrrrrrrrrsrc@�eZdZdd�ZdS)�_GdbOutputFilecC�t|td�dS�N)�stream)r�STDOUT�r
�srrrr4�z_GdbOutputFile.writeN�rrrrrrrrr3�rc@r)�_GdbOutputErrorFilecCrr)r�STDERRr!rrrr<r#z_GdbOutputErrorFile.writeNr$rrrrr&;r%r&�cCs�t�D]}|jD]}|jr||�}|dur||jfSqqt�jD]}|jr8||�}|dur8||jfSq$tD]}|jrO||�}|durO||jfSq;dS)a�Internal function called from GDB to execute all unwinders.

    Runs each currently enabled unwinder until it finds the one that
    can unwind given frame.

    Arguments:
        pending_frame: gdb.PendingFrame instance.

    Returns:
        Tuple with:

          [0] gdb.UnwindInfo instance
          [1] Name of unwinder that claimed the frame (type `str`)

        or None, if no unwinder has claimed the frame.
    N)�objfiles�frame_unwinders�enabled�name�current_progspace)�
pending_frame�objfile�unwinder�unwind_inforrr�_execute_unwindersVs*

����r2cCs�tjdj}d}t|d�s||d<d}z-t|d��}t|��|d�}t|||�Wd�n1s2wYW|r?|d=dSdS|rF|d=w)aBThis function is used to replace Python 2's PyRun_SimpleFile.

    Loads and executes the given file.

    We could use the runpy module, but its documentation says:
    "Furthermore, any functions and classes defined by the executed code are
    not guaranteed to work correctly after a runpy function has returned."
    �__main__F�__file__T�rb�execN)�sys�modules�__dict__�hasattr�open�compile�readr6)�filepath�globals�set_file�file�compiledrrr�
_execute_file}s	
��
�rC)�function�command�printerc	Cs�tD]N}tj�tj�t�|�}tj�|�rPtdd�t�|��}|D].}dt	||dd�f}z|t
jvr;tt
|��nt
|�Wq!t
j�t��d�Yq!qdS)NcSs|�d�o|dkS)Nz.pyz__init__.py)�endswith)�xrrr�<lambda>�sz%_auto_load_packages.<locals>.<lambda>z%s.%s.%s����
)�packages�os�path�join�dirnamer4�exists�filter�listdirrr7r8r�
__import__�stderrr�	traceback�
format_exc)�package�location�py_files�py_file�modnamerrr�_auto_load_packages�s"�
���r]cCsLztj�t�Wn	tyYnwtj�d|�|attt��t	�dS)z3Update sys.path, reload gdb and auto-load packages.rN)
r7rN�remove�	PYTHONDIR�
ValueError�insertrrTrr])�dirrrr�GdbSetPythonDirectory�s�
rccCst�jS)zReturn the current Progspace.)�selected_inferior�	progspacerrrrr-�sr-cCs
t���S)z:Return a sequence of the current program space's objfiles.)r-r)rrrrr)�s
r)cC�t��|�S)zdsolib_name (Long) -> String.
Return the name of the shared library holding a given address, or None.)r-�
solib_name)�addrrrrrg��rgcCrf)z8Return the block containing the given pc value, or None.)r-�block_for_pc��pcrrrrj�srjcCrf)znfind_pc_line (pc) -> Symtab_and_line.
    Return the gdb.Symtab_and_line object corresponding to the pc value.)r-�find_pc_linerkrrrrm�rirmcCs td|dt|�dd�dS)z$Set the GDB parameter NAME to VALUE.zset � T)�	to_stringN)�execute�str)r,�valuerrr�
set_parameter�s rsc	cs8�t|�}t||�zdVWt||�dSt||�w)zYTemporarily set the GDB parameter NAME to VALUE.
    Note that this is a context manager.N)�	parameterrs)r,rr�	old_valuerrr�with_parameter�s�
rv)'rVrMr7�_gdb�
contextlibr�version_info�	importlibr�imp�objectrr�stdoutr&rU�prompt_hook�argv�pretty_printers�
type_printers�xmethods�
frame_filtersr*r2rCrNrPr4r_rLr]rcr-r)rgrjrmrsrvrrrr�<module>sJ
'