| Server IP : 93.86.61.54 / Your IP : 216.73.216.60 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/gdb/python/gdb/__pycache__/ |
Upload File : |
o
��nbN+ � @ s� d Z ddlZddlZddlZejd dkreZeZG dd� de �Z
G dd� de �ZG dd � d e �ZG d
d� de�Z
dd
� Zdd� Zddd�ZdS )zUtilities for defining xmethods� N� c @ s e Zd ZdZdd� ZdS )�XMethoda� Base class (or a template) for an xmethod description.
Currently, the description requires only the 'name' and 'enabled'
attributes. Description objects are managed by 'XMethodMatcher'
objects (see below). Note that this is only a template for the
interface of the XMethodMatcher.methods objects. One could use
this class or choose to use an object which supports this exact same
interface. Also, an XMethodMatcher can choose not use it 'methods'
attribute. In such cases this class (or an equivalent) is not used.
Attributes:
name: The name of the xmethod.
enabled: A boolean indicating if the xmethod is enabled.
c C s || _ d| _d S )NT)�name�enabled��selfr � r �$/usr/share/gdb/python/gdb/xmethod.py�__init__. �
zXMethod.__init__N)�__name__�
__module__�__qualname__�__doc__r
r r r r r s r c @ s e Zd ZdZdd� Zdd� ZdS )�XMethodMatchera� Abstract base class for matching an xmethod.
When looking for xmethods, GDB invokes the `match' method of a
registered xmethod matcher to match the object type and method name.
The `match' method in concrete classes derived from this class should
return an `XMethodWorker' object, or a list of `XMethodWorker'
objects if there is a match (see below for 'XMethodWorker' class).
Attributes:
name: The name of the matcher.
enabled: A boolean indicating if the matcher is enabled.
methods: A sequence of objects of type 'XMethod', or objects
which have at least the attributes of an 'XMethod' object.
This list is used by the 'enable'/'disable'/'info' commands to
enable/disable/list the xmethods registered with GDB. See
the 'match' method below to know how this sequence is used.
This attribute is None if the matcher chooses not have any
xmethods managed by it.
c C s || _ d| _d| _dS )z�
Args:
name: An identifying name for the xmethod or the group of
xmethods returned by the `match' method.
TN)r r �methodsr r r r r
H s
zXMethodMatcher.__init__c C � t d��)a� Match class type and method name.
In derived classes, it should return an XMethodWorker object, or a
sequence of 'XMethodWorker' objects. Only those xmethod workers
whose corresponding 'XMethod' descriptor object is enabled should be
returned.
Args:
class_type: The class type (gdb.Type object) to match.
method_name: The name (string) of the method to match.
zXMethodMatcher match��NotImplementedError)r �
class_type�method_namer r r �matchR � zXMethodMatcher.matchN)r r
r r r
r r r r r r 3 s
r c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �
XMethodWorkera8 Base class for all xmethod workers defined in Python.
An xmethod worker is an object which matches the method arguments, and
invokes the method when GDB wants it to. Internally, GDB first invokes the
'get_arg_types' method to perform overload resolution. If GDB selects to
invoke this Python xmethod, then it invokes it via the overridden
'__call__' method. The 'get_result_type' method is used to implement
'ptype' on the xmethod.
Derived classes should override the 'get_arg_types', 'get_result_type'
and '__call__' methods.
c C r )a� Return arguments types of an xmethod.
A sequence of gdb.Type objects corresponding to the arguments of the
xmethod are returned. If the xmethod takes no arguments, then 'None'
or an empty sequence is returned. If the xmethod takes only a single
argument, then a gdb.Type object or a sequence with a single gdb.Type
element is returned.
zXMethodWorker get_arg_typesr �r r r r �
get_arg_typeso s zXMethodWorker.get_arg_typesc G r )a� Return the type of the result of the xmethod.
Args:
args: Arguments to the method. Each element of the tuple is a
gdb.Value object. The first element is the 'this' pointer
value. These are the same arguments passed to '__call__'.
Returns:
A gdb.Type object representing the type of the result of the
xmethod.
zXMethodWorker get_result_typer �r �argsr r r �get_result_typez r zXMethodWorker.get_result_typec G r )ay Invoke the xmethod.
Args:
args: Arguments to the method. Each element of the tuple is a
gdb.Value object. The first element is the 'this' pointer
value.
Returns:
A gdb.Value corresponding to the value returned by the xmethod.
Returns 'None' if the method does not return anything.
zXMethodWorker __call__r r r r r �__call__� r zXMethodWorker.__call__N)r r
r r r r r r r r r r a s
r c @ s0 e Zd ZdZG dd� de�Zdd� Zdd� ZdS ) �SimpleXMethodMatchera� A utility class to implement simple xmethod mathers and workers.
See the __init__ method below for information on how instances of this
class can be used.
For simple classes and methods, one can choose to use this class. For
complex xmethods, which need to replace/implement template methods on
possibly template classes, one should implement their own xmethod
matchers and workers. See py-xmethods.py in testsuite/gdb.python
directory of the GDB source tree for examples.
c @ s$ e Zd Zdd� Zdd� Zdd� ZdS )z(SimpleXMethodMatcher.SimpleXMethodWorkerc C s || _ || _d S �N)�
_arg_types�_method_function)r �method_function� arg_typesr r r r
� r z1SimpleXMethodMatcher.SimpleXMethodWorker.__init__c C s | j S r! )r"