Update help text for commands implemented in Python

Philippe pointed out that the "enable frame-filter" help text looked
funny.

While fixing this I noticed a few more problems in the help text of
commands written in Python:

* Trailing newlines
* Wrong style for metasyntactic variables
* Indentation of the text
* ... and finally, I thought the function usage lines didn't need
  that extra newline -- someday I'd like to be able to write a
  "usage" command that just greps for the Usage line, so ideally it
  would be tighter than what was done here

This patch fixes all the problems I noticed.

gdb/ChangeLog
2018-10-06  Tom Tromey  <tom@tromey.com>

	* python/lib/gdb/function/strfns.py (_MemEq, _StrLen, _StrEq)
	(_RegEx): Reformat help text.
	* python/lib/gdb/function/caller_is.py (CallerIs, CallerMatches)
	(AnyCallerIs, AnyCallerMatches): Reformat help text.
	* python/lib/gdb/function/as_string.py (_AsString): Reformat help
	text.
	* python/lib/gdb/command/xmethods.py (InfoXMethod)
	(EnableXMethod, DisableXMethod): Remove help indentation.
	Capitalize meta-syntactic variables.
	* python/lib/gdb/command/unwinders.py (InfoUnwinder)
	(EnableUnwinder, DisableUnwinder): Remove help indentation.
	Capitalize meta-syntactic variables.
	* python/lib/gdb/command/explore.py (ExploreCommand)
	(ExploreValueCommand, ExploreTypeCommand): Reformat help text.
	* python/lib/gdb/command/type_printers.py (InfoTypePrinter)
	(EnableTypePrinter, DisableTypePrinter): Remove help indentation.
	* python/lib/gdb/command/pretty_printers.py (InfoPrettyPrinter):
	Remove help indentation.
	(EnablePrettyPrinter, DisablePrettyPrinter): Likewise.
	* python/lib/gdb/command/frame_filters.py (EnableFrameFilter)
	(DisableFrameFilter, SetFrameFilterPriority)
	(ShowFrameFilterPriority, InfoFrameFilter): Reword help text.
This commit is contained in:
Tom Tromey 2018-10-06 22:01:42 -06:00
parent 9e9b8787e9
commit 2fb009bbd1
10 changed files with 196 additions and 216 deletions

View file

@ -1,3 +1,28 @@
2018-10-06 Tom Tromey <tom@tromey.com>
* python/lib/gdb/function/strfns.py (_MemEq, _StrLen, _StrEq)
(_RegEx): Reformat help text.
* python/lib/gdb/function/caller_is.py (CallerIs, CallerMatches)
(AnyCallerIs, AnyCallerMatches): Reformat help text.
* python/lib/gdb/function/as_string.py (_AsString): Reformat help
text.
* python/lib/gdb/command/xmethods.py (InfoXMethod)
(EnableXMethod, DisableXMethod): Remove help indentation.
Capitalize meta-syntactic variables.
* python/lib/gdb/command/unwinders.py (InfoUnwinder)
(EnableUnwinder, DisableUnwinder): Remove help indentation.
Capitalize meta-syntactic variables.
* python/lib/gdb/command/explore.py (ExploreCommand)
(ExploreValueCommand, ExploreTypeCommand): Reformat help text.
* python/lib/gdb/command/type_printers.py (InfoTypePrinter)
(EnableTypePrinter, DisableTypePrinter): Remove help indentation.
* python/lib/gdb/command/pretty_printers.py (InfoPrettyPrinter):
Remove help indentation.
(EnablePrettyPrinter, DisablePrettyPrinter): Likewise.
* python/lib/gdb/command/frame_filters.py (EnableFrameFilter)
(DisableFrameFilter, SetFrameFilterPriority)
(ShowFrameFilterPriority, InfoFrameFilter): Reword help text.
2018-10-06 Tom Tromey <tom@tromey.com> 2018-10-06 Tom Tromey <tom@tromey.com>
PR tui/28819: PR tui/28819:

View file

