public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/3] [rfc][python] Create gdb.python package
@ 2009-12-31 15:00 Matt McCormick
  2009-12-31 15:00 ` [PATCH 2/3] [python] Create gdb.pretty.register Matt McCormick
  0 siblings, 1 reply; 9+ messages in thread
From: Matt McCormick @ 2009-12-31 15:00 UTC (permalink / raw)
  To: archer; +Cc: Matt McCormick

A gdb.pretty Python package for holding code common for using Python
pretty-printers.

gdb/ChangeLog

2009-30-12  Matt McCormick  <matt@mmmccormick.com>

        * python/lib/gdb/pretty/__init__.py: New python package.
        * Makefile.in: Install it.
---
 gdb/Makefile.in                       |    3 ++-
 gdb/python/lib/gdb/pretty/__init__.py |   16 ++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletions(-)
 create mode 100644 gdb/python/lib/gdb/pretty/__init__.py

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index ac3a4a0..80b4dbe 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2020,7 +2020,8 @@ PY_FILES = gdb/FrameIterator.py gdb/FrameWrapper.py gdb/command/alias.py \
     gdb/command/pahole.py gdb/command/upto.py gdb/command/__init__.py \
     gdb/command/ignore_errors.py gdb/command/save_breakpoints.py \
     gdb/function/caller_is.py gdb/function/in_scope.py \
-    gdb/function/__init__.py gdb/backtrace.py gdb/__init__.py
+    gdb/function/__init__.py gdb/pretty/__init__.py \
+    gdb/backtrace.py gdb/__init__.py
 
 # Install the Python library.  Python library files go under
 # $(pythondir).
diff --git a/gdb/python/lib/gdb/pretty/__init__.py b/gdb/python/lib/gdb/pretty/__init__.py
new file mode 100644
index 0000000..be8a854
--- /dev/null
+++ b/gdb/python/lib/gdb/pretty/__init__.py
@@ -0,0 +1,16 @@
+# Package for code common to custom pretty-printers.
+
+# Copyright (C) 2009 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/>.
-- 
1.6.6

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/3] [python] Create pretty-printer lookup_function classes.
  2009-12-31 15:00 ` [PATCH 2/3] [python] Create gdb.pretty.register Matt McCormick
@ 2009-12-31 15:00   ` Matt McCormick
  2010-01-18  3:43   ` [PATCH 2/3] [python] Create gdb.pretty.register Matthew McCormick (thewtex)
  1 sibling, 0 replies; 9+ messages in thread
From: Matt McCormick @ 2009-12-31 15:00 UTC (permalink / raw)
  To: archer; +Cc: Matt McCormick

These prevent repeated code and are extensible.

gdb/ChangeLog

2009-31-12  Matt McCormick  <matt@mmmccormick.com>

        * Makefile.in: Install gdb/pretty/lookup_function.py.
        * python/lib/gdb/pretty/lookup_function.py)
        (RELookupFunction, RELookupFunctionTag): New lookup_function classes.

gdb/testsuite/ChangeLog

2009-31-12  Matt McCormick  <matt@mmmccormick.com>

        * testsuite/gdb.python/py-prettyprint.py (lookup_function):
        Use RELookupFunctionTag to create the lookup_function.
---
 gdb/Makefile.in                              |    2 +-
 gdb/python/lib/gdb/pretty/lookup_function.py |   74 ++++++++++++++++++++++++++
 gdb/testsuite/gdb.python/py-prettyprint.py   |   35 +-----------
 3 files changed, 78 insertions(+), 33 deletions(-)
 create mode 100644 gdb/python/lib/gdb/pretty/lookup_function.py

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 80b4dbe..15afc12 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2021,7 +2021,7 @@ PY_FILES = gdb/FrameIterator.py gdb/FrameWrapper.py gdb/command/alias.py \
     gdb/command/ignore_errors.py gdb/command/save_breakpoints.py \
     gdb/function/caller_is.py gdb/function/in_scope.py \
     gdb/function/__init__.py gdb/pretty/__init__.py \
-    gdb/backtrace.py gdb/__init__.py
+    gdb/pretty/lookup_function.py gdb/backtrace.py gdb/__init__.py
 
 # Install the Python library.  Python library files go under
 # $(pythondir).
