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/command/__pycache__/xmethods.cpython-310.pyc
o

̴6b'�@s�ddlZddlZ	dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�ZGdd�dej	�Z
Gdd�dej	�ZGdd�dej	�Zdd�Z
e
�dS)�NcCs(zt�|�WStytd||��w)NzInvalid %s regexp: %s)�re�compile�SyntaxError)�	part_name�regexp�r�-/usr/share/gdb/python/gdb/command/xmethods.py�validate_xm_regexps
�r	cCs�t�|�}t|�}|dkrtd��d}d}d}|dkr|d}|dkr9|d�dd�}|d}t|�dkr9|d}|rAtd|�}nd}td	|�td
|�|fS)a?Parses the arguments passed to a xmethod command.

    Arguments:
        arg: The argument string passed to a xmethod command.

    Returns:
        A 3-tuple: (<locus matching regular expression>,
                    <matcher matching regular expression>,
                    <name matching regular experession>)
    �zToo many arguments to command.�N�r�;zxmethod name�locuszmatcher name)�gdb�string_to_argv�lenr�splitr	)�arg�argv�argc�locus_regexp�matcher_name_regexp�xm_name_regexp�parts�name_rerrr�parse_xm_command_argss*
�rcs8d}|gi}|�d�r||��fdd�tjD��|S)a�Returns a dict of matching globally registered xmethods.

    Arguments:
        locus_re: Even though only globally registered xmethods are
                  looked up, they will be looked up only if 'global' matches
                  LOCUS_RE.
        matcher_re: The regular expression matching the names of xmethods.

    Returns:
        A dict of matching globally registered xmethod matchers.  The only
        key in the dict will be 'global'.
    �globalc�g|]
}��|j�r|�qSr��match�name��.0�m��
matcher_rerr�
<listcomp>R�z.get_global_method_matchers.<locals>.<listcomp>)r�extendr�xmethods)�locus_rer%�	locus_str�xm_dictrr$r�get_global_method_matchersBs


r-cshi}|D]-}t|tj�r|�d�sqd}n	|�|j�sqd}d||jf}�fdd�|jD�||<q|S)a�Returns a dict of matching registered xmethods in the LOCI.

    Arguments:
        loci: The list of loci to lookup matching xmethods in.
        locus_re: If a locus is an objfile, then xmethod matchers will be
                  looked up in it only if its filename matches the regular
                  expression LOCUS_RE.  If a locus is the current progspace,
                  then xmethod matchers will be looked up in it only if the
                  string "progspace" matches LOCUS_RE.
        matcher_re: The regular expression to match the xmethod matcher
                    names.

    Returns:
        A dict of matching xmethod matchers.  The keys of the dict are the
        filenames of the loci the xmethod matchers belong to.
    �	progspace�objfilez%s %scrrrr!r$rrr&rr'z/get_method_matchers_in_loci.<locals>.<listcomp>)�
isinstancer�	Progspacer�filenamer))�locir*r%r,r�
locus_typer+rr$r�get_method_matchers_in_lociVs
r5cCs�dd�}|sdS|D]>}||sq
td|�||D],}td|j||�f�|js,q|jD]}|dus;|�|j�rFtd|j||�f�q/qq
dS)zPrint a dictionary of xmethods.cSs|jsdSdS)Nz [disabled]r)�enabled)r#rrr�get_status_stringysz(print_xm_info.<locals>.get_status_stringNzXmethods in %s:z  %s%sz    %s%s)�printr �methodsr)r,rr7r+�matcherr#rrr�
print_xm_infovs$
����r;cCsR|��D]"\}}|D]}|s||_q
|jsq
|jD]}|�|j�r$||_qq
qdS)z>Set the status (enabled/disabled) of a dictionary of xmethods.N)�itemsr6r9rr )r,r�statusr+�matchersr:r#rrr�set_xm_status1�s
����r?cCsVt|�\}}}tt||�||�ttt��g||�||�ttt��||�||�dS)z�Set the status (enabled/disabled) of xmethods matching ARG.
    This is a helper function for enable/disable commands.  ARG is the
    argument string passed to the commands.
    N)rr?r-r5r�current_progspace�objfiles)rr=r*r%rrrr�
