Current File : //kunden/usr/share/gdb/python/gdb/command/__pycache__/pretty_printers.cpython-39.opt-1.pyc |
a
ɱZh�8 � @ s� d Z ddlZddlZddlZdd� Zdd� ZG dd� dej�Zd d
� Zdd� Z ddd�Z
dd� Zdd� Zdd� Z
G dd� dej�ZG dd� dej�Zdd� Ze� dS )z.GDB commands for working with pretty-printers.� Nc
C s t �| �}t|�}d}d}d}|dkr.td��|dkr>|d }|dkrr|d �dd�}|d }t|�dkrr|d }zt�|�}W n ty� td | ��Y n0 zt�|�}W n ty� td
| ��Y n0 |du�r
zt�|�} W n t�y td| ��Y n0 nd} ||| fS )a� Internal utility to parse a pretty-printer command argv.
Arguments:
arg: The arguments to the command. The format is:
[object-regexp [name-regexp]].
Individual printers in a collection are named as
printer-name;subprinter-name.
Returns:
The result is a 3-tuple of compiled regular expressions, except that
the resulting compiled subprinter regexp is None if not provided.
Raises:
SyntaxError: an error processing ARG
� N� ztoo many arguments� r � �;zinvalid object regexp: %szinvalid name regexp: %szinvalid subname regexp: %s)�gdbZstring_to_argv�len�SyntaxError�split�re�compile)
�arg�argvZargcZ
object_regexpZname_regexpZsubname_regexpZname_subname� object_re�name_re�
subname_re� r �4/usr/share/gdb/python/gdb/command/pretty_printers.py�parse_printer_regexps s:
r c C s t | d�r| jS dS dS )z>Internal utility to see if printer (or subprinter) is enabled.�enabledTN)�hasattrr ��printerr r r �printer_enabled_pL s
r c sP e Zd ZdZ� fdd�Zedd� �Zedd� �Zdd � Zd
d� Z dd
� Z
� ZS )�InfoPrettyPrintera� GDB command to list all registered pretty-printers.
Usage: info pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]
OBJECT-REGEXP is a regular expression matching the objects to list.
Objects are "global", the program space's file, and the objfiles within
that program space.
NAME-REGEXP matches the name of the pretty-printer.
Individual printers in a collection are named as
printer-name;subprinter-name.c s t t| ��dtj� d S )Nzinfo pretty-printer)�superr �__init__r �COMMAND_DATA��self�� __class__r r r a s zInfoPrettyPrinter.__init__c C s t | �rdS dS dS )z9Return "" if PRINTER is enabled, otherwise " [disabled]".r z [disabled]N)r r r r r �enabled_stringd s z InfoPrettyPrinter.enabled_stringc C s$ t | d�r| jS t | d�r | jS dS )zReturn the printer's name.�name�__name__�unknown)r r# r$ r r r r �printer_namel s
zInfoPrettyPrinter.printer_namec
C s� t t�|�| jd�}|D ]�}| �|�}| �|�}|�|�rtd||f � t|d�r|jdurt t�|j�| jd�}|D ],} |r�|�| j�rxtd| j| �| �f � qxqdS )z Print a list of pretty-printers.)�keyz %s%s�subprintersNz %s%s) �sorted�copyr&