diff --git a/gdb/python/lib/gdb/pretty/lookup_function.py b/gdb/python/lib/gdb/pretty/lookup_function.py
new file mode 100644
index 0000000..3883f8d
--- /dev/null
+++ b/gdb/python/lib/gdb/pretty/lookup_function.py
@@ -0,0 +1,74 @@
+# Pretty-printer lookup function classes.
+
+# Copyright (C) 2009 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 RELookupFunction (object):
+    """Returns a pretty-printer based on some type filtering followed by a search
+    in a dictionary of key:value of typename_regex:pretty-printer."""
+
+    def __init__ (self, pretty_printers_dict):
+        self.pretty_printers_dict = pretty_printers_dict
+
+
+    def _filter_types (self, gdb_type):
+        """Filters the given type and returns a name to pass to the
+        pretty_printers_dict or None."""
+# If it points to a reference, get the reference.
+        if gdb_type.code == gdb.TYPE_CODE_REF:
+            gdb_type = gdb_type.target ()
+
+# Get the unqualified type, stripped of typedefs.
+        gdb_type = gdb_type.unqualified ().strip_typedefs ()
+
+        return str (gdb_type)
+
+
+    def __call__ (self, val):
+        "Returns a pretty-printer that can print val or None."
+        typename = self._filter_types (val.type)
+        if typename == None:
+            return None
+
+        for regex in self.pretty_printers_dict:
+            if regex.match (typename):
+                return self.pretty_printers_dict[regex] (val)
+
+        return None
+        
+
+class RELookupFunctionTag (RELookupFunction):
+    """Similar to RELookupFunction, but when trying to match to type.tag.
+    Useful for ``struct``, ``union``, or ``enum`` in C or C++."""
+
+    def __init__ (self, pretty_printers_dict):
+        super (RELookupFunctionTag, self).__init__ (pretty_printers_dict)
+
+    def _filter_types (self, gdb_type):
+        """Filters the given type and returns a name to pass to the
+        pretty_printers_dict or None."""
+# If it points to a reference, get the reference.
+        if gdb_type.code == gdb.TYPE_CODE_REF:
+            gdb_type = gdb_type.target ()
+
+# Get the unqualified type, stripped of typedefs.
+        gdb_type = gdb_type.unqualified ().strip_typedefs()
+
+        return str (gdb_type.tag)
+
+
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.py b/gdb/testsuite/gdb.python/py-prettyprint.py
index 2f070d8..efe242c 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.py
+++ b/gdb/testsuite/gdb.python/py-prettyprint.py
@@ -18,6 +18,8 @@
 
 import re
 
+from gdb.pretty.lookup_function import RELookupFunctionTag
+
 # Test returning a Value from a printer.
 class string_print:
     def __init__(self, val):
@@ -125,37 +127,6 @@ class pp_outer:
         yield 's', self.val['s']
         yield 'x', self.val['x']
 
-def lookup_function (val):
-    "Look-up and return a pretty-printer that can print val."
-
-    # Get the type.
-    type = val.type
-
-    # If it points to a reference, get the reference.
-    if type.code == gdb.TYPE_CODE_REF:
-        type = type.target ()
-
-    # Get the unqualified type, stripped of typedefs.
-    type = type.unqualified ().strip_typedefs ()
-
-    # Get the type name.    
-    typename = type.tag
-
-    if typename == None:
-        return None
-
-    # Iterate over local dictionary of types to determine
-    # if a printer is registered for that type.  Return an
-    # instantiation of the printer if found.
-    for function in pretty_printers_dict:
-        if function.match (typename):
-            return pretty_printers_dict[function] (val)
-        
-    # Cannot find a pretty printer.  Return None.
-
-    return None
-
-
 def register_pretty_printers ():
     pretty_printers_dict[re.compile ('^struct s$')]   = pp_s
     pretty_printers_dict[re.compile ('^s$')]   = pp_s
@@ -188,6 +159,6 @@ def register_pretty_printers ():
     pretty_printers_dict[re.compile ('^outerstruct$')]  = pp_outer
 
 pretty_printers_dict = {}
-
 register_pretty_printers ()
+lookup_function = RELookupFunctionTag (pretty_printers_dict)
 gdb.pretty_printers.append (lookup_function)
-- 
1.6.6

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/3] [python] Create gdb.pretty.register
  2009-12-31 15:00 [PATCH 1/3] [rfc][python] Create gdb.python package Matt McCormick
