public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  pmuldoon/python-backtrace: Cleanup
@ 2013-03-11 16:59 pmuldoon
  0 siblings, 0 replies; only message in thread
From: pmuldoon @ 2013-03-11 16:59 UTC (permalink / raw)
  To: archer-commits

The branch, pmuldoon/python-backtrace has been updated
       via  79415a4bbb06fc0b3a8060da0a9f70ea9e0afd3e (commit)
       via  b8656bd810ed6bd77ba508d680024628146e773f (commit)
      from  9d45de3ff8519e67889eb97f06602f7f916ec41c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 79415a4bbb06fc0b3a8060da0a9f70ea9e0afd3e
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Mon Mar 11 16:36:56 2013 +0000

    Cleanup

commit b8656bd810ed6bd77ba508d680024628146e773f
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Fri Mar 8 16:51:52 2013 +0000

    Polish documentation

-----------------------------------------------------------------------

Summary of changes:
 gdb/doc/gdb.texinfo                         |  121 ++++++++++++++-------------
 gdb/mi/mi-cmds.h                            |    2 -
 gdb/python/lib/gdb/FrameDecorator.py        |    4 +-
 gdb/python/lib/gdb/FrameIterator.py         |    8 +-
 gdb/python/lib/gdb/command/frame_filters.py |   43 +++++-----
 gdb/python/py-framefilter.c                 |   90 +++++++++++---------
 6 files changed, 139 insertions(+), 129 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 8bfc579..57c5220 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -24381,7 +24381,7 @@ should be taken that some frame filters may have been executed before,
 and that some frame filters will be executed after.
 
 The Python dictionary @code{gdb.frame_filters} contains key/object
-pairings that comprise a frame filter.  FrameAsn filters in this
+pairings that comprise a frame filter.  Frame filters in this
 dictionary are called @code{global} frame filters, and they are
 available when debugging all inferiors.  These frame filters must
 register with the dictionary directly.  In addition to the
@@ -24394,7 +24394,7 @@ object which also contains a @code{frame_filters} dictionary
 attribute.
 
 Each frame filter object in these dictionaries must conform to the
-frame filter interface definition (@pxref{Frame Filter API}).
+frame filter interface definition defined below.
 
 When a command is executed from @value{GDBN} that is compatible with
 frame filters, @value{GDBN} combines the @code{global},
@@ -24435,19 +24435,20 @@ The order that the frame filters will be called is:
 Filter3 -> Filter2 -> Filter1 -> Filter4
 @end smallexample
 
-Note that the output (a Python iterator) from @code{Filter3} is passed
-to the input of @code{Filter2}, and so on.
+Note that the output from @code{Filter3} is passed to the input of
+@code{Filter2}, and so on.
 
 This @code{filter} method is passed a Python iterator.  This iterator
-contains a sequence of frame decorators that wrap each @code{gdb.Frame},
-or another frame decorator that wraps a frame decorator.  The first filter
-that is executed in the sequence of frame filters will receive an
-iterator entirely comprised of @code{FrameDecorator} objects.
-However, after each frame filter is executed, the previous frame
-filter may have wrapped some or all of the frame decorators with their
-own frame decorator.  As frame decorators must also conform to a mandatory
-interface, these decorators can be assumed to act in a uniform manner
-(@pxref{Frame Decorator API}).
+contains a sequence of frame decorators that wrap each
+@code{gdb.Frame}, or a frame decorator that wraps another frame
+decorator.  The first filter that is executed in the sequence of frame
+filters will receive an iterator entirely comprised of default
+@code{FrameDecorator} objects.  However, after each frame filter is
+executed, the previous frame filter may have wrapped some or all of
+the frame decorators with their own frame decorator.  As frame
+decorators must also conform to a mandatory interface, these
+decorators can be assumed to act in a uniform manner (@pxref{Frame
+Decorator API}).
 
 This method must return an object conforming to the Python iterator
 protocol.  Each item in the iterator must be an object conforming to
