summaryrefslogtreecommitdiff
path: root/share/gdb/python/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'share/gdb/python/gdb')
-rw-r--r--share/gdb/python/gdb/FrameDecorator.py2
-rw-r--r--share/gdb/python/gdb/FrameIterator.py2
-rw-r--r--share/gdb/python/gdb/__init__.py29
-rw-r--r--share/gdb/python/gdb/command/__init__.py2
-rw-r--r--share/gdb/python/gdb/command/explore.py40
-rw-r--r--share/gdb/python/gdb/command/frame_filters.py155
-rw-r--r--share/gdb/python/gdb/command/pretty_printers.py49
-rw-r--r--share/gdb/python/gdb/command/prompt.py2
-rw-r--r--share/gdb/python/gdb/command/type_printers.py15
-rw-r--r--share/gdb/python/gdb/command/unwinders.py55
-rw-r--r--share/gdb/python/gdb/command/xmethods.py77
-rw-r--r--share/gdb/python/gdb/frames.py2
-rw-r--r--share/gdb/python/gdb/function/__init__.py2
-rw-r--r--share/gdb/python/gdb/function/as_string.py37
-rw-r--r--share/gdb/python/gdb/function/caller_is.py42
-rw-r--r--share/gdb/python/gdb/function/strfns.py30
-rw-r--r--share/gdb/python/gdb/printer/__init__.py2
-rw-r--r--share/gdb/python/gdb/printer/bound_registers.py9
-rw-r--r--share/gdb/python/gdb/printing.py2
-rw-r--r--share/gdb/python/gdb/prompt.py2
-rw-r--r--share/gdb/python/gdb/types.py6
-rw-r--r--share/gdb/python/gdb/unwinder.py3
-rw-r--r--share/gdb/python/gdb/xmethod.py2
23 files changed, 293 insertions, 274 deletions
diff --git a/share/gdb/python/gdb/FrameDecorator.py b/share/gdb/python/gdb/FrameDecorator.py
index d6bfa1e..4eba088 100644
--- a/share/gdb/python/gdb/FrameDecorator.py
+++ b/share/gdb/python/gdb/FrameDecorator.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2016 Free Software Foundation, Inc.
+# Copyright (C) 2013-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/share/gdb/python/gdb/FrameIterator.py b/share/gdb/python/gdb/FrameIterator.py
index 70dfaf3..4950caf 100644
--- a/share/gdb/python/gdb/FrameIterator.py
+++ b/share/gdb/python/gdb/FrameIterator.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2016 Free Software Foundation, Inc.
+# Copyright (C) 2013-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/share/gdb/python/gdb/__init__.py b/share/gdb/python/gdb/__init__.py
index 5205cc9..af74df8 100644
--- a/share/gdb/python/gdb/__init__.py
+++ b/share/gdb/python/gdb/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2016 Free Software Foundation, Inc.
+# Copyright (C) 2010-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -85,15 +85,14 @@ def execute_unwinders(pending_frame):
Returns:
gdb.UnwindInfo instance or None.
"""
- for objfile in _gdb.objfiles():
+ for objfile in objfiles():
for unwinder in objfile.frame_unwinders:
if unwinder.enabled:
unwind_info = unwinder(pending_frame)
if unwind_info is not None:
return unwind_info
- current_progspace = _gdb.current_progspace()
- for unwinder in current_progspace.frame_unwinders:
+ for unwinder in current_progspace().frame_unwinders:
if unwinder.enabled:
unwind_info = unwinder(pending_frame)
if unwind_info is not None:
@@ -163,3 +162,25 @@ def GdbSetPythonDirectory(dir):
# attributes
reload(__import__(__name__))
auto_load_packages()
+
+def current_progspace():
+ "Return the current Progspace."
+ return selected_inferior().progspace
+
+def objfiles():
+ "Return a sequence of the current program space's objfiles."
+ return current_progspace().objfiles()
+
+def solib_name (addr):
+ """solib_name (Long) -> String.\n\
+Return the name of the shared library holding a given address, or None."""
+ return current_progspace().solib_name(addr)
+
+def block_for_pc(pc):
+ "Return the block containing the given pc value, or None."
+ return current_progspace().block_for_pc(pc)
+
+def find_pc_line(pc):
+ """find_pc_line (pc) -> Symtab_and_line.
+Return the gdb.Symtab_and_line object corresponding to the pc value."""
+ return current_progspace().find_pc_line(pc)
diff --git a/share/gdb/python/gdb/command/__init__.py b/share/gdb/python/gdb/command/__init__.py
index 8433d50..9cd48f1 100644
--- a/share/gdb/python/gdb/command/__init__.py
+++ b/share/gdb/python/gdb/command/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2016 Free Software Foundation, Inc.
+# Copyright (C) 2010-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/share/gdb/python/gdb/command/explore.py b/share/gdb/python/gdb/command/explore.py
index 6c9f17b..f782a97 100644
--- a/share/gdb/python/gdb/command/explore.py
+++ b/share/gdb/python/gdb/command/explore.py
@@ -1,5 +1,5 @@
# GDB 'explore' command.
-# Copyright (C) 2012-2016 Free Software Foundation, Inc.
+# Copyright (C) 2012-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -132,6 +132,7 @@ class Explorer(object):
gdb.TYPE_CODE_UNION : CompoundExplorer,
gdb.TYPE_CODE_PTR : PointerExplorer,
gdb.TYPE_CODE_REF : ReferenceExplorer,
+ gdb.TYPE_CODE_RVALUE_REF : ReferenceExplorer,
gdb.TYPE_CODE_TYPEDEF : TypedefExplorer,
gdb.TYPE_CODE_ARRAY : ArrayExplorer
}
@@ -318,7 +319,6 @@ class ReferenceExplorer(object):
Explorer.explore_type(name, target_type, is_child)
return False
-
class ArrayExplorer(object):
"""Internal class used to explore arrays."""
@@ -649,14 +649,11 @@ class ExploreUtils(object):
class ExploreCommand(gdb.Command):
"""Explore a value or a type valid in the current context.
- Usage:
-
- explore ARG
+Usage: 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.
-
- 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/share/gdb/python/gdb/command/frame_filters.py b/share/gdb/python/gdb/command/frame_filters.py
index c9d4f3e..9d28f84 100644
--- a/share/gdb/python/gdb/command/frame_filters.py
+++ b/share/gdb/python/gdb/command/frame_filters.py
@@ -1,5 +1,5 @@
# Frame-filter commands.
-# Copyright (C) 2013-2016 Free Software Foundation, Inc.
+# Copyright (C) 2013-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -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",
@@ -56,52 +55,44 @@ class InfoFrameFilter(gdb.Command):
else:
return "No"
- def list_frame_filters(self, frame_filters):
- """ Internal worker function to list and print frame filters
- in a dictionary.
-
- Arguments:
- frame_filters: The name of the dictionary, as
- specified by GDB user commands.
- """
-
+ def print_list(self, title, frame_filters, blank_line):
sorted_frame_filters = sorted(frame_filters.items(),
key=lambda i: gdb.frames.get_priority(i[1]),
reverse=True)
if len(sorted_frame_filters) == 0:
- print(" No frame filters registered.")
- else:
- print(" Priority Enabled Name")
- for frame_filter in sorted_frame_filters:
- name = frame_filter[0]
- try:
- priority = '{:<8}'.format(
- str(gdb.frames.get_priority(frame_filter[1])))
- enabled = '{:<7}'.format(
- self.enabled_string(gdb.frames.get_enabled(frame_filter[1])))
- except Exception:
- e = sys.exc_info()[1]
- print(" Error printing filter '"+name+"': "+str(e))
- else:
- print(" %s %s %s" % (priority, enabled, name))
-
- def print_list(self, title, filter_list, blank_line):
+ return 0
+
print(title)
- self.list_frame_filters(filter_list)
+ print(" Priority Enabled Name")
+ for frame_filter in sorted_frame_filters:
+ name = frame_filter[0]
+ try:
+ priority = '{:<8}'.format(
+ str(gdb.frames.get_priority(frame_filter[1])))
+ enabled = '{:<7}'.format(
+ self.enabled_string(gdb.frames.get_enabled(frame_filter[1])))
+ print(" %s %s %s" % (priority, enabled, name))
+ except Exception:
+ e = sys.exc_info()[1]
+ print(" Error printing filter '"+name+"': "+str(e))
if blank_line:
print("")
+ return 1
def invoke(self, arg, from_tty):
- self.print_list("global frame-filters:", gdb.frame_filters, True)
+ any_printed = self.print_list("global frame-filters:", gdb.frame_filters, True)
cp = gdb.current_progspace()
- self.print_list("progspace %s frame-filters:" % cp.filename,
- cp.frame_filters, True)
+ any_printed += self.print_list("progspace %s frame-filters:" % cp.filename,
+ cp.frame_filters, True)
for objfile in gdb.objfiles():
- self.print_list("objfile %s frame-filters:" % objfile.filename,
- objfile.frame_filters, False)
+ any_printed += self.print_list("objfile %s frame-filters:" % objfile.filename,
+ objfile.frame_filters, False)
+
+ if any_printed == 0:
+ print ("No frame filters.")
# Internal enable/disable functions.
@@ -120,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
@@ -150,7 +143,7 @@ def _do_enable_frame_filter(command_tuple, flag):
try:
ff = op_list[frame_filter]
except KeyError:
- msg = "frame-filter '" + str(name) + "' not found."
+ msg = "frame-filter '" + str(frame_filter) + "' not found."
raise gdb.GdbError(msg)
gdb.frames.set_enabled(ff, flag)
@@ -215,21 +208,19 @@ def _complete_frame_filter_name(word, printer_dict):
return flist
class EnableFrameFilter(gdb.Command):
- """GDB command to disable 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
- 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)
@@ -250,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)
@@ -283,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 " \
@@ -347,7 +336,7 @@ class SetFrameFilterPriority(gdb.Command):
try:
ff = op_list[frame_filter]
except KeyError:
- msg = "frame-filter '" + str(name) + "' not found."
+ msg = "frame-filter '" + str(frame_filter) + "' not found."
raise gdb.GdbError(msg)
gdb.frames.set_priority(ff, priority)
@@ -369,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/share/gdb/python/gdb/command/pretty_printers.py b/share/gdb/python/gdb/command/pretty_printers.py
index 21bb0d6..c1bdf68 100644
--- a/share/gdb/python/gdb/command/pretty_printers.py
+++ b/share/gdb/python/gdb/command/pretty_printers.py
@@ -1,5 +1,5 @@
# Pretty-printer commands.
-# Copyright (C) 2010-2016 Free Software Foundation, Inc.
+# Copyright (C) 2010-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -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",
@@ -159,7 +158,7 @@ class InfoPrettyPrinter(gdb.Command):
cp.pretty_printers, "progspace",
object_re, name_re, subname_re)
for objfile in gdb.objfiles():
- self.invoke1(" objfile %s pretty-printers:" % objfile.filename,
+ self.invoke1("objfile %s pretty-printers:" % objfile.filename,
objfile.pretty_printers, objfile.filename,
object_re, name_re, subname_re)
@@ -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/share/gdb/python/gdb/command/prompt.py b/share/gdb/python/gdb/command/prompt.py
index c7fc0d8..3d662a7 100644
--- a/share/gdb/python/gdb/command/prompt.py
+++ b/share/gdb/python/gdb/command/prompt.py
@@ -1,5 +1,5 @@
# Extended prompt.
-# Copyright (C) 2011-2016 Free Software Foundation, Inc.
+# Copyright (C) 2011-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/share/gdb/python/gdb/command/type_printers.py b/share/gdb/python/gdb/command/type_printers.py
index c83ed35..f835f03 100644
--- a/share/gdb/python/gdb/command/type_printers.py
+++ b/share/gdb/python/gdb/command/type_printers.py
@@ -1,5 +1,5 @@
# Type printer commands.
-# Copyright (C) 2010-2016 Free Software Foundation, Inc.
+# Copyright (C) 2010-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -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/share/gdb/python/gdb/command/unwinders.py b/share/gdb/python/gdb/command/unwinders.py
index a9b9d8a..028ad7d 100644
--- a/share/gdb/python/gdb/command/unwinders.py
+++ b/share/gdb/python/gdb/command/unwinders.py
@@ -1,5 +1,5 @@
# Unwinder commands.
-# Copyright 2015-2016 Free Software Foundation, Inc.
+# Copyright 2015-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -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",
@@ -136,6 +135,8 @@ def do_enable_unwinder(arg, flag):
if locus_re.match(objfile.filename):
total += do_enable_unwinder1(objfile.frame_unwinders, name_re,
flag)
+ if total > 0:
+ gdb.invalidate_cached_frames()
print("%d unwinder%s %s" % (total, "" if total == 1 else "s",
"enabled" if flag else "disabled"))
@@ -143,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",
@@ -167,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/share/gdb/python/gdb/command/xmethods.py b/share/gdb/python/gdb/command/xmethods.py
index 46f7b66..ea02609 100644
--- a/share/gdb/python/gdb/command/xmethods.py
+++ b/share/gdb/python/gdb/command/xmethods.py
@@ -1,5 +1,5 @@
# Xmethod commands.
-# Copyright 2013-2016 Free Software Foundation, Inc.
+# Copyright 2013-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -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",
diff --git a/share/gdb/python/gdb/frames.py b/share/gdb/python/gdb/frames.py
index 6ae92ed..d8e4be8 100644
--- a/share/gdb/python/gdb/frames.py
+++ b/share/gdb/python/gdb/frames.py
@@ -1,5 +1,5 @@
# Frame-filter commands.
-# Copyright (C) 2013-2016 Free Software Foundation, Inc.
+# Copyright (C) 2013-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/share/gdb/python/gdb/function/__init__.py b/share/gdb/python/gdb/function/__init__.py
index 5220787..b133472 100644
--- a/share/gdb/python/gdb/function/__init__.py
+++ b/share/gdb/python/gdb/function/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2016 Free Software Foundation, Inc.
+# Copyright (C) 2012-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/share/gdb/python/gdb/function/as_string.py b/share/gdb/python/gdb/function/as_string.py
new file mode 100644
index 0000000..8936b5e
--- /dev/null
+++ b/share/gdb/python/gdb/function/as_string.py
@@ -0,0 +1,37 @@
+# Copyright (C) 2016-2019 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import gdb
+
+
+class _AsString(gdb.Function):
+ """Return the string representation of a value.
+
+Usage: $_as_string (VALUE)
+
+Arguments:
+
+ VALUE: any value
+
+Returns:
+ The string representation of the value."""
+
+ def __init__(self):
+ super(_AsString, self).__init__("_as_string")
+
+ def invoke(self, val):
+ return str(val)
+
+_AsString()
diff --git a/share/gdb/python/gdb/function/caller_is.py b/share/gdb/python/gdb/function/caller_is.py
index 5b89191..27f30dc 100644
--- a/share/gdb/python/gdb/function/caller_is.py
+++ b/share/gdb/python/gdb/function/caller_is.py
@@ -1,5 +1,5 @@
# Caller-is functions.
-# Copyright (C) 2008-2016 Free Software Foundation, Inc.
+# Copyright (C) 2008-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -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/share/gdb/python/gdb/function/strfns.py b/share/gdb/python/gdb/function/strfns.py
index 06a37ad..d29ff61 100644
--- a/share/gdb/python/gdb/function/strfns.py
+++ b/share/gdb/python/gdb/function/strfns.py
@@ -1,5 +1,5 @@
# Useful gdb string convenience functions.
-# Copyright (C) 2012-2016 Free Software Foundation, Inc.
+# Copyright (C) 2012-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -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")
diff --git a/share/gdb/python/gdb/printer/__init__.py b/share/gdb/python/gdb/printer/__init__.py
index a8ac8bc..25dae68 100644
--- a/share/gdb/python/gdb/printer/__init__.py
+++ b/share/gdb/python/gdb/printer/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2016 Free Software Foundation, Inc.
+# Copyright (C) 2014-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/share/gdb/python/gdb/printer/bound_registers.py b/share/gdb/python/gdb/printer/bound_registers.py
index 9ff94aa..f39d220 100644
--- a/share/gdb/python/gdb/printer/bound_registers.py
+++ b/share/gdb/python/gdb/printer/bound_registers.py
@@ -1,5 +1,5 @@
# Pretty-printers for bounds registers.
-# Copyright (C) 2013-2016 Free Software Foundation, Inc.
+# Copyright (C) 2013-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,8 +14,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import sys
+
import gdb.printing
+if sys.version_info[0] > 2:
+ # Python 3 removed basestring and long
+ basestring = str
+ long = int
+
class MpxBound128Printer:
"""Adds size field to a mpx __gdb_builtin_type_bound128 type."""
diff --git a/share/gdb/python/gdb/printing.py b/share/gdb/python/gdb/printing.py
index 63c3aeb..ded8033 100644
--- a/share/gdb/python/gdb/printing.py
+++ b/share/gdb/python/gdb/printing.py
@@ -1,5 +1,5 @@
# Pretty-printer utilities.
-# Copyright (C) 2010-2016 Free Software Foundation, Inc.
+# Copyright (C) 2010-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/share/gdb/python/gdb/prompt.py b/share/gdb/python/gdb/prompt.py
index 15f4a1d..4389b22 100644
--- a/share/gdb/python/gdb/prompt.py
+++ b/share/gdb/python/gdb/prompt.py
@@ -1,5 +1,5 @@
# Extended prompt utilities.
-# Copyright (C) 2011-2016 Free Software Foundation, Inc.
+# Copyright (C) 2011-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/share/gdb/python/gdb/types.py b/share/gdb/python/gdb/types.py
index c22e8a9..ce7f3b6 100644
--- a/share/gdb/python/gdb/types.py
+++ b/share/gdb/python/gdb/types.py
@@ -1,5 +1,5 @@
# Type utilities.
-# Copyright (C) 2010-2016 Free Software Foundation, Inc.
+# Copyright (C) 2010-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,8 +31,10 @@ def get_basic_type(type_):
"""
while (type_.code == gdb.TYPE_CODE_REF or
+ type_.code == gdb.TYPE_CODE_RVALUE_REF or
type_.code == gdb.TYPE_CODE_TYPEDEF):
- if type_.code == gdb.TYPE_CODE_REF:
+ if (type_.code == gdb.TYPE_CODE_REF or
+ type_.code == gdb.TYPE_CODE_RVALUE_REF):
type_ = type_.target()
else:
type_ = type_.strip_typedefs()
diff --git a/share/gdb/python/gdb/unwinder.py b/share/gdb/python/gdb/unwinder.py
index 14b2758..5777979 100644
--- a/share/gdb/python/gdb/unwinder.py
+++ b/share/gdb/python/gdb/unwinder.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016 Free Software Foundation, Inc.
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -92,3 +92,4 @@ def register_unwinder(locus, unwinder, replace=False):
unwinder.name)
i += 1
locus.frame_unwinders.insert(0, unwinder)
+ gdb.invalidate_cached_frames()
diff --git a/share/gdb/python/gdb/xmethod.py b/share/gdb/python/gdb/xmethod.py
index aa0cf0a..67bac9a 100644
--- a/share/gdb/python/gdb/xmethod.py
+++ b/share/gdb/python/gdb/xmethod.py
@@ -1,5 +1,5 @@
# Python side of the support for xmethods.
-# Copyright (C) 2013-2016 Free Software Foundation, Inc.
+# Copyright (C) 2013-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by