@ 2009-12-31 15:00 ` Matt McCormick
  2009-12-31 15:00   ` [PATCH 3/3] [python] Create pretty-printer lookup_function classes Matt McCormick
  2010-01-18  3:43   ` [PATCH 2/3] [python] Create gdb.pretty.register Matthew McCormick (thewtex)
  0 siblings, 2 replies; 9+ messages in thread
From: Matt McCormick @ 2009-12-31 15:00 UTC (permalink / raw)
  To: archer; +Cc: Matt McCormick

A common gdb.pretty.register function serves two purposes: reduces redundant
code and makes the more concise for the objfile-gdb.py files.

Instead of

     def register_printers (objfile):
	 objfile.pretty_printers.add (str_lookup_function)

repeated in all the pretty printer code and

     import gdb.libstdcxx.v6
     gdb.libstdcxx.v6.register_printers (gdb.current_objfile ())
     import gdb.otherprinter
     gdb.otherprinter.register_printers (gdb.current_objfile ())

in the objfile-gdb.py files

     import gdb.pretty
     gdb.pretty.register ('gdb.libstdcxx.v6.printers', gdb.current_objfile ())
     gdb.pretty.register ('gdb.otherprinter', gdb.current_objfile ())

Is only required in the objfile-gdb.py files.  This requires the convention that
a function called 'lookup_function' exists the pretty-printer module.

gdb/ChangeLog

2009-30-12  Matt McCormick  <matt@mmmccormick.com>

        * python/lib/gdb/pretty/__init__.py (register): New function.
---
 gdb/python/lib/gdb/pretty/__init__.py |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/gdb/python/lib/gdb/pretty/__init__.py b/gdb/python/lib/gdb/pretty/__init__.py
index be8a854..e75f757 100644
--- a/gdb/python/lib/gdb/pretty/__init__.py
+++ b/gdb/python/lib/gdb/pretty/__init__.py
@@ -14,3 +14,30 @@
 #
 # 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
+
+def register (module_path, obj):
+    """Register the objfile with the pretty-printer module.
+
+    The module should define a lookup function called *lookup_function* 
+    that returns the gdb pretty-printer or None.
+
+    Arguments
+    ---------
+    module_path: string
+        String specifying the module path.  E.g.
+        'libstdcxx.v6.printer'
+    obj: gdb.Obj
+        Object the printer will be registered with.  If None, the pretty-printer
+        is appended to global gdb module.
+"""
+    if obj == None:
+        obj = gdb
+
+    top_mod = __import__ (module_path, globals(), locals(), ['lookup_function'])
+    mod = sys.modules[module_path]
+    obj.pretty_printers.append (mod.lookup_function)
+
-- 
1.6.6

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] [python] Create gdb.pretty.register
  2009-12-31 15:00 ` [PATCH 2/3] [python] Create gdb.pretty.register Matt McCormick
  2009-12-31 15:00   ` [PATCH 3/3] [python] Create pretty-printer lookup_function classes Matt McCormick
@ 2010-01-18  3:43   ` Matthew McCormick (thewtex)
  2010-01-18  7:57     ` Matt McCormick
                       ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Matthew McCormick (thewtex) @ 2010-01-18  3:43 UTC (permalink / raw)
  To: archer; +Cc: Matt McCormick

An updated series of these patches with the following:

Rebase against archer-tromey-python
Split out a _canonical_type (self, gdb_type) method in
RELookupFunction for reusability's sake.
Regression tested.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/3] [python] Create gdb.pretty.register.
  2010-01-18  3:43   ` [PATCH 2/3] [python] Create gdb.pretty.register Matthew McCormick (thewtex)
