Current File : //proc/self/root/kunden/usr/share/gdb/python/gdb/command/__pycache__/explore.cpython-39.pyc |
a
ɱZhh � @ s� d Z ddlZG dd� de�ZG dd� de�ZG dd� de�ZG d d
� d
e�ZG dd� de�ZG d
d� de�ZG dd� de�Z G dd� de�Z
G dd� dej�ZG dd� dej�Z
G dd� dej�Ze�� e� e
� e� dS )zEImplementation of the GDB 'explore' command using the GDB Python API.� Nc @ s� e Zd ZdZi Zejejejej ej
ejfZe
dd� �Ze
dd� �Ze
dd� �Ze
dd � �Ze
d
d� �Ze
dd
� �Ze
dd� �Ze
dd� �Ze
dd� �ZdS )�Explorerz-Internal class which invokes other explorers.c C s� t | �}d}| d dkr*| |d dkr*n^d}||k r�| | }|dks~d|krV|dks~d |krf|d
ks~d|krx|dkrxnd
}q�|d7 }q.|r�d| d S | S d S )NFr �(� �)�_�a�z�A�Z�0�9T)�len)�expr�lengthZguard�i�c� r �,/usr/share/gdb/python/gdb/command/explore.py�
guard_expr% s8 �������
zExplorer.guard_exprc C sD |j j}|tjv r.tj| }|�| ||�r@qntdt|j � � dS )a� Main function to explore an expression value.
Arguments:
expr: The expression string that is being explored.
value: The gdb.Value value of the expression.
is_child: Boolean value to indicate if the expression is a child.
An expression is a child if it is derived from the main
expression entered by the user. For example, if the user
entered an expression which evaluates to a struct, then
when exploring the fields of the struct, is_child is set
to True internally.
Returns:
No return value.
�*Explorer for type '%s' not yet available.
N)�type�coder �type_code_to_explorer_map�explore_expr�print�str)r �value�is_child� type_code�explorer_classr r r r A s
zExplorer.explore_exprc C s@ |j }|tjv r,tj| }|�| ||�r<qntdt|� � dS )a� Main function to explore a data type.
Arguments:
name: The string representing the path to the data type being
explored.
datatype: The gdb.Type value of the data type being explored.
is_child: Boolean value to indicate if the name is a child.
A name is a child if it is derived from the main name
entered by the user. For example, if the user entered
the name of struct type, then when exploring the fields
of the struct, is_child is set to True internally.
Returns:
No return value.
r N)r r r �explore_typer r )�name�datatyper r r r r r r Z s
zExplorer.explore_typec C sX t jtt jtt jtt jtt jtt jtt jt t j
t t jtt j
tt jtt jtt jti
t_dS )z�Initializes the Explorer environment.
This function should be invoked before starting any exploration. If
invoked before an exploration, it need not be invoked for subsequent
explorations.
N)�gdb�TYPE_CODE_CHAR�ScalarExplorer�
TYPE_CODE_INT�TYPE_CODE_BOOL�
TYPE_CODE_FLT�TYPE_CODE_VOID�TYPE_CODE_ENUM�TYPE_CODE_STRUCT�CompoundExplorer�TYPE_CODE_UNIONZ
TYPE_CODE_PTR�PointerExplorerZ
TYPE_CODE_REF�ReferenceExplorerZTYPE_CODE_RVALUE_REFZTYPE_CODE_TYPEDEF�TypedefExplorerZTYPE_CODE_ARRAY�
ArrayExplorerr r r r r r �init_envs s �zExplorer.init_envc C s | j tjv S )a� Checks whether a type is a scalar type.
A type is a scalar type of its type is
gdb.TYPE_CODE_CHAR or
gdb.TYPE_CODE_INT or
gdb.TYPE_CODE_BOOL or
gdb.TYPE_CODE_FLT or
gdb.TYPE_CODE_VOID or
gdb.TYPE_CODE_ENUM.
Arguments:
type: The type to be checked.
Returns:
'True' if 'type' is a scalar type. 'False' otherwise.
)r r �_SCALAR_TYPE_LIST)r r r r �is_scalar_type� s zExplorer.is_scalar_typec C s t d� dS )z�A utility function which prints that the current exploration session
is returning to the parent value. Useful when exploring values.
z
Returning to parent value...
N�r r r r r �return_to_parent_value� s zExplorer.return_to_parent_valuec C s t d� dS )z�A utility function which prompts the user to press the 'enter' key
so that the exploration session can shift back to the parent value.
Useful when exploring values.
z(
Press enter to return to parent value: N��inputr r r r �return_to_parent_value_prompt� s z&Explorer.return_to_parent_value_promptc C s t d� dS )z�A utility function which prints that the current exploration session
is returning to the enclosing type. Useful when exploring types.
z
Returning to enclosing type...
Nr5 r r r r �return_to_enclosing_type� s z!Explorer.return_to_enclosing_typec C s t d� dS )z�A utility function which prompts the user to press the 'enter' key
so that the exploration session can shift back to the enclosing type.
Useful when exploring types.
z*
Press enter to return to enclosing type: Nr7 r r r r �return_to_enclosing_type_prompt� s z(Explorer.return_to_enclosing_type_promptN)�__name__�
__module__�__qualname__�__doc__r r# r$ r&