public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-python: Replace gdb.Frame.addr_in_block with gdb.Frame.function.
@ 2009-03-29 21:36 bauermann
  0 siblings, 0 replies; only message in thread
From: bauermann @ 2009-03-29 21:36 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-python has been updated
       via  7946cfed05838e9cd6475fca65f9a48662929959 (commit)
       via  51431bcab78f52fd56bd639e9572a1f075282c3d (commit)
      from  74b9d22a011e9f8c6b286647ee0a751063f9ed9f (commit)

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

- Log -----------------------------------------------------------------
commit 7946cfed05838e9cd6475fca65f9a48662929959
Author: Thiago Jung Bauermann <bauerman@br.ibm.com>
Date:   Sun Mar 15 23:01:31 2009 -0300

    Replace gdb.Frame.addr_in_block with gdb.Frame.function.
    
    gdb/
    	* python/lib/gdb/command/backtrace.py: Use gdb.Frame.function
    	instead of gdb.Frame.addr_in_block and gdb.find_pc_function.
    	* python/python-frame.c (frapy_addr_in_block): Remove.
    	(frapy_function): New function.
    	(frame_object_methods): Remove entry for `addr_in_block'.
    	Add entry for `function'.
    	* python/python.c (gdbpy_find_pc_function): Remove.
    	(GdbMethods): Remove entry for `find_pc_function'.
    
    gdb/testsuite/
    	* gdb.python/python-frame.exp: Remove test for
    	gdb.Frame.addr_in_block.  Add test for gdb.function.
    
    gdb/doc/
    	* gdb.texinfo (Frames In Python): Remove documentation of
    	Frame.addr_in_block.  Add documentation for Frame.function.

commit 51431bcab78f52fd56bd639e9572a1f075282c3d
Author: Thiago Jung Bauermann <bauerman@br.ibm.com>
Date:   Sun Mar 29 18:03:54 2009 -0300

    Rework documentation for Value.address.
    
    	* gdb.texinfo (Values From Inferior): Reword Value.address
    	description to avoid mentioning gdb.Value twice.

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

Summary of changes:
 gdb/doc/gdb.texinfo                       |    8 ++++----
 gdb/python/lib/gdb/command/backtrace.py   |    2 +-
 gdb/python/python-frame.c                 |   21 ++++++++++++---------
 gdb/python/python.c                       |   20 --------------------
 gdb/testsuite/gdb.python/python-frame.exp |    2 +-
 5 files changed, 18 insertions(+), 35 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index c415f4c..3ded32d 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18394,8 +18394,8 @@ The following attributes are provided:
 
 @table @code
 @defmethod Value address
-If the @code{gdb.Value} object is addressable, this read-only attribute
-holds a @code{gdb.Value} object representing the address.  Otherwise,
+If this object is addressable, this read-only attribute holds a
+@code{gdb.Value} object representing the address.  Otherwise,
 this attribute holds @code{None}.
 @end defmethod
 
@@ -19548,8 +19548,8 @@ Returns the frame's resume address.
 Returns the frame's code block. @c (@pxref{Block,,Code Blocks and Scopes}).
 @end defmethod
 
-@defmethod Frame address_in_block
-Returns an address which falls within the frame's code block.
+@defmethod Frame function
+Returns the symbol for the function corresponding to this frame. @c (@pxref{Symbols In Python}).
 @end defmethod
 
 @defmethod Frame older
diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py
index f07696e..17b1c18 100644
--- a/gdb/python/lib/gdb/command/backtrace.py
+++ b/gdb/python/lib/gdb/command/backtrace.py
@@ -92,7 +92,7 @@ class FrameWrapper:
                 stream.write (" 0x%08x in" % pc)
             stream.write (" " + name + " (")
 
-            func = gdb.find_pc_function (self.frame.addr_in_block ())
+            func = self.frame.function ()
             self.print_frame_args (stream, func)
 
             stream.write (")")
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index 1fc553b..4b76709 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -253,13 +253,13 @@ frapy_block (PyObject *self, PyObject *args)
 }
 
 
-/* Implementation of gdb.Frame.addr_in_block (self) -> Long.
-   Returns an address which falls within the frame's code block.  */
+/* Implementation of gdb.Frame.function (self) -> gdb.Symbol.
+   Returns the symbol for the function corresponding to this frame.  */
 
 static PyObject *
-frapy_addr_in_block (PyObject *self, PyObject *args)
+frapy_function (PyObject *self, PyObject *args)
 {
-  CORE_ADDR pc = 0;	      /* Initialize to appease gcc warning.  */
+  struct symbol *sym = NULL;
   struct frame_info *frame;
   volatile struct gdb_exception except;
 
@@ -267,11 +267,14 @@ frapy_addr_in_block (PyObject *self, PyObject *args)
     {
       FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
 
-      pc = get_frame_address_in_block (frame);
+      sym = find_pc_function (get_frame_address_in_block (frame));
     }
   GDB_PY_HANDLE_EXCEPTION (except);
 
-  return PyLong_FromUnsignedLongLong (pc);
+  if (sym)
+    return symbol_to_symbol_object (sym);
+
+  Py_RETURN_NONE;
 }
 
 /* Convert a frame_info struct to a Python Frame object.
@@ -634,9 +637,9 @@ Return the frame's resume address." },
   { "block", frapy_block, METH_NOARGS,
     "block () -> gdb.Block.\n\
 Return the frame's code block." },
-  { "addr_in_block", frapy_addr_in_block, METH_NOARGS,
-    "addr_in_block () -> Long.\n\
-Return an address which falls within the frame's code block." },
+  { "function", frapy_function, METH_NOARGS,
+    "function () -> gdb.Symbol.\n\
+Returns the symbol for the function corresponding to this frame." },
   { "older", frapy_older, METH_NOARGS,
     "older () -> gdb.Frame.\n\
 Return the frame immediately older (outer) to this frame." },
diff --git a/gdb/python/python.c b/gdb/python/python.c
index c15e718..c94a252 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -312,23 +312,6 @@ gdbpy_solib_address (PyObject *self, PyObject *args)
   return str_obj;
 }
 
-static PyObject *
-gdbpy_find_pc_function (PyObject *self, PyObject *args)
-{
-  unsigned long long pc;
-  struct symbol *sym;
-  PyObject *sym_obj;
-
-  if (!PyArg_ParseTuple (args, "K", &pc))
-    return NULL;
-
-  sym = find_pc_function (pc);
-  if (sym)
-    return symbol_to_symbol_object (sym);
-
-  Py_RETURN_NONE;
-}
-
 /* Adds GDB value V to the pattern buffer in *PATTERN_BUF.  If SIZE is not zero,
    it specifies the number of bytes from V to copy to *PATTERN_BUF.  The
    function increases the size of *PATTERN_BUF as necessary, adjusting
@@ -1897,9 +1880,6 @@ a boolean indicating if name is a field of the current implied argument\n\
     "solib_address (Long) -> String.\n\
 Return the name of the shared library holding a given address, or None." },
 
-  { "find_pc_function", gdbpy_find_pc_function, METH_VARARGS,
-    "Return the function containing the given pc value, or None." },
-
   { "block_for_pc", gdbpy_block_for_pc, METH_VARARGS,
     "Return the block containing the given pc value, or None." },
 
diff --git a/gdb/testsuite/gdb.python/python-frame.exp b/gdb/testsuite/gdb.python/python-frame.exp
index 674c25e..93a3d21 100644
--- a/gdb/testsuite/gdb.python/python-frame.exp
+++ b/gdb/testsuite/gdb.python/python-frame.exp
@@ -78,7 +78,7 @@ gdb_test "python print 'result =', f0.type () == gdb.NORMAL_FRAME" " = True" "te
 gdb_test "python print 'result =', f0.unwind_stop_reason () == gdb.FRAME_UNWIND_NO_REASON" " = True" "test Frame.type"
 gdb_test "python print 'result =', gdb.frame_stop_reason_string (gdb.FRAME_UNWIND_INNER_ID)" " = previous frame inner to this frame \\(corrupt stack\\?\\)" "test gdb.frame_stop_reason_string"
 gdb_test "python print 'result =', f0.pc ()" " = \[0-9\]+" "test Frame.pc"
-gdb_test "python print 'result =', f0.addr_in_block ()" " = \[0-9\]+" "test Frame.addr_in_block"
+gdb_test "python print 'result =', f0.function ()" " = symbol for f2" "test Frame.function"
 gdb_test "python print 'result =', f0.older ().equals (f1)" " = True" "test Frame.older"
 gdb_test "python print 'result =', f1.newer ().equals (f0)" " = True" "test Frame.newer"
 gdb_test "python print 'result =', f0.read_var ('variable_which_surely_doesnt_exist')" \


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


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

only message in thread, other threads:[~2009-03-29 21:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-29 21:36 [SCM] archer-tromey-python: Replace gdb.Frame.addr_in_block with gdb.Frame.function bauermann

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