@@ -24480,7 +24481,7 @@ filter will not be executed.  This attribute is mandatory.
 @defvar FrameFilter.priority
 The @code{priority} attribute must be Python integer.  This attribute
 controls the order of execution in relation to other frame filters.
-There is no imposed limits on the range of @code{priority} other than
+There are no imposed limits on the range of @code{priority} other than
 it must be a valid integer.  The higher the @code{priority} attribute,
 the sooner the frame filter will be executed in relation to other
 frame filters.  Although @code{priority} can be negative, it is
@@ -24501,11 +24502,11 @@ only be used in conjunction with frame filters.
 The purpose of a frame decorator is to customize the printed content
 of each @code{gdb.Frame} in commands where frame filters are executed.
 This concept is called decorating a frame.  Frame decorators decorate
-a @code{gdb.Frame} with customized data operation contained with each
-API call.  This separates the actual data contained in a
-@code{gdb.Frame} from the decorated data produced by a frame
-decorator.  This abstraction is necessary to maintain integrity of the
-data contained in each @code{gdb.Frame}.
+a @code{gdb.Frame} with Python code contained with each API call.
+This separates the actual data contained in a @code{gdb.Frame} from
+the decorated data produced by a frame decorator.  This abstraction is
+necessary to maintain integrity of the data contained in each
+@code{gdb.Frame}.
 
 Frame decorators have a mandatory interface, defined below.
 
@@ -24539,8 +24540,8 @@ the source iterator.  This will avoid printing the frame twice.
 This method returns the name of the function in the frame that is to
 be printed.
 
-This method must return a Python string describing the function, or a
-Python @code{None}.
+This method must return a Python string describing the function, or
+@code{None}.
 
 If this function returns @code{None}, @value{GDBN} will not print any
 data for this field.
@@ -24551,10 +24552,10 @@ data for this field.
 This method returns the address of the frame that is to be printed.
 
 This method must return a Python numeric integer type of sufficient
-size to describe the address of the frame, @code{None}.
+size to describe the address of the frame, or @code{None}.
 
-If this function returns @code{None}, @value{GDBN} will not print any
-data for this field.
+If this function returns a @code{None}, @value{GDBN} will not print
+any data for this field.
 @end defun
 
 @defun FrameDecorator.filename ()
@@ -24564,8 +24565,8 @@ This method returns the filename and path associated with this frame.
 This method must return a Python string containing the filename and
 the path to the object file backing the frame, or @code{None}.
 
-If this function returns @code{None}, @value{GDBN} will not print any
-data for this field.
+If this function returns a @code{None}, @value{GDBN} will not print
+any data for this field.
 @end defun
 
 
@@ -24574,18 +24575,17 @@ data for this field.
 This method returns the line number associated with the current
 position within the function addressed by this frame.
 
-This method must return a Python integer type, or a Python
-@code{None}.
+This method must return a Python integer type, or @code{None}.
 
-If this function returns @code{None}, @value{GDBN} will not print any
-data for this field.
+If this function returns a @code{None}, @value{GDBN} will not print
+any data for this field.
 @end defun
 
 @defun FrameDecorator.frame_args ()
 @anchor{frame_args}
 