@ -649,14 +649,11 @@ class ExploreUtils(object):
class ExploreCommand(gdb.Command): class ExploreCommand(gdb.Command):
"""Explore a value or a type valid in the current context. """Explore a value or a type valid in the current context.
Usage: Usage: explore ARG
explore ARG - ARG is either a valid expression or a type name.
- At any stage of exploration, hit the return key (instead of a
- ARG is either a valid expression or a type name. choice, if any) to return to the enclosing type or value."""
- At any stage of exploration, hit the return key (instead of a
choice, if any) to return to the enclosing type or value.
"""
def __init__(self): def __init__(self):
super(ExploreCommand, self).__init__(name = "explore", super(ExploreCommand, self).__init__(name = "explore",
@ -689,14 +686,11 @@ class ExploreCommand(gdb.Command):
class ExploreValueCommand(gdb.Command): class ExploreValueCommand(gdb.Command):
"""Explore value of an expression valid in the current context. """Explore value of an expression valid in the current context.
Usage: Usage: explore value ARG
explore value ARG - ARG is a valid expression.
- At any stage of exploration, hit the return key (instead of a
- ARG is a valid expression. choice, if any) to return to the enclosing value."""
- At any stage of exploration, hit the return key (instead of a
choice, if any) to return to the enclosing value.
"""
def __init__(self): def __init__(self):
super(ExploreValueCommand, self).__init__( super(ExploreValueCommand, self).__init__(
@ -718,17 +712,13 @@ class ExploreValueCommand(gdb.Command):
class ExploreTypeCommand(gdb.Command): class ExploreTypeCommand(gdb.Command):
"""Explore a type or the type of an expression valid in the current """Explore a type or the type of an expression.
context.
Usage: Usage: explore type ARG
explore type ARG - ARG is a valid expression or a type name.
- At any stage of exploration, hit the return key (instead of a
- ARG is a valid expression or a type name. choice, if any) to return to the enclosing type."""
- At any stage of exploration, hit the return key (instead of a
choice, if any) to return to the enclosing type.
"""
def __init__(self): def __init__(self):
super(ExploreTypeCommand, self).__init__( super(ExploreTypeCommand, self).__init__(

View file

@ -42,8 +42,7 @@ class ShowFilterPrefixCmd(gdb.Command):
class InfoFrameFilter(gdb.Command): class InfoFrameFilter(gdb.Command):
"""List all registered Python frame-filters. """List all registered Python frame-filters.
Usage: info frame-filters Usage: info frame-filters"""
"""
def __init__(self): def __init__(self):
super(InfoFrameFilter, self).__init__("info frame-filter", super(InfoFrameFilter, self).__init__("info frame-filter",
@ -112,11 +111,13 @@ def _enable_parse_arg(cmd_name, arg):
argv = gdb.string_to_argv(arg); argv = gdb.string_to_argv(arg);
argc = len(argv) argc = len(argv)
if argv[0] == "all" and argc > 1: if argc == 0:
raise gdb.GdbError(cmd_name + " requires an argument")
if argv[0] == "all":
if argc > 1:
raise gdb.GdbError(cmd_name + ": with 'all' " \ raise gdb.GdbError(cmd_name + ": with 'all' " \
"you may not specify a filter.") "you may not specify a filter.")
else: elif argc != 2:
if argv[0] != "all" and argc != 2:
raise gdb.GdbError(cmd_name + " takes exactly two arguments.") raise gdb.GdbError(cmd_name + " takes exactly two arguments.")
return argv return argv
@ -209,19 +210,17 @@ def _complete_frame_filter_name(word, printer_dict):
class EnableFrameFilter(gdb.Command): class EnableFrameFilter(gdb.Command):
"""GDB command to enable the specified frame-filter. """GDB command to enable the specified frame-filter.
Usage: enable frame-filter enable DICTIONARY [NAME] Usage: enable frame-filter DICTIONARY [NAME]
DICTIONARY is the name of the frame filter dictionary on which to DICTIONARY is the name of the frame filter dictionary on which to
operate. If dictionary is set to "all", perform operations on all operate. If dictionary is set to "all", perform operations on all
dictionaries. Named dictionaries are: "global" for the global dictionaries. Named dictionaries are: "global" for the global
frame filter dictionary, "progspace" for the program space's frame frame filter dictionary, "progspace" for the program space's frame
filter dictionary. If either all, or the two named dictionaries filter dictionary. If either all, or the two named dictionaries
are not specified, the dictionary name is assumed to be the name are not specified, the dictionary name is assumed to be the name
of the object-file name. of an "objfile" -- a shared library or an executable.
NAME matches the name of the frame-filter to operate on. If NAME matches the name of the frame-filter to operate on."""
DICTIONARY is "all", NAME is ignored.
"""
def __init__(self): def __init__(self):
super(EnableFrameFilter, self).__init__("enable frame-filter", super(EnableFrameFilter, self).__init__("enable frame-filter",
gdb.COMMAND_DATA) gdb.COMMAND_DATA)
@ -242,19 +241,17 @@ class EnableFrameFilter(gdb.Command):
class DisableFrameFilter(gdb.Command): class DisableFrameFilter(gdb.Command):
"""GDB command to disable the specified frame-filter. """GDB command to disable the specified frame-filter.
Usage: disable frame-filter disable DICTIONARY [NAME] Usage: disable frame-filter DICTIONARY [NAME]
DICTIONARY is the name of the frame filter dictionary on which to DICTIONARY is the name of the frame filter dictionary on which to
operate. If dictionary is set to "all", perform operations on all operate. If dictionary is set to "all", perform operations on all
dictionaries. Named dictionaries are: "global" for the global dictionaries. Named dictionaries are: "global" for the global
frame filter dictionary, "progspace" for the program space's frame frame filter dictionary, "progspace" for the program space's frame
filter dictionary. If either all, or the two named dictionaries filter dictionary. If either all, or the two named dictionaries
are not specified, the dictionary name is assumed to be the name are not specified, the dictionary name is assumed to be the name
of the object-file name. of an "objfile" -- a shared library or an executable.
NAME matches the name of the frame-filter to operate on. If NAME matches the name of the frame-filter to operate on."""
DICTIONARY is "all", NAME is ignored.
"""
def __init__(self): def __init__(self):
super(DisableFrameFilter, self).__init__("disable frame-filter", super(DisableFrameFilter, self).__init__("disable frame-filter",
gdb.COMMAND_DATA) gdb.COMMAND_DATA)
@ -275,19 +272,19 @@ class DisableFrameFilter(gdb.Command):
class SetFrameFilterPriority(gdb.Command): class SetFrameFilterPriority(gdb.Command):
"""GDB command to set the priority of the specified frame-filter. """GDB command to set the priority of the specified frame-filter.
Usage: set frame-filter priority DICTIONARY NAME PRIORITY Usage: set frame-filter priority DICTIONARY NAME PRIORITY
DICTIONARY is the name of the frame filter dictionary on which to DICTIONARY is the name of the frame filter dictionary on which to
operate. Named dictionaries are: "global" for the global frame operate. Named dictionaries are: "global" for the global frame
filter dictionary, "progspace" for the program space's framefilter filter dictionary, "progspace" for the program space's framefilter
dictionary. If either of these two are not specified, the dictionary. If either of these two are not specified, the
dictionary name is assumed to be the name of the object-file name. dictionary name is assumed to be the name of an "objfile" -- a
shared library or an executable.
NAME matches the name of the frame filter to operate on. NAME matches the name of the frame filter to operate on.
PRIORITY is the an integer to assign the new priority to the frame PRIORITY is the an integer to assign the new priority to the frame
filter. filter."""
"""
def __init__(self): def __init__(self):
super(SetFrameFilterPriority, self).__init__("set frame-filter " \ super(SetFrameFilterPriority, self).__init__("set frame-filter " \
@ -361,16 +358,16 @@ class SetFrameFilterPriority(gdb.Command):
class ShowFrameFilterPriority(gdb.Command): class ShowFrameFilterPriority(gdb.Command):
"""GDB command to show the priority of the specified frame-filter. """GDB command to show the priority of the specified frame-filter.
Usage: show frame-filter priority DICTIONARY NAME Usage: show frame-filter priority DICTIONARY NAME
DICTIONARY is the name of the frame filter dictionary on which to DICTIONARY is the name of the frame filter dictionary on which to
operate. Named dictionaries are: "global" for the global frame operate. Named dictionaries are: "global" for the global frame
filter dictionary, "progspace" for the program space's framefilter filter dictionary, "progspace" for the program space's framefilter
dictionary. If either of these two are not specified, the dictionary. If either of these two are not specified, the
dictionary name is assumed to be the name of the object-file name. dictionary name is assumed to be the name of an "objfile" -- a
shared library or an executable.
NAME matches the name of the frame-filter to operate on. NAME matches the name of the frame-filter to operate on."""
"""
def __init__(self): def __init__(self):
super(ShowFrameFilterPriority, self).__init__("show frame-filter " \ super(ShowFrameFilterPriority, self).__init__("show frame-filter " \

View file

@ -84,16 +84,15 @@ def printer_enabled_p(printer):
class InfoPrettyPrinter(gdb.Command): class InfoPrettyPrinter(gdb.Command):
"""GDB command to list all registered pretty-printers. """GDB command to list all registered pretty-printers.
Usage: info pretty-printer [object-regexp [name-regexp]] Usage: info pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]
OBJECT-REGEXP is a regular expression matching the objects to list. OBJECT-REGEXP is a regular expression matching the objects to list.
Objects are "global", the program space's file, and the objfiles within Objects are "global", the program space's file, and the objfiles within
that program space. that program space.
NAME-REGEXP matches the name of the pretty-printer. NAME-REGEXP matches the name of the pretty-printer.
Individual printers in a collection are named as Individual printers in a collection are named as
printer-name;subprinter-name. printer-name;subprinter-name."""
"""
def __init__ (self): def __init__ (self):
super(InfoPrettyPrinter, self).__init__("info pretty-printer", super(InfoPrettyPrinter, self).__init__("info pretty-printer",
@ -316,16 +315,15 @@ def do_enable_pretty_printer (arg, flag):
class EnablePrettyPrinter (gdb.Command): class EnablePrettyPrinter (gdb.Command):
"""GDB command to enable the specified pretty-printer. """GDB command to enable the specified pretty-printer.
Usage: enable pretty-printer [object-regexp [name-regexp]] Usage: enable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]
OBJECT-REGEXP is a regular expression matching the objects to examine. OBJECT-REGEXP is a regular expression matching the objects to examine.
Objects are "global", the program space's file, and the objfiles within Objects are "global", the program space's file, and the objfiles within
that program space. that program space.
NAME-REGEXP matches the name of the pretty-printer. NAME-REGEXP matches the name of the pretty-printer.
Individual printers in a collection are named as Individual printers in a collection are named as
printer-name;subprinter-name. printer-name;subprinter-name."""
"""
def __init__(self): def __init__(self):
super(EnablePrettyPrinter, self).__init__("enable pretty-printer", super(EnablePrettyPrinter, self).__init__("enable pretty-printer",
@ -339,16 +337,15 @@ class EnablePrettyPrinter (gdb.Command):
class DisablePrettyPrinter (gdb.Command): class DisablePrettyPrinter (gdb.Command):
"""GDB command to disable the specified pretty-printer. """GDB command to disable the specified pretty-printer.
Usage: disable pretty-printer [object-regexp [name-regexp]] Usage: disable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]
OBJECT-REGEXP is a regular expression matching the objects to examine. OBJECT-REGEXP is a regular expression matching the objects to examine.
Objects are "global", the program space's file, and the objfiles within Objects are "global", the program space's file, and the objfiles within
that program space. that program space.
NAME-REGEXP matches the name of the pretty-printer. NAME-REGEXP matches the name of the pretty-printer.
Individual printers in a collection are named as Individual printers in a collection are named as
printer-name;subprinter-name. printer-name;subprinter-name."""
"""
def __init__(self): def __init__(self):
super(DisablePrettyPrinter, self).__init__("disable pretty-printer", super(DisablePrettyPrinter, self).__init__("disable pretty-printer",

View file

@ -22,8 +22,7 @@ import gdb
class InfoTypePrinter(gdb.Command): class InfoTypePrinter(gdb.Command):
"""GDB command to list all registered type-printers. """GDB command to list all registered type-printers.
Usage: info type-printers Usage: info type-printers"""
"""
def __init__ (self): def __init__ (self):
super(InfoTypePrinter, self).__init__("info type-printers", super(InfoTypePrinter, self).__init__("info type-printers",
@ -101,10 +100,9 @@ class _EnableOrDisableCommand(gdb.Command):
class EnableTypePrinter(_EnableOrDisableCommand): class EnableTypePrinter(_EnableOrDisableCommand):
"""GDB command to enable the specified type printer. """GDB command to enable the specified type printer.
Usage: enable type-printer NAME Usage: enable type-printer NAME
NAME is the name of the type-printer. NAME is the name of the type-printer."""
"""
def __init__(self): def __init__(self):
super(EnableTypePrinter, self).__init__(True, "enable type-printer") super(EnableTypePrinter, self).__init__(True, "enable type-printer")
@ -112,10 +110,9 @@ class EnableTypePrinter(_EnableOrDisableCommand):
class DisableTypePrinter(_EnableOrDisableCommand): class DisableTypePrinter(_EnableOrDisableCommand):
"""GDB command to disable the specified type-printer. """GDB command to disable the specified type-printer.
Usage: disable type-printer NAME Usage: disable type-printer NAME
NAME is the name of the type-printer. NAME is the name of the type-printer."""
"""
def __init__(self): def __init__(self):
super(DisableTypePrinter, self).__init__(False, "disable type-printer") super(DisableTypePrinter, self).__init__(False, "disable type-printer")

View file

@ -56,18 +56,17 @@ def parse_unwinder_command_args(arg):
class InfoUnwinder(gdb.Command): class InfoUnwinder(gdb.Command):
"""GDB command to list unwinders. """GDB command to list unwinders.
Usage: info unwinder [locus-regexp [name-regexp]] Usage: info unwinder [LOCUS-REGEXP [NAME-REGEXP]]
LOCUS-REGEXP is a regular expression matching the location of the LOCUS-REGEXP is a regular expression matching the location of the
unwinder. If it is omitted, all registered unwinders from all unwinder. If it is omitted, all registered unwinders from all
loci are listed. A locus can be 'global', 'progspace' to list loci are listed. A locus can be 'global', 'progspace' to list
the unwinders from the current progspace, or a regular expression the unwinders from the current progspace, or a regular expression
matching filenames of objfiles. matching filenames of objfiles.
NAME-REGEXP is a regular expression to filter unwinder names. If NAME-REGEXP is a regular expression to filter unwinder names. If
this omitted for a specified locus, then all registered unwinders this omitted for a specified locus, then all registered unwinders
in the locus are listed. in the locus are listed."""
"""
def __init__(self): def __init__(self):
super(InfoUnwinder, self).__init__("info unwinder", super(InfoUnwinder, self).__init__("info unwinder",
@ -145,17 +144,15 @@ def do_enable_unwinder(arg, flag):
class EnableUnwinder(gdb.Command): class EnableUnwinder(gdb.Command):
"""GDB command to enable unwinders. """GDB command to enable unwinders.
Usage: enable unwinder [locus-regexp [name-regexp]] Usage: enable unwinder [LOCUS-REGEXP [NAME-REGEXP]]
LOCUS-REGEXP is a regular expression specifying the unwinders to LOCUS-REGEXP is a regular expression specifying the unwinders to
enable. It can 'global', 'progspace', or the name of an objfile enable. It can 'global', 'progspace', or the name of an objfile
within that progspace. within that progspace.
NAME_REGEXP is a regular expression to filter unwinder names. If NAME_REGEXP is a regular expression to filter unwinder names. If
this omitted for a specified locus, then all registered unwinders this omitted for a specified locus, then all registered unwinders
in the locus are affected. in the locus are affected."""
"""
def __init__(self): def __init__(self):
super(EnableUnwinder, self).__init__("enable unwinder", super(EnableUnwinder, self).__init__("enable unwinder",
@ -169,17 +166,15 @@ class EnableUnwinder(gdb.Command):
class DisableUnwinder(gdb.Command): class DisableUnwinder(gdb.Command):
"""GDB command to disable the specified unwinder. """GDB command to disable the specified unwinder.
Usage: disable unwinder [locus-regexp [name-regexp]] Usage: disable unwinder [LOCUS-REGEXP [NAME-REGEXP]]
LOCUS-REGEXP is a regular expression specifying the unwinders to LOCUS-REGEXP is a regular expression specifying the unwinders to
disable. It can 'global', 'progspace', or the name of an objfile disable. It can 'global', 'progspace', or the name of an objfile
within that progspace. within that progspace.
NAME_REGEXP is a regular expression to filter unwinder names. If NAME_REGEXP is a regular expression to filter unwinder names. If
this omitted for a specified locus, then all registered unwinders this omitted for a specified locus, then all registered unwinders
in the locus are affected. in the locus are affected."""
"""
def __init__(self): def __init__(self):
super(DisableUnwinder, self).__init__("disable unwinder", super(DisableUnwinder, self).__init__("disable unwinder",

View file

@ -177,21 +177,20 @@ def set_xm_status(arg, status):
class InfoXMethod(gdb.Command): class InfoXMethod(gdb.Command):
"""GDB command to list registered xmethod matchers. """GDB command to list registered xmethod matchers.
Usage: info xmethod [locus-regexp [name-regexp]] Usage: info xmethod [LOCUS-REGEXP [NAME-REGEXP]]
LOCUS-REGEXP is a regular expression matching the location of the LOCUS-REGEXP is a regular expression matching the location of the
xmethod matchers. If it is omitted, all registered xmethod matchers xmethod matchers. If it is omitted, all registered xmethod matchers
from all loci are listed. A locus could be 'global', a regular expression from all loci are listed. A locus could be 'global', a regular expression
matching the current program space's filename, or a regular expression matching the current program space's filename, or a regular expression
matching filenames of objfiles. Locus could be 'progspace' to specify that matching filenames of objfiles. Locus could be 'progspace' to specify that
only xmethods from the current progspace should be listed. only xmethods from the current progspace should be listed.
NAME-REGEXP is a regular expression matching the names of xmethod NAME-REGEXP is a regular expression matching the names of xmethod
matchers. If this omitted for a specified locus, then all registered matchers. If this omitted for a specified locus, then all registered
xmethods in the locus are listed. To list only a certain xmethods xmethods in the locus are listed. To list only a certain xmethods
managed by a single matcher, the name regexp can be specified as managed by a single matcher, the name regexp can be specified as
matcher-name-regexp;xmethod-name-regexp. matcher-name-regexp;xmethod-name-regexp."""
"""
def __init__(self): def __init__(self):
super(InfoXMethod, self).__init__("info xmethod", super(InfoXMethod, self).__init__("info xmethod",
@ -213,21 +212,20 @@ class InfoXMethod(gdb.Command):
class EnableXMethod(gdb.Command): class EnableXMethod(gdb.Command):
"""GDB command to enable a specified (group of) xmethod(s). """GDB command to enable a specified (group of) xmethod(s).
Usage: enable xmethod [locus-regexp [name-regexp]] Usage: enable xmethod [LOCUS-REGEXP [NAME-REGEXP]]
LOCUS-REGEXP is a regular expression matching the location of the LOCUS-REGEXP is a regular expression matching the location of the
xmethod matchers. If it is omitted, all registered xmethods matchers xmethod matchers. If it is omitted, all registered xmethods matchers
from all loci are enabled. A locus could be 'global', a regular expression from all loci are enabled. A locus could be 'global', a regular expression
matching the current program space's filename, or a regular expression matching the current program space's filename, or a regular expression
matching filenames of objfiles. Locus could be 'progspace' to specify that matching filenames of objfiles. Locus could be 'progspace' to specify that
only xmethods from the current progspace should be enabled. only xmethods from the current progspace should be enabled.
NAME-REGEXP is a regular expression matching the names of xmethods NAME-REGEXP is a regular expression matching the names of xmethods
within a given locus. If this omitted for a specified locus, then all within a given locus. If this omitted for a specified locus, then all
registered xmethod matchers in the locus are enabled. To enable only registered xmethod matchers in the locus are enabled. To enable only
a certain xmethods managed by a single matcher, the name regexp can be a certain xmethods managed by a single matcher, the name regexp can be
specified as matcher-name-regexp;xmethod-name-regexp. specified as matcher-name-regexp;xmethod-name-regexp."""
"""
def __init__(self): def __init__(self):
super(EnableXMethod, self).__init__("enable xmethod", super(EnableXMethod, self).__init__("enable xmethod",
@ -240,21 +238,20 @@ class EnableXMethod(gdb.Command):
class DisableXMethod(gdb.Command): class DisableXMethod(gdb.Command):
"""GDB command to disable a specified (group of) xmethod(s). """GDB command to disable a specified (group of) xmethod(s).
Usage: disable xmethod [locus-regexp [name-regexp]] Usage: disable xmethod [LOCUS-REGEXP [NAME-REGEXP]]
LOCUS-REGEXP is a regular expression matching the location of the LOCUS-REGEXP is a regular expression matching the location of the
xmethod matchers. If it is omitted, all registered xmethod matchers xmethod matchers. If it is omitted, all registered xmethod matchers
from all loci are disabled. A locus could be 'global', a regular from all loci are disabled. A locus could be 'global', a regular
expression matching the current program space's filename, or a regular expression matching the current program space's filename, or a regular
expression filenames of objfiles. Locus could be 'progspace' to specify expression filenames of objfiles. Locus could be 'progspace' to specify
that only xmethods from the current progspace should be disabled. that only xmethods from the current progspace should be disabled.
NAME-REGEXP is a regular expression matching the names of xmethods NAME-REGEXP is a regular expression matching the names of xmethods
within a given locus. If this omitted for a specified locus, then all within a given locus. If this omitted for a specified locus, then all
registered xmethod matchers in the locus are disabled. To disable registered xmethod matchers in the locus are disabled. To disable
only a certain xmethods managed by a single matcher, the name regexp only a certain xmethods managed by a single matcher, the name regexp
can be specified as matcher-name-regexp;xmethod-name-regexp. can be specified as matcher-name-regexp;xmethod-name-regexp."""
"""
def __init__(self): def __init__(self):
super(DisableXMethod, self).__init__("disable xmethod", super(DisableXMethod, self).__init__("disable xmethod",

View file

@ -19,16 +19,14 @@ import gdb
class _AsString(gdb.Function): class _AsString(gdb.Function):
"""Return the string representation of a value. """Return the string representation of a value.
Usage: Usage: $_as_string (VALUE)
$_as_string(value)
Arguments: Arguments:
value: A gdb.Value. VALUE: any value
Returns: Returns:
The string representation of the value. The string representation of the value."""
"""
def __init__(self): def __init__(self):
super(_AsString, self).__init__("_as_string") super(_AsString, self).__init__("_as_string")

View file

@ -20,21 +20,19 @@ import re
class CallerIs(gdb.Function): class CallerIs(gdb.Function):
"""Check the calling function's name. """Check the calling function's name.
Usage: Usage: $_caller_is (NAME [, NUMBER-OF-FRAMES])
$_caller_is(name [, number_of_frames])
Arguments: Arguments:
name: The name of the function to search for. NAME: The name of the function to search for.
number_of_frames: How many stack frames to traverse back from the currently NUMBER-OF-FRAMES: How many stack frames to traverse back from the currently
selected frame to compare with. If the value is greater than the depth of selected frame to compare with. If the value is greater than the depth of
the stack from that point then the result is False. the stack from that point then the result is False.
The default is 1. The default is 1.
Returns: Returns:
True if the function's name at the specified frame is equal to name. True if the function's name at the specified frame is equal to NAME."""
"""
def __init__(self): def __init__(self):
super(CallerIs, self).__init__("_caller_is") super(CallerIs, self).__init__("_caller_is")
@ -53,21 +51,19 @@ Returns:
class CallerMatches(gdb.Function): class CallerMatches(gdb.Function):
"""Compare the calling function's name with a regexp. """Compare the calling function's name with a regexp.
Usage: Usage: $_caller_matches (REGEX [, NUMBER-OF-FRAMES])
$_caller_matches(regex [, number_of_frames])
Arguments: Arguments:
regex: The regular expression to compare the function's name with. REGEX: The regular expression to compare the function's name with.
number_of_frames: How many stack frames to traverse back from the currently NUMBER-OF-FRAMES: How many stack frames to traverse back from the currently
selected frame to compare with. If the value is greater than the depth of selected frame to compare with. If the value is greater than the depth of
the stack from that point then the result is False. the stack from that point then the result is False.
The default is 1. The default is 1.
Returns: Returns:
True if the function's name at the specified frame matches regex. True if the function's name at the specified frame matches REGEX."""
"""
def __init__(self): def __init__(self):
super(CallerMatches, self).__init__("_caller_matches") super(CallerMatches, self).__init__("_caller_matches")
@ -86,21 +82,19 @@ Returns:
class AnyCallerIs(gdb.Function): class AnyCallerIs(gdb.Function):
"""Check all calling function's names. """Check all calling function's names.
Usage: Usage: $_any_caller_is (NAME [, NUMBER-OF-FRAMES])
$_any_caller_is(name [, number_of_frames])
Arguments: Arguments:
name: The name of the function to search for. NAME: The name of the function to search for.
number_of_frames: How many stack frames to traverse back from the currently NUMBER-OF-FRAMES: How many stack frames to traverse back from the currently
selected frame to compare with. If the value is greater than the depth of selected frame to compare with. If the value is greater than the depth of
the stack from that point then the result is False. the stack from that point then the result is False.
The default is 1. The default is 1.
Returns: Returns:
True if any function's name is equal to name. True if any function's name is equal to NAME."""
"""
def __init__(self): def __init__(self):
super(AnyCallerIs, self).__init__("_any_caller_is") super(AnyCallerIs, self).__init__("_any_caller_is")
@ -121,21 +115,19 @@ Returns:
class AnyCallerMatches(gdb.Function): class AnyCallerMatches(gdb.Function):
"""Compare all calling function's names with a regexp. """Compare all calling function's names with a regexp.
Usage: Usage: $_any_caller_matches (REGEX [, NUMBER-OF-FRAMES])
$_any_caller_matches(regex [, number_of_frames])
Arguments: Arguments:
regex: The regular expression to compare the function's name with. REGEX: The regular expression to compare the function's name with.
number_of_frames: How many stack frames to traverse back from the currently NUMBER-OF-FRAMES: How many stack frames to traverse back from the currently
selected frame to compare with. If the value is greater than the depth of selected frame to compare with. If the value is greater than the depth of
the stack from that point then the result is False. the stack from that point then the result is False.
The default is 1. The default is 1.
Returns: Returns:
True if any function's name matches regex. True if any function's name matches REGEX."""
"""
def __init__(self): def __init__(self):
super(AnyCallerMatches, self).__init__("_any_caller_matches") super(AnyCallerMatches, self).__init__("_any_caller_matches")

View file

@ -23,12 +23,10 @@ import re
class _MemEq(gdb.Function): class _MemEq(gdb.Function):
"""$_memeq - compare bytes of memory """$_memeq - compare bytes of memory
Usage: Usage: $_memeq (A, B, LEN)
$_memeq(a, b, len)
Returns: Returns:
True if len bytes at a and b compare equally. True if LEN bytes at A and B compare equally."""
"""
def __init__(self): def __init__(self):
super(_MemEq, self).__init__("_memeq") super(_MemEq, self).__init__("_memeq")
@ -48,12 +46,10 @@ Returns:
class _StrLen(gdb.Function): class _StrLen(gdb.Function):
"""$_strlen - compute string length """$_strlen - compute string length
Usage: Usage: $_strlen (A)
$_strlen(a)
Returns: Returns:
Length of string a, assumed to be a string in the current language. Length of string A, assumed to be a string in the current language."""
"""
def __init__(self): def __init__(self):
super(_StrLen, self).__init__("_strlen") super(_StrLen, self).__init__("_strlen")
@ -65,16 +61,14 @@ Returns:
class _StrEq(gdb.Function): class _StrEq(gdb.Function):
"""$_streq - check string equality """$_streq - check string equality
Usage: Usage: $_streq (A, B)
$_streq(a, b)
Returns: Returns:
True if a and b are identical strings in the current language. True if A and B are identical strings in the current language.
Example (amd64-linux): Example (amd64-linux):
catch syscall open catch syscall open
cond $bpnum $_streq((char*) $rdi, "foo") cond $bpnum $_streq((char*) $rdi, "foo")"""
"""
def __init__(self): def __init__(self):
super(_StrEq, self).__init__("_streq") super(_StrEq, self).__init__("_streq")
@ -85,13 +79,11 @@ Example (amd64-linux):
class _RegEx(gdb.Function): class _RegEx(gdb.Function):
"""$_regex - check if a string matches a regular expression """$_regex - check if a string matches a regular expression
Usage: Usage: $_regex (STRING, REGEX)
$_regex(string, regex)
Returns: Returns:
True if string str (in the current language) matches the True if string STRING (in the current language) matches the
regular expression regex. regular expression REGEX."""
"""
def __init__(self): def __init__(self):
super(_RegEx, self).__init__("_regex") super(_RegEx, self).__init__("_regex")