@ 2010-01-18  7:57     ` Matt McCormick
  2010-01-18  7:57     ` [PATCH 3/3] [python] Create pretty-printer lookup_function classes Matt McCormick
  2010-01-18  7:57     ` [PATCH 1/3] [python] Create gdb.pretty package Matt McCormick
  2 siblings, 0 replies; 9+ messages in thread
From: Matt McCormick @ 2010-01-18  7:57 UTC (permalink / raw)
  To: archer

A common gdb.pretty.register function serves two purposes: reduces redundant
code and makes registering more concise for the objfile-gdb.py files.

Instead of

     def register_printers (objfile):
	 objfile.pretty_printers.add (str_lookup_function)

repeated in all the pretty printer code and

     import gdb.libstdcxx.v6
     gdb.libstdcxx.v6.register_printers (gdb.current_objfile ())
     import gdb.otherprinter
     gdb.otherprinter.register_printers (gdb.current_objfile ())

in the objfile-gdb.py files

     import gdb.pretty
     gdb.pretty.register ('gdb.libstdcxx.v6.printers', gdb.current_objfile ())
     gdb.pretty.register ('gdb.otherprinter', gdb.current_objfile ())

Is only required in the objfile-gdb.py files.  This requires the convention that
a function called 'lookup_function' exists the pretty-printer module.

gdb/ChangeLog

2009-30-12  Matt McCormick  <matt@mmmccormick.com>

        * python/lib/gdb/pretty/__init__.py (register): New function.
---

 gdb/python/lib/gdb/pretty/__init__.py |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/gdb/python/lib/gdb/pretty/__init__.py b/gdb/python/lib/gdb/pretty/__init__.py
index be8a854..3cd9174 100644
--- a/gdb/python/lib/gdb/pretty/__init__.py
+++ b/gdb/python/lib/gdb/pretty/__init__.py
@@ -14,3 +14,29 @@
 #
 # 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
+
+def register (module_path, obj):
+    """Register the objfile with the pretty-printer module.
+
+    The module should define a lookup function called *lookup_function*
+    that returns the gdb pretty-printer or None.
+
+    Arguments
+    ---------
+    module_path: string
+        String specifying the module path.  E.g.
+        'libstdcxx.v6.printer'
+    obj: gdb.Obj
+        Object the printer will be registered with.  If None, the pretty-printer
+        is appended to global gdb module.
+"""
+    if obj == None:
+        obj = gdb
+
+    top_mod = __import__ (module_path, globals(), locals(), ['lookup_function'])
+    mod = sys.modules[module_path]
+    obj.pretty_printers.append (mod.lookup_function)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/3] [python] Create pretty-printer lookup_function classes.
  2010-01-18  3:43   ` [PATCH 2/3] [python] Create gdb.pretty.register Matthew McCormick (thewtex)
  2010-01-18  7:57     ` Matt McCormick
@ 2010-01-18  7:57     ` Matt McCormick
  2010-01-18  7:57     ` [PATCH 1/3] [python] Create gdb.pretty package Matt McCormick
  2 siblings, 0 replies; 9+ messages in thread
From: Matt McCormick @ 2010-01-18  7:57 UTC (permalink / raw)
  To: archer

These prevent repeated code and are extensible.

gdb/ChangeLog

2009-31-12  Matt McCormick  <matt@mmmccormick.com>

        * Makefile.in: Install gdb/pretty/lookup_function.py.
        * python/lib/gdb/pretty/lookup_function.py)
        (RELookupFunction, RELookupFunctionTag): New lookup_function classes.

gdb/testsuite/ChangeLog

2009-31-12  Matt McCormick  <matt@mmmccormick.com>

        * gdb.python/py-prettyprint.py (lookup_function):
        Use RELookupFunctionTag to create the lookup_function.
---

 gdb/Makefile.in                              |    2 -
 gdb/python/lib/gdb/pretty/lookup_function.py |   75 ++++++++++++++++++++++++++
 gdb/testsuite/gdb.python/py-prettyprint.py   |   35 +-----------
 3 files changed, 79 insertions(+), 33 deletions(-)
 create mode 100644 gdb/python/lib/gdb/pretty/lookup_function.py

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index e9055b1..d1510c2 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2075,7 +2075,7 @@ PY_FILES = gdb/FrameIterator.py gdb/FrameWrapper.py gdb/command/alias.py \
     gdb/command/ignore_errors.py gdb/command/save_breakpoints.py \
     gdb/function/caller_is.py gdb/function/in_scope.py \
     gdb/function/__init__.py gdb/backtrace.py gdb/__init__.py \
-    gdb/pretty/__init__.py
+    gdb/pretty/__init__.py gdb/pretty/lookup_function.py
 
 # Install the Python library.  Python library files go under
 # $(pythondir).
diff --git a/gdb/python/lib/gdb/pretty/lookup_function.py b/gdb/python/lib/gdb/pretty/lookup_function.py
new file mode 100644
index 0000000..f6699bd
--- /dev/null
+++ b/gdb/python/lib/gdb/pretty/lookup_function.py
@@ -0,0 +1,75 @@
+# Pretty-printer lookup_function classes.
+
+# Copyright (C) 2009 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 RELookupFunction (object):
+    """Returns a pretty-printer based on some type filtering followed by a search
+    in a dictionary of key:value of typename_regex:pretty-printer.  If it cannot
+    find a pretty-printer to print the given type, returns None.
+    
+    Arguments
+    ---------
+    pretty_printers_dict: dict
+        typename_regex : pretty-pretter-function
+    """
+
+    def __init__ (self, pretty_printers_dict, type_attribute=''):
+        self.pretty_printers_dict = pretty_printers_dict
+
+    def _canonical_type (self, gdb_type):
+# If it points to a reference, get the reference.
+        if gdb_type.code == gdb.TYPE_CODE_REF:
+            gdb_type = gdb_type.target ()
+
+# Get the unqualified type, stripped of typedefs.
+        gdb_type = gdb_type.unqualified ().strip_typedefs ()
+
+        return gdb_type
+
+    def _filter_types (self, gdb_type):
+        """Filters the given type and returns a name to pass to the
+        pretty_printers_dict or None."""
+        gdb_type = self._canonical_type (gdb_type)
+
+        return gdb_type
+
+    def __call__ (self, val):
+        "Returns a pretty-printer that can print val or None."
+        typename = self._filter_types (val.type)
+        if typename == None:
+            return None
+
+        for regex in self.pretty_printers_dict:
+            if regex.match (str (typename)):
+                return self.pretty_printers_dict[regex] (val)
+
+        return None
+        
+class RELookupFunctionTag (RELookupFunction):
+    """Similar to RELookupFunction, but when trying to match to type.tag.
+    Useful for ``struct``, ``union``, or ``enum`` in C or C++."""
+
+    def __init__ (self, pretty_printers_dict):
+        super (RELookupFunctionTag, self).__init__ (pretty_printers_dict)
+
+    def _filter_types (self, gdb_type):
+        """Filters the given type and returns a name to pass to the
+        pretty_printers_dict or None."""
+        gdb_type = self._canonical_type (gdb_type)
+
+        return gdb_type.tag
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.py b/gdb/testsuite/gdb.python/py-prettyprint.py
index 9a0d107..84682a8 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.py
+++ b/gdb/testsuite/gdb.python/py-prettyprint.py
@@ -18,6 +18,8 @@
 
 import re
 
+from gdb.pretty.lookup_function import RELookupFunctionTag
+
 # Test returning a Value from a printer.
 class string_print:
     def __init__(self, val):
@@ -137,37 +139,6 @@ class pp_outer:
         yield 's', self.val['s']
         yield 'x', self.val['x']
 
-def lookup_function (val):
-    "Look-up and return a pretty-printer that can print val."
-
-    # Get the type.
-    type = val.type
-
-    # If it points to a reference, get the reference.
-    if type.code == gdb.TYPE_CODE_REF:
-        type = type.target ()
-
-    # Get the unqualified type, stripped of typedefs.
-    type = type.unqualified ().strip_typedefs ()
-
-    # Get the type name.    
-    typename = type.tag
-
-    if typename == None:
-        return None
-
-    # Iterate over local dictionary of types to determine
-    # if a printer is registered for that type.  Return an
-    # instantiation of the printer if found.
-    for function in pretty_printers_dict:
-        if function.match (typename):
-            return pretty_printers_dict[function] (val)
-        
-    # Cannot find a pretty printer.  Return None.
-
-    return None
-
-
 def register_pretty_printers ():
     pretty_printers_dict[re.compile ('^struct s$')]   = pp_s
     pretty_printers_dict[re.compile ('^s$')]   = pp_s
@@ -203,6 +174,6 @@ def register_pretty_printers ():
     pretty_printers_dict[re.compile ('^outerstruct$')]  = pp_outer
 
 pretty_printers_dict = {}
-
 register_pretty_printers ()
+lookup_function = RELookupFunctionTag (pretty_printers_dict)
 gdb.pretty_printers.append (lookup_function)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] [python] Create gdb.pretty package.
  2010-01-18  3:43   ` [PATCH 2/3] [python] Create gdb.pretty.register Matthew McCormick (thewtex)
  2010-01-18  7:57     ` Matt McCormick
  2010-01-18  7:57     ` [PATCH 3/3] [python] Create pretty-printer lookup_function classes Matt McCormick
