Current File : //usr/share/gdb/python/gdb/command/explore.pyo |
�
�� Rc @ sX d Z d d l Z d d l Z e j d d k r: e Z n d e f d � � YZ d e f d � � YZ d e f d
� � YZ d e f d � � YZ
d
e f d � � YZ d e f d � � YZ d e f d � � YZ
d e f d � � YZ d e j f d � � YZ d e j f d � � YZ d e j f d � � YZ e j � e � e � e � d S( sE Implementation of the GDB 'explore' command using the GDB Python API.i����Ni i t Explorerc B s� e Z d Z i Z e j e j e j e j e j e j
f Z e d � � Z
e d � � Z e d � � Z e d � � Z e d � � Z e d � � Z e d � � Z e d � � Z e d � � Z RS(
s- Internal class which invokes other explorers.c C s� t | � } t } | d d k r9 | | d d k r9 n� d } x� | | k r� | | } | d k s� d | k r| | d k s� d | k r� | d k s� d
| k r� | d k r� n t } P| d 7} qB W| r� d | d S| Sd S( Ni t (i t )t _t at zt At Zt 0t 9( t lent Falset True( t exprt lengtht guardt it c( ( s, /usr/share/gdb/python/gdb/command/explore.pyt
guard_expr) s $
$0c C s] | j j } | t j k rG t j | } x. | j | | | � rC q+ Wn d t | j � GHd S( s� 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.
s* Explorer for type '%s' not yet available.
N( t typet codeR t type_code_to_explorer_mapt explore_exprt str( R
t valuet is_childt type_codet explorer_class( ( s, /usr/share/gdb/python/gdb/command/explore.pyR A s
c C sW | j } | t j k rD t j | } x+ | j | | | � r@ q( Wn d t | � GHd S( s� 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.
s* Explorer for type '%s' not yet available.
N( R R R t explore_typeR ( t namet datatypeR R R ( ( s, /usr/share/gdb/python/gdb/command/explore.pyR [ s
c C s� i t t j 6t t j 6t t j 6t t j 6t t j 6t t j 6t t j 6t t j
6t t j 6t
t j 6t t j 6t t j 6t _ d S( s� 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( t ScalarExplorert gdbt TYPE_CODE_CHARt
TYPE_CODE_INTt TYPE_CODE_BOOLt
TYPE_CODE_FLTt TYPE_CODE_VOIDt TYPE_CODE_ENUMt CompoundExplorert TYPE_CODE_STRUCTt TYPE_CODE_UNIONt PointerExplorert
TYPE_CODE_PTRt ReferenceExplorert
TYPE_CODE_REFt TypedefExplorert TYPE_CODE_TYPEDEFt
ArrayExplorert TYPE_CODE_ARRAYR R ( ( ( s, /usr/share/gdb/python/gdb/command/explore.pyt init_envu s
c C s | j t j k S( s� 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 t _SCALAR_TYPE_LIST( R ( ( s, /usr/share/gdb/python/gdb/command/explore.pyt is_scalar_type� s c C s d GHd S( s� A utility function which prints that the current exploration session
is returning to the parent value. Useful when exploring values.
s
Returning to parent value...
N( ( ( ( s, /usr/share/gdb/python/gdb/command/explore.pyt return_to_parent_value� s c C s t d � d S( s� 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.
s(
Press enter to return to parent value: N( t raw_input( ( ( s, /usr/share/gdb/python/gdb/command/explore.pyt return_to_parent_value_prompt� s c C s d GHd S( s� A utility function which prints that the current exploration session
is returning to the enclosing type. Useful when exploring types.
s
Returning to enclosing type...
N( ( ( ( s, /usr/share/gdb/python/gdb/command/explore.pyt return_to_enclosing_type� s c C s t d � d S( s� 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.
s*
Press enter to return to enclosing type: N( R6 ( ( ( s, /usr/share/gdb/python/gdb/command/explore.pyt return_to_enclosing_type_prompt� s ( t __name__t
__module__t __doc__R R R! R"