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>
PR tui/28819:

View File

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

View File

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

View File

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

View File

@ -22,8 +22,7 @@ import gdb
class InfoTypePrinter(gdb.Command):
"""GDB command to list all registered type-printers.
Usage: info type-printers
"""
Usage: info type-printers"""
def __init__ (self):
super(InfoTypePrinter, self).__init__("info type-printers",
@ -101,10 +100,9 @@ class _EnableOrDisableCommand(gdb.Command):
class EnableTypePrinter(_EnableOrDisableCommand):
"""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):
super(EnableTypePrinter, self).__init__(True, "enable type-printer")
@ -112,10 +110,9 @@ class EnableTypePrinter(_EnableOrDisableCommand):
class DisableTypePrinter(_EnableOrDisableCommand):
"""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):
super(DisableTypePrinter, self).__init__(False, "disable type-printer")

View File

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

View File

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

View File

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

View File

@ -20,21 +20,19 @@ import re
class CallerIs(gdb.Function):
"""Check the calling function's name.
Usage:
$_caller_is(name [, number_of_frames])
Usage: $_caller_is (NAME [, NUMBER-OF-FRAMES])
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
the stack from that point then the result is False.
The default is 1.
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):
super(CallerIs, self).__init__("_caller_is")
@ -53,21 +51,19 @@ Returns:
class CallerMatches(gdb.Function):
"""Compare the calling function's name with a regexp.
Usage:
$_caller_matches(regex [, number_of_frames])
Usage: $_caller_matches (REGEX [, NUMBER-OF-FRAMES])
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
the stack from that point then the result is False.
The default is 1.
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):
super(CallerMatches, self).__init__("_caller_matches")
@ -86,21 +82,19 @@ Returns:
class AnyCallerIs(gdb.Function):
"""Check all calling function's names.
Usage:
$_any_caller_is(name [, number_of_frames])
Usage: $_any_caller_is (NAME [, NUMBER-OF-FRAMES])
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
the stack from that point then the result is False.
The default is 1.
Returns:
True if any function's name is equal to name.
"""
True if any function's name is equal to NAME."""
def __init__(self):
super(AnyCallerIs, self).__init__("_any_caller_is")
@ -121,21 +115,19 @@ Returns:
class AnyCallerMatches(gdb.Function):
"""Compare all calling function's names with a regexp.
Usage:
$_any_caller_matches(regex [, number_of_frames])
Usage: $_any_caller_matches (REGEX [, NUMBER-OF-FRAMES])
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
the stack from that point then the result is False.
The default is 1.
Returns:
True if any function's name matches regex.
"""
True if any function's name matches REGEX."""
def __init__(self):
super(AnyCallerMatches, self).__init__("_any_caller_matches")

View File

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