@ 2010-01-18  7:57     ` Matt McCormick
  2010-01-18  8:05       ` [Archer] " Joel Brobecker
  2 siblings, 1 reply; 9+ messages in thread
From: Matt McCormick @ 2010-01-18  7:57 UTC (permalink / raw)
  To: archer

A gdb.pretty Python package for holding code common for using Python
pretty-printers.

gdb/ChangeLog

2009-30-12  Matt McCormick  <matt@mmmccormick.com>

        * python/lib/gdb/pretty/__init__.py: New python package.
        * Makefile.in: Install it.
---

 gdb/Makefile.in                       |    3 ++-
 gdb/python/lib/gdb/pretty/__init__.py |   16 ++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletions(-)
 create mode 100644 gdb/python/lib/gdb/pretty/__init__.py

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index f450a7b..e9055b1 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2074,7 +2074,8 @@ PY_FILES = gdb/FrameIterator.py gdb/FrameWrapper.py gdb/command/alias.py \
     gdb/command/pahole.py gdb/command/upto.py gdb/command/__init__.py \
     gdb/command/ignore_errors.py gdb/command/save_breakpoints.py \
     gdb/function/caller_is.py gdb/function/in_scope.py \
-    gdb/function/__init__.py gdb/backtrace.py gdb/__init__.py
+    gdb/function/__init__.py gdb/backtrace.py gdb/__init__.py \
+    gdb/pretty/__init__.py
 
 # Install the Python library.  Python library files go under
 # $(pythondir).
