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

Classes

class  SimpleXMethodWorker
 

Public Member Functions

 __init__ (self, name, class_matcher, method_matcher, method_function, *arg_types)
 
 match (self, class_type, method_name)
 
 __init__ (self, name, class_matcher, method_matcher, method_function, *arg_types)
 
 match (self, class_type, method_name)
 

Protected Attributes

 _method_function
 
 _class_matcher
 
 _method_matcher
 
 _arg_types
 

Additional Inherited Members

- Public Attributes inherited from gdb.xmethod.XMethodMatcher
 name
 
 enabled
 
 methods
 

Detailed Description

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.

Definition at line 144 of file xmethod.py.

Constructor & Destructor Documentation

◆ __init__() [1/2]

gdb.xmethod.SimpleXMethodMatcher.__init__ ( self,
name,
class_matcher,
method_matcher,
method_function,
* arg_types )
Args:
    name: Name of the xmethod matcher.
    class_matcher: A regular expression used to match the name of the
        class whose method this xmethod is implementing/replacing.
    method_matcher: A regular expression used to match the name of the
        method this xmethod is implementing/replacing.
    method_function: A Python callable which would be called via the
        'invoke' method of the worker returned by the objects of this
        class.  This callable should accept the object (*this) as the
        first argument followed by the rest of the arguments to the
        method. All arguments to this function should be gdb.Value
        objects.
    arg_types: The gdb.Type objects corresponding to the arguments that
        this xmethod takes. It can be None, or an empty sequence,
        or a single gdb.Type object, or a sequence of gdb.Type objects.

Reimplemented from gdb.xmethod.XMethodMatcher.

Definition at line 168 of file xmethod.py.

◆ __init__() [2/2]

gdb.xmethod.SimpleXMethodMatcher.__init__ ( self,
name,
class_matcher,
method_matcher,
method_function,
* arg_types )
Args:
    name: Name of the xmethod matcher.
    class_matcher: A regular expression used to match the name of the
        class whose method this xmethod is implementing/replacing.
    method_matcher: A regular expression used to match the name of the
        method this xmethod is implementing/replacing.
    method_function: A Python callable which would be called via the
        'invoke' method of the worker returned by the objects of this
        class.  This callable should accept the object (*this) as the
        first argument followed by the rest of the arguments to the
        method. All arguments to this function should be gdb.Value
        objects.
    arg_types: The gdb.Type objects corresponding to the arguments that
        this xmethod takes. It can be None, or an empty sequence,
        or a single gdb.Type object, or a sequence of gdb.Type objects.

Reimplemented from gdb.xmethod.XMethodMatcher.

Definition at line 168 of file xmethod.py.

References gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker._arg_types, gdb.xmethod.SimpleXMethodMatcher._arg_types, gdb.xmethod.SimpleXMethodMatcher._class_matcher, gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker._method_function, gdb.xmethod.SimpleXMethodMatcher._method_function, and gdb.xmethod.SimpleXMethodMatcher._method_matcher.

Member Function Documentation

◆ match() [1/2]

gdb.xmethod.SimpleXMethodMatcher.match ( self,
class_type,
method_name )
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.

Reimplemented from gdb.xmethod.XMethodMatcher.

Definition at line 198 of file xmethod.py.

References gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker._arg_types, gdb.xmethod.SimpleXMethodMatcher._arg_types, gdb.xmethod.SimpleXMethodMatcher._class_matcher, gdb.xmethod._lookup_xmethod_matcher(), gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker._method_function, gdb.xmethod.SimpleXMethodMatcher._method_function, gdb.xmethod.SimpleXMethodMatcher._method_matcher, and gdb.xmethod._validate_xmethod_matcher().

◆ match() [2/2]

gdb.xmethod.SimpleXMethodMatcher.match ( self,
class_type,
method_name )
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.

Reimplemented from gdb.xmethod.XMethodMatcher.

Definition at line 198 of file xmethod.py.

References gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker._arg_types, gdb.xmethod.SimpleXMethodMatcher._arg_types, gdb.xmethod.SimpleXMethodMatcher._class_matcher, gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker._method_function, gdb.xmethod.SimpleXMethodMatcher._method_function, and gdb.xmethod.SimpleXMethodMatcher._method_matcher.

Member Data Documentation

◆ _arg_types

gdb.xmethod.SimpleXMethodMatcher._arg_types
protected

◆ _class_matcher

gdb.xmethod.SimpleXMethodMatcher._class_matcher
protected

◆ _method_function

gdb.xmethod.SimpleXMethodMatcher._method_function
protected

◆ _method_matcher

gdb.xmethod.SimpleXMethodMatcher._method_matcher
protected

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