HEX
Server: LiteSpeed
System: Linux br-asc-web1845.main-hosting.eu 5.14.0-611.42.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 24 05:30:20 EDT 2026 x86_64
User: u790421558 (790421558)
PHP: 8.2.30
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //lib/python3.9/site-packages/elftools/construct/__pycache__/debug.cpython-39.opt-1.pyc
a

�#�_��@sxdZddlmZddlZddlZddlZddlZddlmZm	Z	ddl
mZmZm
Z
Gdd�de�ZGd	d
�d
e	�ZdS)z$
Debugging utilities for constructs
�)�print_functionN�)�	Construct�Subconstruct)�	HexString�	Container�
ListContainerc@sNeZdZdZgd�ZdZddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�Probea�
    A probe: dumps the context, stack frames, and stream content to the screen
    to aid the debugging process.
    See also Debugger.

    Parameters:
    * name - the display name
    * show_stream - whether or not to show stream contents. default is True.
      the stream must be seekable.
    * show_context - whether or not to show the context. default is True.
    * show_stack - whether or not to show the upper stack frames. default
      is True.
    * stream_lookahead - the number of bytes to dump when show_stack is set.
      default is 100.

    Example:
    Struct("foo",
        UBInt8("a"),
        Probe("between a and b"),
        UBInt8("b"),
    )
    )�	printname�show_stream�show_context�
show_stack�stream_lookaheadrNT�dcCsPt�|d�|dur.tjd7_dtjf}||_||_||_||_||_dS)Nrz<unnamed %d>)	r�__init__r	�counterr
rrr
r)�self�namerrr
r�r�</usr/lib/python3.9/site-packages/elftools/construct/debug.pyr*szProbe.__init__cCsd|jj|jfS)Nz%s(%r))�	__class__�__name__r
)rrrr�__repr__6szProbe.__repr__cCs|�||�dS�N��printout�r�stream�contextrrr�_parse8szProbe._parsecCs|�||�dSrr�r�objrrrrr�_build:szProbe._buildcCsdS)Nrr)rrrrr�_sizeof<sz
Probe._sizeofcCs�t�}|jrN|��|_|�|j�}|s.d|_n|�t|�d�t	|�|_t
|jrZ||_|j
r�t�|_dd�t��D�dd�}|��|D]"}t�}|�|j�|j�|�q�t
d�t
d|j�t
|�t
d�dS)NzEOF reachedrcSsg|]}|d�qS)rr)�.0�srrr�
<listcomp>P�z"Probe.printout.<locals>.<listcomp>����P================================================================================r	)rr�tellZstream_position�readrZfollowing_stream_data�seek�lenr�printrrr
r�stack�inspect�reverseZ
__update__�f_locals�appendr
)rrrr!ZfollowsZframes�f�arrrr?s.

zProbe.printout)NTTTr)r�
__module__�__qualname__�__doc__�	__slots__rrrrr"r#rrrrrr	
s�
r	c@s0eZdZdZdgZdd�Zdd�Zd
dd	�ZdS)�DebuggeraR
    A pdb-based debugger. When an exception occurs in the subcon, a debugger
    will appear and allow you to debug the error (and even fix on-the-fly).

    Parameters:
    * subcon - the subcon to debug

    Example:
    Debugger(
        Enum(UBInt8("foo"),
            a = 1,
            b = 2,
            c = 3
        )
    )
    �retvalcCsPz|j�||�WStyJt|_|�d�|jtur<�n
|jYSYn0dS)Nz@(you can set the value of 'self.retval', which will be returned))�subconr�	Exception�NotImplementedr;�
handle_excrrrrrns

zDebugger._parsecCs4z|j�|||�Wnty.|��Yn0dSr)r<r"r=r?r rrrr"yszDebugger._buildNcCsbtd�td|jf�td�tjt���dd���|rDt|�t�t��d�td�dS)Nr)zDebugging exception of %s:�r�)	r.r<�join�	traceback�format_exception�sys�exc_info�pdbZpost_mortem)r�msgrrrr?~s zDebugger.handle_exc)N)rr6r7r8r9rr"r?rrrrr:\s
r:)r8Z
__future__rrErCrGr0Zcorerr�librrrr	r:rrrr�<module>sO