-This method must return an iterable @code{None}.  This iterable must
-contain objects that implement two methods, described here.
+This method must return an iterable or @code{None}.  This iterable
+must contain objects that implement two methods, described here.
 
 The object must implement an @code{argument} method which takes no
 parameters and must return a @code{gdb.Symbol} (@pxref{Symbols In
@@ -24599,17 +24599,16 @@ look-up and print the value of the @code{gdb.Symbol} automatically.
 A brief example:
 
 @smallexample
-class SymValueWrapper ():
+class SymValueWrapper():
 
     def __init__(self, symbol, value):
         self.sym = symbol
         self.val = value
 
-    def value (self):
+    def value(self):
         return self.val
 
-    def symbol (self):
-
+    def symbol(self):
         return self.sym
 
 class SomeFrameDecorator()
@@ -24622,6 +24621,8 @@ class SomeFrameDecorator()
         except:
             return None
 
+        # Iterate over all symbols in a block.  Only add
+        # symbols that are arguments.
         for sym in block:
             if not sym.is_argument:
                 continue
@@ -24634,7 +24635,7 @@ class SomeFrameDecorator()
 @end smallexample
 
 Even if the @code{frame_args} method returns only a single object, it
-must be wrapped in an iterable.
+must be iterable.
 
 If this function returns @code{None}, @value{GDBN} will not print
 arguments for this frame.
@@ -24659,6 +24660,8 @@ class SomeFrameDecorator()
         except:
             return None
 
+        # Iterate over all symbols in a block.  Add all
+        # symbols, except arguments.
         for sym in block:
             if sym.is_argument:
                 continue
@@ -24682,7 +24685,7 @@ locals for this frame.
 This method must return the underlying @code{gdb.Frame} that this
 frame decorate is decorating.  @value{GDBN} requires the underlying
 frame for internal frame information to determine how to print certain
-values in frame printing
+values in frame printing.
 @end defun
 
 @node Writing a Frame Filter/Decorator
@@ -24696,13 +24699,13 @@ it must decide if it is to work on the data provided by
 @value{GDBN}.  In all cases, whether it works on the iterator or not,
 each frame filter must return an iterator.  A bare-bones frame filter
 follows the pattern in the following example.
-g
+
 @smallexample
 import gdb
 
-class FrameFilter ():
+class FrameFilter():
 
-    def __init__ (self):
+    def __init__(self):
         # Frame filter attribute creation.
         #
         # 'name' is the name of the filter that GDB will display.
@@ -24719,9 +24722,9 @@ class FrameFilter ():
 
         # Register this frame filter with the global frame_filters
         # dictionary.
-        gdb.frame_filters [self.name] = self
+        gdb.frame_filters[self.name] = self
 
-    def filter (self, frame_iter):
+    def filter(self, frame_iter):
         # Just return the iterator.
         return frame_iter
 @end smallexample
@@ -24746,10 +24749,10 @@ important consideration.  Generally, if a filter is specific to a set
 of code, it should be registered either in the @code{objfile} or
 @code{progspace} dictionaries as they are specific to the program
 currently loaded in @value{GDBN}.  The global dictionary is always
-present, and so will be the frame filters registered in it.  To avoid
+present, and so will the frame filters registered in it.  To avoid
 filters that may conflict, it is generally better to register frame
 filters against the dictionaries that more closely align with the
-usage of the filter currently in question
+usage of the filter currently in question.
 
 @value{GDBN} takes a hands-off approach to frame filter registration,
 therefore it is the frame filter's responsibility to ensure
@@ -24762,7 +24765,7 @@ Management}), the names @value{GDBN} will display are those contained
 in the @code{name} attribute.
 
 The final step of this example is the implementation of the
-@code{filter} method. As shown in the example comments, we define the
+@code{filter} method.  As shown in the example comments, we define the
 @code{filter} method and note that the method must take an iterator,
 and also must return an iterator.  In this bare-bones example, the
 frame filter is not very useful as it just returns the iterator
@@ -24807,17 +24810,17 @@ can substantially delay the printing of the backtrace which will
 result in large memory usage, and a poor user experience.
 
 @smallexample
-class InlineFilter ():
+class InlineFilter():
 
-    def __init__ (self):
+    def __init__(self):
         self.name = "Inlined Frame Class"
         self.priority = 100
         self.enabled = True
-        gdb.frame_filters [self.name] = self
+        gdb.frame_filters[self.name] = self
 
-    def filter (self, frame_iter):
-        frame_iter = itertools.imap (InlinedFrameDecorator,
-                                     frame_iter)
+    def filter(self, frame_iter):
+        frame_iter = itertools.imap(InlinedFrameDecorator,
+                                    frame_iter)
         return frame_iter
 @end smallexample
 
@@ -24831,13 +24834,13 @@ wraps the existing one.
 Below is the frame decorator for this example.
 
 @smallexample
-class InlinedFrameDecorator (FrameDecorator):
+class InlinedFrameDecorator(FrameDecorator):
 
     def __init__(self, fobj):
         super(InlinedFrameDecorator, self).__init__(fobj)
         self.fobj = fobj
 
-    def function (self):
+    def function(self):
         frame = self.inferior_frame()
         name = str(frame.name())
         function = str(frame.function())
@@ -24886,16 +24889,16 @@ example illustrates the approach an author might use.
 This example comprises of three sections.
 
 @smallexample
-class InlineFrameFilter ():
+class InlineFrameFilter():
 
-    def __init__ (self):
+    def __init__(self):
         self.name = "Inlined Frame Class"
         self.priority = 100
         self.enabled = True
-        gdb.frame_filters [self.name] = self
+        gdb.frame_filters[self.name] = self
 
-    def filter (self, frame_iter):
-        return ElidingInlineIterator (frame_iter)
+    def filter(self, frame_iter):
+        return ElidingInlineIterator(frame_iter)
 @end smallexample
 
 This frame filter is very similar to the other examples.  The only
diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h
index 38eca37..83bf55f 100644
--- a/gdb/mi/mi-cmds.h
+++ b/gdb/mi/mi-cmds.h
@@ -148,8 +148,6 @@ struct mi_cmd
   int *suppress_notification;
 };
 
-extern void
-stack_enable_frame_filters (void);
 
 /* Lookup a command in the MI command table.  */
 
diff --git a/gdb/python/lib/gdb/FrameDecorator.py b/gdb/python/lib/gdb/FrameDecorator.py
index df6c3a0..1ec733e 100644
--- a/gdb/python/lib/gdb/FrameDecorator.py
+++ b/gdb/python/lib/gdb/FrameDecorator.py
@@ -22,8 +22,8 @@ class FrameDecorator(object):
     decorator, and provides convenience methods.  If this object is
     wrapping a frame decorator, defer to that wrapped object's method
     if it has one.  This allows for frame decorators that have
-    sub-classed FrameDecorators, but also wrap other frame decorators
-    on the same frame to correctly execute.
+    sub-classed FrameDecorator object, but also wrap other frame
+    decorators on the same frame to correctly execute.
 
     E.g
 
diff --git a/gdb/python/lib/gdb/FrameIterator.py b/gdb/python/lib/gdb/FrameIterator.py
index 636e778..109a06c 100644
--- a/gdb/python/lib/gdb/FrameIterator.py
+++ b/gdb/python/lib/gdb/FrameIterator.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012, 2013 Free Software Foundation, Inc.
+# Copyright (C) 2013 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,7 +20,7 @@ class FrameIterator(object):
     """A gdb.Frame iterator.  Iterates over gdb.Frames or objects that
     conform to that interface."""
 
-    def __init__ (self, frame_obj):
+    def __init__(self, frame_obj):
         """Initialize a FrameIterator.
 
         Arguments:
@@ -29,7 +29,7 @@ class FrameIterator(object):
         super(FrameIterator, self).__init__()
         self.frame = frame_obj
 
-    def __iter__ (self):
+    def __iter__(self):
         return self
 
     def __getitem__(self,index):
@@ -40,7 +40,7 @@ class FrameIterator(object):
 
         return next(itertools.islice(self.frame,index,index+1))
 
-    def next (self):
+    def next(self):
         """next implementation.
 
         Returns:
diff --git a/gdb/python/lib/gdb/command/frame_filters.py b/gdb/python/lib/gdb/command/frame_filters.py
index 05b5625..4750c91 100644
--- a/gdb/python/lib/gdb/command/frame_filters.py
+++ b/gdb/python/lib/gdb/command/frame_filters.py
@@ -1,5 +1,5 @@
 # Frame-filter commands.
-# Copyright (C) 2012, 2013 Free Software Foundation, Inc.
+# Copyright (C) 2013 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
@@ -103,25 +103,21 @@ def _get_name(frame_filter):
 
     Returns:
         The name of the frame filter from the "name" attribute.
-
-    Raises:
-        AttributeError: When the name attribute has not been
-        implemented.
     """
     return frame_filter.name
 
 def _return_list(name):
     """ Internal Worker function to return the frame filter
     dictionary, depending on the name supplied as an argument.  If the
-    name is not "global" or "progspace", it is assumed to name an
-    object-file.
+    name is not "all", "global" or "progspace", it is assumed to name
+    an object-file.
 
     Arguments:
         name: The name of the list, as specified by GDB user commands.
 
     Returns:
         A dictionary object for a single specified dictionary, or a
-        list containing all the items for "alldicts"
+        list containing all the items for "all"
 
     Raises:
         gdb.GdbError:  A dictionary of that name cannot be found.
@@ -289,6 +285,7 @@ def _complete_frame_filter_list(text, word, all_flag):
         text: The full text of the command line.
         word: The most recent word of the command line.
         all_flag: Whether to include the word "all" in completion.
+
     Returns:
         A list of suggested frame filter dictionary name completions
         from text/word analysis.  This list can be empty when there
@@ -346,12 +343,15 @@ class EnableFrameFilter(gdb.Command):
     Usage: enable frame-filter enable [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.
-
-    NAME matches the name of the frame-filter to operate on.
+    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.
+
+    NAME matches the name of the frame-filter to operate on.  If
+    DICTIONARY is "all", NAME is ignored.
     """
     def __init__(self):
         super(EnableFrameFilter, self).__init__("enable frame-filter",
@@ -376,12 +376,15 @@ class DisableFrameFilter(gdb.Command):
     Usage: disable frame-filter disable [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.
-
-    NAME matches the name of the frame-filter to operate on.
+    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.
+
+    NAME matches the name of the frame-filter to operate on.  If
+    DICTIONARY is "all", NAME is ignored.
     """
     def __init__(self):
         super(DisableFrameFilter, self).__init__("disable frame-filter",
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index bd8cafa..7525d37 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -1,6 +1,6 @@
 /* Python frame filters
 
-   Copyright (C) 2012, 2013 Free Software Foundation, Inc.
+   Copyright (C) 2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -45,7 +45,7 @@ typedef enum mi_print_types
    from a Python object that conforms to the "Symbol Value" interface.
    OBJ is the Python object to extract the values from.  NAME is a
    pass-through argument where the name of the symbol will be written.
-   *NAME is allocated in this function, but the caller is responsible
+   NAME is allocated in this function, but the caller is responsible
    for clean up.  SYM is a pass-through argument where the symbol
    will be written.  In the case of the API returning a string, this
    will be set to NULL.  LANGUAGE is also a pass-through argument
@@ -106,9 +106,9 @@ extract_sym (PyObject *obj, char **name, struct symbol **sym,
 
 /* Helper function to extract a value from an object that conforms to
    the "Symbol Value" interface.  OBJ is the Python object to extract
-   the value from.  **VALUE is a pass-through argument where the value
+   the value from.  VALUE is a pass-through argument where the value
    will be written.  If the object does not have the value attribute,
-   or provides the Python None for a value, **VALUE will be set to
+   or provides the Python None for a value, VALUE will be set to
    NULL and this function will return as successful.  Returns 0 on
    error with the appropriate Python exception set, and 1 on
    success.  */


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-03-11 16:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-11 16:59 [SCM] pmuldoon/python-backtrace: Cleanup pmuldoon

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).