set_xm_status�s��rBc�(eZdZdZ�fdd�Zdd�Z�ZS)�InfoXMethodaiGDB command to list registered xmethod matchers.

    Usage: info xmethod [LOCUS-REGEXP [NAME-REGEXP]]

    LOCUS-REGEXP is a regular expression matching the location of the
    xmethod matchers.  If it is omitted, all registered xmethod matchers
    from all loci are listed.  A locus could be 'global', a regular expression
    matching the current program space's filename, or a regular expression
    matching filenames of objfiles.  Locus could be 'progspace' to specify that
    only xmethods from the current progspace should be listed.

    NAME-REGEXP is a regular expression matching the names of xmethod
    matchers.  If this omitted for a specified locus, then all registered
    xmethods in the locus are listed.  To list only a certain xmethods
    managed by a single matcher, the name regexp can be specified as
    matcher-name-regexp;xmethod-name-regexp.c�tt|��dtj�dS)Nzinfo xmethod)�superrD�__init__r�COMMAND_DATA��self��	__class__rrrG��zInfoXMethod.__init__cCsPt|�\}}}tt||�|�ttt��g||�|�ttt��||�|�dS)N)rr;r-r5rr@rA)rJr�from_ttyr*r%rrrr�invoke�s���zInfoXMethod.invoke��__name__�
__module__�__qualname__�__doc__rGrO�
__classcell__rrrKrrD��rDcrC)�
EnableXMethoda�GDB command to enable a specified (group of) xmethod(s).

    Usage: enable xmethod [LOCUS-REGEXP [NAME-REGEXP]]

    LOCUS-REGEXP is a regular expression matching the location of the
    xmethod matchers.  If it is omitted, all registered xmethods matchers
    from all loci are enabled.  A locus could be 'global', a regular expression
    matching the current program space's filename, or a regular expression
    matching filenames of objfiles.  Locus could be 'progspace' to specify that
    only xmethods from the current progspace should be enabled.

    NAME-REGEXP is a regular expression matching the names of xmethods
    within a given locus.  If this omitted for a specified locus, then all
    registered xmethod matchers in the locus are enabled.  To enable only
    a certain xmethods managed by a single matcher, the name regexp can be
    specified as matcher-name-regexp;xmethod-name-regexp.crE)Nzenable xmethod)rFrWrGrrHrIrKrrrG�rMzEnableXMethod.__init__cC�t|d�dS)NT�rB�rJrrNrrrrO��zEnableXMethod.invokerPrrrKrrW�rVrWcrC)�DisableXMethoda�GDB command to disable a specified (group of) xmethod(s).

    Usage: disable xmethod [LOCUS-REGEXP [NAME-REGEXP]]

    LOCUS-REGEXP is a regular expression matching the location of the
    xmethod matchers.  If it is omitted, all registered xmethod matchers
    from all loci are disabled.  A locus could be 'global', a regular
    expression matching the current program space's filename, or a regular
    expression filenames of objfiles. Locus could be 'progspace' to specify
    that only xmethods from the current progspace should be disabled.

    NAME-REGEXP is a regular expression matching the names of xmethods
    within a given locus.  If this omitted for a specified locus, then all
    registered xmethod matchers in the locus are disabled.  To disable
    only a certain xmethods managed by a single matcher, the name regexp
    can be specified as matcher-name-regexp;xmethod-name-regexp.crE)Nzdisable xmethod)rFr\rGrrHrIrKrrrGrMzDisableXMethod.__init__cCrX)NFrYrZrrrrOr[zDisableXMethod.invokerPrrrKrr\�rVr\cCst�t�t�dS)zInstalls the xmethod commands.N)rDrWr\rrrr�register_xmethod_commandss
r])rrr	rr-r5r;r?rB�CommandrDrWr\r]rrrr�<module>s$ #