Update help text for commands implemented in Python

Message ID 20180918051014.25542-1-tom@tromey.com
State New
Headers show
Series
  • Update help text for commands implemented in Python
Related show

Commit Message

Tom Tromey Sept. 18, 2018, 5:10 a.m.
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-09-17  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.
---
 gdb/ChangeLog                                 | 25 +++++
 gdb/python/lib/gdb/command/explore.py         | 36 +++-----
 gdb/python/lib/gdb/command/frame_filters.py   | 91 +++++++++----------
 gdb/python/lib/gdb/command/pretty_printers.py | 45 +++++----
 gdb/python/lib/gdb/command/type_printers.py   | 13 +--
 gdb/python/lib/gdb/command/unwinders.py       | 51 +++++------
 gdb/python/lib/gdb/command/xmethods.py        | 79 ++++++++--------
 gdb/python/lib/gdb/function/as_string.py      |  8 +-
 gdb/python/lib/gdb/function/caller_is.py      | 40 ++++----
 gdb/python/lib/gdb/function/strfns.py         | 28 ++----
 10 files changed, 198 insertions(+), 218 deletions(-)

-- 
2.17.1

Comments

Tom Tromey Oct. 7, 2018, 4:02 a.m. | #1
>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:


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

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

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

Tom> This patch fixes all the problems I noticed.

I'm checking this in now.

Tom

Patch

diff --git a/gdb/python/lib/gdb/command/explore.py b/gdb/python/lib/gdb/command/explore.py
index 2efd14d97b6..0bc475c2daa 100644
--- a/gdb/python/lib/gdb/command/explore.py
+++ b/gdb/python/lib/gdb/command/explore.py
@@ -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:
-
-         explore value ARG
+Usage: 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.
-
-       Usage:
+    """Explore a type or the type of an expression.
 
-         explore type ARG
+Usage: 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__(
diff --git a/gdb/python/lib/gdb/command/frame_filters.py b/gdb/python/lib/gdb/command/frame_filters.py
index 16a40ed98ed..217fce56ef0 100644
--- a/gdb/python/lib/gdb/command/frame_filters.py
+++ b/gdb/python/lib/gdb/command/frame_filters.py
@@ -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 " \
diff --git a/gdb/python/lib/gdb/command/pretty_printers.py b/gdb/python/lib/gdb/command/pretty_printers.py
index a6ee9559a6a..429505f93ec 100644
--- a/gdb/python/lib/gdb/command/pretty_printers.py
+++ b/gdb/python/lib/gdb/command/pretty_printers.py
@@ -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",
diff --git a/gdb/python/lib/gdb/command/type_printers.py b/gdb/python/lib/gdb/command/type_printers.py
index 3baf19104ef..d089c0b4dc5 100644
--- a/gdb/python/lib/gdb/command/type_printers.py
+++ b/gdb/python/lib/gdb/command/type_printers.py
@@ -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")
diff --git a/gdb/python/lib/gdb/command/unwinders.py b/gdb/python/lib/gdb/command/unwinders.py
index f970e726ec6..a6309922b5e 100644
--- a/gdb/python/lib/gdb/command/unwinders.py
+++ b/gdb/python/lib/gdb/command/unwinders.py
@@ -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]]
-
-    LOCUS-REGEXP is a regular expression specifying the unwinders to
-    enable.  It can 'global', 'progspace', or the name of an objfile
-    within that progspace.
+Usage: enable unwinder [LOCUS-REGEXP [NAME-REGEXP]]
 
-    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.
+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."""
 
     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",
diff --git a/gdb/python/lib/gdb/command/xmethods.py b/gdb/python/lib/gdb/command/xmethods.py
index 68315a7ef05..2baf9ba22fa 100644
--- a/gdb/python/lib/gdb/command/xmethods.py
+++ b/gdb/python/lib/gdb/command/xmethods.py
@@ -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]]
-
-    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.
-    """
+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.
+
+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",
diff --git a/gdb/python/lib/gdb/function/as_string.py b/gdb/python/lib/gdb/function/as_string.py
index faa65e3a0fe..2bc8f174bf6 100644
--- a/gdb/python/lib/gdb/function/as_string.py
+++ b/gdb/python/lib/gdb/function/as_string.py
@@ -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")
diff --git a/gdb/python/lib/gdb/function/caller_is.py b/gdb/python/lib/gdb/function/caller_is.py
index 49aa41c7096..081dcbe6e25 100644
--- a/gdb/python/lib/gdb/function/caller_is.py
+++ b/gdb/python/lib/gdb/function/caller_is.py
@@ -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")
diff --git a/gdb/python/lib/gdb/function/strfns.py b/gdb/python/lib/gdb/function/strfns.py
index 47620f3893b..70772c9804f 100644
--- a/gdb/python/lib/gdb/function/strfns.py
+++ b/gdb/python/lib/gdb/function/strfns.py
@@ -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")