diff --git a/gdb/python/lib/gdb/pretty/__init__.py b/gdb/python/lib/gdb/pretty/__init__.py
new file mode 100644
index 0000000..be8a854
--- /dev/null
+++ b/gdb/python/lib/gdb/pretty/__init__.py
@@ -0,0 +1,16 @@
+# Package for code common to custom pretty-printers.
+
+# Copyright (C) 2009 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/>.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Archer] [PATCH 1/3] [python] Create gdb.pretty package.
  2010-01-18  7:57     ` [PATCH 1/3] [python] Create gdb.pretty package Matt McCormick
@ 2010-01-18  8:05       ` Joel Brobecker
  2010-01-18 16:20         ` Matthew McCormick (thewtex)
  0 siblings, 1 reply; 9+ messages in thread
From: Joel Brobecker @ 2010-01-18  8:05 UTC (permalink / raw)
  To: Matt McCormick; +Cc: archer

> A gdb.pretty Python package for holding code common for using Python
> pretty-printers.

Any reason why this is not submitted to gdb-patches? There is a modest
ongoing development effort to provide pretty-printers for the GDB types,
and we would very likely use this code.

-- 
Joel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Archer] [PATCH 1/3] [python] Create gdb.pretty package.
  2010-01-18  8:05       ` [Archer] " Joel Brobecker
@ 2010-01-18 16:20         ` Matthew McCormick (thewtex)
  0 siblings, 0 replies; 9+ messages in thread
From: Matthew McCormick (thewtex) @ 2010-01-18 16:20 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: archer

On Mon, Jan 18, 2010 at 2:05 AM, Joel Brobecker <brobecker@adacore.com> wrote:
>> A gdb.pretty Python package for holding code common for using Python
>> pretty-printers.
>
> Any reason why this is not submitted to gdb-patches? There is a modest
> ongoing development effort to provide pretty-printers for the GDB types,
> and we would very likely use this code.
>

Joel, the work to create gdb-gdb.py looks cool, and this would be
helpful there too.

My patches were based off archer-tromey-python, so I thought this was
the right place to post it, but if I can get it upstream by submitting
to gdb-patches, I will do so.

These are the beginning, and other patches are in the queue for
submission.  I hope to send a screencast demonstrating the goal they
are reaching to this mailing list soon.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-01-18 16:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-31 15:00 [PATCH 1/3] [rfc][python] Create gdb.python package Matt McCormick
2009-12-31 15:00 ` [PATCH 2/3] [python] Create gdb.pretty.register Matt McCormick
2009-12-31 15:00   ` [PATCH 3/3] [python] Create pretty-printer lookup_function classes Matt McCormick
2010-01-18  3:43   ` [PATCH 2/3] [python] Create gdb.pretty.register Matthew McCormick (thewtex)
2010-01-18  7:57     ` Matt McCormick
2010-01-18  7:57     ` [PATCH 3/3] [python] Create pretty-printer lookup_function classes Matt McCormick
2010-01-18  7:57     ` [PATCH 1/3] [python] Create gdb.pretty package Matt McCormick
2010-01-18  8:05       ` [Archer] " Joel Brobecker
2010-01-18 16:20         ` Matthew McCormick (thewtex)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).