GDB (xrefs)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
gdb.xmethod.XMethodWorker Class Reference
Inheritance diagram for gdb.xmethod.XMethodWorker:
gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker

Public Member Functions

 get_arg_types (self)
 
 get_result_type (self, *args)
 
 __call__ (self, *args)
 
 get_arg_types (self)
 
 get_result_type (self, *args)
 
 __call__ (self, *args)
 

Detailed Description

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.

Definition at line 90 of file xmethod.py.

Member Function Documentation

◆ __call__() [1/2]

gdb.xmethod.XMethodWorker.__call__ ( self,
* args )
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.

Reimplemented in gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker, and gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker.

Definition at line 129 of file xmethod.py.

◆ __call__() [2/2]

gdb.xmethod.XMethodWorker.__call__ ( self,
* args )
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.

Reimplemented in gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker, and gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker.

Definition at line 129 of file xmethod.py.

◆ get_arg_types() [1/2]

gdb.xmethod.XMethodWorker.get_arg_types ( self)
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.

Reimplemented in gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker, and gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker.

Definition at line 104 of file xmethod.py.

◆ get_arg_types() [2/2]

gdb.xmethod.XMethodWorker.get_arg_types ( self)
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.

Reimplemented in gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker, and gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker.

Definition at line 104 of file xmethod.py.

◆ get_result_type() [1/2]

gdb.xmethod.XMethodWorker.get_result_type ( self,
* args )
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.

Definition at line 115 of file xmethod.py.

◆ get_result_type() [2/2]

gdb.xmethod.XMethodWorker.get_result_type ( self,
* args )
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.

Definition at line 115 of file xmethod.py.


The documentation for this class was generated from the following files: