public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM] archer-pmuldoon-python-backtrace: Add more comments, rewrite others. Remove FrameFilter.py
@ 2012-11-29 17:50 pmuldoon
0 siblings, 0 replies; only message in thread
From: pmuldoon @ 2012-11-29 17:50 UTC (permalink / raw)
To: archer-commits
The branch, archer-pmuldoon-python-backtrace has been updated
via a2871b2eadcd787de03d30f8b6c312aa45640f99 (commit)
from fb356a89253f12087866787ebe9fea49c56f4c24 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit a2871b2eadcd787de03d30f8b6c312aa45640f99
Author: Phil Muldoon <pmuldoon@redhat.com>
Date: Thu Nov 29 17:49:30 2012 +0000
Add more comments, rewrite others. Remove FrameFilter.py
-----------------------------------------------------------------------
Summary of changes:
gdb/data-directory/Makefile.in | 1 -
gdb/python/lib/gdb/FrameIterator.py | 33 ++++++++-
gdb/python/lib/gdb/FrameWrapper.py | 106 +++++++++++++++------------
gdb/python/lib/gdb/command/frame_filters.py | 1 -
4 files changed, 88 insertions(+), 53 deletions(-)
First 500 lines of diff:
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
index dbc5a25..4cc92bc 100644
--- a/gdb/data-directory/Makefile.in
+++ b/gdb/data-directory/Makefile.in
@@ -54,7 +54,6 @@ PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR)
PYTHON_FILES = \
gdb/__init__.py \
gdb/BaseFrameWrapper.py \
- gdb/FrameFilter.py \
gdb/FrameIterator.py \
gdb/FrameWrapper.py \
gdb/types.py \
diff --git a/gdb/python/lib/gdb/FrameIterator.py b/gdb/python/lib/gdb/FrameIterator.py
index 5816c57..ddc9087 100644
--- a/gdb/python/lib/gdb/FrameIterator.py
+++ b/gdb/python/lib/gdb/FrameIterator.py
@@ -1,13 +1,30 @@
+# Copyright (C) 2012 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
import itertools
class FrameIterator(object):
- """A frame iterator. Iterates over gdb.Frames or objects that
+ """A gdb.Frame iterator. Iterates over gdb.Frames or objects that
conform to that interface."""
def __init__ (self, frame_obj):
- """Initialize a FrameIterator. FRAME_OBJ is the starting
- frame."""
+ """Initialize a FrameIterator.
+
+ Arguments:
+ frame_obj the starting frame."""
super(FrameIterator, self).__init__()
self.frame = frame_obj
@@ -16,9 +33,19 @@ class FrameIterator(object):
return self
def __getitem__(self,index):
+ """__getitem__ implementation.
+
+ Arguments:
+ index: A specific index to fetch."""
+
return next(itertools.islice(self.frame,index,index+1))
def next (self):
+ """__next__ implementation.
+
+ Returns:
+ The next oldest frame."""
+
result = self.frame
if result is None:
raise StopIteration
diff --git a/gdb/python/lib/gdb/FrameWrapper.py b/gdb/python/lib/gdb/FrameWrapper.py
index 0db37de..4db9a43 100644
--- a/gdb/python/lib/gdb/FrameWrapper.py
+++ b/gdb/python/lib/gdb/FrameWrapper.py
@@ -16,7 +16,7 @@
import gdb
class FrameWrapper (object):
- """Interface for a Frame Wrapper"""
+ """Interface for a Frame Wrapper."""
""" A frame wrapper wraps a frame and provides additional and
convenience methods. """
@@ -25,23 +25,22 @@ class FrameWrapper (object):
self.frame = frame
def elided (self):
- """ The 'elided' function groups frames together in a
+ """ The elided method groups frames together in a
hierarchical system. An example would be an interpreter call
that occurs over many frames but might be better represented
as a group of frames distinct from the other frames.
Arguments: None
- Returns: The 'elide' function must return an iterator that
- contains the frames that are being elided. Elided frames are
- indented from normal frames in a backtrace, to show affinity
- with the frame that elided them. Note that it is the Frame
- Filter's task to filter out the elided frames from the
- iterator the source frames were acquired, and also to provide
- the iterator of elided frames in this function.
-
- If this function returns a Python None, no frames will be
- elided.
+ Returns: The elided function must return an iterator that
+ contains the frames that are being elided, or None.
+ Elided frames are indented from normal frames in a
+ backtrace, to show affinity with the frame that
+ elided them. Note that it is the frame filter's task
+ to filter out the elided frames from the source
+ iterator, and also to provide the iterator of elided
+ frames in this function. If this function returns a
+ None, no frames will be elided.
"""
pass
@@ -51,10 +50,9 @@ class FrameWrapper (object):
Arguments: None.
- Returns: A string describing the function.
-
- If this function returns a Python None, no data will be
- displayed for this field at printing.
+ Returns: A string describing the function. If this function
+ returns None, no data will be displayed for this
+ field at printing.
"""
pass
@@ -64,25 +62,22 @@ class FrameWrapper (object):
Arguments: None.
Returns: A numeric integer type of sufficient size to describe
- the address of the frame.
-
- If this function returns a Python None, no data will be
- displayed for this field at printing.
+ the address of the frame, or None. If this function
+ returns a None, no data will be displayed for this
+ field at printing.
"""
pass
def filename (self):
- """ The filename associated with the function and line number
- addressed by this frame.
+ """ The filename associated with the function of this frame.
Arguments: None.
Returns: A string containing the filename, and optionally, the
- path to the filename of the frame.
-
- If this function returns a Python None, the field output from
- the function will be left blank.""
+ path to the filename of the frame, or None. If this
+ function returns a None, no data will be displayed
+ for this field at printing.
"""
pass
@@ -93,10 +88,9 @@ class FrameWrapper (object):
Arguments: None.
- Returns: A number integer type line number
-
- If this function returns a Python None, the field output from
- the function will be left blank.""
+ Returns: An integer type representing the line number, or
+ None. If this function returns a None, no data will
+ be displayed for this field at printing.
"""
pass
@@ -106,15 +100,23 @@ class FrameWrapper (object):
Arguments: None.
- Returns: An iterator that returns a tuple pairing of
- "argument", and "value". The "argument" element can be either
- a gdb.Symbol or a string. The "value" argument must be a
- gdb.Value or a Python value that can be translated into a
- gdb.Value.
-
-
- If this function returns a Python None, frame arguments will
- not be printed.
+ Returns: An iterator that conforms to the Python iterator
+ protocol, or None. If this method returns a None,
+ instead of an iterator, then no data will be printed
+ for frame arguments. If this method returns an
+ iterator, it must contain objects that implement two
+ methods, described here.
+
+ The object must implement an argument method which
+ takes no parameters and must return a gdb.Symbol or a
+ Python string. It must also implement a value method
+ which takes no parameters and which must return a
+ gdb.Value, a Python value, or None. If the value
+ method returns a None, and the argument method
+ returns a gdb.Symbol, GDB will look-up and print the
+ value of the gdb.Symbol automatically. If the
+ argument method contains a string, then the value
+ method must not return a None.
"""
pass
@@ -123,15 +125,23 @@ class FrameWrapper (object):
Arguments: None.
- Returns: An iterator that returns a tuple pairing of
- "argument", and "value". The "argument" element can be either
- a gdb.Symbol or a string. The "value" argument must be a
- gdb.Value or a Python value that can be translated into a
- gdb.Value.
-
-
- If this function returns a Python None, local variables will
- not be printed.
+ Returns: An iterator that conforms to the Python iterator
+ protocol, or None. If this method returns a None,
+ instead of an iterator, then no data will be printed
+ for frame locals. If this method returns an
+ iterator, it must contain objects that implement two
+ methods, described here.
+
+ The object must implement an argument method which
+ takes no parameters and must return a gdb.Symbol or a
+ Python string. It must also implement a value method
+ which takes no parameters and which must return a
+ gdb.Value, a Python value, or None. If the value
+ method returns a None, and the argument method
+ returns a gdb.Symbol, GDB will look-up and print the
+ value of the gdb.Symbol automatically. If the
+ argument method contains a string, then the value
+ method must not return a None.
"""
pass
diff --git a/gdb/python/lib/gdb/command/frame_filters.py b/gdb/python/lib/gdb/command/frame_filters.py
index b5a4ceb..fc115b0 100644
--- a/gdb/python/lib/gdb/command/frame_filters.py
+++ b/gdb/python/lib/gdb/command/frame_filters.py
@@ -18,7 +18,6 @@
import gdb
import copy
-import gdb.FrameFilter
from gdb.FrameIterator import FrameIterator
from gdb.BaseFrameWrapper import BaseFrameWrapper
import itertools
hooks/post-receive
--
Repository for Project Archer.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-11-29 17:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-29 17:50 [SCM] archer-pmuldoon-python-backtrace: Add more comments, rewrite others. Remove FrameFilter.py 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).