public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-30 17:22 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-30 17:22 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  0adf45a975c950b336e60ae9b6707a03b214cb08 (commit)
       via  4cbedfdc756e827c0cad49a43e68917487988b3c (commit)
       via  823ab34a0473db7f19cf665998afbb8763533ff1 (commit)
      from  a99d5b6c1c3f8667b833b186eefe5f94dc1f6c22 (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/doc/gdb.texinfo                       |   41 ++++++++++----------
 gdb/python/python-frame.c                 |   59 ++++++++++++++---------------
 gdb/testsuite/gdb.python/python-frame.exp |   12 +++---
 3 files changed, 55 insertions(+), 57 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 3eb5854..2dc5a3e 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -19575,32 +19575,36 @@ separated by newlines.  If there are no commands, this attribute is
 @cindex frames in python
 @tindex gdb.Frame
 @tindex Frame
-When the debugged program stops, @value{GDBN} is able to analyse its call
+When the debugged program stops, @value{GDBN} is able to analyze its call
 stack (@pxref{Frames,,Stack frames}).  The @code{gdb.Frame} class
 represents a frame in the stack.  A @code{gdb.Frame} object is only valid
 while its corresponding frame exists in the inferior's stack.  If you try
-to use an invalid frame object, a @code{RuntimeError} exception will be
-thrown.
+to use an invalid frame object, @value{GDBN} will throw a @code{RuntimeError}
+exception.
+
+Two @code{gdb.Frame} objects can be compared for equality with the @code{==}
+operator, like:
+
+@smallexample
+(@value{GDBP}) python print gdb.newest_frame() == gdb.selected_frame ()
+True
+@end smallexample
 
 The following frame-related functions are available in the @code{gdb} module:
 
-@findex gdb.frames
 @defun frames
 Return a tuple containing all frame objects.
 @end defun
 
-@findex gdb.newest_frame
 @defun newest_frame
 Return the newest frame object.
 @end defun
 
-@findex gdb.selected_frame
 @defun selected_frame
 Return the selected frame object.  (@pxref{Selection,,Selecting a Frame}).
 @end defun
 
-@findex gdb.frame_stop_reason_string
-@defun frame_stop_reason_string @var{reason}
+@defun frame_stop_reason_string reason
 Return a string explaining the reason why @value{GDBN} stopped unwinding
 frames, as expressed by the given @var{reason} code (an integer, see the
 @code{unwind_stop_reason} method further down in this section).
@@ -19609,15 +19613,11 @@ frames, as expressed by the given @var{reason} code (an integer, see the
 A @code{gdb.Frame} object has the following methods:
 
 @table @code
-@defmethod Frame equals @code{frame}
-Compare frames.
-@end defmethod
-
 @defmethod Frame is_valid
 Returns true if the @code{gdb.Frame} object is valid, false if not.
 A frame object can become invalid if the frame it refers to doesn't
 exist anymore in the inferior.  All @code{gdb.Frame} methods will throw
-an exception if it is invalid at the time the method call is made.
+an exception if it is invalid at the time the method is called.
 @end defmethod
 
 @defmethod Frame name
@@ -19626,15 +19626,16 @@ obtained.
 @end defmethod
 
 @defmethod Frame type
-Returns the type of the frame. The value can be one of
+Returns the type of the frame.  The value can be one of
 @code{gdb.NORMAL_FRAME}, @code{gdb.DUMMY_FRAME}, @code{gdb.SIGTRAMP_FRAME}
 or @code{gdb.SENTINEL_FRAME}.
 @end defmethod
 
 @defmethod Frame unwind_stop_reason
 Return an integer representing the reason why it's not possible to find
-frames older than this.  Use @code{gdb.frame_stop_reason_string} to convert
-the value returned by this function to a string.
+more frames toward the outermost frame.  Use
+@code{gdb.frame_stop_reason_string} to convert the value returned by this
+function to a string.
 @end defmethod
 
 @defmethod Frame pc
@@ -19650,19 +19651,19 @@ Returns the symbol for the function corresponding to this frame. @c (@pxref{Symb
 @end defmethod
 
 @defmethod Frame older
-Return the frame immediately older (outer) to this frame.
+Return the frame that called this frame.
 @end defmethod
 
 @defmethod Frame newer
-Return the frame immediately newer (inner) to this frame.
+Return the frame called by this frame.
 @end defmethod
 
 @defmethod Frame find_sal
 Return the frame's symtab and line object. @c (@pxref{Symtab_and_line,, Symtab and line}).
 @end defmethod
 
-@defmethod Frame read_var @var{variable}
-Return the value of the given variable in this frame.  @code{variable} can be
+@defmethod Frame read_var variable
+Return the value of the given variable in this frame.  @var{variable} can be
 either a string or a @code{gdb.Symbol} object. @c (@pxref{Symbols In Python}).
 @end defmethod
 @end table
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index 4b76709..6c33e65 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -109,31 +109,6 @@ frapy_is_valid (PyObject *self, PyObject *args)
   Py_RETURN_TRUE;
 }
 
-/* Implementation of gdb.Frame.equals (self, other) -> Boolean. */
-
-static PyObject *
-frapy_equal_p (PyObject *self, PyObject *args)
-{
-  int equalp = 0;	  /* Initialize to appease gcc warning.  */
-  frame_object *self_frame = (frame_object *) self;
-  frame_object *other;
-  volatile struct gdb_exception except;
-
-  if (!PyArg_ParseTuple (args, "O!", &frame_object_type, &other))
-    return NULL;
-
-  TRY_CATCH (except, RETURN_MASK_ALL)
-    {
-      equalp = frame_id_eq (self_frame->frame_id, other->frame_id);
-    }
-  GDB_PY_HANDLE_EXCEPTION (except);
-
-  if (equalp)
-    Py_RETURN_TRUE;
-
-  Py_RETURN_FALSE;
-}
-
 /* Implementation of gdb.Frame.name (self) -> String.
    Returns the name of the function corresponding to this frame.  */
 
@@ -581,6 +556,31 @@ gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args)
   return PyUnicode_Decode (str, strlen (str), host_charset (), NULL);
 }
 
+/* Implements the equality comparison for Frame objects.
+   All other comparison operators will throw a TypeError Python exception,
+   as they aren't valid for frames.  */
+
+static PyObject *
+frapy_richcompare (PyObject *self, PyObject *other, int op)
+{
+  if (!PyObject_TypeCheck (other, &frame_object_type))
+    {
+      PyErr_SetString (PyExc_TypeError, "Frame object expected in comparison.");
+      return NULL;
+    }
+  else if (op != Py_EQ)
+    {
+      PyErr_SetString (PyExc_TypeError, "Invalid comparison for gdb.Frame.");
+      return NULL;
+    }
+
+  if (frame_id_eq (((frame_object *) self)->frame_id,
+		   ((frame_object *) other)->frame_id))
+    Py_RETURN_TRUE;
+
+  Py_RETURN_FALSE;
+}
+
 /* Sets up the Frame API in the gdb module.  */
 
 void
@@ -616,9 +616,6 @@ gdbpy_initialize_frames (void)
 \f
 
 static PyMethodDef frame_object_methods[] = {
-  { "equals", frapy_equal_p, METH_VARARGS,
-    "equals (frame) -> Boolean.\n\
-Compare this frame to the given frame." },
   { "is_valid", frapy_is_valid, METH_NOARGS,
     "is_valid () -> Boolean.\n\
 Return true if this frame is valid, false if not." },
@@ -642,10 +639,10 @@ Return the frame's code block." },
 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." },
+Return the frame that called this frame." },
   { "newer", frapy_newer, METH_NOARGS,
     "newer () -> gdb.Frame.\n\
-Return the frame immetidaely newer (inner) to this frame." },
+Return the frame called by this frame." },
   { "find_sal", frapy_find_sal, METH_NOARGS,
     "find_sal () -> gdb.Symtab_and_line.\n\
 Return the frame's symtab and line." },
@@ -680,7 +677,7 @@ static PyTypeObject frame_object_type = {
   "GDB frame object",		  /* tp_doc */
   0,				  /* tp_traverse */
   0,				  /* tp_clear */
-  0,				  /* tp_richcompare */
+  frapy_richcompare,		  /* tp_richcompare */
   0,				  /* tp_weaklistoffset */
   0,				  /* tp_iter */
   0,				  /* tp_iternext */
diff --git a/gdb/testsuite/gdb.python/python-frame.exp b/gdb/testsuite/gdb.python/python-frame.exp
index 93a3d21..cbf1095 100644
--- a/gdb/testsuite/gdb.python/python-frame.exp
+++ b/gdb/testsuite/gdb.python/python-frame.exp
@@ -70,8 +70,8 @@ gdb_test "python print frames" "\\(<gdb.Frame object at 0x\[\[:xdigit:\]\]+>, <g
 gdb_py_test_silent_cmd "python f0 = frames\[0\]" "get first frame" 0
 gdb_py_test_silent_cmd "python f1 = frames\[1\]" "get second frame" 0
 
-gdb_test "python print 'result =', f0.equals (f1)" " = False" "test equals (false)"
-gdb_test "python print 'result =', f0.equals (f0)" " = True" "test equals (true)"
+gdb_test "python print 'result =', f0 == f1" " = False" "test equality comparison (false)"
+gdb_test "python print 'result =', f0 == f0" " = True" "test equality comparison (true)"
 gdb_test "python print 'result =', f0.is_valid ()" " = True" "test Frame.is_valid"
 gdb_test "python print 'result =', f0.name ()" " = f2" "test Frame.name"
 gdb_test "python print 'result =', f0.type () == gdb.NORMAL_FRAME" " = True" "test Frame.type"
@@ -79,14 +79,14 @@ gdb_test "python print 'result =', f0.unwind_stop_reason () == gdb.FRAME_UNWIND_
 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.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.older () == f1" " = True" "test Frame.older"
+gdb_test "python print 'result =', f1.newer () == f0" " = True" "test Frame.newer"
 gdb_test "python print 'result =', f0.read_var ('variable_which_surely_doesnt_exist')" \
   "ValueError: variable 'variable_which_surely_doesnt_exist' not found.*Error while executing Python code." \
   "test Frame.read_var - error"
 gdb_test "python print 'result =', f0.read_var ('a')" " = 1" "test Frame.read_var - success"
 
-gdb_test "python print 'result =', gdb.newest_frame ().equals (f0)" " = True" "test gdb.newest_frame"
-gdb_test "python print 'result =', gdb.selected_frame ().equals (f1)" " = True" "test gdb.selected_frame"
+gdb_test "python print 'result =', gdb.newest_frame () == f0" " = True" "test gdb.newest_frame"
+gdb_test "python print 'result =', gdb.selected_frame () == f1" " = True" "test gdb.selected_frame"
 
 gdb_test "python print 'result =', f0.block ()" "<gdb.Block object at 0x\[\[:xdigit:\]\]+>" "test Frame.block"


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-06-26 13:51 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-06-26 13:51 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  725480fec09998dbd52df1b30fa5aaabaf03f004 (commit)
       via  18d519b77a10771c92b8942f9f4ba202a10182a0 (commit)
       via  27864e441f63a596e0c6896bf26e5594949332a3 (commit)
       via  f8d2da2d8353b6850f847fd3f0b710e27cf19c3d (commit)
       via  1657fe434a4c30495959f707c80c7deb1736f883 (commit)
       via  d56fb1922950addd30c761755328ab22e11ece1a (commit)
       via  204034ea25dd552ffb3c464e3495373ae95a1c29 (commit)
       via  631162cfc21c649cc7b4348c34d82141458c3897 (commit)
       via  d6a564476a586759e0197355ec414c57c465f0f7 (commit)
       via  bdbbc99af120cbed5ab7e70a5cc641e25c45693f (commit)
       via  4aba94aee1ec62631e374f56e7b663228ea9b844 (commit)
       via  a5133b5808c88f924471b54adb995389fe271143 (commit)
       via  00ceaa46a7b32de3725c71fa7cfe1d49bae988a9 (commit)
       via  dd2b7c83458971fe9913fa090f7ff0ac8908dcb9 (commit)
       via  670c9f14b289153d9e6cee63b6a07395f27da411 (commit)
       via  e8f8ceab0830198c9f8417f4aaa78ed8cec565ec (commit)
       via  d99cc5ff7f712fa95d0088d61fdb1388d7c7f7fd (commit)
       via  99fed820d59957045cab648b0f590eb2f1608fdc (commit)
       via  07517a764e067b0d51aad3ea709eece78c129ffa (commit)
       via  dd3c068a8992a62520966b7b995c1eab633e4d01 (commit)
       via  ee82b0f3ce7b4cb241a4a47b82bd160a1a9d584f (commit)
       via  a7eab7ca9f3e72649d20061bb7fb82d00157ec4e (commit)
       via  266b32c46c0490da02454d11925ae2c957e4a8e7 (commit)
       via  b792e3f279f2e97426551c6def0d54175345ba12 (commit)
       via  94f728e3e2cba80e7e69e7516787f96251196744 (commit)
       via  94cd6b61db67d25c1f490f7b7a2fbf6ca33de917 (commit)
       via  da85b7464016e598ab52d749011248be3349a97c (commit)
       via  774d588d6a6625f1429380fb188c9d895e1b3828 (commit)
       via  6438f4615202149330f83f2a00a24f899ec0488d (commit)
       via  91f83ec148e00425a56eb0bbd58b92f83e677f44 (commit)
       via  611ecd1eccf8b1b75dac0c7e815938e893133143 (commit)
       via  62ac46f24ce72e95225f11da6276fdbf4a8c0084 (commit)
       via  28fd786ae855936d970046edb0923e34670bb103 (commit)
       via  a3bfe50522d5569e1448ed658de1c6095863b539 (commit)
       via  1598d0587cbfe0af5f819a36e874b06ca38879b3 (commit)
       via  d870112d827ffe607896358f6c7bb99aed210c57 (commit)
       via  04687403162fc6cd98679d98abfc7b34a2d44c83 (commit)
       via  c7d9ddfbfc71bdb63152defdc3cd38217bd2c84f (commit)
       via  cb9e0721888056bf67f56cdd718142a33361cb0a (commit)
       via  eaaf690a1a521b88418bb71d41cf620e11949692 (commit)
       via  b494f111290407d0aff43245d95d685f742c2574 (commit)
       via  e689d32aa08e4e44927e308b45a6577e2e166547 (commit)
       via  50c163f184912dc8c49918527aaab5e79a7406c9 (commit)
       via  dc819dc03600217379d46d9b2035081bf0998844 (commit)
       via  6bc1281be79a0301af5975312d6041b26f5f0d09 (commit)
       via  1c942a12c392ccb841d10d152dd8a75ba0f8c58b (commit)
       via  8b3b9e0e5b245a830df492eb8ad53a3b2accdefd (commit)
       via  dfe0569acfc83773bffbbee3c3b367f95c24aca6 (commit)
       via  b4008950667b96caeae8da75fa88c4fb0c34ea81 (commit)
       via  08a3baba8d4c0e08295cf694ad886902346b205b (commit)
       via  ca4aee6f39522ca9d5688a3232f98053748bd76c (commit)
       via  2ea0c9c0a1be8813e735544bac92d75a544e0d4b (commit)
       via  e5ef087820ce89b48b31d3df368ca9c5cc6faa39 (commit)
       via  a3f53d04c2005ca3ebe4d1f9d8a35d3b0746e01c (commit)
       via  98c8f4ad592e12f048aa0283f811938069e9c8c9 (commit)
       via  6a5159cf2e62b4c038aad5197b56f39c2c4b7828 (commit)
       via  35a298634d6dba3a8d504018e3e3883270dd82b4 (commit)
       via  9a60c03aaabe878f395e4158140b910c78115c70 (commit)
       via  23f94c7e31924c5f4a75160b6e190320788bc015 (commit)
       via  f802b04a465484d532631a283282d82f1eaf4742 (commit)
       via  d3c83ad5ec9f7672b87af9ad29279f459e53da11 (commit)
       via  cb2b7a541caeb06fb445bcadd785c61e3fb6d44a (commit)
       via  fd8aac6a938dc4bb127a0b4c114611e49e108b6d (commit)
       via  9fb6f32c7058328ec08efac2eb2c4838261b9705 (commit)
       via  0ab7f7fff17e89d3a01dd720b4c857120af6dd95 (commit)
       via  b5fae1114b5f6b2748e864cd42668f5a70db7e27 (commit)
       via  ea59c1b78c91bf5fa3f86bdef2f0a982b62a63c2 (commit)
       via  ede4b6284a7269c9019afc1e609b15ff965dc5bd (commit)
       via  63c0f33ffb33ec6412a7bed6d77e5f2329fa9fee (commit)
       via  9c3a1d66a1cf9ad0b565ca9a9421ddcb6e074dfe (commit)
       via  f890dfe48b075970744089b96086cae8a523e7f3 (commit)
       via  6999df1e2bc1dc0758782220f3b05997f1cb12cc (commit)
       via  6f72e3aabb5003b122630ba710030e0724b753e9 (commit)
       via  23d4c598a61989a7cb8a617e41d1649a82e41c69 (commit)
       via  5c9cfba5481ca11270ae4b66f334589b1246b74b (commit)
       via  8f2d11a0ab6b41dcb2a16cef2746f6db24c8eb30 (commit)
       via  30694f93d4a412614d819cbf361102cc26bff1ba (commit)
       via  fbb87559bb19198db0265d0e4402639a6bb1191d (commit)
       via  b27d958ef69eef2dece490af88a6062ae4e8b5a5 (commit)
       via  bdeb17716c0e7deab059245d9b0297cf02c7e66a (commit)
       via  3aa76975264f166f4a0cfc02682c29f55b3ca82f (commit)
       via  efca68d4734dd8aed126161eae4406fbd3dbf0f9 (commit)
       via  3fbdedd57f5502cf99a7a6a6a4a69f839d6301b1 (commit)
       via  41a6048fa52e72d36eec64f6f63614f504fdad74 (commit)
       via  007e2beed8f9a6eb7a94f5cd08f6f4550b9df995 (commit)
       via  e86f805127ee532e968dda33d291e8130f15eeb1 (commit)
       via  0eed6da5f6a39b6c2220eeb6df9db99866505b1f (commit)
       via  91037e3c68f9959687d98e050db7c021a72f6ba1 (commit)
       via  ffc8d494a22c525b1603d1396282a7202ddd47dc (commit)
       via  0219d54f165088785f56e7dfe046a8b81aa30d65 (commit)
       via  7c9a1d3de8ca1071889504bda5126f429cfef826 (commit)
       via  f9bedb806c036ba345887d86dbb280a0d48189c3 (commit)
       via  ca89850fb293b9367ba478c3b64c0a3a954013bb (commit)
       via  f04484802a7a2a2e0e2a9ca8fc431e6286bbb3b1 (commit)
       via  46d9edb3cc87900695ed4f72b3db11d6b39f07f3 (commit)
       via  33b624c666c0657d879322da307a8ff9712d5017 (commit)
       via  1f875a4da263b0d5be4a01cb9fb7079d1c26a74f (commit)
       via  01a7fe27ba681c9c5cca7a0fea7e3c32db019105 (commit)
       via  4aafb4fe9ace5b76de1d315dd31321a8e19233b2 (commit)
       via  4122c5c211b4ce5345579bfc2de9e20d473c8109 (commit)
       via  23da2762737346f683b2be1db5d4305c80ce33fe (commit)
       via  82879e9f139e22f6d7b8846399a62594474e4f77 (commit)
      from  250924957fe147f3d74543f4d731e0e7dcb1eeea (commit)

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

- Log -----------------------------------------------------------------
commit 725480fec09998dbd52df1b30fa5aaabaf03f004
Merge: 18d519b77a10771c92b8942f9f4ba202a10182a0 27864e441f63a596e0c6896bf26e5594949332a3
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Tue Apr 7 19:57:12 2009 +0200

    Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python

commit 18d519b77a10771c92b8942f9f4ba202a10182a0
Merge: 250924957fe147f3d74543f4d731e0e7dcb1eeea f8d2da2d8353b6850f847fd3f0b710e27cf19c3d
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Tue Apr 7 18:22:13 2009 +0200

    Merge commit 'origin/master' into archer-jankratochvil-python
    
    Conflicts:
    	gdb/breakpoint.h
    	gdb/doc/gdb.texinfo
    	gdb/dwarf2read.c
    	gdb/python/python-frame.c
    	gdb/python/python-internal.h
    	gdb/python/python-value.c
    	gdb/python/python.c
    	gdb/testsuite/gdb.python/python-frame.exp
    	gdb/testsuite/gdb.python/python-value.exp

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

Summary of changes:
 ChangeLog                                       |    5 +
 bfd/ChangeLog                                   |  154 +++
 bfd/bfd-in.h                                    |    4 +
 bfd/bfd-in2.h                                   |    4 +
 bfd/coff-arm.c                                  |   10 +-
 bfd/coff-rs6000.c                               |  504 ++++----
 bfd/coff-x86_64.c                               |    7 +-
 bfd/cpu-arm.c                                   |    4 +-
 bfd/elf-attrs.c                                 |    4 +-
 bfd/elf32-arm.c                                 |  145 ++-
 bfd/elf32-vax.c                                 |   44 +-
 bfd/elf32-xtensa.c                              |    7 +-
 bfd/elflink.c                                   |    3 +-
 bfd/libpei.h                                    |    1 +
 bfd/peXXigen.c                                  |   82 ++
 bfd/section.c                                   |   10 +
 bfd/version.h                                   |    2 +-
 bfd/xcofflink.c                                 | 1159 +++++++++++--------
 djunpack.bat                                    |    2 +-
 gdb/ChangeLog                                   |  290 +++++-
 gdb/NEWS                                        |   13 +
 gdb/ada-lang.h                                  |    4 +-
 gdb/ada-tasks.c                                 |    5 +-
 gdb/breakpoint.c                                |  555 +++++++++-
 gdb/breakpoint.h                                |   29 +-
 gdb/config/djgpp/fnchange.lst                   |  165 +++-
 gdb/cp-name-parser.y                            |    2 +-
 gdb/cp-valprint.c                               |   28 +-
 gdb/doc/ChangeLog                               |   42 +
 gdb/doc/gdb.texinfo                             |  186 ++-
 gdb/dwarf2read.c                                |    4 +-
 gdb/gdbserver/ChangeLog                         |  427 +++++++
 gdb/gdbserver/Makefile.in                       |    3 +-
 gdb/gdbserver/event-loop.c                      |  504 ++++++++
 gdb/gdbserver/gdb_proc_service.h                |    4 +-
 gdb/gdbserver/inferiors.c                       |  169 +++-
 gdb/gdbserver/linux-low.c                       | 1368 ++++++++++++++++------
 gdb/gdbserver/linux-low.h                       |   35 +-
 gdb/gdbserver/mem-break.c                       |   47 +-
 gdb/gdbserver/mem-break.h                       |    5 +
 gdb/gdbserver/proc-service.c                    |    5 +-
 gdb/gdbserver/remote-utils.c                    |  364 +++++--
 gdb/gdbserver/server.c                          | 1439 +++++++++++++++--------
 gdb/gdbserver/server.h                          |  154 +++-
 gdb/gdbserver/spu-low.c                         |  109 ++-
 gdb/gdbserver/target.c                          |   72 +-
 gdb/gdbserver/target.h                          |  160 ++-
 gdb/gdbserver/thread-db.c                       |   74 +-
 gdb/gdbserver/win32-low.c                       |  189 ++--
 gdb/gdbthread.h                                 |    4 +
 gdb/inf-loop.c                                  |    5 +-
 gdb/linux-nat.c                                 |   21 +-
 gdb/minsyms.c                                   |   32 +-
 gdb/mips-tdep.c                                 |   14 +
 gdb/mn10300-tdep.c                              |    3 +
 gdb/observer.sh                                 |    4 +-
 gdb/ppc-linux-nat.c                             |   73 +-
 gdb/python/python-frame.c                       |    9 +-
 gdb/python/python-internal.h                    |    1 +
 gdb/python/python-membuf.c                      |   59 +-
 gdb/python/python-objfile.c                     |    4 +
 gdb/python/python.c                             |   51 +-
 gdb/remote.c                                    |  164 ++--
 gdb/sparc64nbsd-nat.c                           |    7 +-
 gdb/spu-linux-nat.c                             |   19 +-
 gdb/stabsread.c                                 |    4 +-
 gdb/symtab.h                                    |    8 +-
 gdb/testsuite/ChangeLog                         |  106 ++-
 gdb/testsuite/gdb.ada/tasks.exp                 |   79 ++
 gdb/testsuite/gdb.ada/tasks/foo.adb             |   68 ++
 gdb/testsuite/gdb.arch/powerpc-prologue.exp     |    4 +-
 gdb/testsuite/gdb.base/attach.exp               |    5 -
 gdb/testsuite/gdb.dwarf2/dw2-strp.S             |   18 +-
 gdb/testsuite/gdb.dwarf2/dw2-unresolved-main.c  |   46 +
 gdb/testsuite/gdb.dwarf2/dw2-unresolved.S       |  171 +++
 gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp     |   41 +
 gdb/testsuite/gdb.mi/basics.c                   |    7 +-
 gdb/testsuite/gdb.mi/mi-nonstop-exit.exp        |   44 +-
 gdb/testsuite/gdb.mi/mi-nonstop.exp             |   73 +-
 gdb/testsuite/gdb.mi/mi-nsintrall.exp           |   36 +-
 gdb/testsuite/gdb.mi/mi-nsmoribund.exp          |   36 +-
 gdb/testsuite/gdb.python/python-frame.exp       |    4 +-
 gdb/testsuite/gdb.python/python-membuf.c        |   11 +
 gdb/testsuite/gdb.python/python-membuf.exp      |   70 ++
 gdb/testsuite/gdb.python/python-prettyprint.c   |   34 +-
 gdb/testsuite/gdb.python/python-prettyprint.exp |    4 +-
 gdb/testsuite/gdb.python/python-prettyprint.py  |   17 +
 gdb/testsuite/gdb.server/ext-attach.exp         |    7 +-
 gdb/testsuite/gdb.threads/pending-step.c        |   61 +
 gdb/testsuite/gdb.threads/pending-step.exp      |   95 ++
 gdb/testsuite/gdb.trace/actions.exp             |   78 +-
 gdb/testsuite/gdb.trace/deltrace.exp            |   97 +--
 gdb/testsuite/gdb.trace/infotrace.exp           |   12 +-
 gdb/testsuite/gdb.trace/passcount.exp           |   74 +-
 gdb/testsuite/gdb.trace/save-trace.exp          |   11 +-
 gdb/testsuite/gdb.trace/tracecmd.exp            |    3 +-
 gdb/testsuite/gdb.trace/while-stepping.exp      |   15 +-
 gdb/testsuite/lib/mi-support.exp                |   28 +-
 gdb/thread.c                                    |   16 +
 gdb/tracepoint.c                                |  767 ++-----------
 gdb/tracepoint.h                                |   95 +--
 gdb/version.in                                  |    2 +-
 gdb/windows-nat.c                               |    7 +
 include/coff/ChangeLog                          |    4 +
 include/coff/xcoff.h                            |   61 -
 include/elf/ChangeLog                           |   15 +
 include/elf/common.h                            |    5 +
 libdecnumber/ChangeLog                          |   13 +
 libdecnumber/decBasic.c                         |  911 +++++++++------
 libdecnumber/decCommon.c                        |  431 ++++---
 libdecnumber/decContext.c                       |   83 +-
 libdecnumber/decContext.h                       |   78 +-
 libdecnumber/decDPD.h                           |   45 +-
 libdecnumber/decDouble.c                        |  174 ++--
 libdecnumber/decDouble.h                        |   25 +-
 libdecnumber/decNumber.c                        |  866 +++++++-------
 libdecnumber/decNumber.h                        |    6 +-
 libdecnumber/decNumberLocal.h                   |  241 +++--
 libdecnumber/decPacked.c                        |   24 +-
 libdecnumber/decPacked.h                        |   14 +-
 libdecnumber/decQuad.c                          |  170 ++--
 libdecnumber/decQuad.h                          |   49 +-
 libdecnumber/decSingle.c                        |   53 +-
 libdecnumber/decSingle.h                        |   20 +-
 libdecnumber/dpd/decimal128.c                   |  119 +-
 libdecnumber/dpd/decimal128.h                   |   16 +-
 libdecnumber/dpd/decimal32.c                    |   83 +-
 libdecnumber/dpd/decimal32.h                    |   14 +-
 libdecnumber/dpd/decimal64.c                    |  133 +--
 libdecnumber/dpd/decimal64.h                    |   14 +-
 libiberty/ChangeLog                             |   10 +
 libiberty/Makefile.in                           |   14 +-
 libiberty/config.in                             |    3 +
 libiberty/configure                             |    4 +-
 libiberty/configure.ac                          |    3 +-
 libiberty/functions.texi                        |   13 +-
 libiberty/memmem.c                              |   70 ++
 opcodes/ChangeLog                               |   27 +
 opcodes/arm-dis.c                               |   10 +-
 opcodes/ppc-dis.c                               |   24 +-
 opcodes/ppc-opc.c                               |   62 +-
 141 files changed, 10135 insertions(+), 5098 deletions(-)
 create mode 100644 gdb/gdbserver/event-loop.c
 create mode 100644 gdb/testsuite/gdb.ada/tasks.exp
 create mode 100644 gdb/testsuite/gdb.ada/tasks/foo.adb
 create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-unresolved-main.c
 create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-unresolved.S
 create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp
 create mode 100644 gdb/testsuite/gdb.python/python-membuf.c
 create mode 100644 gdb/testsuite/gdb.python/python-membuf.exp
 create mode 100644 gdb/testsuite/gdb.threads/pending-step.c
 create mode 100644 gdb/testsuite/gdb.threads/pending-step.exp
 create mode 100644 libiberty/memmem.c

First 500 lines of diff:
diff --git a/ChangeLog b/ChangeLog
index 7e44f7d..85cc9df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-03-27  Eli Zaretskii  <eliz@gnu.org>
+
+	* djunpack.bat: Use ".." quoting in Sed command, for the sake of
+	Windows builds of Sed.
+
 2009-03-18  Tom Tromey  <tromey@redhat.com>
 
 	* configure: Rebuild.
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 11a0acb..6fdba4d 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,157 @@
+2009-04-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* coff-x86_64.c (bfd_pe_print_pdata): Defined to
+	_bfd_pex64_print_pdata only if PE is defined.
+
+	* libpei.h (_bfd_pep_print_x64_pdata): Renamed to ...
+	(_bfd_pex64_print_pdata): This.
+
+	* peXXigen.c (_bfd_pep_print_x64_pdata): Renamed to ...
+	(_bfd_pex64_print_pdata): This.  Defined only if COFF_WITH_pex64
+	is defined.
+
+2009-04-05  Kai Tietz  <kai.tietz@onevision.com>
+
+	* coff-x86_64.c (bfd_pe_print_pdata): Define as
+	_bfd_pep_print_x64_pdata.
+	* libpei.h (_bfd_pep_print_x64_pdata): Add prototype.
+	* peXXigen.c (_bfd_pep_print_x64_pdata): New.
+
+2009-04-02  Sterling Augustine  <sterling@jaw.hq.tensilica.com>
+
+	* elf32-xtensa.c (relax_property_section): Always set r_offset 
+	to zero.
+
+2009-04-02  Christophe Lyon  <christophe.lyon@st.com>
+
+	* elf32-arm.c (elf32_arm_stub_long_branch_v4t_thumb_thumb,
+	elf32_arm_stub_long_branch_v4t_thumb_thumb_pic): Two new long
+	branch stubs.
+	(elf32_arm_stub_type): New enum values for the two new stubs.
+	(arm_type_of_stub): Make use of the two new stubs.
+	(arm_size_one_stub): Handle the two new stubs.
+
+2009-04-01  Matt Thomas  <matt@netbsd.org>
+
+	* elf32-vax.c (elf_vax_check_relocs): Do not put relocations against
+	hidden symbols into the GOT or PLT.GOT.
+	(elf_vax_relocate_section): Do not emit a PCREL reloc 
+	into a shared object if it is against a hidden symbol.
+
+2009-04-01  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+	* xcofflink.c (xcoff_archive_info): Add contains_shared_object_p
+	and know_contains_shared_object_p.
+	(xcoff_archive_contains_shared_object_p): Add an "info" parameter.
+	Cache the result in the archive_info table.
+	(xcoff_auto_export_p): Add an "info" parameter and update the
+	call to xcoff_archive_contains_shared_object_p.
+	(xcoff_mark_auto_exports): Update accordingly.
+	(xcoff_post_gc_symbol): Likewise.
+
+2009-04-01  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+	* xcofflink.c (bfd_link_input_bfd): Treat __rtinit as C_HIDEXT
+	rather than C_EXT.
+
+2009-04-01  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+	* coff-rs6000.c (member_layout): New structure.
+	(archive_iterator): Likewise.
+	(member_layout_init): New function.
+	(archive_iterator_begin): Likewise.
+	(archive_iterator_next): Likewise.
+	(xcoff_write_armap_old): Use the new iterator functions.
+	(do_shared_object_padding): Delete.
+	(xcoff_write_armap_big): Use the new iterator functions.  Simplify
+	handling of arch_info.
+	(xcoff_write_archive_contents_old): Allocate arelt_data in the
+	first loop rather than the second.  Allocate a member header if
+	there isn't one, then work out the stat information and length
+	in the first loop too.  Use the new iterators for the second loop.
+	(xcoff_write_archive_contents_big): Likewise.
+
+2009-04-01  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+	* bfd-in.h (bfd_xcoff_split_import_path): Declare.
+	(bfd_xcoff_set_archive_import_path): Likewise.
+	* bfd-in2.h: Regenerate.
+	* xcofflink.c: Include libiberty.h.
+	(xcoff_archive_info): New structure.
+	(xcoff_archive_info_hash): New function.
+	(xcoff_archive_info_eq): Likewise.
+	(xcoff_get_archive_info): Likewise.
+	(_bfd_xcoff_bfd_link_hash_table_create): Initialize archive_info.
+	(bfd_xcoff_split_import_path): New function.
+	(bfd_xcoff_set_archive_import_path): Likewise.
+	(xcoff_set_import_path): Move earlier in file.
+	(xcoff_link_add_dynamic_symbols): Set the import path of a non-archive
+	object to the the directory part of the bfd's filename.  Get the
+	import path and filename of an archive object from the archive's
+	xcoff_tdata, initializing it if necessary.  Update use of
+	import_file_id.
+	(bfd_link_input_bfd): Update use of import_file_id.
+	(xcoff_write_global_symbol): Likewise.
+
+2009-04-01  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+	* xcofflink.c (xcoff_link_hash_table): Moved from include/coff/xcoff.h.
+
+2009-04-01  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+	* xcofflink.c (xcoff_link_create_extra_sections): Don't create
+	a .loader section for relocatable links.
+	(xcoff_need_ldrel_p): New function.
+	(xcoff_mark): Use it.
+	(bfd_xcoff_link_count_reloc): Only count loader relocs if there's
+	a loader section.
+	(xcoff_build_ldsym): New function, split out from...
+	(xcoff_build_ldsyms): ...here.  Rename to...
+	(xcoff_post_gc_symbol): ...this.  Only export symbols, and only
+	call xcoff_build_ldsym, if there's a loader section.
+	(xcoff_build_loader_section): New function, extracted verbatim from...
+	(bfd_xcoff_size_dynamic_sections): ...here.  Only call it if
+	there's a loader section.  Only add an __rtinit loader symbol
+	if there's a loader section.  Update after above name change.
+	(xcoff_symbol_section, xcoff_create_ldrel): New functions.
+	(bfd_link_input_bfd): Use xcoff_need_ldrel_p, xcoff_symbol_section
+	and xcoff_create_ldrel.
+	(xcoff_write_global_symbol): Use xcoff_create_ldrel.
+	(xcoff_reloc_link_order): Likewise, but only call it if there's
+	a loader section.  Use xcoff_symbol_section.
+	(_bfd_xcoff_bfd_final_link): Only use fdinfo.ldrel and fdinfo.ldsym
+	if there's a loader section.
+
+2009-04-01  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* xcofflink.c (bfd_link_input_bfd): Fix buffer overrun.
+
+2009-04-01  Christophe Lyon  <christophe.lyon@st.com>
+
+	* elf32-arm.c (group_sections): Rewrite loops for better
+	readability.
+
+2009-03-30  DJ Delorie  <dj@redhat.com>
+
+	* elflink.c (elf_link_input_bfd): Don't try to resolve complex
+	relocs when doing a relocatable link.
+
+2009-03-28  Mark Mitchell  <mark@codesourcery.com>
+
+	* coff-arm.c (coff_arm_merge_private_bfd_data): Use "error:", not
+	"ERROR:", in error messages.
+	* cpu-arm.c (bfd_arm_merge_machines): Likewise.
+	* elf-attrs.c (_bfd_elf_merge_object_attributes): Likewise.
+	* elf32-arm.c (tag_cpu_arch_combine): Likewise.
+	(elf32_arm_merge_eabi_attributes): Likewise.
+	(elf32_arm_merge_private_bfd_data): Likewise.
+
+2009-03-27  Nick Clifton  <nickc@redhat.com>
+
+	* section.c (bfd_get_section_contents): Detect and handle the case
+	where a section has the SEC_IN_MEMORY flag set but no actual
+	contents allocated.
+
 2009-03-26  Alan Modra  <amodra@bigpond.net.au>
 
 	PR 6494
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 5a3e13f..9a303e0 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -765,6 +765,10 @@ extern bfd_boolean bfd_get_file_window
 
 /* XCOFF support routines for the linker.  */
 
+extern bfd_boolean bfd_xcoff_split_import_path
+  (bfd *, const char *, const char **, const char **);
+extern bfd_boolean bfd_xcoff_set_archive_import_path
+  (struct bfd_link_info *, bfd *, const char *);
 extern bfd_boolean bfd_xcoff_link_record_set
   (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type);
 extern bfd_boolean bfd_xcoff_import_symbol
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 78a5bd9..646be2c 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -772,6 +772,10 @@ extern bfd_boolean bfd_get_file_window
 
 /* XCOFF support routines for the linker.  */
 
+extern bfd_boolean bfd_xcoff_split_import_path
+  (bfd *, const char *, const char **, const char **);
+extern bfd_boolean bfd_xcoff_set_archive_import_path
+  (struct bfd_link_info *, bfd *, const char *);
 extern bfd_boolean bfd_xcoff_link_record_set
   (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type);
 extern bfd_boolean bfd_xcoff_import_symbol
diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c
index d2c27c4..a5bcc77 100644
--- a/bfd/coff-arm.c
+++ b/bfd/coff-arm.c
@@ -2208,7 +2208,7 @@ coff_arm_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
 	    {
 	      _bfd_error_handler
 		/* xgettext: c-format */
-		(_("ERROR: %B is compiled for APCS-%d, whereas %B is compiled for APCS-%d"),
+		(_("error: %B is compiled for APCS-%d, whereas %B is compiled for APCS-%d"),
 		 ibfd, obfd,
 		 APCS_26_FLAG (ibfd) ? 26 : 32,
 		 APCS_26_FLAG (obfd) ? 26 : 32
@@ -2224,10 +2224,10 @@ coff_arm_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
 
 	      if (APCS_FLOAT_FLAG (ibfd))
 		/* xgettext: c-format */
-		msg = _("ERROR: %B passes floats in float registers, whereas %B passes them in integer registers");
+		msg = _("error: %B passes floats in float registers, whereas %B passes them in integer registers");
 	      else
 		/* xgettext: c-format */
-		msg = _("ERROR: %B passes floats in integer registers, whereas %B passes them in float registers");
+		msg = _("error: %B passes floats in integer registers, whereas %B passes them in float registers");
 
 	      _bfd_error_handler (msg, ibfd, obfd);
 
@@ -2241,10 +2241,10 @@ coff_arm_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
 
 	      if (PIC_FLAG (ibfd))
 		/* xgettext: c-format */
-		msg = _("ERROR: %B is compiled as position independent code, whereas target %B is absolute position");
+		msg = _("error: %B is compiled as position independent code, whereas target %B is absolute position");
 	      else
 		/* xgettext: c-format */
-		msg = _("ERROR: %B is compiled as absolute position code, whereas target %B is position independent");
+		msg = _("error: %B is compiled as absolute position code, whereas target %B is position independent");
 	      _bfd_error_handler (msg, ibfd, obfd);
 
 	      bfd_set_error (bfd_error_wrong_format);
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 3343530..c5a486b 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -180,8 +180,6 @@ static bfd_boolean do_pad
   PARAMS ((bfd *, unsigned int));
 static bfd_boolean do_copy
   PARAMS ((bfd *, bfd *));
-static bfd_boolean do_shared_object_padding
-  PARAMS ((bfd *, bfd *, file_ptr *, int));
 
 /* Relocation functions */
 static bfd_boolean xcoff_reloc_type_br
@@ -238,6 +236,119 @@ bfd_boolean (*xcoff_complain_overflow[XCOFF_MAX_COMPLAIN_OVERFLOW])
   xcoff_complain_overflow_unsigned_func,
 };
 
+/* Information about one member of an archive.  */
+struct member_layout {
+  /* The archive member that this structure describes.  */
+  bfd *member;
+
+  /* The number of bytes of padding that must be inserted before the
+     start of the member in order to ensure that the section contents
+     are correctly aligned.  */
+  unsigned int leading_padding;
+
+  /* The offset of MEMBER from the start of the archive (i.e. the end
+     of the leading padding).  */
+  file_ptr offset;
+
+  /* The normalized name of MEMBER.  */
+  const char *name;
+
+  /* The length of NAME, without padding.  */
+  bfd_size_type namlen;
+
+  /* The length of NAME, with padding.  */
+  bfd_size_type padded_namlen;
+
+  /* The size of MEMBER's header, including the name and magic sequence.  */
+  bfd_size_type header_size;
+
+  /* The size of the MEMBER's contents.  */
+  bfd_size_type contents_size;
+
+  /* The number of bytes of padding that must be inserted after MEMBER
+     in order to preserve even alignment.  */
+  bfd_size_type trailing_padding;
+};
+
+/* A structure used for iterating over the members of an archive.  */
+struct archive_iterator {
+  /* The archive itself.  */
+  bfd *archive;
+
+  /* Information about the current archive member.  */
+  struct member_layout current;
+
+  /* Information about the next archive member.  MEMBER is null if there
+     are no more archive members, in which case OFFSET is the offset of
+     the first unused byte.  */
+  struct member_layout next;
+};
+
+/* Initialize INFO so that it describes member MEMBER of archive ARCHIVE.
+   OFFSET is the even-padded offset of MEMBER, not including any leading
+   padding needed for section alignment.  */
+
+static void
+member_layout_init (struct member_layout *info, bfd *archive,
+		    bfd *member, file_ptr offset)
+{
+  info->member = member;
+  info->leading_padding = 0;
+  if (member)
+    {
+      info->name = normalize_filename (member);
+      info->namlen = strlen (info->name);
+      info->padded_namlen = info->namlen + (info->namlen & 1);
+      if (xcoff_big_format_p (archive))
+	info->header_size = SIZEOF_AR_HDR_BIG;
+      else
+	info->header_size = SIZEOF_AR_HDR;
+      info->header_size += info->padded_namlen + SXCOFFARFMAG;
+      info->contents_size = arelt_size (member);
+      info->trailing_padding = info->contents_size & 1;
+
+      if (bfd_check_format (member, bfd_object)
+	  && bfd_get_flavour (member) == bfd_target_xcoff_flavour
+	  && (member->flags & DYNAMIC) != 0)
+	info->leading_padding
+	  = (-(offset + info->header_size)
+	     & ((1 << bfd_xcoff_text_align_power (member)) - 1));
+    }
+  info->offset = offset + info->leading_padding;
+}
+
+/* Set up ITERATOR to iterate through archive ARCHIVE.  */
+
+static void
+archive_iterator_begin (struct archive_iterator *iterator,
+			bfd *archive)
+{
+  iterator->archive = archive;
+  member_layout_init (&iterator->next, archive, archive->archive_head,
+		      xcoff_big_format_p (archive)
+		      ? SIZEOF_AR_FILE_HDR_BIG
+		      : SIZEOF_AR_FILE_HDR);
+}
+
+/* Make ITERATOR visit the first unvisited archive member.  Return true
+   on success; return false if all members have been visited.  */
+
+static bfd_boolean
+archive_iterator_next (struct archive_iterator *iterator)
+{
+  if (!iterator->next.member)
+    return FALSE;
+
+  iterator->current = iterator->next;
+  member_layout_init (&iterator->next, iterator->archive,
+		      iterator->current.member->archive_next,
+		      iterator->current.offset
+		      + iterator->current.header_size
+		      + iterator->current.contents_size
+		      + iterator->current.trailing_padding);
+  return TRUE;
+}
+
 /* We use our own tdata type.  Its first field is the COFF tdata type,
    so the COFF routines are compatible.  */
 
@@ -1603,11 +1714,10 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
      unsigned int orl_count;
      int stridx;
 {
+  struct archive_iterator iterator;
   struct xcoff_ar_hdr hdr;
   char *p;
   unsigned char buf[4];
-  bfd *sub;
-  file_ptr fileoff;
   unsigned int i;
 
   memset (&hdr, 0, sizeof hdr);
@@ -1635,29 +1745,16 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
   if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
     return FALSE;
 
-  sub = abfd->archive_head;
-  fileoff = SIZEOF_AR_FILE_HDR;
   i = 0;
-  while (sub != NULL && i < orl_count)
-    {
-      size_t namlen;
-
-      while (map[i].u.abfd == sub)
-	{
-	  H_PUT_32 (abfd, fileoff, buf);
-	  if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
-	    return FALSE;
-	  ++i;
-	}
-      namlen = strlen (normalize_filename (sub));
-      namlen = (namlen + 1) &~ (size_t) 1;
-      fileoff += (SIZEOF_AR_HDR
-		  + namlen
-		  + SXCOFFARFMAG
-		  + arelt_size (sub));
-      fileoff = (fileoff + 1) &~ 1;
-      sub = sub->archive_next;
-    }
+  archive_iterator_begin (&iterator, abfd);
+  while (i < orl_count && archive_iterator_next (&iterator))
+    while (map[i].u.abfd == iterator.current.member)
+      {
+	H_PUT_32 (abfd, iterator.current.offset, buf);
+	if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
+	  return FALSE;
+	++i;
+      }
 
   for (i = 0; i < orl_count; i++)
     {
@@ -1759,34 +1856,6 @@ do_copy (out_bfd, in_bfd)
 }
 
 static bfd_boolean
-do_shared_object_padding (out_bfd, in_bfd, offset, ar_header_size)
-     bfd *out_bfd;
-     bfd *in_bfd;
-     file_ptr *offset;
-     int ar_header_size;
-{
-  if (bfd_check_format (in_bfd, bfd_object)
-      && bfd_get_flavour (in_bfd) == bfd_target_xcoff_flavour
-      && (in_bfd->flags & DYNAMIC) != 0)
-    {
-      bfd_size_type pad = 0;
-      int text_align_power;
-
-      text_align_power = bfd_xcoff_text_align_power (in_bfd);
-
-      pad = 1 << text_align_power;
-      pad -= (*offset + ar_header_size) & (pad - 1);
-
-      if (! do_pad (out_bfd, pad))
-	return FALSE;
-
-      *offset += pad;
-    }
-
-  return TRUE;
-}
-
-static bfd_boolean
 xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
      bfd *abfd;
      unsigned int elength ATTRIBUTE_UNUSED;
@@ -1794,9 +1863,10 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
      unsigned int orl_count;
      int stridx;
 {
+  struct archive_iterator iterator;
   struct xcoff_ar_file_hdr_big *fhdr;
   bfd_vma i, sym_32, sym_64, str_32, str_64;
-  const bfd_arch_info_type *arch_info = NULL;
+  const bfd_arch_info_type *arch_info;
   bfd *current_bfd;
   size_t string_length;
   file_ptr nextoff, prevoff;
@@ -1805,16 +1875,15 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
      from 32-bit objects and which from 64-bit ones.  */
   sym_32 = sym_64 = str_32 = str_64 = 0;
 
-  current_bfd = abfd->archive_head;
-  if (current_bfd != NULL)
-    arch_info = bfd_get_arch_info (current_bfd);
-    i = 0;
-    while (current_bfd != NULL && i < orl_count)
+  i = 0;
+  for (current_bfd = abfd->archive_head;
+       current_bfd != NULL && i < orl_count;
+       current_bfd = current_bfd->archive_next)
     {
+      arch_info = bfd_get_arch_info (current_bfd);
       while (map[i].u.abfd == current_bfd)
 	{
 	  string_length = strlen (*map[i].name) + 1;
-
 	  if (arch_info->bits_per_address == 64)
 	    {
 	      sym_64++;
@@ -1827,9 +1896,6 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
 	    }


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-29 22:42 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-29 22:42 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  a99d5b6c1c3f8667b833b186eefe5f94dc1f6c22 (commit)
       via  7946cfed05838e9cd6475fca65f9a48662929959 (commit)
       via  51431bcab78f52fd56bd639e9572a1f075282c3d (commit)
       via  74b9d22a011e9f8c6b286647ee0a751063f9ed9f (commit)
       via  1948198702b51b31d79793fc49434b529b4e245f (commit)
       via  4d8ab8c4efc5939b06dee212d3883cf3b8c2c153 (commit)
      from  b7e737e1c5dfed18c85c76318ca732cc5b1f786f (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/doc/gdb.texinfo                            |   18 +++++-----
 gdb/python/lib/gdb/command/backtrace.py        |    2 +-
 gdb/python/lib/gdb/libstdcxx/v6/printers.py    |    4 +-
 gdb/python/python-frame.c                      |   21 +++++++-----
 gdb/python/python-value.c                      |   41 +++++++++++++++++------
 gdb/python/python.c                            |   20 -----------
 gdb/testsuite/gdb.ada/lang_switch.exp          |    2 +
 gdb/testsuite/gdb.ada/ref_param.exp            |    2 +
 gdb/testsuite/gdb.base/call-ar-st.exp          |    1 +
 gdb/testsuite/gdb.base/funcargs.exp            |    2 +
 gdb/testsuite/gdb.python/find.exp              |   10 +++---
 gdb/testsuite/gdb.python/python-frame.exp      |    2 +-
 gdb/testsuite/gdb.python/python-prettyprint.py |    4 +-
 gdb/testsuite/gdb.python/python-value.exp      |    6 +++
 14 files changed, 75 insertions(+), 60 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 19d5daf..3eb5854 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18487,9 +18487,15 @@ bar = some_val['foo']
 
 Again, @code{bar} will also be a @code{gdb.Value} object.
 
-The following attribute is provided:
+The following attributes are provided:
 
 @table @code
+@defmethod Value address
+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
+
 @cindex optimized out value in Python
 @defmethod Value is_optimized_out
 This read-only boolean attribute is true if the compiler optimized out
@@ -18500,12 +18506,6 @@ this value, thus it is not available for fetching from the inferior.
 The following methods are provided:
 
 @table @code
-@defmethod Value address
-If the @code{gdb.Value} object is addressable, this will return a new
-@code{gdb.Value} object representing the address.  Otherwise, this
-will throw an exception.
-@end defmethod
-
 @defmethod Value cast type
 Cast the @code{gdb.Value} to the type represented by @var{type}, and
 return a new @code{gdb.Value}.  @var{type} must be a @code{gdb.Type}
@@ -19645,8 +19645,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/lib/gdb/libstdcxx/v6/printers.py b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
index bbe4475..9758420 100644
--- a/gdb/python/lib/gdb/libstdcxx/v6/printers.py
+++ b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
@@ -49,7 +49,7 @@ class StdListPrinter:
         def __init__(self, nodetype, head):
             self.nodetype = nodetype
             self.base = head['_M_next']
-            self.head = head.address()
+            self.head = head.address
             self.count = 0
 
         def __iter__(self):
@@ -73,7 +73,7 @@ class StdListPrinter:
         return self._iterator(nodetype, self.val['_M_impl']['_M_node'])
 
     def to_string(self):
-        if self.val['_M_impl']['_M_node'].address() == self.val['_M_impl']['_M_node']['_M_next']:
+        if self.val['_M_impl']['_M_node'].address == self.val['_M_impl']['_M_node']['_M_next']:
             return 'empty std::list'
         return 'std::list'
 
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-value.c b/gdb/python/python-value.c
index 5d4f596..b55463c 100644
--- a/gdb/python/python-value.c
+++ b/gdb/python/python-value.c
@@ -62,7 +62,7 @@ struct value *values_in_python = NULL;
 typedef struct {
   PyObject_HEAD
   struct value *value;
-  int owned_by_gdb;
+  PyObject *address;
 } value_object;
 
 /* Called by the Python interpreter when deallocating a value object.  */
@@ -73,8 +73,14 @@ valpy_dealloc (PyObject *obj)
 
   value_remove_from_list (&values_in_python, self->value);
 
-  if (!self->owned_by_gdb)
-    value_free (self->value);
+  value_free (self->value);
+
+  if (self->address)
+    /* Use braces to appease gcc warning.  *sigh*  */
+    {
+      Py_DECREF (self->address);
+    }
+
   self->ob_type->tp_free (self);
 }
 
@@ -108,7 +114,7 @@ valpy_new (PyTypeObject *subtype, PyObject *args, PyObject *keywords)
     }
 
   value_obj->value = value;
-  value_obj->owned_by_gdb = 0;
+  value_obj->address = NULL;
   release_value (value);
   value_prepend_to_list (&values_in_python, value);
 
@@ -133,18 +139,30 @@ valpy_dereference (PyObject *self, PyObject *args)
 
 /* Return "&value".  */
 static PyObject *
-valpy_address (PyObject *self, PyObject *args)
+valpy_get_address (PyObject *self, void *closure)
 {
   struct value *res_val = NULL;	  /* Initialize to appease gcc warning.  */
+  value_object *val_obj = (value_object *) self;
   volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  if (!val_obj->address)
     {
-      res_val = value_addr (((value_object *) self)->value);
+      TRY_CATCH (except, RETURN_MASK_ALL)
+	{
+	  res_val = value_addr (val_obj->value);
+	}
+      if (except.reason < 0)
+	{
+	  val_obj->address = Py_None;
+	  Py_INCREF (Py_None);
+	}
+      else
+	val_obj->address = value_to_value_object (res_val);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
 
-  return value_to_value_object (res_val);
+  Py_INCREF (val_obj->address);
+
+  return val_obj->address;
 }
 
 /* Return type of the value.  */
@@ -765,7 +783,7 @@ value_to_value_object (struct value *val)
   if (val_obj != NULL)
     {
       val_obj->value = val;
-      val_obj->owned_by_gdb = 0;
+      val_obj->address = NULL;
       release_value (val);
       value_prepend_to_list (&values_in_python, val);
     }
@@ -926,6 +944,8 @@ gdbpy_initialize_values (void)
 \f
 
 static PyGetSetDef value_object_getset[] = {
+  { "address", valpy_get_address, NULL, "The address of the value.",
+    NULL },
   { "is_optimized_out", valpy_get_is_optimized_out, NULL,
     "Boolean telling whether the value is optimized out (i.e., not available).",
     NULL },
@@ -933,7 +953,6 @@ static PyGetSetDef value_object_getset[] = {
 };
 
 static PyMethodDef value_object_methods[] = {
-  { "address", valpy_address, METH_NOARGS, "Return the address of the value." },
   { "cast", valpy_cast, METH_VARARGS, "Cast the value to the supplied type." },
   { "dereference", valpy_dereference, METH_NOARGS, "Dereferences the value." },
   { "type", valpy_type, METH_NOARGS, "Return type of the value." },
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 0bc25b1..f5c20d4 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -313,23 +313,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
@@ -1907,9 +1890,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.ada/lang_switch.exp b/gdb/testsuite/gdb.ada/lang_switch.exp
index 45a4e53..3fc3584 100644
--- a/gdb/testsuite/gdb.ada/lang_switch.exp
+++ b/gdb/testsuite/gdb.ada/lang_switch.exp
@@ -41,6 +41,8 @@ gdb_load ${binfile}
 set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.c]
 runto "foo.c:$bp_location"
 
+gdb_test "set print frame-arguments all" ""
+
 # Make sure that the language is switched to Ada for the second frame
 # by checking the string parameter.
 gdb_test "bt" \
diff --git a/gdb/testsuite/gdb.ada/ref_param.exp b/gdb/testsuite/gdb.ada/ref_param.exp
index 5325dd2..4d49296 100644
--- a/gdb/testsuite/gdb.ada/ref_param.exp
+++ b/gdb/testsuite/gdb.ada/ref_param.exp
@@ -39,6 +39,8 @@ if ![runto call_me] then {
   return
 } 
 
+gdb_test "set print frame-arguments all" ""
+
 set expected_d "\\(one => 1, two => 2, three => 3, four => 4, five => 5, six => 6\\)"
 gdb_test "frame" \
          "#0\[ \t\]*pck\\.call_me \\(d=${expected_d}\\).*"  \
diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp
index b88ff02..a058f67 100644
--- a/gdb/testsuite/gdb.base/call-ar-st.exp
+++ b/gdb/testsuite/gdb.base/call-ar-st.exp
@@ -332,6 +332,7 @@ gdb_expect {
 gdb_test "break sum_array_print" \
 	".*Breakpoint ${decimal}: file .*call-ar-st.c, line.*" \
 	"set breakpoint in sum_array_print"
+gdb_test "set print frame-arguments all" ""
 gdb_test "continue" \
 	".*Breakpoint ${decimal}, sum_array_print \\(seed=10, linked_list1=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .4, 6, 8, 10, 12, 14, 16, 18, 20, 22., head = 0., linked_list2=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .8, 10, 12, 14, 16, 18, 20, 22, 24, 26., head = 0., linked_list3=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .10, 12, 14, 16, 18, 20, 22, 24, 26, 28., head = 0., linked_list4=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .20, 22, 24, 26, 28, 30, 32, 34, 36, 38., head = 0.\\) at .*call-ar-st.c:1105\[ \t\n\r\]+1105.*printf\\(.Sum of 4 arrays, by element \\(add in seed as well\\).*\\);.*" \
 	"check args of sum_array_print"
diff --git a/gdb/testsuite/gdb.base/funcargs.exp b/gdb/testsuite/gdb.base/funcargs.exp
index 1cf3e9d..037f0a0 100644
--- a/gdb/testsuite/gdb.base/funcargs.exp
+++ b/gdb/testsuite/gdb.base/funcargs.exp
@@ -1194,6 +1194,8 @@ gdb_expect {
 
 # Perform tests
 
+gdb_test "set print frame-arguments all" ""
+
 integral_args
 funcargs_reload
 unsigned_integral_args
diff --git a/gdb/testsuite/gdb.python/find.exp b/gdb/testsuite/gdb.python/find.exp
index dd9aabc..d63ea84 100644
--- a/gdb/testsuite/gdb.python/find.exp
+++ b/gdb/testsuite/gdb.python/find.exp
@@ -91,7 +91,7 @@ set two_patterns_found "${newline}.${dec_number}L, ${dec_number}L]"
 
 gdb_test "set *(int32_t*) &int8_search_buf\[10\] = 0x61616161" "" ""
 gdb_test "py search_buf = gdb.selected_frame ().read_var ('int8_search_buf')" "" ""
-gdb_test "py start_addr = search_buf.address ()" "" ""
+gdb_test "py start_addr = search_buf.address" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 
 gdb_test "py print gdb.search_memory (start_addr, length, 'aaa')" \
@@ -129,7 +129,7 @@ gdb_test "py print gdb.search_memory (start_addr, length, \['a', 'a'\], max_coun
 
 gdb_test "set int16_search_buf\[10\] = 0x1234" "" ""
 gdb_test "py search_buf = gdb.selected_frame ().read_var ('int16_search_buf')" "" ""
-gdb_test "py start_addr = search_buf.address ()" "" ""
+gdb_test "py start_addr = search_buf.address" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 gdb_test "py pattern = gdb.parse_and_eval ('(int16_t) 0x1234')" "" ""
 
@@ -143,7 +143,7 @@ gdb_test "py print gdb.search_memory (start_addr, length, pattern)" \
 
 gdb_test "set int32_search_buf\[10\] = 0x12345678" "" ""
 gdb_test "py search_buf = gdb.selected_frame ().read_var ('int32_search_buf')" "" ""
-gdb_test "py start_addr = search_buf.address ()" "" ""
+gdb_test "py start_addr = search_buf.address" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 gdb_test "py pattern = gdb.parse_and_eval ('(int32_t) 0x12345678')" "" ""
 
@@ -156,7 +156,7 @@ gdb_test "py print gdb.search_memory (start_addr, length, pattern)" \
 
 gdb_test "set int64_search_buf\[10\] = 0xfedcba9876543210LL" "" ""
 gdb_test "py search_buf = gdb.selected_frame ().read_var ('int64_search_buf')" "" ""
-gdb_test "py start_addr = search_buf.address ()" "" ""
+gdb_test "py start_addr = search_buf.address" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 gdb_test "py pattern = gdb.parse_and_eval ('(int64_t) 0xfedcba9876543210LL')" "" ""
 
@@ -171,7 +171,7 @@ gdb_test "set *(int8_t*) &search_buf\[10\] = 0x62" "" ""
 gdb_test "set *(int16_t*) &search_buf\[11\] = 0x6363" "" ""
 gdb_test "set *(int32_t*) &search_buf\[13\] = 0x64646464" "" ""
 gdb_test "py search_buf = gdb.selected_frame ().read_var ('search_buf')" "" ""
-gdb_test "py start_addr = search_buf\[0\].address ()" "" ""
+gdb_test "py start_addr = search_buf\[0\].address" "" ""
 gdb_test "py pattern1 = gdb.parse_and_eval ('(int8_t) 0x62')" "" ""
 gdb_test "py pattern2 = gdb.parse_and_eval ('(int16_t) 0x6363')" "" ""
 gdb_test "py pattern3 = gdb.parse_and_eval ('(int32_t) 0x64646464')" "" ""
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')" \
diff --git a/gdb/testsuite/gdb.python/python-prettyprint.py b/gdb/testsuite/gdb.python/python-prettyprint.py
index 0d9cb87..e032303 100644
--- a/gdb/testsuite/gdb.python/python-prettyprint.py
+++ b/gdb/testsuite/gdb.python/python-prettyprint.py
@@ -60,8 +60,8 @@ class pp_s:
     def to_string(self):
         a = self.val["a"]
         b = self.val["b"]
-        if a.address() != b:
-            raise Exception("&a(%s) != b(%s)" % (str(a.address()), str(b)))
+        if a.address != b:
+            raise Exception("&a(%s) != b(%s)" % (str(a.address), str(b)))
         return " a=<" + str(self.val["a"]) + "> b=<" + str(self.val["b"]) + ">"
 
 class pp_ss:
diff --git a/gdb/testsuite/gdb.python/python-value.exp b/gdb/testsuite/gdb.python/python-value.exp
index bd54b2f..6825f03 100644
--- a/gdb/testsuite/gdb.python/python-value.exp
+++ b/gdb/testsuite/gdb.python/python-value.exp
@@ -70,6 +70,9 @@ proc test_value_creation {} {
   gdb_py_test_silent_cmd "python a = gdb.Value (u'unicode test')" "create unicode value" 1
   gdb_test "python print a" "\"unicode test\"" "print Unicode string"
   gdb_test "python print a.__class__" "<type 'gdb.Value'>" "verify type of unicode string"
+
+  # Test address attribute is None in a non-addressable value
+  gdb_test "python print 'result =', i.address" "= None" "Test address attribute in non-addressable value"
 }
 
 proc test_value_numeric_ops {} {
@@ -228,6 +231,9 @@ proc test_value_in_inferior {} {
 
   # Smoke-test is_optimized_out attribute
   gdb_test "python print 'result =', arg0.is_optimized_out" "= False" "Test is_optimized_out attribute"
+
+  # Test address attribute
+  gdb_test "python print 'result =', arg0.address" "= 0x\[\[:xdigit:\]\]+" "Test address attribute"
 }
 
 proc test_value_after_death {} {


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-27  0:35 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-27  0:35 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  68ac9fbeb0ff5bc68f44bfd25445a2243ef3dc79 (commit)
       via  33b84b7e2f03c65b80ccaf9fbb23b74ea1daa15e (commit)
       via  95b4138baf512e661d95b09c38bdd95c05234a1e (commit)
       via  2425a4d7939bae66a15832bd8a325be4aa26e4bf (commit)
       via  3157aba1ab73fb5b5cd0e2dbb5c031a1336a93db (commit)
       via  64c287329177f68d0da2ce81207f5f3f105dabfe (commit)
       via  cbd12f3666346846dd18e762f7881f4a0b1767ee (commit)
       via  3092115a3d791e551209af2e1945666169a04de7 (commit)
       via  27c4a5d2ebbfd4f68a5e87b459adbbc6eeda7cf8 (commit)
       via  8c4195d13e945d3cf2c8583c9f818bbf4a3b5710 (commit)
       via  390ac7259731cdf469ea739345e64d3a7d248818 (commit)
       via  9533c58c4b0c692975a4b97267222ad002364a29 (commit)
       via  3f81316d6eb8f3c951acd8774da7bc8ad23bdedd (commit)
       via  c5f1a7ef72922178569418b5d5060f8240c1767e (commit)
       via  6f1a685bc7bfe44af998e54b99963dffc8e715e5 (commit)
       via  d7b3c9ecbb4f7c782aacbe4224c9aeb8d0d161b2 (commit)
       via  b20dff1b337ceb1bd5f241bff2ed1233780936df (commit)
       via  032f67142ca0678c31a574314adc53d316960f72 (commit)
       via  817ede0ad440e39f3311cc8a1f55ad5655b97e9a (commit)
       via  165709eaa90768f4d03e76188188e5e5afa4ac2c (commit)
       via  50a6b4966bccf97597d65486bd60561d05a65dff (commit)
       via  b3c3db206b652d19fad5290df7b630335acc5889 (commit)
       via  02dc98a6209b37e8473ee3218b5eb4ff6bc7e44d (commit)
       via  70e735001ef74606d3e86a75cf4fd04173e10974 (commit)
       via  90ab18a605385cb7e7984c4ac83a4f7461f99906 (commit)
       via  3836cfdf3b7de8b0f34fda25e5a1b4ae33e253ea (commit)
       via  6c2b67e0220165c9411c128b2f8f7d1e8856795b (commit)
       via  7f0e4fa27448e8da47cdedfa6f8342f94245ab76 (commit)
       via  ff21434d7a766aba9f937e270016e4e7d9e6ba40 (commit)
       via  40dd9754f21987e1fca43c2cde6b3adc18464f1d (commit)
       via  60194aaeeb94372651c09fb5dc0cb5d3329b921e (commit)
       via  c3bcf1c464f8633b5ce91cb72bafee27ce9b05ce (commit)
       via  7d1733001ce46390908da9e6868f45006409b056 (commit)
       via  214296a4b2a36f3e0bc8a270647da2fc21b8b874 (commit)
       via  7ad6aabd74342df423bc2ba496c9750e14d86e85 (commit)
       via  0ee8ee241dcc7feeaf538a120826051dcd8cccfd (commit)
       via  3caef2b656659161247d9c8d418ba8fcc889a04c (commit)
       via  da12fddea1a71fb3b808e88a5ef83bbca8e2cb30 (commit)
       via  297cccbb83721274c4df1eec08dde9eb9f51a733 (commit)
       via  7f43a566f95a1cf96ed799471319b5c574ee575e (commit)
       via  e0f2167a8e0855ab0a1545da2b5f1472cac923dc (commit)
       via  0db2376071441d14829885eaa95b2b8a69a3a1ae (commit)
       via  22a744906c7e0303d9f56c9160900946eff17206 (commit)
       via  d65e7bd9988748a8d39dba3439cbf3cfc873f724 (commit)
       via  e5e85060ca59a79204d185b1b4cf3e30eb0fd1ba (commit)
       via  50158e6deec5d6304429f655fd0a7990c0c14cfc (commit)
       via  f01a34d4d484fb2a8e69233429e993283ee39235 (commit)
       via  d33df476c193a636fbc205d541dce62a6b327fdb (commit)
       via  5943423dd8fd3c0df0586c8c05631165d84f341d (commit)
       via  b4494ffc89755afd15f3dda0b71b82244aa5ea2f (commit)
       via  095e9826734cc7660ab9f444e72a517736272902 (commit)
       via  a371c4d2c371566a571f9c9d08df72f200024b9c (commit)
       via  2e7a4dfe356485e3d14ec2b73b405f016336fcd2 (commit)
       via  d351e41f278158d1b8219d523b0fa03c02b76189 (commit)
       via  8a4ca176c977982bf74c885ec927ed3d6c677bde (commit)
       via  6418262610197a1d63af6393d077f10fac01304c (commit)
       via  67df65cc54808054e45498160f67ce682a9aaa7b (commit)
       via  7075b478c79fa7bf8a95b17474f5f799b0ad5523 (commit)
      from  2e4985cad1fc3d054eaceac9aef5fed7dfa2fd37 (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 bfd/ChangeLog                         |   50 +
 bfd/cpu-i386.c                        |    8 +-
 bfd/elf32-cris.c                      |   32 +-
 bfd/elf32-ppc.c                       |   31 +-
 bfd/elf32-s390.c                      |   33 +-
 bfd/elf64-ppc.c                       |   12 +-
 bfd/elf64-s390.c                      |   33 +-
 bfd/version.h                         |    2 +-
 gdb/ChangeLog                         |  487 +++++
 gdb/Makefile.in                       |   12 +-
 gdb/NEWS                              |   14 +
 gdb/acinclude.m4                      |   37 +-
 gdb/ada-exp.y                         |    1 +
 gdb/ada-lang.c                        |   33 +-
 gdb/ada-lang.h                        |    8 +-
 gdb/ada-typeprint.c                   |   11 +-
 gdb/ada-valprint.c                    |   26 +-
 gdb/auxv.c                            |    3 +-
 gdb/breakpoint.c                      |   61 +-
 gdb/buildsym.c                        |   26 +
 gdb/c-exp.y                           |  477 +++--
 gdb/c-lang.c                          |  826 +++++++-
 gdb/c-lang.h                          |   41 +-
 gdb/c-valprint.c                      |   83 +-
 gdb/charset-list.h                    | 1190 +++++++++++
 gdb/charset.c                         | 1559 +++++---------
 gdb/charset.h                         |  184 +-
 gdb/config.in                         |    6 +
 gdb/configure                         |  639 ++++---
 gdb/configure.ac                      |   58 +-
 gdb/darwin-nat.c                      |    8 +-
 gdb/defs.h                            |    2 +
 gdb/doc/ChangeLog                     |   50 +
 gdb/doc/gdb.texinfo                   |   88 +-
 gdb/doc/gdbint.texinfo                | 1651 +++++++++++----
 gdb/doc/observer.texi                 |    4 +
 gdb/doc/stack_frame.eps               | 3708 +++++++++++++++++++++++++++++++++
 gdb/doc/stack_frame.pdf               |  Bin 0 -> 77972 bytes
 gdb/doc/stack_frame.png               |  Bin 0 -> 67273 bytes
 gdb/doc/stack_frame.svg               |  866 ++++++++
 gdb/doc/stack_frame.txt               |   39 +
 gdb/dwarf2expr.c                      |    2 +-
 gdb/eval.c                            |    1 +
 gdb/expprint.c                        |   12 +-
 gdb/f-lang.c                          |   20 +-
 gdb/f-valprint.c                      |    7 +-
 gdb/gdb_locale.h                      |    4 +
 gdb/gdb_obstack.h                     |    3 +
 gdb/{mi/mi-main.h => gdb_usleep.c}    |   35 +-
 gdb/{mi/mi-main.h => gdb_usleep.h}    |   24 +-
 gdb/gdb_wchar.h                       |   62 +
 gdb/gdbserver/ChangeLog               |   25 +
 gdb/gdbserver/Makefile.in             |   18 +-
 gdb/gdbserver/configure               |    2 +-
 gdb/gdbserver/configure.ac            |    6 +-
 gdb/gdbserver/gdbreplay.c             |    2 +-
 gdb/gdbserver/i387-fp.c               |   40 +-
 gdb/gdbserver/inferiors.c             |    5 +-
 gdb/gdbserver/linux-arm-low.c         |    2 +-
 gdb/gdbserver/linux-cris-low.c        |    4 +-
 gdb/gdbserver/linux-crisv32-low.c     |   44 +-
 gdb/gdbserver/linux-i386-low.c        |    4 +-
 gdb/gdbserver/linux-low.c             |  177 +-
 gdb/gdbserver/linux-mips-low.c        |    2 +-
 gdb/gdbserver/linux-s390-low.c        |    1 -
 gdb/gdbserver/linux-sparc-low.c       |   39 +-
 gdb/gdbserver/linux-x86-64-low.c      |   10 +-
 gdb/gdbserver/linux-xtensa-low.c      |    2 +-
 gdb/gdbserver/proc-service.c          |    2 -
 gdb/gdbserver/regcache.c              |    5 +-
 gdb/gdbserver/remote-utils.c          |   48 +-
 gdb/gdbserver/server.c                |   56 +-
 gdb/gdbserver/spu-low.c               |    8 +-
 gdb/gdbserver/target.h                |    8 +-
 gdb/gdbserver/thread-db.c             |    2 +-
 gdb/gdbserver/win32-low.c             |   82 +-
 gdb/gdbserver/xtensa-xtregs.c         |    1 -
 gdb/gdbthread.h                       |    4 +
 gdb/infcall.c                         |   26 +-
 gdb/infcmd.c                          |   27 +-
 gdb/inferior.h                        |   12 -
 gdb/infrun.c                          |   34 +-
 gdb/jv-lang.c                         |    5 +-
 gdb/jv-valprint.c                     |    4 +-
 gdb/language.c                        |   16 +-
 gdb/language.h                        |   21 +-
 gdb/m2-lang.c                         |   19 +-
 gdb/m2-valprint.c                     |   10 +-
 gdb/macroexp.c                        |   31 +-
 gdb/mi/mi-interp.c                    |   32 +-
 gdb/mi/mi-main.c                      |    5 +
 gdb/mi/mi-main.h                      |    1 +
 gdb/objc-lang.c                       |   16 +-
 gdb/p-lang.c                          |   32 +-
 gdb/p-lang.h                          |    9 +-
 gdb/p-valprint.c                      |   20 +-
 gdb/parse.c                           |   59 +
 gdb/parser-defs.h                     |   18 +
 gdb/printcmd.c                        |  104 +-
 gdb/python/python-cmd.c               |    2 +-
 gdb/python/python.c                   |   11 +-
 gdb/scm-lang.c                        |    6 +-
 gdb/scm-lang.h                        |    2 +-
 gdb/scm-valprint.c                    |    3 +-
 gdb/ser-unix.c                        |    9 +-
 gdb/symfile.c                         |    9 +-
 gdb/symtab.c                          |    2 +-
 gdb/testsuite/ChangeLog               |   41 +
 gdb/testsuite/gdb.base/auxv.exp       |   12 +-
 gdb/testsuite/gdb.base/call-rt-st.exp |    2 +-
 gdb/testsuite/gdb.base/callfuncs.exp  |   14 +-
 gdb/testsuite/gdb.base/charset.c      |   39 +-
 gdb/testsuite/gdb.base/charset.exp    |  214 ++-
 gdb/testsuite/gdb.base/constvars.exp  |    6 +-
 gdb/testsuite/gdb.base/long_long.exp  |   10 +-
 gdb/testsuite/gdb.base/pointers.exp   |    2 +-
 gdb/testsuite/gdb.base/printcmds.exp  |   58 +-
 gdb/testsuite/gdb.base/setvar.exp     |    6 +-
 gdb/testsuite/gdb.base/store.exp      |    4 +-
 gdb/testsuite/gdb.cp/ref-types.exp    |    4 +-
 gdb/testsuite/lib/gdb.exp             |    3 +
 gdb/thread.c                          |    6 +-
 gdb/typeprint.c                       |    2 +-
 gdb/utils.c                           |  127 +-
 gdb/valops.c                          |   18 +
 gdb/valprint.c                        |   13 +-
 gdb/valprint.h                        |    5 +-
 gdb/value.c                           |    1 +
 gdb/value.h                           |    4 +-
 gdb/varobj.c                          |   10 +-
 gdb/version.in                        |    2 +-
 gdb/windows-nat.c                     |  350 ++--
 include/elf/ChangeLog                 |    4 +
 include/elf/common.h                  |    1 +
 libiberty/ChangeLog                   |    8 +
 libiberty/cp-demangle.c               |   24 +-
 libiberty/testsuite/demangle-expected |   10 +-
 137 files changed, 11663 insertions(+), 3050 deletions(-)
 create mode 100644 gdb/charset-list.h
 create mode 100644 gdb/doc/stack_frame.eps
 create mode 100644 gdb/doc/stack_frame.pdf
 create mode 100644 gdb/doc/stack_frame.png
 create mode 100644 gdb/doc/stack_frame.svg
 create mode 100644 gdb/doc/stack_frame.txt
 copy gdb/{mi/mi-main.h => gdb_usleep.c} (58%)
 copy gdb/{mi/mi-main.h => gdb_usleep.h} (58%)
 create mode 100644 gdb/gdb_wchar.h

First 500 lines of diff:
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index dc5454b..dfb9bb5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,53 @@
+2009-03-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* cpu-i386.c (bfd_x86_64_arch_intel_syntax): Make it static.
+	(bfd_i386_arch_intel_syntax): Likewise.
+	(i8086_arch): Likewise.
+	(bfd_x86_64_arch): Likewise.
+
+2009-03-24  Hans-Peter Nilsson  <hp@axis.com>
+
+	* elf32-cris.c (cris_elf_relocate_section): <case
+	R_CRIS_16_DTPREL, R_CRIS_32_DTPREL>: Allow use of non-local
+	symbols for non-allocated sections.  Don't check whether to
+	generate R_CRIS_DTPMOD for non-allocated sections.
+	(cris_elf_gc_sweep_hook) <case R_CRIS_32_DTPREL>: Don't
+	handle relocation GC:ing if applied to non-allocated section.
+	(cris_elf_check_relocs): Similar.
+
+	* elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_32_GD>
+	<R_CRIS_16_GOT_GD, R_CRIS_32_GOT_GD>: Don't include the TLS size
+	when emitting a known TP offset in the GOT.
+
+2009-03-23  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf64-ppc.c (synthetic_opd): Delete.
+	(compare_symbols): Look for .opd name rather than section match.
+	(ppc64_elf_get_synthetic_symtab): Likewise.
+
+2009-03-21  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf32-ppc.c (is_pic_glink_stub): Delete.
+	(is_nonpic_glink_stub): New function.
+	(ppc_elf_get_synthetic_symtab): Check for last non-pic stub rather
+	than first pic one.
+	(struct ppc_elf_link_hash_table <glink_pltresolve>): Comment fix.
+
+2009-03-20  Martin Schwidefsky  <schwidefsky@de.ibm.com>
+	    Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+	* elf32-s390.c (elf_s390_check_relocs): Use the SYMBOL_*
+        macros for visibilty and locality checks.
+	(elf_s390_adjust_dynamic_symbol): Likewise.
+	(allocate_dynrelocs): Likewise.
+	(elf_s390_relocate_section): Likewise.
+	(elf_s390_finish_dynamic_symbol): Likewise.
+	* elf64-s390.c (elf_s390_check_relocs): Likewise.
+	(elf_s390_adjust_dynamic_symbol): Likewise.
+	(allocate_dynrelocs): Likewise.
+	(elf_s390_relocate_section): Likewise.
+	(elf_s390_finish_dynamic_symbol): Likewise.
+
 2009-03-19  Kai Tietz  <kai.tietz@onevision.com>
 
 	* bfd-in2.h: Regenerated.
diff --git a/bfd/cpu-i386.c b/bfd/cpu-i386.c
index 4001a05..952e659 100644
--- a/bfd/cpu-i386.c
+++ b/bfd/cpu-i386.c
@@ -23,7 +23,7 @@
 #include "bfd.h"
 #include "libbfd.h"
 
-const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
+static const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
 {
   64, /* 64 bits in a word */
   64, /* 64 bits in an address */
@@ -39,7 +39,7 @@ const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
   0
 };
 
-const bfd_arch_info_type bfd_i386_arch_intel_syntax =
+static const bfd_arch_info_type bfd_i386_arch_intel_syntax =
 {
   32,	/* 32 bits in a word */
   32,	/* 32 bits in an address */
@@ -55,7 +55,7 @@ const bfd_arch_info_type bfd_i386_arch_intel_syntax =
   &bfd_x86_64_arch_intel_syntax
 };
 
-const bfd_arch_info_type i8086_arch =
+static const bfd_arch_info_type i8086_arch =
 {
   32,	/* 32 bits in a word */
   32,	/* 32 bits in an address (well, not really) */
@@ -71,7 +71,7 @@ const bfd_arch_info_type i8086_arch =
   &bfd_i386_arch_intel_syntax
 };
 
-const bfd_arch_info_type bfd_x86_64_arch =
+static const bfd_arch_info_type bfd_x86_64_arch =
 {
   64, /* 32 bits in a word */
   64, /* 32 bits in an address */
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index bd6de29..ed1f3e8 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -1615,10 +1615,12 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 	case R_CRIS_16_DTPREL:
 	case R_CRIS_32_DTPREL:
 	  /* This relocation must only be performed against local
-	     symbols.  It's also ok when we link a program and the
-	     symbol is defined in an ordinary (non-DSO) object (if
-	     it's undefined there, we've already seen an error).  */
+	     symbols, or to sections that are not loadable.  It's also
+	     ok when we link a program and the symbol is defined in an
+	     ordinary (non-DSO) object (if it's undefined there, we've
+	     already seen an error).  */
 	  if (h != NULL
+	      && (input_section->flags & SEC_ALLOC) != 0
 	      && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
 	      && (info->shared
 		  || (!h->def_regular
@@ -1641,14 +1643,16 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 	      return FALSE;
 	    }
 
-	  BFD_ASSERT (elf_cris_hash_table (info)->dtpmod_refcount != 0);
+	  BFD_ASSERT ((input_section->flags & SEC_ALLOC) == 0
+		      || elf_cris_hash_table (info)->dtpmod_refcount != 0);
 
 	  /* Fill in a R_CRIS_DTPMOD reloc at offset 3 if we haven't
 	     already done so.  Note that we do this in .got.plt, not
 	     in .got, as .got.plt contains the first part, still the
 	     reloc is against .got, because the linker script directs
 	     (is required to direct) them both into .got.  */
-	  if (elf_cris_hash_table (info)->dtpmod_refcount > 0)
+	  if (elf_cris_hash_table (info)->dtpmod_refcount > 0
+	      && (input_section->flags & SEC_ALLOC) != 0)
 	    {
 	      asection *sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
 	      BFD_ASSERT (sgotplt != NULL);
@@ -1735,9 +1739,8 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 	      bfd_vma off;
 
 	      /* The symbol is defined in the program, so just write
-		 (1, -prog_tls_size+known_tpoffset) into the GOT.  */
+		 (1, known_tpoffset) into the GOT.  */
 	      relocation -= elf_hash_table (info)->tls_sec->vma;
-	      relocation -= elf_hash_table (info)->tls_size;
 
 	      if (h != NULL)
 		{
@@ -2685,6 +2688,10 @@ cris_elf_gc_sweep_hook (bfd *abfd,
 	  break;
 
 	case R_CRIS_32_DTPREL:
+	  /* This'd be a .dtpreld entry in e.g. debug info.  */
+	  if ((sec->flags & SEC_ALLOC) == 0)
+	    break;
+	  /* Fall through.  */
 	case R_CRIS_16_DTPREL:
 	  elf_cris_hash_table (info)->dtpmod_refcount--;
 	  if (elf_cris_hash_table (info)->dtpmod_refcount == 0)
@@ -3152,8 +3159,17 @@ cris_elf_check_relocs (abfd, info, sec, relocs)
 	 on the first input bfd we found that contained dynamic relocs.  */
       switch (r_type)
 	{
-	case R_CRIS_16_DTPREL:
 	case R_CRIS_32_DTPREL:
+	  if ((sec->flags & SEC_ALLOC) == 0)
+	    /* This'd be a .dtpreld entry in e.g. debug info.  We have
+	       several different switch statements below, but none of
+	       that is needed; we need no preparations for resolving
+	       R_CRIS_32_DTPREL into a non-allocated section (debug
+	       info), so let's just move on to the next
+	       relocation.  */
+	    continue;
+	  /* Fall through.  */
+	case R_CRIS_16_DTPREL:
 	  /* The first .got.plt entry is right after the R_CRIS_DTPMOD
 	     entry at index 3. */
 	  if (elf_cris_hash_table (info)->dtpmod_refcount == 0)
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 5db64b0..e15f88e 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2328,26 +2328,17 @@ ppc_elf_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED)
 }
 \f
 static bfd_boolean
-is_pic_glink_stub (bfd *abfd, asection *glink, bfd_vma off)
+is_nonpic_glink_stub (bfd *abfd, asection *glink, bfd_vma off)
 {
-  bfd_byte buf[16];
-  unsigned int insn;
+  bfd_byte buf[GLINK_ENTRY_SIZE];
 
-  if (!bfd_get_section_contents (abfd, glink, buf, off, 16))
+  if (!bfd_get_section_contents (abfd, glink, buf, off, GLINK_ENTRY_SIZE))
     return FALSE;
 
-  insn = bfd_get_32 (abfd, buf);
-  if ((insn & 0xffff0000) == LWZ_11_30
-      && bfd_get_32 (abfd, buf + 4) == MTCTR_11
-      && bfd_get_32 (abfd, buf + 8) == BCTR)
-    return TRUE;
-
-  if ((insn & 0xffff0000) == ADDIS_11_30
-      && (bfd_get_32 (abfd, buf + 4) & 0xffff0000) == LWZ_11_11
-      && bfd_get_32 (abfd, buf + 8) == MTCTR_11
-      && bfd_get_32 (abfd, buf + 12) == BCTR)
-    return TRUE;
-  return FALSE;
+  return ((bfd_get_32 (abfd, buf + 0) & 0xffff0000) == LIS_11
+	  && (bfd_get_32 (abfd, buf + 4) & 0xffff0000) == LWZ_11_11
+	  && bfd_get_32 (abfd, buf + 8) == MTCTR_11
+	  && bfd_get_32 (abfd, buf + 12) == BCTR);
 }
 
 static bfd_boolean
@@ -2484,10 +2475,8 @@ ppc_elf_get_synthetic_symtab (bfd *abfd, long symcount, asymbol **syms,
      multiple stubs for each plt entry.  If that is the case then
      there is no way to associate stubs with their plt entries short
      of figuring out the GOT pointer value used in the stub.  */
-  if (!bfd_get_section_contents (abfd, glink, buf,
-				 stub_vma - glink->vma, 4)
-      || ((bfd_get_32 (abfd, buf) & 0xffff0000) != LIS_11
-	  && is_pic_glink_stub (abfd, glink, stub_vma - glink->vma - 16)))
+  if (!is_nonpic_glink_stub (abfd, glink,
+			     glink_vma - GLINK_ENTRY_SIZE - glink->vma))
     return 0;
 
   slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table;
@@ -2722,7 +2711,7 @@ struct ppc_elf_link_hash_table
     bfd_vma offset;
   } tlsld_got;
 
-  /* Offset of PltResolve function in glink.  */
+  /* Offset of branch table to PltResolve function in glink.  */
   bfd_vma glink_pltresolve;
 
   /* Size of reserved GOT entries.  */
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 7aadadc..14c4cb0 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -1261,7 +1261,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
 		    && ELF32_R_TYPE (rel->r_info) != R_390_PC32DBL
 		    && ELF32_R_TYPE (rel->r_info) != R_390_PC32)
 		   || (h != NULL
-		       && (! info->symbolic
+		       && (! SYMBOLIC_BIND (info, h)
 			   || h->root.type == bfd_link_hash_defweak
 			   || !h->def_regular))))
 	      || (ELIMINATE_COPY_RELOCS
@@ -1566,11 +1566,9 @@ elf_s390_adjust_dynamic_symbol (info, h)
       || h->needs_plt)
     {
       if (h->plt.refcount <= 0
-	  || (! info->shared
-	      && !h->def_dynamic
-	      && !h->ref_dynamic
-	      && h->root.type != bfd_link_hash_undefweak
-	      && h->root.type != bfd_link_hash_undefined))
+	  || SYMBOL_CALLS_LOCAL (info, h)
+	  || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+	      && h->root.type != bfd_link_hash_undefweak))
 	{
 	  /* This case can occur if we saw a PLT32 reloc in an input
 	     file, but the symbol was never referred to by a dynamic
@@ -1709,9 +1707,7 @@ allocate_dynrelocs (h, inf)
   htab = elf_s390_hash_table (info);
 
   if (htab->elf.dynamic_sections_created
-      && h->plt.refcount > 0
-      && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
-	  || h->root.type != bfd_link_hash_undefweak))
+      && h->plt.refcount > 0)
     {
       /* Make sure this symbol is output as a dynamic symbol.
 	 Undefined weak syms won't yet be marked as dynamic.  */
@@ -1840,7 +1836,7 @@ allocate_dynrelocs (h, inf)
 
   if (info->shared)
     {
-      if (SYMBOL_REFERENCES_LOCAL (info, h))
+      if (SYMBOL_CALLS_LOCAL (info, h))
 	{
 	  struct elf_s390_dyn_relocs **pp;
 
@@ -2364,10 +2360,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
 	      dyn = htab->elf.dynamic_sections_created;
 	      if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
 		  || (info->shared
-		      && (info->symbolic
-			  || h->dynindx == -1
-			  || h->forced_local)
-		      && h->def_regular)
+		      && SYMBOL_REFERENCES_LOCAL (info, h))
 		  || (ELF_ST_VISIBILITY (h->other)
 		      && h->root.type == bfd_link_hash_undefweak))
 		{
@@ -2537,8 +2530,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
 		    && r_type != R_390_PC16DBL
 		    && r_type != R_390_PC32DBL
 		    && r_type != R_390_PC32)
-		   || (h != NULL
-		       && !SYMBOL_REFERENCES_LOCAL (info, h))))
+		   || !SYMBOL_CALLS_LOCAL (info, h)))
 	      || (ELIMINATE_COPY_RELOCS
 		  && !info->shared
 		  && h != NULL
@@ -2580,7 +2572,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
 			   || r_type == R_390_PC32DBL
 			   || r_type == R_390_PC32
 			   || !info->shared
-			   || !info->symbolic
+			   || !SYMBOLIC_BIND (info, h)
 			   || !h->def_regular))
 		{
 		  outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
@@ -3262,11 +3254,10 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
 	 The entry in the global offset table will already have been
 	 initialized in the relocate_section function.  */
       if (info->shared
-	  && (info->symbolic
-	      || h->dynindx == -1
-	      || h->forced_local)
-	  && h->def_regular)
+	  && SYMBOL_REFERENCES_LOCAL (info, h))
 	{
+	  if (!h->def_regular)
+	    return FALSE;
 	  BFD_ASSERT((h->got.offset & 1) != 0);
 	  rela.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
 	  rela.r_addend = (h->root.u.def.value
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 1873728..ce82e16 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -2689,7 +2689,6 @@ get_opd_info (asection * sec)
 }
 \f
 /* Parameters for the qsort hook.  */
-static asection *synthetic_opd;
 static bfd_boolean synthetic_relocatable;
 
 /* qsort comparison function for ppc64_elf_get_synthetic_symtab.  */
@@ -2707,9 +2706,11 @@ compare_symbols (const void *ap, const void *bp)
     return 1;
 
   /* then .opd symbols.  */
-  if (a->section == synthetic_opd && b->section != synthetic_opd)
+  if (strcmp (a->section->name, ".opd") == 0
+      && strcmp (b->section->name, ".opd") != 0)
     return -1;
-  if (a->section != synthetic_opd && b->section == synthetic_opd)
+  if (strcmp (a->section->name, ".opd") != 0
+      && strcmp (b->section->name, ".opd") == 0)
     return 1;
 
   /* then other code symbols.  */
@@ -2863,7 +2864,6 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
   else
     memcpy (syms, static_syms, (symcount + 1) * sizeof (*syms));
 
-  synthetic_opd = opd;
   synthetic_relocatable = relocatable;
   qsort (syms, symcount, sizeof (*syms), compare_symbols);
 
@@ -2881,7 +2881,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
     }
 
   i = 0;
-  if (syms[i]->section == opd)
+  if (strcmp (syms[i]->section->name, ".opd") == 0)
     ++i;
   codesecsym = i;
 
@@ -2898,7 +2898,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
   secsymend = i;
 
   for (; i < symcount; ++i)
-    if (syms[i]->section != opd)
+    if (strcmp (syms[i]->section->name, ".opd") != 0)
       break;
   opdsymend = i;
 
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 7d8795e..21a5864 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -1228,7 +1228,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
 		    && ELF64_R_TYPE (rel->r_info) != R_390_PC32DBL
 		    && ELF64_R_TYPE (rel->r_info) != R_390_PC64)
 		   || (h != NULL
-		       && (! info->symbolic
+		       && (! SYMBOLIC_BIND (info, h)
 			   || h->root.type == bfd_link_hash_defweak
 			   || !h->def_regular))))
 	      || (ELIMINATE_COPY_RELOCS
@@ -1541,11 +1541,9 @@ elf_s390_adjust_dynamic_symbol (info, h)
       || h->needs_plt)
     {
       if (h->plt.refcount <= 0
-	  || (! info->shared
-	      && !h->def_dynamic
-	      && !h->ref_dynamic
-	      && h->root.type != bfd_link_hash_undefweak
-	      && h->root.type != bfd_link_hash_undefined))
+	  || SYMBOL_CALLS_LOCAL (info, h)
+	  || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+	      && h->root.type == bfd_link_hash_undefweak))
 	{
 	  /* This case can occur if we saw a PLT32 reloc in an input
 	     file, but the symbol was never referred to by a dynamic
@@ -1684,9 +1682,7 @@ allocate_dynrelocs (h, inf)
   htab = elf_s390_hash_table (info);
 
   if (htab->elf.dynamic_sections_created
-      && h->plt.refcount > 0
-      && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
-	  || h->root.type != bfd_link_hash_undefweak))
+      && h->plt.refcount > 0)
     {
       /* Make sure this symbol is output as a dynamic symbol.
 	 Undefined weak syms won't yet be marked as dynamic.  */
@@ -1815,7 +1811,7 @@ allocate_dynrelocs (h, inf)
 
   if (info->shared)
     {
-      if (SYMBOL_REFERENCES_LOCAL (info, h))
+      if (SYMBOL_CALLS_LOCAL (info, h))
 	{
 	  struct elf_s390_dyn_relocs **pp;
 
@@ -2340,10 +2336,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
 	      dyn = htab->elf.dynamic_sections_created;
 	      if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
 		  || (info->shared
-		      && (info->symbolic
-			  || h->dynindx == -1
-			  || h->forced_local)
-		      && h->def_regular)
+		      && SYMBOL_REFERENCES_LOCAL (info, h))
 		  || (ELF_ST_VISIBILITY (h->other)
 		      && h->root.type == bfd_link_hash_undefweak))
 		{
@@ -2519,8 +2512,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
 		    && r_type != R_390_PC32
 		    && r_type != R_390_PC32DBL
 		    && r_type != R_390_PC64)
-		   || (h != NULL
-		       && !SYMBOL_REFERENCES_LOCAL (info, h))))
+		   || !SYMBOL_CALLS_LOCAL (info, h)))
 	      || (ELIMINATE_COPY_RELOCS
 		  && !info->shared
 		  && h != NULL
@@ -2563,7 +2555,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
 			   || r_type == R_390_PC32DBL
 			   || r_type == R_390_PC64
 			   || !info->shared
-			   || !info->symbolic
+			   || !SYMBOLIC_BIND (info, h)
 			   || !h->def_regular))
 		{
 		  outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
@@ -3168,11 +3160,10 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
 	 The entry in the global offset table will already have been
 	 initialized in the relocate_section function.  */
       if (info->shared
-	  && (info->symbolic
-	      || h->dynindx == -1
-	      || h->forced_local)
-	  && h->def_regular)
+	  && SYMBOL_REFERENCES_LOCAL (info, h))
 	{
+	  if (!h->def_regular)
+	    return FALSE;
 	  BFD_ASSERT((h->got.offset & 1) != 0);
 	  rela.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
 	  rela.r_addend = (h->root.u.def.value
diff --git a/bfd/version.h b/bfd/version.h
index 8fe3dcb..21bfd82 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,4 +1,4 @@
-#define BFD_VERSION_DATE 20090319
+#define BFD_VERSION_DATE 20090324
 #define BFD_VERSION @bfd_version@
 #define BFD_VERSION_STRING  @bfd_version_package@ @bfd_version_string@
 #define REPORT_BUGS_TO @report_bugs_to@
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 107396e..a88bc6b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,490 @@
+2009-03-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* configure.ac: Initialize the variable $PREFER_CURSES.
+	* configure: Regenerated.
+
+2009-03-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
+


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-25 19:00 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-25 19:00 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  2e4985cad1fc3d054eaceac9aef5fed7dfa2fd37 (commit)
       via  ffcb73fcb226abe0bb6d6f6855f479f0c5456527 (commit)
      from  57ef0cba8a93024e781a32a323884f8a7ff1d557 (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/stack.c    |   53 ++++++++---------------------------------------------
 gdb/valprint.c |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 45 deletions(-)

First 500 lines of diff:
diff --git a/gdb/stack.c b/gdb/stack.c
index d6ef5a3..88b672d 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -58,7 +58,7 @@ void (*deprecated_selected_frame_level_changed_hook) (int);
 
 static const char *print_frame_arguments_choices[] =
   {"all", "scalars", "none", NULL};
-static const char *print_frame_arguments = "all";
+static const char *print_frame_arguments = "scalars";
 
 /* Prototypes for local functions. */
 
@@ -158,46 +158,6 @@ print_frame_nameless_args (struct frame_info *frame, long start, int num,
     }
 }
 
-/* Return non-zero if the debugger should print the value of the provided
-   symbol parameter (SYM).  */
-
-static int
-print_this_frame_argument_p (struct symbol *sym)
-{
-  struct type *type;
-  
-  /* If the user asked to print no argument at all, then obviously
-     do not print this argument.  */
-
-  if (strcmp (print_frame_arguments, "none") == 0)
-    return 0;
-
-  /* If the user asked to print all arguments, then we should print
-     that one.  */
-
-  if (strcmp (print_frame_arguments, "all") == 0)
-    return 1;
-
-  /* The user asked to print only the scalar arguments, so do not
-     print the non-scalar ones.  */
-
-  type = CHECK_TYPEDEF (SYMBOL_TYPE (sym));
-  while (TYPE_CODE (type) == TYPE_CODE_REF)
-    type = CHECK_TYPEDEF (TYPE_TARGET_TYPE (type));
-  switch (TYPE_CODE (type))
-    {
-      case TYPE_CODE_ARRAY:
-      case TYPE_CODE_STRUCT:
-      case TYPE_CODE_UNION:
-      case TYPE_CODE_SET:
-      case TYPE_CODE_STRING:
-      case TYPE_CODE_BITSTRING:
-        return 0;
-      default:
-        return 1;
-    }
-}
-
 /* Print the arguments of frame FRAME on STREAM, given the function
    FUNC running in that frame (as a symbol), where NUM is the number
    of arguments according to the stack frame (or -1 if the number of
@@ -220,6 +180,10 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
   int args_printed = 0;
   struct cleanup *old_chain, *list_chain;
   struct ui_stream *stb;
+  /* True if we should print arguments, false otherwise.  */
+  int print_args = strcmp (print_frame_arguments, "none");
+  /* True in "summary" mode, false otherwise.  */
+  int summary = !strcmp (print_frame_arguments, "scalars");
 
   stb = ui_out_stream_new (uiout);
   old_chain = make_cleanup_ui_out_stream_delete (stb);
@@ -354,7 +318,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
 	  annotate_arg_name_end ();
 	  ui_out_text (uiout, "=");
 
-          if (print_this_frame_argument_p (sym))
+          if (print_args)
             {
 	      /* Avoid value_print because it will deref ref parameters.
 		 We just want to print their addresses.  Print ??? for
@@ -381,9 +345,8 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
 
 		  get_raw_print_options (&opts);
 		  opts.deref_ref = 0;
-		  opts.summary = 1;
-		  common_val_print (val, stb->stream, 2,
-				    &opts, language);
+		  opts.summary = summary;
+		  common_val_print (val, stb->stream, 2, &opts, language);
 		  ui_out_field_stream (uiout, "value", stb);
 	        }
 	      else
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 1eb7088..4f2ddbe 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -217,6 +217,33 @@ show_addressprint (struct ui_file *file, int from_tty,
 }
 \f
 
+/* A helper function for val_print.  When printing in "summary" mode,
+   we want to print scalar arguments, but not aggregate arguments.
+   This function distinguishes between the two.  */
+
+static int
+scalar_type_p (struct type *type)
+{
+  CHECK_TYPEDEF (type);
+  while (TYPE_CODE (type) == TYPE_CODE_REF)
+    {
+      type = TYPE_TARGET_TYPE (type);
+      CHECK_TYPEDEF (type);
+    }
+  switch (TYPE_CODE (type))
+    {
+    case TYPE_CODE_ARRAY:
+    case TYPE_CODE_STRUCT:
+    case TYPE_CODE_UNION:
+    case TYPE_CODE_SET:
+    case TYPE_CODE_STRING:
+    case TYPE_CODE_BITSTRING:
+      return 0;
+    default:
+      return 1;
+    }
+}
+
 /* Print using the given LANGUAGE the data of type TYPE located at VALADDR
    (within GDB), which came from the inferior at address ADDRESS, onto
    stdio stream STREAM according to OPTIONS.
@@ -269,6 +296,14 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	return ret;
     }
 
+  /* Handle summary mode.  If the value is a scalar, print it;
+     otherwise, print an ellipsis.  */
+  if (options->summary && !scalar_type_p (type))
+    {
+      fprintf_filtered (stream, "...");
+      return 0;
+    }
+
   TRY_CATCH (except, RETURN_MASK_ERROR)
     {
       ret = language->la_val_print (type, valaddr, embedded_offset, address,


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-24 17:33 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-24 17:33 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  57ef0cba8a93024e781a32a323884f8a7ff1d557 (commit)
       via  cb7eaa7343fa9fa04f8deee2471b85be2b44fe13 (commit)
       via  cb27ee6e1ada4fd6992dd51da402baef10ad88e3 (commit)
       via  e107fb9687bb1e7f74170aa3d19c4a8f6edbb10f (commit)
       via  6e85bcb66b4c94185c527f475c14711b621d0fdf (commit)
      from  9640dcec5549aabe60d6e0bb71264195d243990f (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/doc/gdb.texinfo                         |   12 +++++++++++-
 gdb/python/lib/gdb/libstdcxx/v6/printers.py |   23 ++++++++++++++++-------
 gdb/python/python-frame.c                   |    2 +-
 gdb/python/python-type.c                    |    9 ++++++++-
 gdb/python/python-value.c                   |   21 ++++++++++++++++++++-
 gdb/testsuite/gdb.python/python-value.exp   |    3 +++
 6 files changed, 59 insertions(+), 11 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 7a13a7f..b82be72 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18514,6 +18514,15 @@ bar = some_val['foo']
 
 Again, @code{bar} will also be a @code{gdb.Value} object.
 
+The following attribute is provided:
+
+@table @code
+@defmethod Value is_optimized_out
+This read-only boolean attribute is true if the compiler optimized out
+this value, thus it is not available for fetching from the inferior.
+@end defmethod
+@end table
+
 The following methods are provided:
 
 @table @code
@@ -18637,7 +18646,8 @@ non-zero value, which is the size of the field in bits.  Otherwise,
 this will be zero; in this case the field's size is given by its type.
 
 @item type
-The type of the field.
+The type of the field.  This is usually an instance of @code{Type},
+but it can be @code{None} in some situations.
 @end table
 @end defmethod
 
diff --git a/gdb/python/lib/gdb/libstdcxx/v6/printers.py b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
index c0dc987..bbe4475 100644
--- a/gdb/python/lib/gdb/libstdcxx/v6/printers.py
+++ b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
@@ -27,6 +27,8 @@ class StdPointerPrinter:
         self.val = val
 
     def to_string (self):
+        if self.val['_M_refcount']['_M_pi'] == 0:
+            return '%s (empty) %s' % (self.typename, self.val['_M_ptr'])
         return '%s (count %d) %s' % (self.typename,
         self.val['_M_refcount']['_M_pi']['_M_use_count'],
         self.val['_M_ptr'])
@@ -617,14 +619,21 @@ def build_libstdcxx_dictionary ():
     pretty_printers_dict[re.compile('^std::vector<.*>$')] = StdVectorPrinter
     # vector<bool>
 
-    # These are the C++0x printers. They also exist in the standard namespace.
+    # These are the TR1 and C++0x printers.
     # For array - the default GDB pretty-printer seems reasonable.
-    pretty_printers_dict[re.compile('^std::(tr1::)?shared_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::shared_ptr', val)
-    pretty_printers_dict[re.compile('^std::(tr1::)?weak_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::weak_ptr', val)
-    pretty_printers_dict[re.compile('^std::(tr1::)?unordered_map<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_map', val)
-    pretty_printers_dict[re.compile('^std::(tr1::)?unordered_set<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_set', val)
-    pretty_printers_dict[re.compile('^std::(tr1::)?unordered_multimap<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_multimap', val)
-    pretty_printers_dict[re.compile('^std::(tr1::)?unordered_multiset<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_multiset', val)
+    pretty_printers_dict[re.compile('^std::shared_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::shared_ptr', val)
+    pretty_printers_dict[re.compile('^std::weak_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::weak_ptr', val)
+    pretty_printers_dict[re.compile('^std::unordered_map<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::unordered_map', val)
+    pretty_printers_dict[re.compile('^std::unordered_set<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::unordered_set', val)
+    pretty_printers_dict[re.compile('^std::unordered_multimap<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::unordered_multimap', val)
+    pretty_printers_dict[re.compile('^std::unordered_multiset<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::unordered_multiset', val)
+
+    pretty_printers_dict[re.compile('^std::tr1::shared_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::tr1::shared_ptr', val)
+    pretty_printers_dict[re.compile('^std::tr1::weak_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::tr1::weak_ptr', val)
+    pretty_printers_dict[re.compile('^std::tr1::unordered_map<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_map', val)
+    pretty_printers_dict[re.compile('^std::tr1::unordered_set<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_set', val)
+    pretty_printers_dict[re.compile('^std::tr1::unordered_multimap<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_multimap', val)
+    pretty_printers_dict[re.compile('^std::tr1::unordered_multiset<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_multiset', val)
 
 
     # Extensions.
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index dc3f45e..1fc553b 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -419,7 +419,7 @@ frapy_read_var (PyObject *self, PyObject *args)
 
       var_name = python_string_to_target_string (sym_obj);
       if (!var_name)
-      	return NULL;
+	return NULL;
       cleanup = make_cleanup (xfree, var_name);
 
       TRY_CATCH (except, RETURN_MASK_ALL)
diff --git a/gdb/python/python-type.c b/gdb/python/python-type.c
index 772a011..c851cdb 100644
--- a/gdb/python/python-type.c
+++ b/gdb/python/python-type.c
@@ -176,7 +176,14 @@ convert_field (struct type *type, int field)
   if (PyObject_SetAttrString (result, "bitsize", arg) < 0)
     goto failarg;
 
-  arg = type_to_type_object (TYPE_FIELD_TYPE (type, field));
+  /* A field can have a NULL type in some situations.  */
+  if (TYPE_FIELD_TYPE (type, field) == NULL)
+    {
+      arg = Py_None;
+      Py_INCREF (arg);
+    }
+  else
+    arg = type_to_type_object (TYPE_FIELD_TYPE (type, field));
   if (!arg)
     goto fail;
   if (PyObject_SetAttrString (result, "type", arg) < 0)
diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c
index 2507fcd..5d4f596 100644
--- a/gdb/python/python-value.c
+++ b/gdb/python/python-value.c
@@ -312,6 +312,18 @@ valpy_str (PyObject *self)
   return result;
 }
 
+/* Implements gdb.Value.is_optimized_out.  */
+static PyObject *
+valpy_get_is_optimized_out (PyObject *self, void *closure)
+{
+  struct value *value = ((value_object *) self)->value;
+
+  if (value_optimized_out (value))
+    Py_RETURN_TRUE;
+
+  Py_RETURN_FALSE;
+}
+
 enum valpy_opcode
 {
   VALPY_ADD,
@@ -913,6 +925,13 @@ gdbpy_initialize_values (void)
 
 \f
 
+static PyGetSetDef value_object_getset[] = {
+  { "is_optimized_out", valpy_get_is_optimized_out, NULL,
+    "Boolean telling whether the value is optimized out (i.e., not available).",
+    NULL },
+  {NULL}  /* Sentinel */
+};
+
 static PyMethodDef value_object_methods[] = {
   { "address", valpy_address, METH_NOARGS, "Return the address of the value." },
   { "cast", valpy_cast, METH_VARARGS, "Cast the value to the supplied type." },
@@ -987,7 +1006,7 @@ PyTypeObject value_object_type = {
   0,				  /* tp_iternext */
   value_object_methods,		  /* tp_methods */
   0,				  /* tp_members */
-  0,				  /* tp_getset */
+  value_object_getset,		  /* tp_getset */
   0,				  /* tp_base */
   0,				  /* tp_dict */
   0,				  /* tp_descr_get */
diff --git a/gdb/testsuite/gdb.python/python-value.exp b/gdb/testsuite/gdb.python/python-value.exp
index 9ca9593..bd54b2f 100644
--- a/gdb/testsuite/gdb.python/python-value.exp
+++ b/gdb/testsuite/gdb.python/python-value.exp
@@ -225,6 +225,9 @@ proc test_value_in_inferior {} {
 
   # Check that the dereferenced value is sane
   gdb_test "python print arg0" "0x.*$testfile\"" "verify dereferenced value"
+
+  # Smoke-test is_optimized_out attribute
+  gdb_test "python print 'result =', arg0.is_optimized_out" "= False" "Test is_optimized_out attribute"
 }
 
 proc test_value_after_death {} {


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-09 17:05 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-09 17:05 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  534f5de0c9569a9eae535d722864afa1d78dc9dc (commit)
       via  0874c29c3341c169ebaaf3f125792d57595fc525 (commit)
      from  9ae706a486c079a09f55352803456dc2588d5b92 (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/python/lib/gdb/libstdcxx/v6/printers.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

First 500 lines of diff:
diff --git a/gdb/python/lib/gdb/libstdcxx/v6/printers.py b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
index ccef97d..c0dc987 100644
--- a/gdb/python/lib/gdb/libstdcxx/v6/printers.py
+++ b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
@@ -615,6 +615,7 @@ def build_libstdcxx_dictionary ():
     pretty_printers_dict[re.compile('^std::stack<.*>$')] = lambda val: StdStackOrQueuePrinter("std::stack", val)
     pretty_printers_dict[re.compile('^std::unique_ptr<.*>$')] = UniquePointerPrinter
     pretty_printers_dict[re.compile('^std::vector<.*>$')] = StdVectorPrinter
+    # vector<bool>
 
     # These are the C++0x printers. They also exist in the standard namespace.
     # For array - the default GDB pretty-printer seems reasonable.
@@ -626,7 +627,7 @@ def build_libstdcxx_dictionary ():
     pretty_printers_dict[re.compile('^std::(tr1::)?unordered_multiset<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_multiset', val)
 
 
-    # Extensions to std, tr1 pretty-printers.
+    # Extensions.
     pretty_printers_dict[re.compile('^__gnu_cxx::slist<.*>$')] = StdSlistPrinter
 
     if True:


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-06 16:59 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-06 16:59 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  ed5683b8c1957677e95baa80db811894c39a321e (commit)
       via  7479ac4e385bcaa2846c3aad5c616f571ff53c97 (commit)
      from  652968509fe26811de7e57036ec8bd801593ccbb (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/testsuite/gdb.python/python-frame.exp |   17 +++--------------
 1 files changed, 3 insertions(+), 14 deletions(-)

First 500 lines of diff:
diff --git a/gdb/testsuite/gdb.python/python-frame.exp b/gdb/testsuite/gdb.python/python-frame.exp
index e9e063a..674c25e 100644
--- a/gdb/testsuite/gdb.python/python-frame.exp
+++ b/gdb/testsuite/gdb.python/python-frame.exp
@@ -81,20 +81,9 @@ 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.older ().equals (f1)" " = True" "test Frame.older"
 gdb_test "python print 'result =', f1.newer ().equals (f0)" " = True" "test Frame.newer"
-
-set test "test Frame.read_var - error"
-gdb_test_multiple "python print 'result =', f0.read_var ('b')" $test {
-    -re "ValueError: variable 'b' not found.*Error while executing Python code.\r\n$gdb_prompt $" {
-	pass $test
-    }
-    -re "result = \\\{i = \\\{0, \[0-9\]+\\\}, d = 0\\.\[0-9\]+\\\}\r\n$gdb_prompt $" {
-	# libm.so debuginfo contains file static symbol `b' from `atnat.h'.
-	# local `b' would be find first if it would exist so it is more a PASS.
-	setup_xfail *-*-*
-	fail $test
-    }
-}
-
+gdb_test "python print 'result =', f0.read_var ('variable_which_surely_doesnt_exist')" \
+  "ValueError: variable 'variable_which_surely_doesnt_exist' not found.*Error while executing Python code." \
+  "test Frame.read_var - error"
 gdb_test "python print 'result =', f0.read_var ('a')" " = 1" "test Frame.read_var - success"
 
 gdb_test "python print 'result =', gdb.newest_frame ().equals (f0)" " = True" "test gdb.newest_frame"


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-06 14:26 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-06 14:26 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  652968509fe26811de7e57036ec8bd801593ccbb (commit)
       via  eff2403b365bdda84c08eb68890152ca1a58f1c6 (commit)
      from  b4c50b1c09c24b8796dbc6c5d82572029472c014 (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/testsuite/gdb.python/python-frame.exp |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

First 500 lines of diff:
diff --git a/gdb/testsuite/gdb.python/python-frame.exp b/gdb/testsuite/gdb.python/python-frame.exp
index 083fa90..e9e063a 100644
--- a/gdb/testsuite/gdb.python/python-frame.exp
+++ b/gdb/testsuite/gdb.python/python-frame.exp
@@ -81,9 +81,20 @@ 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.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 ('b')" \
-  "ValueError: variable 'b' not found.*Error while executing Python code." \
-  "test Frame.read_var - error"
+
+set test "test Frame.read_var - error"
+gdb_test_multiple "python print 'result =', f0.read_var ('b')" $test {
+    -re "ValueError: variable 'b' not found.*Error while executing Python code.\r\n$gdb_prompt $" {
+	pass $test
+    }
+    -re "result = \\\{i = \\\{0, \[0-9\]+\\\}, d = 0\\.\[0-9\]+\\\}\r\n$gdb_prompt $" {
+	# libm.so debuginfo contains file static symbol `b' from `atnat.h'.
+	# local `b' would be find first if it would exist so it is more a PASS.
+	setup_xfail *-*-*
+	fail $test
+    }
+}
+
 gdb_test "python print 'result =', f0.read_var ('a')" " = 1" "test Frame.read_var - success"
 
 gdb_test "python print 'result =', gdb.newest_frame ().equals (f0)" " = True" "test gdb.newest_frame"


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-05 21:53 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-05 21:53 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  b4c50b1c09c24b8796dbc6c5d82572029472c014 (commit)
       via  5d73409799981c07fba0c15494f53285bb662437 (commit)
      from  a0d288848d0d1ae00798d5f5a86ee8d48ea8f87c (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/python/python-function.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

First 500 lines of diff:
diff --git a/gdb/python/python-function.c b/gdb/python/python-function.c
index 608ac28..4a85a33 100644
--- a/gdb/python/python-function.c
+++ b/gdb/python/python-function.c
@@ -93,7 +93,7 @@ fnpy_call (void *cookie, int argc, struct value **argv)
 
   Py_DECREF (result);
   do_cleanups (cleanup);
-  
+
   return value;
 }
 
@@ -127,10 +127,9 @@ fnpy_init (PyObject *self, PyObject *args, PyObject *kwds)
 void
 gdbpy_initialize_functions (void)
 {
-  fnpy_object_type.tp_new = PyType_GenericNew;
-  fnpy_object_type.tp_init = fnpy_init;
   if (PyType_Ready (&fnpy_object_type) < 0)
     return;
+
   Py_INCREF (&fnpy_object_type);
   PyModule_AddObject (gdb_module, "Function", (PyObject *) &fnpy_object_type);
 }
@@ -167,5 +166,15 @@ static PyTypeObject fnpy_object_type =
   0,				  /* tp_weaklistoffset */
   0,				  /* tp_iter */
   0,				  /* tp_iternext */
-  0				  /* tp_methods */
+  0,				  /* tp_methods */
+  0,				  /* tp_members */
+  0,				  /* tp_getset */
+  0,				  /* tp_base */
+  0,				  /* tp_dict */
+  0,				  /* tp_descr_get */
+  0,				  /* tp_descr_set */
+  0,				  /* tp_dictoffset */
+  fnpy_init,			  /* tp_init */
+  0,				  /* tp_alloc */
+  PyType_GenericNew		  /* tp_new */
 };


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-05 21:15 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-05 21:15 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  a0d288848d0d1ae00798d5f5a86ee8d48ea8f87c (commit)
       via  a9edccdb7bff2cbea16f21972531097a8bcccc90 (commit)
       via  f61c9e6e4488ddec2eb88bfef2aaa3fb12aba9db (commit)
      from  5cb172eb14db3f9b01bb8229fb001617ee447b9b (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/python/lib/gdb/command/require.py |    4 ++--
 gdb/python/python-function.c          |   17 ++---------------
 gdb/value.c                           |   29 ++++++++++-------------------
 gdb/value.h                           |    5 ++++-
 4 files changed, 18 insertions(+), 37 deletions(-)

First 500 lines of diff:
diff --git a/gdb/python/lib/gdb/command/require.py b/gdb/python/lib/gdb/command/require.py
index f75faad..1fbc1e8 100644
--- a/gdb/python/lib/gdb/command/require.py
+++ b/gdb/python/lib/gdb/command/require.py
@@ -1,6 +1,6 @@
 # Demand-loading commands.
 
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
@@ -41,7 +41,7 @@ class RequireSubcommand (gdb.Command):
             exec ('import gdb.' + self.name + '.' + cmd, globals ())
 
     def complete (self, text, word):
-        dir = gdb.pythonlibdir + '/gdb/' + self.name
+        dir = gdb.pythondir + '/gdb/' + self.name
         result = []
         for file in os.listdir(dir):
             if not file.startswith (word) or not file.endswith ('.py'):
diff --git a/gdb/python/python-function.c b/gdb/python/python-function.c
index 5e346d6..608ac28 100644
--- a/gdb/python/python-function.c
+++ b/gdb/python/python-function.c
@@ -1,6 +1,6 @@
 /* Convenience functions implemented in Python.
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -97,19 +97,6 @@ fnpy_call (void *cookie, int argc, struct value **argv)
   return value;
 }
 
-/* Called when destroying a struct internal_function.  */
-
-static void
-fnpy_destroy (void *cookie)
-{
-  PyGILState_STATE state;
-
-  state = PyGILState_Ensure ();
-  Py_DECREF ((PyObject *) cookie);
-  PyGILState_Release (state);
-
-}
-
 /* Initializer for a Function object.  It takes one argument, the name
    of the function.  */
 
@@ -131,7 +118,7 @@ fnpy_init (PyObject *self, PyObject *args, PyObject *kwds)
   if (! docstring)
     docstring = _("This function is not documented.");
 
-  add_internal_function (name, docstring, fnpy_call, self, fnpy_destroy);
+  add_internal_function (name, docstring, fnpy_call, self);
   return 0;
 }
 
diff --git a/gdb/value.c b/gdb/value.c
index b5998bb..7fda20b 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -58,10 +58,6 @@ struct internal_function
 
   /* User data for the handler.  */
   void *cookie;
-
-  /* Function called to destroy the cookie when the function object is
-     destroyed.  */
-  void (*destroyer) (void *cookie);
 };
 
 static struct cmd_list_element *functionlist;
@@ -974,6 +970,7 @@ create_internalvar (const char *name)
   var->value = allocate_value (builtin_type_void);
   var->endian = gdbarch_byte_order (current_gdbarch);
   var->make_value = NULL;
+  var->canonical = 0;
   release_value (var->value);
   var->next = internalvars;
   internalvars = var;
@@ -1103,6 +1100,9 @@ set_internalvar (struct internalvar *var, struct value *val)
 {
   struct value *newval;
 
+  if (var->canonical)
+    error (_("Cannot overwrite convenience function %s"), var->name);
+
   newval = value_copy (val);
   newval->modifiable = 1;
 
@@ -1134,22 +1134,15 @@ internalvar_name (struct internalvar *var)
 static struct value *
 value_create_internal_function (const char *name,
 				internal_function_fn handler,
-				void *cookie,
-				void (*destroyer) (void *))
+				void *cookie)
 {
   struct value *result = allocate_value (internal_fn_type);
   gdb_byte *addr = value_contents_writeable (result);
   struct internal_function **fnp = (struct internal_function **) addr;
-  /* The internal_function object is leaked here -- to make it truly
-     deletable, we would have to reference count it and add special
-     code to value_free and value_copy.  The setup here is a bit odd
-     in general.  It would be better to have a special case in
-     help_command.  */
   struct internal_function *ifn = XNEW (struct internal_function);
   ifn->name = xstrdup (name);
   ifn->handler = handler;
   ifn->cookie = cookie;
-  ifn->destroyer = destroyer;
   *fnp = ifn;
   return result;
 }
@@ -1191,19 +1184,17 @@ function_destroyer (struct cmd_list_element *self, void *ignore)
 /* Add a new internal function.  NAME is the name of the function; DOC
    is a documentation string describing the function.  HANDLER is
    called when the function is invoked.  COOKIE is an arbitrary
-   pointer which is passed to HANDLER and is intended for "user data".
-   DESTROYER is invoked when the function is destroyed.  */
+   pointer which is passed to HANDLER and is intended for "user
+   data".  */
 void
 add_internal_function (const char *name, const char *doc,
-		       internal_function_fn handler,
-		       void *cookie, void (*destroyer) (void *))
+		       internal_function_fn handler, void *cookie)
 {
   struct cmd_list_element *cmd;
   struct internalvar *var = lookup_internalvar (name);
-  struct value *fnval = value_create_internal_function (name, handler, cookie,
-							destroyer);
-  release_value (fnval);
+  struct value *fnval = value_create_internal_function (name, handler, cookie);
   set_internalvar (var, fnval);
+  var->canonical = 1;
 
   cmd = add_cmd (xstrdup (name), no_class, function_command, (char *) doc,
 		 &functionlist);
diff --git a/gdb/value.h b/gdb/value.h
index d70f1bc..138b050 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -321,6 +321,9 @@ struct internalvar
   struct value *value;
   internalvar_make_value make_value;
   int endian;
+  /* True if this internalvar is the canonical name for a convenience
+     function.  */
+  int canonical;
 };
 
 \f
@@ -676,7 +679,7 @@ typedef struct value *(*internal_function_fn) (void *cookie,
 
 void add_internal_function (const char *name, const char *doc,
 			    internal_function_fn handler,
-			    void *cookie, void (*destroyer) (void *));
+			    void *cookie);
 
 struct value *call_internal_function (struct value *function,
 				      int argc, struct value **argv);


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-04 23:54 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-04 23:54 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  5cb172eb14db3f9b01bb8229fb001617ee447b9b (commit)
       via  80e9d289cba705a6d9a834fb659df9640b4a2a6e (commit)
      from  e42b07c2ea95c94f7f08f35479758953fa6a7d1c (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/Makefile.in |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

First 500 lines of diff:
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index cb0d2ba..6e0d8ec 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1955,9 +1955,17 @@ install-python:
 	  $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(pythondir)/$$file; \
 	done
 
-# Brute force.
+# Other packages may have their files installed in $(pythondir).
 uninstall-python:
-	rm -rf $(DESTDIR)/$(pythondir)
+	files='$(PY_FILES)'; for file in $$files; do \
+	  slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'`; \
+	  rm -f $(DESTDIR)$(pythondir)/$$file; \
+	  while test "x$$file" != "x$$slashdir"; do \
+	    rmdir 2>/dev/null "$(DESTDIR)$(pythondir)$$slashdir"; \
+	    file="$$slashdir"; \
+	    slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
+	  done \
+	done
 
 #
 # Dependency tracking.  Most of this is conditional on GNU Make being


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-04 22:34 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-04 22:34 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  e42b07c2ea95c94f7f08f35479758953fa6a7d1c (commit)
       via  84db8f9a3164350cdaa19dcc0c9122d55a5019bd (commit)
       via  8cd105bd9c53585384cb4249c942bed395ba2b89 (commit)
       via  dea5a03d229ce609df3ab3dd10f762608e8df094 (commit)
       via  9a0e06375eeafd272d38863feed8c9a8c1408701 (commit)
       via  7322121d6f77ef446b26f5d048529ae85de30ffd (commit)
       via  e180fc688f2f720ed9431d5712821142db49b46f (commit)
       via  7d013430def2b170f8e8ab1d24312dfecaccc13d (commit)
       via  661248db174bd85e6816ab6794483533f95e3097 (commit)
       via  db7ebad5e30d3ba79028421b7aa39779f796769b (commit)
      from  a6074bdc87ab8bfe8f517b7eccb1698af8dd0622 (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/Makefile.in            |   26 +++++-------
 gdb/config.in              |   12 ++++-
 gdb/configure              |   96 +++++++++++++++++++++++++++++++++++---------
 gdb/configure.ac           |   56 +++++++++++++++++++++----
 gdb/defs.h                 |    3 +
 gdb/doc/gdb.texinfo        |    6 +++
 gdb/main.c                 |   37 +++++++++++++++++
 gdb/maint.c                |    8 ++++
 gdb/python/python-membuf.c |   34 +++++++++++----
 gdb/python/python.c        |   55 ++++++++++++++++++-------
 10 files changed, 262 insertions(+), 71 deletions(-)

First 500 lines of diff:
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index f3d66f5..cb0d2ba 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -172,7 +172,12 @@ LIBICONV = @LIBICONV@
 TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
 TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
 
-GDB_PYTHONDIR_PATH = @GDB_PYTHONDIR_PATH@
+# Did the user give us a --with-gdb-datadir option?
+GDB_DATADIR_PATH = @GDB_DATADIR_PATH@
+
+# The argument to --with-pythondir.  If not given, this is
+# GDB_DATADIR_PATH/python.
+pythondir = @pythondir@
 
 # Helper code from gnulib.
 LIBGNU = gnulib/libgnu.a
@@ -1942,26 +1947,17 @@ PY_FILES = gdb/FrameIterator.py gdb/command/alias.py \
     gdb/__init__.py
 
 # Install the Python library.  Python library files go under
-# $(GDB_PYTHONDIR_PATH)/python.
+# $(pythondir).
 install-python:
 	files='$(PY_FILES)'; for file in $$files; do \
 	  dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
-	  $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$dir; \
-	  $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$file; \
+	  $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(pythondir)/$$dir; \
+	  $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(pythondir)/$$file; \
 	done
 
-# Other packages may have their files installed in $(GDB_PYTHONDIR_PATH).
+# Brute force.
 uninstall-python:
-	rm -rf $(DESTDIR)/$(GDB_PYTHONDIR_PATH)/python
-	files='$(PY_FILES)'; for file in $$files; do \
-	  dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
-	  rm -f $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$file; \
-	  while test "x$$file" != "x$$dir"; do \
-	    rmdir 2>/dev/null "$(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$dir"; \
-	    file="$$dir"; \
-	    dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
-	  done \
-	done
+	rm -rf $(DESTDIR)/$(pythondir)
 
 #
 # Dependency tracking.  Most of this is conditional on GNU Make being
diff --git a/gdb/config.in b/gdb/config.in
index cad7492..eea6037 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -42,6 +42,12 @@
    language is requested. */
 #undef ENABLE_NLS
 
+/* Global directory for GDB data files. */
+#undef GDB_DATADIR
+
+/* Define if GDB datadir should be relocated when GDB is moved. */
+#undef GDB_DATADIR_RELOCATABLE
+
 /* Define to be a string naming the default host character set. */
 #undef GDB_DEFAULT_HOST_CHARSET
 
@@ -60,9 +66,6 @@
 /* Define to the default OS ABI for this configuration. */
 #undef GDB_OSABI_DEFAULT
 
-/* Base directory for GDB Python modules. */
-#undef GDB_PYTHONDIR_PATH
-
 /* Define to 1 if you have `alloca', as a function or macro. */
 #undef HAVE_ALLOCA
 
@@ -621,6 +624,9 @@
    'ptrdiff_t'. */
 #undef PTRDIFF_T_SUFFIX
 
+/* Define to install path for Python sources */
+#undef PYTHONDIR
+
 /* Bug reporting address */
 #undef REPORT_BUGS_TO
 
diff --git a/gdb/configure b/gdb/configure
index fdfe573..9f55a02 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -314,7 +314,7 @@ ac_subdirs_all="$ac_subdirs_all doc testsuite"
 ac_subdirs_all="$ac_subdirs_all gdbtk"
 ac_subdirs_all="$ac_subdirs_all multi-ice"
 ac_subdirs_all="$ac_subdirs_all gdbserver"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT GDB_PYTHONDIR_PATH PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBICONV LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE GDB_DATADIR_PATH pythondir subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBICONV LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS'
 ac_subst_files='host_makefile_frag'
 ac_pwd=`pwd`
 
@@ -882,6 +882,10 @@ Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-separate-debug-dir=path   Look for global separate debug info in this path LIBDIR/debug
+  --with-gdb-datadir      look for global separate data files in this path
+                          [DATADIR/gdb]
+  --with-pythondir        install Python data files in this path
+                          [DATADIR/gdb/python]
   --with-libunwind            Use libunwind frame unwinding support
   --with-pkgversion=PKG   Use PKG in the version string in place of "GDB"
   --with-bugurl=URL       Direct users to URL to report a bug
@@ -7130,6 +7134,75 @@ _ACEOF
   ;;
 esac
 
+# GDB's datadir relocation
+
+gdbdatadir=${datadir}/gdb
+
+
+# Check whether --with-gdb-datadir or --without-gdb-datadir was given.
+if test "${with_gdb_datadir+set}" = set; then
+  withval="$with_gdb_datadir"
+  gdbdatadir="${withval}"
+fi;
+
+
+  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+  ac_define_dir=`eval echo $gdbdatadir`
+  ac_define_dir=`eval echo $ac_define_dir`
+
+cat >>confdefs.h <<_ACEOF
+#define GDB_DATADIR "$ac_define_dir"
+_ACEOF
+
+
+
+if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
+  if test "x$prefix" = xNONE; then
+    test_prefix=/usr/local
+  else
+    test_prefix=$prefix
+  fi
+else
+  test_prefix=$exec_prefix
+fi
+
+case ${gdbdatadir} in
+  "${test_prefix}"|"${test_prefix}/"*|\
+  '${exec_prefix}'|'${exec_prefix}/'*)
+
+cat >>confdefs.h <<\_ACEOF
+#define GDB_DATADIR_RELOCATABLE 1
+_ACEOF
+
+  ;;
+esac
+GDB_DATADIR_PATH=${gdbdatadir}
+
+
+
+# Check whether --with-pythondir or --without-pythondir was given.
+if test "${with_pythondir+set}" = set; then
+  withval="$with_pythondir"
+  pythondir="${withval}"
+else
+  pythondir=no
+fi;
+
+# If the user passed in a path, define it.  Otherwise, compute it at
+# runtime based on the possibly-relocatable datadir.
+if test "$pythondir" = "no"; then
+  pythondir='$(GDB_DATADIR_PATH)/python'
+else
+
+cat >>confdefs.h <<_ACEOF
+#define PYTHONDIR "$pythondir"
+_ACEOF
+
+fi
+
+
+
 
 
 subdirs="$subdirs doc testsuite"
@@ -11156,7 +11229,6 @@ echo $ECHO_N "checking whether to use python... $ECHO_C" >&6
 echo "$as_me:$LINENO: result: $with_python" >&5
 echo "${ECHO_T}$with_python" >&6
 
-GDB_PYTHONDIR_PATH=
 if test "${with_python}" = no; then
   { echo "$as_me:$LINENO: WARNING: python support disabled; some features may be unavailable." >&5
 echo "$as_me: WARNING: python support disabled; some features may be unavailable." >&2;}
@@ -11388,20 +11460,7 @@ _ACEOF
 
     fi
   fi
-  if test ${have_libpython} != no; then
-    GDB_PYTHONDIR_PATH="`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib();"`"
-
-  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
-  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-  ac_define_dir=`eval echo $GDB_PYTHONDIR_PATH`
-  ac_define_dir=`eval echo $ac_define_dir`
-
-cat >>confdefs.h <<_ACEOF
-#define GDB_PYTHONDIR_PATH "$ac_define_dir"
-_ACEOF
-
-
-  else
+  if test ${have_libpython} = no; then
     case "${with_python}" in
     yes)
       { { echo "$as_me:$LINENO: error: python is missing or unusable" >&5
@@ -11423,8 +11482,6 @@ echo "$as_me: error: no usable python found at ${with_python}" >&2;}
   fi
 fi
 
-
-PYTHON_CFLAGS=
 if test "${have_libpython}" = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -21883,6 +21940,8 @@ s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
 s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
 s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
 s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@GDB_DATADIR_PATH@,$GDB_DATADIR_PATH,;t t
+s,@pythondir@,$pythondir,;t t
 s,@subdirs@,$subdirs,;t t
 s,@TARGET_OBS@,$TARGET_OBS,;t t
 s,@PKGVERSION@,$PKGVERSION,;t t
@@ -21904,7 +21963,6 @@ s,@READLINE_CFLAGS@,$READLINE_CFLAGS,;t t
 s,@HAVE_LIBEXPAT@,$HAVE_LIBEXPAT,;t t
 s,@LIBEXPAT@,$LIBEXPAT,;t t
 s,@LTLIBEXPAT@,$LTLIBEXPAT,;t t
-s,@GDB_PYTHONDIR_PATH@,$GDB_PYTHONDIR_PATH,;t t
 s,@PYTHON_CFLAGS@,$PYTHON_CFLAGS,;t t
 s,@ALLOCA@,$ALLOCA,;t t
 s,@CONFIG_LDFLAGS@,$CONFIG_LDFLAGS,;t t
diff --git a/gdb/configure.ac b/gdb/configure.ac
index c197fe8..267fe9f 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1,6 +1,6 @@
 dnl Autoconf configure script for GDB, the GNU debugger.
 dnl Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-dnl 2005, 2006, 2007, 2008
+dnl 2005, 2006, 2007, 2008, 2009
 dnl Free Software Foundation, Inc.
 dnl
 dnl This file is part of GDB.
@@ -118,6 +118,51 @@ case ${debugdir} in
   ;;
 esac
 
+# GDB's datadir relocation
+
+gdbdatadir=${datadir}/gdb
+
+AC_ARG_WITH([gdb-datadir],
+  [AS_HELP_STRING([--with-gdb-datadir],
+                  [look for global separate data files in this path [DATADIR/gdb]])], [gdbdatadir="${withval}"])
+
+AC_DEFINE_DIR(GDB_DATADIR, gdbdatadir,
+              [Global directory for GDB data files. ])
+
+if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
+  if test "x$prefix" = xNONE; then
+    test_prefix=/usr/local
+  else
+    test_prefix=$prefix
+  fi
+else
+  test_prefix=$exec_prefix
+fi
+
+case ${gdbdatadir} in
+  "${test_prefix}"|"${test_prefix}/"*|\
+  '${exec_prefix}'|'${exec_prefix}/'*)
+    AC_DEFINE(GDB_DATADIR_RELOCATABLE, 1, [Define if GDB datadir should be relocated when GDB is moved.])
+  ;;
+esac
+GDB_DATADIR_PATH=${gdbdatadir}
+AC_SUBST(GDB_DATADIR_PATH)
+
+AC_ARG_WITH([pythondir],
+  [AS_HELP_STRING([--with-pythondir],
+                  [install Python data files in this path [DATADIR/gdb/python]])], [pythondir="${withval}"], [pythondir=no])
+
+# If the user passed in a path, define it.  Otherwise, compute it at
+# runtime based on the possibly-relocatable datadir.
+if test "$pythondir" = "no"; then
+  pythondir='$(GDB_DATADIR_PATH)/python'
+else
+  AC_DEFINE_UNQUOTED(PYTHONDIR, "$pythondir",
+      [Define to install path for Python sources])
+fi
+AC_SUBST(pythondir)
+
+
 AC_CONFIG_SUBDIRS(doc testsuite)
 
 # Check whether to support alternative target configurations
@@ -585,7 +630,6 @@ AC_ARG_WITH(python,
 AC_MSG_CHECKING([whether to use python])
 AC_MSG_RESULT([$with_python])
 
-GDB_PYTHONDIR_PATH=
 if test "${with_python}" = no; then
   AC_MSG_WARN([python support disabled; some features may be unavailable.])
   have_libpython=no
@@ -628,11 +672,7 @@ else
       AC_DEFINE(HAVE_LIBPYTHON2_4, 1, [Define if Python 2.4 is being used.])
     fi
   fi
-  if test ${have_libpython} != no; then
-    GDB_PYTHONDIR_PATH="`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib();"`"
-    AC_DEFINE_DIR(GDB_PYTHONDIR_PATH, GDB_PYTHONDIR_PATH, 
-		  [Base directory for GDB Python modules.])
-  else
+  if test ${have_libpython} = no; then
     case "${with_python}" in
     yes)
       AC_MSG_ERROR([python is missing or unusable])
@@ -648,9 +688,7 @@ else
     LIBS=$save_LIBS
   fi
 fi
-AC_SUBST(GDB_PYTHONDIR_PATH)
 
-PYTHON_CFLAGS=
 if test "${have_libpython}" = yes; then
   AC_DEFINE(HAVE_PYTHON, 1, [Define if Python interpreter is being linked in.])
   CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
diff --git a/gdb/defs.h b/gdb/defs.h
index 845b320..5da17e1 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -151,6 +151,9 @@ extern int dbx_commands;
 /* System root path, used to find libraries etc.  */
 extern char *gdb_sysroot;
 
+/* GDB datadir, used to store data files.  */
+extern char *gdb_datadir;
+
 /* Search path for separate debug files.  */
 extern char *debug_file_directory;
 
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index dc8d2c1..480b846 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18401,6 +18401,12 @@ If this file does not exist, and if the parameter
 @code{debug-file-directory} is set, then @value{GDBN} will append the
 object file's real name to the value of this parameter, and try again.
 
+Finally, if this file does not exist, then @value{GDBN} will look in
+subdirectory of @code{gdb_datadir} (whose value is available from
+@code{maint show gdb_datadir}).  Specifically, @value{GDBN} will take
+the value of @code{gdb_datadir}, append @samp{python/auto-load}, and
+then append the object file's real name.
+
 Also, if a separate debug file is used, @value{GDBN} will look for the
 @samp{-gdb.py} file both in the directory associated with the
 application and the directory associated with the separate debug file.
diff --git a/gdb/main.c b/gdb/main.c
index 4a5eb23..6f9e61b 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -64,6 +64,9 @@ int dbx_commands = 0;
 /* System root path, used to find libraries etc.  */
 char *gdb_sysroot = 0;
 
+/* GDB datadir, used to store data files.  */
+char *gdb_datadir = 0;
+
 struct ui_file *gdb_stdout;
 struct ui_file *gdb_stderr;
 struct ui_file *gdb_stdlog;
@@ -361,6 +364,40 @@ captured_main (void *data)
 	}
     }
 
+#ifdef GDB_DATADIR_RELOCATABLE
+  gdb_datadir = make_relative_prefix (argv[0], BINDIR, GDB_DATADIR);
+  if (gdb_datadir)
+    {
+      struct stat s;
+      int res = 0;
+
+      if (stat (gdb_datadir, &s) == 0)
+	if (S_ISDIR (s.st_mode))
+	  res = 1;
+
+      if (res == 0)
+	{
+	  xfree (gdb_datadir);
+	  gdb_datadir = xstrdup (GDB_DATADIR);
+	}
+    }
+  else
+    gdb_datadir = xstrdup (GDB_DATADIR);
+#else
+  gdb_datadir = xstrdup (GDB_DATADIR);
+#endif /* GDB_DATADIR_RELOCATABLE */
+
+  /* Canonicalize the GDB's datadir path.  */
+  if (*gdb_datadir)
+    {
+      char *canon_debug = lrealpath (gdb_datadir);
+      if (canon_debug)
+	{
+	  xfree (gdb_datadir);
+	  gdb_datadir = canon_debug;
+	}
+    }
+
   get_init_files (&system_gdbinit, &home_gdbinit, &local_gdbinit);
 
   /* There will always be an interpreter.  Either the one passed into
diff --git a/gdb/maint.c b/gdb/maint.c
index 56cafe9..1b57ff5 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -906,4 +906,12 @@ When enabled GDB is profiled."),
 			   show_maintenance_profile_p,
 			   &maintenance_set_cmdlist,
 			   &maintenance_show_cmdlist);
+  add_setshow_filename_cmd ("gdb_datadir", class_maintenance,
+                           &gdb_datadir, _("Set GDB's datadir path."),
+                           _("Show GDB's datadir path."),
+                           _("\
+When set, GDB uses the specified path to search for data files."),
+                           NULL, NULL,
+                           &maintenance_set_cmdlist,
+                           &maintenance_show_cmdlist);
 }
diff --git a/gdb/python/python-membuf.c b/gdb/python/python-membuf.c
index 57836f9..a4c7d74 100644
--- a/gdb/python/python-membuf.c
+++ b/gdb/python/python-membuf.c
@@ -125,12 +125,12 @@ mbpy_str (PyObject *self)
 {
   membuf_object *membuf_obj = (membuf_object *) self;
 
-  return PyString_FromFormat ("memory buffer for address %p, %u bytes long",
-			      (void *) (uintptr_t) membuf_obj->addr,
-			      (unsigned int) membuf_obj->length);
+  return PyString_FromFormat ("memory buffer for address %s, %s bytes long",
+			      paddress (membuf_obj->addr),
+			      pulongest (membuf_obj->length));
 }
 
-Py_ssize_t
+static Py_ssize_t
 get_read_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr)
 {
   membuf_object *membuf_obj = (membuf_object *) self;
@@ -147,13 +147,13 @@ get_read_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr)
   return membuf_obj->length;
 }
 
-Py_ssize_t
+static Py_ssize_t
 get_write_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr)
 {
   return get_read_buffer (self, segment, ptrptr);
 }
 
-Py_ssize_t
+static Py_ssize_t
 get_seg_count (PyObject *self, Py_ssize_t *lenp)
 {
   if (lenp)
@@ -162,7 +162,7 @@ get_seg_count (PyObject *self, Py_ssize_t *lenp)
   return 1;
 }
 
-Py_ssize_t
+static Py_ssize_t
 get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr)
 {
   void *ptr = NULL;
@@ -212,13 +212,29 @@ static PyTypeObject membuf_object_type = {
   0,				  /*tp_setattro*/
   &buffer_procs,		  /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT,		  /*tp_flags*/
-  "GDB memory buffer object" 	  /*tp_doc*/
+  "GDB memory buffer object", 	  /*tp_doc*/
+  0,				  /* tp_traverse */
+  0,				  /* tp_clear */
+  0,				  /* tp_richcompare */
+  0,				  /* tp_weaklistoffset */
+  0,				  /* tp_iter */
+  0,				  /* tp_iternext */
+  0,				  /* tp_methods */


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-04 15:02 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-04 15:02 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  a6074bdc87ab8bfe8f517b7eccb1698af8dd0622 (commit)
       via  b2d8ee40deb869373afc86c870c85aa720870072 (commit)
      from  8376995d229ccbbec3d59897c511bdb35c9e0944 (commit)

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

- Log -----------------------------------------------------------------
commit a6074bdc87ab8bfe8f517b7eccb1698af8dd0622
Merge: 8376995d229ccbbec3d59897c511bdb35c9e0944 b2d8ee40deb869373afc86c870c85aa720870072
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 4 16:02:32 2009 +0100

    Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python

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

Summary of changes:

First 500 lines of diff:


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-03 21:46 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-03 21:46 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  b7d72995b3fb6e6ef1ca3d5cf33269dc523a561f (commit)
       via  2c02a8f709f15aa25a10fb47a9e3bd98ff9d9a78 (commit)
      from  f3ec9b4195a8b4b4de2c513841f469553d9f3b38 (commit)

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

- Log -----------------------------------------------------------------
commit b7d72995b3fb6e6ef1ca3d5cf33269dc523a561f
Merge: f3ec9b4195a8b4b4de2c513841f469553d9f3b38 2c02a8f709f15aa25a10fb47a9e3bd98ff9d9a78
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Tue Mar 3 22:46:29 2009 +0100

    Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python

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

Summary of changes:
 gdb/doc/gdb.texinfo                       |    2 +-
 gdb/python/lib/gdb/command/backtrace.py   |    2 +-
 gdb/python/python-frame.c                 |    8 ++++----
 gdb/testsuite/gdb.python/find.exp         |   14 +++++++-------
 gdb/testsuite/gdb.python/python-frame.exp |    6 +++---
 5 files changed, 16 insertions(+), 16 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 8e259f8..dc8d2c1 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -19594,7 +19594,7 @@ Return the frame immediately newer (inner) to this frame.
 Return the frame's symtab and line object. @c (see @xref{Symtab_and_line,, Symtab and line}).
 @end defmethod
 
-@defmethod Frame read_var_value @var{variable}
+@defmethod Frame read_var @var{variable}
 Return the value of the given variable in this frame.  @code{variable} can be
 either a string or a @code{gdb.Symbol} object. @c (@pxref{Symbols In Python}).
 @end defmethod
diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py
index 008e5dd..f07696e 100644
--- a/gdb/python/lib/gdb/command/backtrace.py
+++ b/gdb/python/lib/gdb/command/backtrace.py
@@ -33,7 +33,7 @@ class FrameWrapper:
 
         stream.write (sym.print_name + "=")
         try:
-            val = self.frame.read_var_value (sym)
+            val = self.frame.read_var (sym)
             if val != None:
                 val = str (val)
         # FIXME: would be nice to have a more precise exception here.
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index 1729717..c98dc39 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -391,13 +391,13 @@ frapy_find_sal (PyObject *self, PyObject *args)
   return sal_obj;
 }
 
-/* Implementation of gdb.Frame.read_var_value (self, variable) -> gdb.Value.
+/* Implementation of gdb.Frame.read_var (self, variable) -> gdb.Value.
    Returns the value of the given variable in this frame.  The argument can be
    either a gdb.Symbol or a string.  Returns None if GDB can't find the
    specified variable.  */
 
 static PyObject *
-frapy_read_var_value (PyObject *self, PyObject *args)
+frapy_read_var (PyObject *self, PyObject *args)
 {
   struct frame_info *frame;
   PyObject *sym_obj;
@@ -645,8 +645,8 @@ Return the frame immetidaely newer (inner) to this frame." },
   { "find_sal", frapy_find_sal, METH_NOARGS,
     "find_sal () -> gdb.Symtab_and_line.\n\
 Return the frame's symtab and line." },
-  { "read_var_value", frapy_read_var_value, METH_VARARGS,
-    "read_var_value (variable) -> gdb.Value.\n\
+  { "read_var", frapy_read_var, METH_VARARGS,
+    "read_var (variable) -> gdb.Value.\n\
 Return the value of the variable in this frame." },
   {NULL}  /* Sentinel */
 };
diff --git a/gdb/testsuite/gdb.python/find.exp b/gdb/testsuite/gdb.python/find.exp
index a7dad97..dd9aabc 100644
--- a/gdb/testsuite/gdb.python/find.exp
+++ b/gdb/testsuite/gdb.python/find.exp
@@ -90,7 +90,7 @@ set two_patterns_found "${newline}.${dec_number}L, ${dec_number}L]"
 # Test string pattern.
 
 gdb_test "set *(int32_t*) &int8_search_buf\[10\] = 0x61616161" "" ""
-gdb_test "py search_buf = gdb.selected_frame ().read_var_value ('int8_search_buf')" "" ""
+gdb_test "py search_buf = gdb.selected_frame ().read_var ('int8_search_buf')" "" ""
 gdb_test "py start_addr = search_buf.address ()" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 
@@ -128,7 +128,7 @@ gdb_test "py print gdb.search_memory (start_addr, length, \['a', 'a'\], max_coun
 # Test 16-bit pattern.
 
 gdb_test "set int16_search_buf\[10\] = 0x1234" "" ""
-gdb_test "py search_buf = gdb.selected_frame ().read_var_value ('int16_search_buf')" "" ""
+gdb_test "py search_buf = gdb.selected_frame ().read_var ('int16_search_buf')" "" ""
 gdb_test "py start_addr = search_buf.address ()" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 gdb_test "py pattern = gdb.parse_and_eval ('(int16_t) 0x1234')" "" ""
@@ -142,7 +142,7 @@ gdb_test "py print gdb.search_memory (start_addr, length, pattern)" \
 # Test 32-bit pattern.
 
 gdb_test "set int32_search_buf\[10\] = 0x12345678" "" ""
-gdb_test "py search_buf = gdb.selected_frame ().read_var_value ('int32_search_buf')" "" ""
+gdb_test "py search_buf = gdb.selected_frame ().read_var ('int32_search_buf')" "" ""
 gdb_test "py start_addr = search_buf.address ()" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 gdb_test "py pattern = gdb.parse_and_eval ('(int32_t) 0x12345678')" "" ""
@@ -155,7 +155,7 @@ gdb_test "py print gdb.search_memory (start_addr, length, pattern)" \
 # Test 64-bit pattern.
 
 gdb_test "set int64_search_buf\[10\] = 0xfedcba9876543210LL" "" ""
-gdb_test "py search_buf = gdb.selected_frame ().read_var_value ('int64_search_buf')" "" ""
+gdb_test "py search_buf = gdb.selected_frame ().read_var ('int64_search_buf')" "" ""
 gdb_test "py start_addr = search_buf.address ()" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 gdb_test "py pattern = gdb.parse_and_eval ('(int64_t) 0xfedcba9876543210LL')" "" ""
@@ -170,7 +170,7 @@ gdb_test "py print gdb.search_memory (start_addr, length, pattern)" \
 gdb_test "set *(int8_t*) &search_buf\[10\] = 0x62" "" ""
 gdb_test "set *(int16_t*) &search_buf\[11\] = 0x6363" "" ""
 gdb_test "set *(int32_t*) &search_buf\[13\] = 0x64646464" "" ""
-gdb_test "py search_buf = gdb.selected_frame ().read_var_value ('search_buf')" "" ""
+gdb_test "py search_buf = gdb.selected_frame ().read_var ('search_buf')" "" ""
 gdb_test "py start_addr = search_buf\[0\].address ()" "" ""
 gdb_test "py pattern1 = gdb.parse_and_eval ('(int8_t) 0x62')" "" ""
 gdb_test "py pattern2 = gdb.parse_and_eval ('(int16_t) 0x6363')" "" ""
@@ -187,8 +187,8 @@ set CHUNK_SIZE 16000 ;
 
 gdb_test "set *(int32_t*) &search_buf\[0*${CHUNK_SIZE}+100\] = 0x12345678" "" ""
 gdb_test "set *(int32_t*) &search_buf\[1*${CHUNK_SIZE}+100\] = 0x12345678" "" ""
-gdb_test "py start_addr = gdb.selected_frame ().read_var_value ('search_buf')" "" ""
-gdb_test "py length = gdb.selected_frame ().read_var_value ('search_buf_size')" "" ""
+gdb_test "py start_addr = gdb.selected_frame ().read_var ('search_buf')" "" ""
+gdb_test "py length = gdb.selected_frame ().read_var ('search_buf_size')" "" ""
 
 gdb_test "py print gdb.search_memory (start_addr, length, 0x12345678, 4)" \
   "${two_patterns_found}" "search spanning large range"
diff --git a/gdb/testsuite/gdb.python/python-frame.exp b/gdb/testsuite/gdb.python/python-frame.exp
index f62f63d..083fa90 100644
--- a/gdb/testsuite/gdb.python/python-frame.exp
+++ b/gdb/testsuite/gdb.python/python-frame.exp
@@ -81,10 +81,10 @@ 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.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_value ('b')" \
+gdb_test "python print 'result =', f0.read_var ('b')" \
   "ValueError: variable 'b' not found.*Error while executing Python code." \
-  "test Frame.read_var_value - error"
-gdb_test "python print 'result =', f0.read_var_value ('a')" " = 1" "test Frame.read_var_value - success"
+  "test Frame.read_var - error"
+gdb_test "python print 'result =', f0.read_var ('a')" " = 1" "test Frame.read_var - success"
 
 gdb_test "python print 'result =', gdb.newest_frame ().equals (f0)" " = True" "test gdb.newest_frame"
 gdb_test "python print 'result =', gdb.selected_frame ().equals (f1)" " = True" "test gdb.selected_frame"


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-03 21:45 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-03 21:45 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  f3ec9b4195a8b4b4de2c513841f469553d9f3b38 (commit)
       via  258d034209fdf76c6d9c1508fcabe8e98eab8e97 (commit)
      from  e906c13419e917c520586e8ae04a396bc3018395 (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/python/python-frame.c |   40 ++++++++++++++++++++++++++++------------
 gdb/python/python.c       |   17 +++++++++++------
 2 files changed, 39 insertions(+), 18 deletions(-)

First 500 lines of diff:
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index 7305199..1729717 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -612,26 +612,42 @@ gdbpy_initialize_frames (void)
 \f
 
 static PyMethodDef frame_object_methods[] = {
-  { "equals", frapy_equal_p, METH_VARARGS, "Compare frames." },
+  { "equals", frapy_equal_p, METH_VARARGS,
+    "equals (frame) -> Boolean.\n\
+Compare this frame to the given frame." },
   { "is_valid", frapy_is_valid, METH_NOARGS,
-    "Return true if this frame is valid, false if not." },
+    "is_valid () -> Boolean.\n\
+Return true if this frame is valid, false if not." },
   { "name", frapy_name, METH_NOARGS,
-    "Return the function name of the frame." },
-  { "type", frapy_type, METH_NOARGS, "Return the type of the frame." },
+    "name () -> String.\n\
+Return the function name of the frame, or None if it can't be determined." },
+  { "type", frapy_type, METH_NOARGS,
+    "type () -> Integer.\n\
+Return the type of the frame." },
   { "unwind_stop_reason", frapy_unwind_stop_reason, METH_NOARGS,
-    "Return the reason why it's not possible to find frames older than this." },
-  { "pc", frapy_pc, METH_NOARGS, "Return the frame's resume address." },
-  { "block", frapy_block, METH_NOARGS, "Return the frame's code block." },
+    "unwind_stop_reason () -> Integer.\n\
+Return the reason why it's not possible to find frames older than this." },
+  { "pc", frapy_pc, METH_NOARGS,
+    "pc () -> Long.\n\
+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,
-    "Return an address which falls within the frame's code block." },
+    "addr_in_block () -> Long.\n\
+Return an address which falls within the frame's code block." },
   { "older", frapy_older, METH_NOARGS,
-    "Return the frame immediately older (outer) to this frame." },
+    "older () -> gdb.Frame.\n\
+Return the frame immediately older (outer) to this frame." },
   { "newer", frapy_newer, METH_NOARGS,
-    "Return the frame immetidaely newer (inner) to this frame." },
+    "newer () -> gdb.Frame.\n\
+Return the frame immetidaely newer (inner) to this frame." },
   { "find_sal", frapy_find_sal, METH_NOARGS,
-    "Return the frame's symtab and line." },
+    "find_sal () -> gdb.Symtab_and_line.\n\
+Return the frame's symtab and line." },
   { "read_var_value", frapy_read_var_value, METH_VARARGS,
-    "Return the value of the variable in this frame." },
+    "read_var_value (variable) -> gdb.Value.\n\
+Return the value of the variable in this frame." },
   {NULL}  /* Sentinel */
 };
 
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 32df67c..3cebc53 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1855,13 +1855,17 @@ static PyMethodDef GdbMethods[] =
     "Return a sequence of all loaded objfiles." },
 
   { "frames", gdbpy_frames, METH_NOARGS,
-    "Return a tuple of all frame objects." },
+    "frames () -> (gdb.Frame, ...).\n\
+Return a tuple of all frame objects." },
   { "newest_frame", gdbpy_newest_frame, METH_NOARGS,
-    "Return the newest frame object." },
+    "newest_frame () -> gdb.Frame.\n\
+Return the newest frame object." },
   { "selected_frame", gdbpy_selected_frame, METH_NOARGS,
-    "Return the selected frame object." },
-  { "frame_stop_reason_string", gdbpy_frame_stop_reason_string,
-    METH_VARARGS, "Return a string explaining unwind stop reason." },
+    "selected_frame () -> gdb.Frame.\n\
+Return the selected frame object." },
+  { "frame_stop_reason_string", gdbpy_frame_stop_reason_string, METH_VARARGS,
+    "stop_reason_string (Integer) -> String.\n\
+Return a string explaining unwind stop reason." },
 
   { "lookup_symbol", (PyCFunction) gdbpy_lookup_symbol,
     METH_VARARGS | METH_KEYWORDS,
@@ -1870,7 +1874,8 @@ Return a tuple with the symbol corresponding to the given name (or None) and\n\
 a boolean indicating if name is a field of the current implied argument\n\
 `this' (when the current language is object-oriented)." },
   { "solib_address", gdbpy_solib_address, METH_VARARGS,
-    "Return shared library holding a given address, or None." },
+    "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." },


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-02 20:46 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-02 20:46 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  2fac9534dc2dc85f7c999b94574cf0acf1767dd6 (commit)
       via  d1078c2fa27154160e390b04f9c89a41103d80ed (commit)
       via  1453f41cc1b2703b905f769de4b48a4db44a21d2 (commit)
      from  49f350efd1b7ea38798e77eb8951440160fd7c81 (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/doc/gdb.texinfo                       |   20 ++++++++++++++++++--
 gdb/python/python-frame.c                 |   24 ++++++++++++++++++------
 gdb/testsuite/gdb.python/python-frame.exp |    9 +++++++++
 3 files changed, 45 insertions(+), 8 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index be22f07..8e259f8 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18350,6 +18350,11 @@ which is typically four bytes.  @var{max_count} is the highest number of matches
 to search for.
 @end defun
 
+@findex gdb.solib_address
+@defun solib_address @var{address}
+Return the name of the shared library holding the given address, or None.
+@end defun
+
 @node Exception Handling
 @subsubsection Exception Handling
 @cindex python exceptions
@@ -19559,10 +19564,20 @@ Returns the type of the frame. The value can be one of
 or @code{gdb.SENTINEL_FRAME}.
 @end defmethod
 
+@defmethod Frame unwind_stop_reason
+Return an integer representing the reason why it's not possible to find
+frames older than this.  Use @code{gdb.frame_stop_reason_string} to convert
+the value returned by this function to a string.
+@end defmethod
+
 @defmethod Frame pc
 Returns the frame's resume address.
 @end defmethod
 
+@defmethod Frame block
+Returns the frame's code block. @c (see @xref{Block,,Code Blocks and Scopes}).
+@end defmethod
+
 @defmethod Frame address_in_block
 Returns an address which falls within the frame's code block.
 @end defmethod
@@ -19579,8 +19594,9 @@ Return the frame immediately newer (inner) to this frame.
 Return the frame's symtab and line object. @c (see @xref{Symtab_and_line,, Symtab and line}).
 @end defmethod
 
-@defmethod Frame read_var_value @var{symbol}
-Return the value of the variable corresponding to the given symbol in this frame.
+@defmethod Frame read_var_value @var{variable}
+Return the value of the given variable in this frame.  @code{variable} can be
+either a string or a @code{gdb.Symbol} object. @c (@pxref{Symbols In Python}).
 @end defmethod
 @end table
 
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index 1f152b8..7305199 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -413,20 +413,32 @@ frapy_read_var_value (PyObject *self, PyObject *args)
   else if (gdbpy_is_string (sym_obj))
     {
       char *var_name;
-      struct block *block;
+      struct block *block = NULL;
+      struct cleanup *cleanup;
       volatile struct gdb_exception except;
 
+      var_name = python_string_to_target_string (sym_obj);
+      cleanup = make_cleanup (xfree, var_name);
+
       TRY_CATCH (except, RETURN_MASK_ALL)
 	{
-	  struct block *block;
-
 	  FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
 
 	  block = block_for_pc (get_frame_address_in_block (frame));
-	  var = lookup_symbol (python_string_to_target_string (sym_obj), block,
-			       VAR_DOMAIN, NULL);
+	  var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
 	}
       GDB_PY_HANDLE_EXCEPTION (except);
+
+      if (!var)
+	{
+	  PyErr_Format (PyExc_ValueError,
+			_("variable '%s' not found"), var_name);
+	  do_cleanups (cleanup);
+
+	  return NULL;
+	}
+
+      do_cleanups (cleanup);
     }
   else
     {
@@ -573,7 +585,7 @@ gdbpy_initialize_frames (void)
   if (PyType_Ready (&frame_object_type) < 0)
     return;
 
-  /* FIXME: These would probably be best exposed as class attributes of Frame,
+  /* Note: These would probably be best exposed as class attributes of Frame,
      but I don't know how to do it except by messing with the type's dictionary.
      That seems too messy.  */
   PyModule_AddIntConstant (gdb_module, "NORMAL_FRAME", NORMAL_FRAME);
diff --git a/gdb/testsuite/gdb.python/python-frame.exp b/gdb/testsuite/gdb.python/python-frame.exp
index cfa2226..f62f63d 100644
--- a/gdb/testsuite/gdb.python/python-frame.exp
+++ b/gdb/testsuite/gdb.python/python-frame.exp
@@ -63,6 +63,7 @@ if ![runto_main] then {
 
 gdb_breakpoint "f2"
 gdb_continue_to_breakpoint "breakpoint at f2"
+gdb_test "up" "" ""
 
 gdb_py_test_silent_cmd "python frames = gdb.frames ()" "get frames list" 1
 gdb_test "python print frames" "\\(<gdb.Frame object at 0x\[\[:xdigit:\]\]+>, <gdb.Frame object at 0x\[\[:xdigit:\]\]+>, <gdb.Frame object at 0x\[\[:xdigit:\]\]+>\\)" "verify frames list"
@@ -75,9 +76,17 @@ gdb_test "python print 'result =', f0.is_valid ()" " = True" "test Frame.is_vali
 gdb_test "python print 'result =', f0.name ()" " = f2" "test Frame.name"
 gdb_test "python print 'result =', f0.type () == gdb.NORMAL_FRAME" " = True" "test Frame.type"
 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.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_value ('b')" \
+  "ValueError: variable 'b' not found.*Error while executing Python code." \
+  "test Frame.read_var_value - error"
+gdb_test "python print 'result =', f0.read_var_value ('a')" " = 1" "test Frame.read_var_value - success"
+
+gdb_test "python print 'result =', gdb.newest_frame ().equals (f0)" " = True" "test gdb.newest_frame"
+gdb_test "python print 'result =', gdb.selected_frame ().equals (f1)" " = True" "test gdb.selected_frame"
 
 gdb_test "python print 'result =', f0.block ()" "<gdb.Block object at 0x\[\[:xdigit:\]\]+>" "test Frame.block"


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-03-01 14:38 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-03-01 14:38 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  c3b72d37227864dd76c5ce77fb67958403b9c815 (commit)
       via  3d0c4bcb05d5112ca43433e3c0fd5185c9ea945e (commit)
       via  ebd9eefcf0e56102c40cfd104eb1c290526b3f51 (commit)
      from  454f9ae0d58d33f857af8474b387f2fc122e7edc (commit)

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

- Log -----------------------------------------------------------------
commit c3b72d37227864dd76c5ce77fb67958403b9c815
Merge: ebd9eefcf0e56102c40cfd104eb1c290526b3f51 3d0c4bcb05d5112ca43433e3c0fd5185c9ea945e
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Mar 1 15:29:43 2009 +0100

    Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python

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

Summary of changes:
 gdb/Makefile.in           |   24 ++++++++++-----
 gdb/config.in             |    9 ++----
 gdb/configure             |   70 ++++++++++++--------------------------------
 gdb/configure.ac          |   39 +++++--------------------
 gdb/defs.h                |    3 --
 gdb/main.c                |   37 -----------------------
 gdb/maint.c               |    8 -----
 gdb/python/python-frame.c |    2 +-
 gdb/python/python.c       |   17 ++++------
 9 files changed, 54 insertions(+), 155 deletions(-)

First 500 lines of diff:
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index fb8b0a6..f3d66f5 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -172,8 +172,7 @@ LIBICONV = @LIBICONV@
 TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
 TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
 
-# Did the user give us a --with-gdb-datadir option?
-GDB_DATADIR_PATH = @GDB_DATADIR_PATH@
+GDB_PYTHONDIR_PATH = @GDB_PYTHONDIR_PATH@
 
 # Helper code from gnulib.
 LIBGNU = gnulib/libgnu.a
@@ -1938,22 +1937,31 @@ PY_FILES = gdb/FrameIterator.py gdb/command/alias.py \
     gdb/command/pahole.py gdb/command/__init__.py \
     gdb/command/ignore_errors.py gdb/command/save_breakpoints.py \
     gdb/libstdcxx/v6/printers.py gdb/libstdcxx/v6/__init__.py \
-    gdb/libstdcxx/__init__.py gdb/function/caller_is.py	\
+    gdb/libstdcxx/__init__.py gdb/function/caller_is.py \
     gdb/function/in_scope.py gdb/function/__init__.py gdb/backtrace.py \
     gdb/__init__.py
 
 # Install the Python library.  Python library files go under
-# $(GDB_DATADIR_PATH)/python.
+# $(GDB_PYTHONDIR_PATH)/python.
 install-python:
 	files='$(PY_FILES)'; for file in $$files; do \
 	  dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
-	  $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR_PATH)/python/$$dir; \
-	  $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(GDB_DATADIR_PATH)/python/$$file; \
+	  $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$dir; \
+	  $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$file; \
 	done
 
-# Brute force.
+# Other packages may have their files installed in $(GDB_PYTHONDIR_PATH).
 uninstall-python:
-	rm -rf $(DESTDIR)/$(GDB_DATADIR_PATH)/python
+	rm -rf $(DESTDIR)/$(GDB_PYTHONDIR_PATH)/python
+	files='$(PY_FILES)'; for file in $$files; do \
+	  dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
+	  rm -f $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$file; \
+	  while test "x$$file" != "x$$dir"; do \
+	    rmdir 2>/dev/null "$(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$dir"; \
+	    file="$$dir"; \
+	    dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
+	  done \
+	done
 
 #
 # Dependency tracking.  Most of this is conditional on GNU Make being
diff --git a/gdb/config.in b/gdb/config.in
index 7c4b0d5..cad7492 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -42,12 +42,6 @@
    language is requested. */
 #undef ENABLE_NLS
 
-/* Global directory for GDB data files. */
-#undef GDB_DATADIR
-
-/* Define if GDB datadir should be relocated when GDB is moved. */
-#undef GDB_DATADIR_RELOCATABLE
-
 /* Define to be a string naming the default host character set. */
 #undef GDB_DEFAULT_HOST_CHARSET
 
@@ -66,6 +60,9 @@
 /* Define to the default OS ABI for this configuration. */
 #undef GDB_OSABI_DEFAULT
 
+/* Base directory for GDB Python modules. */
+#undef GDB_PYTHONDIR_PATH
+
 /* Define to 1 if you have `alloca', as a function or macro. */
 #undef HAVE_ALLOCA
 
diff --git a/gdb/configure b/gdb/configure
index 0cb918a..fdfe573 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -314,7 +314,7 @@ ac_subdirs_all="$ac_subdirs_all doc testsuite"
 ac_subdirs_all="$ac_subdirs_all gdbtk"
 ac_subdirs_all="$ac_subdirs_all multi-ice"
 ac_subdirs_all="$ac_subdirs_all gdbserver"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE GDB_DATADIR_PATH subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBICONV LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT GDB_PYTHONDIR_PATH PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBICONV LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS'
 ac_subst_files='host_makefile_frag'
 ac_pwd=`pwd`
 
@@ -882,8 +882,6 @@ Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-separate-debug-dir=path   Look for global separate debug info in this path LIBDIR/debug
-  --with-gdb-datadir      look for global separate data files in this path
-                          [DATADIR/gdb]
   --with-libunwind            Use libunwind frame unwinding support
   --with-pkgversion=PKG   Use PKG in the version string in place of "GDB"
   --with-bugurl=URL       Direct users to URL to report a bug
@@ -7132,52 +7130,6 @@ _ACEOF
   ;;
 esac
 
-# GDB's datadir relocation
-
-gdbdatadir=${datadir}/gdb
-
-
-# Check whether --with-gdb-datadir or --without-gdb-datadir was given.
-if test "${with_gdb_datadir+set}" = set; then
-  withval="$with_gdb_datadir"
-  gdbdatadir="${withval}"
-fi;
-
-
-  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
-  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-  ac_define_dir=`eval echo $gdbdatadir`
-  ac_define_dir=`eval echo $ac_define_dir`
-
-cat >>confdefs.h <<_ACEOF
-#define GDB_DATADIR "$ac_define_dir"
-_ACEOF
-
-
-
-if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
-  if test "x$prefix" = xNONE; then
-    test_prefix=/usr/local
-  else
-    test_prefix=$prefix
-  fi
-else
-  test_prefix=$exec_prefix
-fi
-
-case ${gdbdatadir} in
-  "${test_prefix}"|"${test_prefix}/"*|\
-  '${exec_prefix}'|'${exec_prefix}/'*)
-
-cat >>confdefs.h <<\_ACEOF
-#define GDB_DATADIR_RELOCATABLE 1
-_ACEOF
-
-  ;;
-esac
-GDB_DATADIR_PATH=${gdbdatadir}
-
-
 
 
 subdirs="$subdirs doc testsuite"
@@ -11204,6 +11156,7 @@ echo $ECHO_N "checking whether to use python... $ECHO_C" >&6
 echo "$as_me:$LINENO: result: $with_python" >&5
 echo "${ECHO_T}$with_python" >&6
 
+GDB_PYTHONDIR_PATH=
 if test "${with_python}" = no; then
   { echo "$as_me:$LINENO: WARNING: python support disabled; some features may be unavailable." >&5
 echo "$as_me: WARNING: python support disabled; some features may be unavailable." >&2;}
@@ -11435,7 +11388,20 @@ _ACEOF
 
     fi
   fi
-  if test ${have_libpython} = no; then
+  if test ${have_libpython} != no; then
+    GDB_PYTHONDIR_PATH="`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib();"`"
+
+  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+  ac_define_dir=`eval echo $GDB_PYTHONDIR_PATH`
+  ac_define_dir=`eval echo $ac_define_dir`
+
+cat >>confdefs.h <<_ACEOF
+#define GDB_PYTHONDIR_PATH "$ac_define_dir"
+_ACEOF
+
+
+  else
     case "${with_python}" in
     yes)
       { { echo "$as_me:$LINENO: error: python is missing or unusable" >&5
@@ -11457,6 +11423,8 @@ echo "$as_me: error: no usable python found at ${with_python}" >&2;}
   fi
 fi
 
+
+PYTHON_CFLAGS=
 if test "${have_libpython}" = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -21915,7 +21883,6 @@ s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
 s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
 s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
 s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
-s,@GDB_DATADIR_PATH@,$GDB_DATADIR_PATH,;t t
 s,@subdirs@,$subdirs,;t t
 s,@TARGET_OBS@,$TARGET_OBS,;t t
 s,@PKGVERSION@,$PKGVERSION,;t t
@@ -21937,6 +21904,7 @@ s,@READLINE_CFLAGS@,$READLINE_CFLAGS,;t t
 s,@HAVE_LIBEXPAT@,$HAVE_LIBEXPAT,;t t
 s,@LIBEXPAT@,$LIBEXPAT,;t t
 s,@LTLIBEXPAT@,$LTLIBEXPAT,;t t
+s,@GDB_PYTHONDIR_PATH@,$GDB_PYTHONDIR_PATH,;t t
 s,@PYTHON_CFLAGS@,$PYTHON_CFLAGS,;t t
 s,@ALLOCA@,$ALLOCA,;t t
 s,@CONFIG_LDFLAGS@,$CONFIG_LDFLAGS,;t t
diff --git a/gdb/configure.ac b/gdb/configure.ac
index c99d3d3..c197fe8 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -118,36 +118,6 @@ case ${debugdir} in
   ;;
 esac
 
-# GDB's datadir relocation
-
-gdbdatadir=${datadir}/gdb
-
-AC_ARG_WITH([gdb-datadir],
-  [AS_HELP_STRING([--with-gdb-datadir],
-                  [look for global separate data files in this path [DATADIR/gdb]])], [gdbdatadir="${withval}"])
-
-AC_DEFINE_DIR(GDB_DATADIR, gdbdatadir,
-              [Global directory for GDB data files. ])
-
-if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
-  if test "x$prefix" = xNONE; then
-    test_prefix=/usr/local
-  else
-    test_prefix=$prefix
-  fi
-else
-  test_prefix=$exec_prefix
-fi
-
-case ${gdbdatadir} in
-  "${test_prefix}"|"${test_prefix}/"*|\
-  '${exec_prefix}'|'${exec_prefix}/'*)
-    AC_DEFINE(GDB_DATADIR_RELOCATABLE, 1, [Define if GDB datadir should be relocated when GDB is moved.])
-  ;;
-esac
-GDB_DATADIR_PATH=${gdbdatadir}
-AC_SUBST(GDB_DATADIR_PATH)
-
 AC_CONFIG_SUBDIRS(doc testsuite)
 
 # Check whether to support alternative target configurations
@@ -615,6 +585,7 @@ AC_ARG_WITH(python,
 AC_MSG_CHECKING([whether to use python])
 AC_MSG_RESULT([$with_python])
 
+GDB_PYTHONDIR_PATH=
 if test "${with_python}" = no; then
   AC_MSG_WARN([python support disabled; some features may be unavailable.])
   have_libpython=no
@@ -657,7 +628,11 @@ else
       AC_DEFINE(HAVE_LIBPYTHON2_4, 1, [Define if Python 2.4 is being used.])
     fi
   fi
-  if test ${have_libpython} = no; then
+  if test ${have_libpython} != no; then
+    GDB_PYTHONDIR_PATH="`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib();"`"
+    AC_DEFINE_DIR(GDB_PYTHONDIR_PATH, GDB_PYTHONDIR_PATH, 
+		  [Base directory for GDB Python modules.])
+  else
     case "${with_python}" in
     yes)
       AC_MSG_ERROR([python is missing or unusable])
@@ -673,7 +648,9 @@ else
     LIBS=$save_LIBS
   fi
 fi
+AC_SUBST(GDB_PYTHONDIR_PATH)
 
+PYTHON_CFLAGS=
 if test "${have_libpython}" = yes; then
   AC_DEFINE(HAVE_PYTHON, 1, [Define if Python interpreter is being linked in.])
   CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
diff --git a/gdb/defs.h b/gdb/defs.h
index 5da17e1..845b320 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -151,9 +151,6 @@ extern int dbx_commands;
 /* System root path, used to find libraries etc.  */
 extern char *gdb_sysroot;
 
-/* GDB datadir, used to store data files.  */
-extern char *gdb_datadir;
-
 /* Search path for separate debug files.  */
 extern char *debug_file_directory;
 
diff --git a/gdb/main.c b/gdb/main.c
index 6f9e61b..4a5eb23 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -64,9 +64,6 @@ int dbx_commands = 0;
 /* System root path, used to find libraries etc.  */
 char *gdb_sysroot = 0;
 
-/* GDB datadir, used to store data files.  */
-char *gdb_datadir = 0;
-
 struct ui_file *gdb_stdout;
 struct ui_file *gdb_stderr;
 struct ui_file *gdb_stdlog;
@@ -364,40 +361,6 @@ captured_main (void *data)
 	}
     }
 
-#ifdef GDB_DATADIR_RELOCATABLE
-  gdb_datadir = make_relative_prefix (argv[0], BINDIR, GDB_DATADIR);
-  if (gdb_datadir)
-    {
-      struct stat s;
-      int res = 0;
-
-      if (stat (gdb_datadir, &s) == 0)
-	if (S_ISDIR (s.st_mode))
-	  res = 1;
-
-      if (res == 0)
-	{
-	  xfree (gdb_datadir);
-	  gdb_datadir = xstrdup (GDB_DATADIR);
-	}
-    }
-  else
-    gdb_datadir = xstrdup (GDB_DATADIR);
-#else
-  gdb_datadir = xstrdup (GDB_DATADIR);
-#endif /* GDB_DATADIR_RELOCATABLE */
-
-  /* Canonicalize the GDB's datadir path.  */
-  if (*gdb_datadir)
-    {
-      char *canon_debug = lrealpath (gdb_datadir);
-      if (canon_debug)
-	{
-	  xfree (gdb_datadir);
-	  gdb_datadir = canon_debug;
-	}
-    }
-
   get_init_files (&system_gdbinit, &home_gdbinit, &local_gdbinit);
 
   /* There will always be an interpreter.  Either the one passed into
diff --git a/gdb/maint.c b/gdb/maint.c
index 1b57ff5..56cafe9 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -906,12 +906,4 @@ When enabled GDB is profiled."),
 			   show_maintenance_profile_p,
 			   &maintenance_set_cmdlist,
 			   &maintenance_show_cmdlist);
-  add_setshow_filename_cmd ("gdb_datadir", class_maintenance,
-                           &gdb_datadir, _("Set GDB's datadir path."),
-                           _("Show GDB's datadir path."),
-                           _("\
-When set, GDB uses the specified path to search for data files."),
-                           NULL, NULL,
-                           &maintenance_set_cmdlist,
-                           &maintenance_show_cmdlist);
 }
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index ef1c178..1f152b8 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -401,7 +401,7 @@ frapy_read_var_value (PyObject *self, PyObject *args)
 {
   struct frame_info *frame;
   PyObject *sym_obj;
-  struct symbol *var;
+  struct symbol *var = NULL;	/* gcc-4.3.2 false warning.  */
   struct value *val = NULL;
   volatile struct gdb_exception except;
 
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 5bae140..32df67c 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1761,8 +1761,6 @@ Enables or disables auto-loading of Python code when an object is opened."),
   PyModule_AddStringConstant (gdb_module, "VERSION", (char*) version);
   PyModule_AddStringConstant (gdb_module, "HOST_CONFIG", (char*) host_name);
   PyModule_AddStringConstant (gdb_module, "TARGET_CONFIG", (char*) target_name);
-  if (gdb_datadir)
-    PyModule_AddStringConstant (gdb_module, "datadir", gdb_datadir);
 
   gdbpy_initialize_values ();
   gdbpy_initialize_breakpoints ();
@@ -1814,14 +1812,13 @@ class GdbOutputFile:\n\
 \n\
 sys.stderr = GdbOutputFile()\n\
 sys.stdout = GdbOutputFile()\n\
-if hasattr (gdb, 'datadir'):\n\
-  gdb.pythonlibdir = gdb.datadir + '/python'\n\
-  sys.path.insert(0, gdb.pythonlibdir)\n\
-  gdb.__path__ = [gdb.pythonlibdir + '/gdb']\n\
-  from os.path import exists\n\
-  ipy = gdb.pythonlibdir + '/gdb/__init__.py'\n\
-  if exists (ipy):\n\
-    execfile (ipy)\n\
+# FIXME: gdb.pythonlibdir is deprecated as it is just the standard libdir.\n\
+gdb.pythonlibdir = '" GDB_PYTHONDIR_PATH "'\n\
+gdb.__path__ = [gdb.pythonlibdir + '/gdb']\n\
+from os.path import exists\n\
+ipy = gdb.pythonlibdir + '/gdb/__init__.py'\n\
+if exists (ipy):\n\
+  execfile (ipy)\n\
 ");
 
   /* Release the GIL while gdb runs.  */


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-02-28 19:26 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-02-28 19:26 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  8cfb53175964b36c34f54147a3ea057c9a7fd728 (commit)
       via  960557011f37ee49ac8109c9090e1f8ac5df41a9 (commit)
       via  73864473aa5f3f47d681c6a1d95e04c2ecff2180 (commit)
       via  745c2e91d30f0ee78c2a9e2779b807f382be51d1 (commit)
       via  8d7cda5302bef3e53337906e3ac3f5dffaa372ca (commit)
       via  2206b86f85f03bf20dbe642703bc02ad58a35e61 (commit)
       via  6dd3e965ad875563547f5d36ae74e3940050c706 (commit)
       via  d19d9fde47e23944526327e3c7942b93c4ac4277 (commit)
      from  ebadcf6e954061122d1c6d0a1e79de5cf23b85b8 (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/doc/gdb.texinfo                     |   16 +++-
 gdb/python/python-cmd.c                 |   12 ++-
 gdb/python/python-frame.c               |  136 +++++++++++++++++++++++++------
 gdb/python/python-internal.h            |    2 +-
 gdb/python/python-symbol.c              |   18 +++--
 gdb/python/python-value.c               |   16 +++--
 gdb/python/python.c                     |   37 +++++---
 gdb/testsuite/gdb.python/find.exp       |   43 +++++++---
 gdb/testsuite/gdb.python/python-cmd.exp |   26 ++++++
 9 files changed, 229 insertions(+), 77 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 4f27cdf..be22f07 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18157,6 +18157,14 @@ auto-loading is disabled.
 @cindex python api
 @cindex programming in python
 
+You can get quick online help for @value{GDBN}'s Python API by issuing
+the command @w{@kbd{python help (gdb)}}.
+
+Functions and methods which have two or more optional arguments allow
+them to be specified using keyword syntax.  This allows passing some
+optional arguments while skipping others.  Example:
+@w{@code{gdb.some_function ('foo', bar = 1, baz = 2)}}.
+
 @cindex python stdout
 @cindex python pagination
 At startup, @value{GDBN} overrides Python's @code{sys.stdout} and
@@ -18476,7 +18484,7 @@ The result @code{bar} will be a @code{gdb.Value} object holding the
 value pointed to by @code{foo}.
 @end defmethod
 
-@defmethod Value string @r{[}encoding @r{[}errors@r{]}@r{]}
+@defmethod Value string @r{[}encoding@r{]} @r{[}errors@r{]}
 If this @code{gdb.Value} represents a string, then this method
 converts the contents to a Python string.  Otherwise, this method will
 throw an exception.
@@ -18976,7 +18984,7 @@ You can implement new @value{GDBN} CLI commands in Python.  A CLI
 command is implemented using an instance of the @code{gdb.Command}
 class, most commonly using a subclass.
 
-@defmethod Command __init__ name @var{command-class} @r{[}@var{completer-class} @var{prefix}@r{]}
+@defmethod Command __init__ name @var{command_class} @r{[}@var{completer_class}@r{]} @r{[}@var{prefix}@r{]}
 The object initializer for @code{Command} registers the new command
 with @value{GDBN}.  This initializer is normally invoked from the
 subclass' own @code{__init__} method.
@@ -18988,11 +18996,11 @@ an exception is raised.
 
 There is no support for multi-line commands.
 
-@var{command-class} should be one of the @samp{COMMAND_} constants
+@var{command_class} should be one of the @samp{COMMAND_} constants
 defined below.  This argument tells @value{GDBN} how to categorize the
 new command in the help system.
 
-@var{completer-class} is an optional argument.  If given, it should be
+@var{completer_class} is an optional argument.  If given, it should be
 one of the @samp{COMPLETE_} constants defined below.  This argument
 tells @value{GDBN} how to perform completion for this command.  If not
 given, @value{GDBN} will attempt to complete using the object's
diff --git a/gdb/python/python-cmd.c b/gdb/python/python-cmd.c
index 90cc780..e6e3ac0 100644
--- a/gdb/python/python-cmd.c
+++ b/gdb/python/python-cmd.c
@@ -337,16 +337,16 @@ gdbpy_parse_command_name (char *text, struct cmd_list_element ***base_list,
 
 /* Object initializer; sets up gdb-side structures for command.
 
-   Use: __init__(NAME, CMDCLASS, [COMPLETERCLASS, [PREFIX]]).
+   Use: __init__(NAME, COMMAND_CLASS, [COMPLETER_CLASS, [PREFIX]]).
 
    NAME is the name of the command.  It may consist of multiple words,
    in which case the final word is the name of the new command, and
    earlier words must be prefix commands.
 
-   CMDCLASS is the kind of command.  It should be one of the COMMAND_*
+   COMMAND_CLASS is the kind of command.  It should be one of the COMMAND_*
    constants defined in the gdb module.
 
-   COMPLETERCLASS is the kind of completer.  If not given, the
+   COMPLETER_CLASS is the kind of completer.  If not given, the
    "complete" method will be used.  Otherwise, it should be one of the
    COMPLETE_* constants defined in the gdb module.
 
@@ -357,7 +357,7 @@ gdbpy_parse_command_name (char *text, struct cmd_list_element ***base_list,
    
 */
 static int
-cmdpy_init (PyObject *self, PyObject *args, PyObject *kwds)
+cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
 {
   cmdpy_object *obj = (cmdpy_object *) self;
   char *name;
@@ -367,6 +367,8 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kwds)
   volatile struct gdb_exception except;
   struct cmd_list_element **cmd_list;
   char *cmd_name, *pfx_name;
+  static char *keywords[] = { "name", "command_class", "completer_class",
+			      "prefix", NULL };
   PyObject *is_prefix = NULL;
   int cmp;
 
@@ -379,7 +381,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kwds)
       return -1;
     }
 
-  if (! PyArg_ParseTuple (args, "si|iO", &name, &cmdtype,
+  if (! PyArg_ParseTupleAndKeywords (args, kw, "si|iO", keywords, &name, &cmdtype,
 			  &completetype, &is_prefix))
     return -1;
 
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index c2224cf..ef1c178 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -1,6 +1,6 @@
 /* Python interface to stack frames
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -54,6 +54,9 @@ typedef struct {
 
 static PyTypeObject frame_object_type;
 
+/* Returns the frame_info object corresponding to the given Python Frame
+   object.  If the frame doesn't exist anymore (the frame id doesn't
+   correspond to any frame in the inferior), returns NULL.  */
 
 static struct frame_info *
 frame_object_to_frame_info (frame_object *frame_obj)
@@ -70,6 +73,9 @@ frame_object_to_frame_info (frame_object *frame_obj)
   return frame;
 }
 
+/* Called by the Python interpreter to obtain string representation
+   of the object.  */
+
 static PyObject *
 frapy_str (PyObject *self)
 {
@@ -87,6 +93,10 @@ frapy_str (PyObject *self)
   return result;
 }
 
+/* Implementation of gdb.Frame.is_valid (self) -> Boolean.
+   Returns True if the frame corresponding to the frame_id of this
+   object still exists in the inferior.  */
+
 static PyObject *
 frapy_is_valid (PyObject *self, PyObject *args)
 {
@@ -99,6 +109,8 @@ frapy_is_valid (PyObject *self, PyObject *args)
   Py_RETURN_TRUE;
 }
 
+/* Implementation of gdb.Frame.equals (self, other) -> Boolean. */
+
 static PyObject *
 frapy_equal_p (PyObject *self, PyObject *args)
 {
@@ -122,6 +134,9 @@ frapy_equal_p (PyObject *self, PyObject *args)
   Py_RETURN_FALSE;
 }
 
+/* Implementation of gdb.Frame.name (self) -> String.
+   Returns the name of the function corresponding to this frame.  */
+
 static PyObject *
 frapy_name (PyObject *self, PyObject *args)
 {
@@ -150,6 +165,9 @@ frapy_name (PyObject *self, PyObject *args)
   return result;
 }
 
+/* Implementation of gdb.Frame.type (self) -> Integer.
+   Returns the frame type, namely one of the gdb.*_FRAME constants.  */
+
 static PyObject *
 frapy_type (PyObject *self, PyObject *args)
 {
@@ -168,6 +186,9 @@ frapy_type (PyObject *self, PyObject *args)
   return PyInt_FromLong (type);
 }
 
+/* Implementation of gdb.Frame.unwind_stop_reason (self) -> Integer.
+   Returns one of the gdb.FRAME_UNWIND_* constants.  */
+
 static PyObject *
 frapy_unwind_stop_reason (PyObject *self, PyObject *args)
 {
@@ -186,6 +207,9 @@ frapy_unwind_stop_reason (PyObject *self, PyObject *args)
   return PyInt_FromLong (stop_reason);
 }
 
+/* Implementation of gdb.Frame.pc (self) -> Long.
+   Returns the frame's resume address.  */
+
 static PyObject *
 frapy_pc (PyObject *self, PyObject *args)
 {
@@ -204,6 +228,9 @@ frapy_pc (PyObject *self, PyObject *args)
   return PyLong_FromUnsignedLongLong (pc);
 }
 
+/* Implementation of gdb.Frame.block (self) -> gdb.Block.
+   Returns the frame's code block.  */
+
 static PyObject *
 frapy_block (PyObject *self, PyObject *args)
 {
@@ -225,6 +252,10 @@ frapy_block (PyObject *self, PyObject *args)
   Py_RETURN_NONE;
 }
 
+
+/* Implementation of gdb.Frame.addr_in_block (self) -> Long.
+   Returns an address which falls within the frame's code block.  */
+
 static PyObject *
 frapy_addr_in_block (PyObject *self, PyObject *args)
 {
@@ -243,6 +274,9 @@ frapy_addr_in_block (PyObject *self, PyObject *args)
   return PyLong_FromUnsignedLongLong (pc);
 }
 
+/* Convert a frame_info struct to a Python Frame object.
+   Sets a Python exception and returns NULL on error.  */
+
 static frame_object *
 frame_info_to_frame_object (struct frame_info *frame)
 {
@@ -276,6 +310,10 @@ frame_info_to_frame_object (struct frame_info *frame)
   return frame_obj;
 }
 
+/* Implementation of gdb.Frame.older (self) -> gdb.Frame.
+   Returns the frame immediately older (outer) to this frame, or None if
+   there isn't one.  */
+
 static PyObject *
 frapy_older (PyObject *self, PyObject *args)
 {
@@ -301,6 +339,10 @@ frapy_older (PyObject *self, PyObject *args)
   return prev_obj;
 }
 
+/* Implementation of gdb.Frame.newer (self) -> gdb.Frame.
+   Returns the frame immediately newer (inner) to this frame, or None if
+   there isn't one.  */
+
 static PyObject *
 frapy_newer (PyObject *self, PyObject *args)
 {
@@ -326,6 +368,9 @@ frapy_newer (PyObject *self, PyObject *args)
   return next_obj;
 }
 
+/* Implementation of gdb.Frame.find_sal (self) -> gdb.Symtab_and_line.
+   Returns the frame's symtab and line.  */
+
 static PyObject *
 frapy_find_sal (PyObject *self, PyObject *args)
 {
@@ -346,6 +391,11 @@ frapy_find_sal (PyObject *self, PyObject *args)
   return sal_obj;
 }
 
+/* Implementation of gdb.Frame.read_var_value (self, variable) -> gdb.Value.
+   Returns the value of the given variable in this frame.  The argument can be
+   either a gdb.Symbol or a string.  Returns None if GDB can't find the
+   specified variable.  */
+
 static PyObject *
 frapy_read_var_value (PyObject *self, PyObject *args)
 {
@@ -355,13 +405,33 @@ frapy_read_var_value (PyObject *self, PyObject *args)
   struct value *val = NULL;
   volatile struct gdb_exception except;
 
-  if (!PyArg_ParseTuple (args, "O!", &symbol_object_type, &sym_obj))
+  if (!PyArg_ParseTuple (args, "O", &sym_obj))
     return NULL;
 
-  var = symbol_object_to_symbol (sym_obj);
-  if (! var)
+  if (PyObject_TypeCheck (sym_obj, &symbol_object_type))
+    var = symbol_object_to_symbol (sym_obj);
+  else if (gdbpy_is_string (sym_obj))
     {
-      PyErr_SetString (PyExc_RuntimeError, "second argument must be symbol");
+      char *var_name;
+      struct block *block;
+      volatile struct gdb_exception except;
+
+      TRY_CATCH (except, RETURN_MASK_ALL)
+	{
+	  struct block *block;
+
+	  FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
+
+	  block = block_for_pc (get_frame_address_in_block (frame));
+	  var = lookup_symbol (python_string_to_target_string (sym_obj), block,
+			       VAR_DOMAIN, NULL);
+	}
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  else
+    {
+      PyErr_SetString (PyExc_TypeError,
+		       _("argument must be a symbol or string"));
       return NULL;
     }
 
@@ -379,6 +449,9 @@ frapy_read_var_value (PyObject *self, PyObject *args)
   Py_RETURN_NONE;
 }
 
+/* Implementation of gdb.frames () -> (gdb.Frame, ...).
+   Returns a tuple of all frame objects.  */
+
 PyObject *
 gdbpy_frames (PyObject *self, PyObject *args)
 {
@@ -429,6 +502,9 @@ gdbpy_frames (PyObject *self, PyObject *args)
   return tuple;
 }
 
+/* Implementation of gdb.newest_frame () -> gdb.Frame.
+   Returns the newest frame object.  */
+
 PyObject *
 gdbpy_newest_frame (PyObject *self, PyObject *args)
 {
@@ -446,6 +522,9 @@ gdbpy_newest_frame (PyObject *self, PyObject *args)
   return (PyObject *) frame_obj;
 }
 
+/* Implementation of gdb.selected_frame () -> gdb.Frame.
+   Returns the selected frame object.  */
+
 PyObject *
 gdbpy_selected_frame (PyObject *self, PyObject *args)
 {
@@ -463,6 +542,9 @@ gdbpy_selected_frame (PyObject *self, PyObject *args)
   return (PyObject *) frame_obj;
 }
 
+/* Implementation of gdb.stop_reason_string (Integer) -> String.
+   Return a string explaining the unwind stop reason.  */
+
 PyObject *
 gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args)
 {
@@ -482,6 +564,8 @@ gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args)
   return PyUnicode_Decode (str, strlen (str), host_charset (), NULL);
 }
 
+/* Sets up the Frame API in the gdb module.  */
+
 void
 gdbpy_initialize_frames (void)
 {
@@ -523,7 +607,7 @@ static PyMethodDef frame_object_methods[] = {
     "Return the function name of the frame." },
   { "type", frapy_type, METH_NOARGS, "Return the type of the frame." },
   { "unwind_stop_reason", frapy_unwind_stop_reason, METH_NOARGS,
-    "Return the function name of the frame." },
+    "Return the reason why it's not possible to find frames older than this." },
   { "pc", frapy_pc, METH_NOARGS, "Return the frame's resume address." },
   { "block", frapy_block, METH_NOARGS, "Return the frame's code block." },
   { "addr_in_block", frapy_addr_in_block, METH_NOARGS,
@@ -541,26 +625,26 @@ static PyMethodDef frame_object_methods[] = {
 
 static PyTypeObject frame_object_type = {
   PyObject_HEAD_INIT (NULL)
-  0,				  /*ob_size*/
-  "gdb.Frame",			  /*tp_name*/
-  sizeof (frame_object),	  /*tp_basicsize*/
-  0,				  /*tp_itemsize*/
-  0,				  /*tp_dealloc*/
-  0,				  /*tp_print*/
-  0,				  /*tp_getattr*/
-  0,				  /*tp_setattr*/
-  0,				  /*tp_compare*/
-  0,				  /*tp_repr*/
-  0,				  /*tp_as_number*/
-  0,				  /*tp_as_sequence*/
-  0,				  /*tp_as_mapping*/
-  0,				  /*tp_hash */
-  0,				  /*tp_call*/
-  frapy_str,			  /*tp_str*/
-  0,				  /*tp_getattro*/
-  0,				  /*tp_setattro*/
-  0,				  /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT,		  /*tp_flags*/
+  0,				  /* ob_size */
+  "gdb.Frame",			  /* tp_name */
+  sizeof (frame_object),	  /* tp_basicsize */
+  0,				  /* tp_itemsize */
+  0,				  /* tp_dealloc */
+  0,				  /* tp_print */
+  0,				  /* tp_getattr */
+  0,				  /* tp_setattr */
+  0,				  /* tp_compare */
+  0,				  /* tp_repr */
+  0,				  /* tp_as_number */
+  0,				  /* tp_as_sequence */
+  0,				  /* tp_as_mapping */
+  0,				  /* tp_hash  */
+  0,				  /* tp_call */
+  frapy_str,			  /* tp_str */
+  0,				  /* tp_getattro */
+  0,				  /* tp_setattro */
+  0,				  /* tp_as_buffer */
+  Py_TPFLAGS_DEFAULT,		  /* tp_flags */
   "GDB frame object",		  /* tp_doc */
   0,				  /* tp_traverse */
   0,				  /* tp_clear */
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 12422af..4aae0aa 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -78,7 +78,7 @@ PyObject *gdbpy_breakpoints (PyObject *, PyObject *);
 PyObject *gdbpy_frames (PyObject *, PyObject *);
 PyObject *gdbpy_newest_frame (PyObject *, PyObject *);
 PyObject *gdbpy_frame_stop_reason_string (PyObject *, PyObject *);
-PyObject *gdbpy_lookup_symbol (PyObject *self, PyObject *args);
+PyObject *gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw);
 PyObject *gdbpy_selected_frame (PyObject *self, PyObject *args);
 PyObject *gdbpy_block_for_pc (PyObject *self, PyObject *args);
 PyObject *gdbpy_read_memory (PyObject *self, PyObject *args);
diff --git a/gdb/python/python-symbol.c b/gdb/python/python-symbol.c
index 223e6d3..c7fda5c 100644
--- a/gdb/python/python-symbol.c
+++ b/gdb/python/python-symbol.c
@@ -166,21 +166,23 @@ symbol_object_to_symbol (PyObject *obj)
   return ((symbol_object *) obj)->symbol;
 }
 
-/* This function has less arguments than its C counterpart, to simplify the
-   Python interface: name, block and domain. The other two arguments are always
-   assumed to be set, and a tuple with 2 elements is always returned. The first
-   is the symbol object or None, the second is a boolean with the value of
-   is_a_field_of_this.  */
-PyObject *gdbpy_lookup_symbol (PyObject *self, PyObject *args)
+/* Implementation of
+   gdb.lookup_symbol (name [, block] [, domain]) -> (symbol, is_field_of_this)
+   A tuple with 2 elements is always returned.  The first is the symbol
+   object or None, the second is a boolean with the value of
+   is_a_field_of_this (see comment in lookup_symbol_in_language).  */
+
+PyObject *gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
 {
   int domain = VAR_DOMAIN, is_a_field_of_this = 0;
   const char *name;
+  static char *keywords[] = { "name", "block", "domain", NULL };
   struct symbol *symbol;
   PyObject *block_obj = NULL, *ret_tuple, *sym_obj, *bool_obj;
   struct block *block = NULL;
 
-  if (! PyArg_ParseTuple (args, "s|O!i", &name, &block_object_type, &block_obj,
-			  &domain))
+  if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O!i", keywords, &name,
+				     &block_object_type, &block_obj, &domain))
     return NULL;
 
   if (block_obj)
diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c
index ca29f46..de54b9d 100644
--- a/gdb/python/python-value.c
+++ b/gdb/python/python-value.c
@@ -155,10 +155,11 @@ valpy_type (PyObject *self, PyObject *args)
   return type_to_type_object (value_type (value));
 }
 
-/* Return Unicode string with value contents (assumed to be encoded in the
-   target's charset).  */
+/* Implementation of gdb.Value.string ([encoding] [, errors]) -> string
+   Return Unicode string with value contents.  If ENCODING is not given,
+   the string is assumed to be encoded in the target's charset.  */
 static PyObject *
-valpy_string (PyObject *self, PyObject *args)
+valpy_string (PyObject *self, PyObject *args, PyObject *kw)
 {
   int length, ret = 0;
   gdb_byte *buffer;
@@ -169,8 +170,10 @@ valpy_string (PyObject *self, PyObject *args)
   const char *errors = NULL;
   const char *user_encoding = NULL;
   const char *la_encoding = NULL;
+  static char *keywords[] = { "encoding", "errors" };
 
-  if (!PyArg_ParseTuple (args, "|ss", &user_encoding, &errors))
+  if (!PyArg_ParseTupleAndKeywords (args, kw, "|ss", keywords,
+				    &user_encoding, &errors))
     return NULL;
 
   TRY_CATCH (except, RETURN_MASK_ALL)
@@ -915,8 +918,9 @@ static PyMethodDef value_object_methods[] = {
   { "cast", valpy_cast, METH_VARARGS, "Cast the value to the supplied type." },
   { "dereference", valpy_dereference, METH_NOARGS, "Dereferences the value." },
   { "type", valpy_type, METH_NOARGS, "Return type of the value." },
-  { "string", valpy_string, METH_VARARGS,
-    "Return Unicode string representation of the value." },
+  { "string", (PyCFunction) valpy_string, METH_VARARGS | METH_KEYWORDS,
+    "string ([encoding] [, errors]) -> string\n\


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


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

* [SCM]  archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python
@ 2009-02-26 23:01 jkratoch
  0 siblings, 0 replies; 20+ messages in thread
From: jkratoch @ 2009-02-26 23:01 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-python has been updated
       via  8919c803a68e50c045db5b8f5f88d33c40449139 (commit)
       via  cf7156e5eb72d57a6b886dfe862705fc210f6f67 (commit)
       via  b5235efef9aa1d619d8a5defc5aa1219dff76d3d (commit)
       via  9f534e722211caffa7caef5cd11c5da2ac24f6c4 (commit)
       via  6b43f0eaec652104bcbf802d7a86869d956ce4e4 (commit)
       via  f17c887e8b4aa77c8a49885a0f8bf2dab0dba228 (commit)
      from  807b1035c00186e947eab716ffd5d8993b9ca8a8 (commit)

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

- Log -----------------------------------------------------------------
commit 8919c803a68e50c045db5b8f5f88d33c40449139
Merge: 807b1035c00186e947eab716ffd5d8993b9ca8a8 cf7156e5eb72d57a6b886dfe862705fc210f6f67
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Feb 27 00:01:17 2009 +0100

    Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python

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

Summary of changes:
 gdb/doc/gdb.texinfo                            |   69 +++++---
 gdb/python/lib/gdb/libstdcxx/v6/printers.py    |  114 ++++++++----
 gdb/python/python-internal.h                   |    6 +-
 gdb/python/python-membuf.c                     |    2 +-
 gdb/python/python-objfile.c                    |   12 +-
 gdb/python/python-type.c                       |   13 ++-
 gdb/python/python-utils.c                      |   16 ++-
 gdb/python/python.c                            |  234 +++++++++++-------------
 gdb/testsuite/gdb.python/python-prettyprint.py |   76 ++++++--
 gdb/varobj.c                                   |  108 ++++++-----
 10 files changed, 379 insertions(+), 271 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 35461a9..4f27cdf 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18593,6 +18593,11 @@ target's @code{char} type will be an 8-bit byte.  However, on some
 unusual platforms, this type may have a different size.
 @end defmethod
 
+@defmethod Type strip_typedefs
+Return a new @code{gdb.Type} that represents the real type,
+after removing all layers of typedefs.
+@end defmethod
+
 @defmethod Type tag
 Return the tag name for this type.  The tag name is the name after
 @code{struct}, @code{union}, or @code{enum} in C; not all languages
@@ -18853,30 +18858,27 @@ convertible to @code{gdb.Value}, an exception is raised.
 
 @subsubsection Selecting Pretty-Printers
 
-The Python dictionary @code{gdb.pretty_printers} maps regular
-expressions (strings) onto constructors.  Each @code{gdb.Objfile} also
-contains a @code{pretty_printers} attribute.  A constructor, in this
-context, is a function which takes a single @code{gdb.Value} argument
-and returns a a pretty-printer conforming to the interface definition
-above.
+The Python list @code{gdb.pretty_printers} contains an array of
+functions that have been registered via addition as a pretty-printer.
+Each function will be called with a @code{gdb.Value} to be
+pretty-printed.  Each @code{gdb.Objfile} also contains a
+@code{pretty_printers} attribute.  A function on one of these lists
+takes a single @code{gdb.Value} argument and returns a pretty-printer
+object conforming to the interface definition above.  If this function
+cannot create a pretty-printer for the value, it should return
+@code{None}.
 
-When printing a value, @value{GDBN} first computes the value's
-canonical type by following typedefs, following a reference type to
-its referenced type, and removing qualifiers, such as @code{const} or
-@code{volatile}.
-
-Then, @value{GDBN} tests each regular expression against this type name.
 @value{GDBN} first checks the @code{pretty_printers} attribute of each
-@code{gdb.Objfile}; after these have been exhausted it tries the
-global @code{gdb.pretty_printers}.
-
-If a regular expression matches, then the corresponding pretty-printer
-is invoked with a @code{gdb.Value} representing the value to be
-printed.
+@code{gdb.Objfile} and iteratively calls each function in the list for
+that @code{gdb.Objfile} until it receives a pretty-printer object.
+After these @code{gdb.Objfile} have been exhausted, it tries the
+global @code{gdb.pretty-printers} list, again calling each function
+until an object is returned.
 
 The order in which the objfiles are searched is not specified.
-Similarly, the order in which the regular expressions in a given
-dictionary are tried is not specified.
+Functions are always invoked from the head of the
+@code{gdb.pretty-printers} list, and iterated over sequentially until
+the end of the list, or a printer object is returned.
 
 Here is an example showing how a @code{std::string} printer might be
 written:
@@ -18885,13 +18887,34 @@ written:
 class StdStringPrinter:
     "Print a std::string"
 
-    def __init__(self, val):
+    def __init__ (self, val):
         self.val = val
 
-    def to_string(self):
+    def to_string (self):
         return self.val['_M_dataplus']['_M_p']
 @end smallexample
 
+And here is an example showing how a lookup function for
+the printer example above might be written. 
+
+@smallexample
+def str_lookup_function (val):
+
+    lookup_tag = val.type ().tag ()
+    regex = re.compile ("^std::basic_string<char,.*>$")
+    if lookup_tag == None:
+        return None
+    if regex.match (lookup_tag):
+        return StdStringPrinter (val)
+    
+    return None
+@end smallexample
+
+The example lookup function extracts the value's type, and attempts to
+match it to a type that it can pretty-print.  If it is a type the
+printer can pretty-print, it will return a printer object.  If not, it
+returns: @code{None}.
+
 We recommend that you put your core pretty-printers into a versioned
 python package, and then restrict your auto-loaded code to idempotent
 behavior -- for example, just @code{import}s of your printer modules,
@@ -18904,7 +18927,7 @@ For example, in addition to the above, this code might appear in
 
 @smallexample
 def register_printers (objfile):
-    objfile.pretty_printers['^std::basic_string<char.*>$'] = StdStringPrinter
+    objfile.pretty_printers.add (str_lookup_function)
 @end smallexample
 
 And then the corresponding contents of the auto-load file would be:
diff --git a/gdb/python/lib/gdb/libstdcxx/v6/printers.py b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
index 508a22d..7a77ad4 100644
--- a/gdb/python/lib/gdb/libstdcxx/v6/printers.py
+++ b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
@@ -1,6 +1,6 @@
 # Pretty-printers for libstc++.
 
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
@@ -17,6 +17,7 @@
 
 import gdb
 import itertools
+import re
 
 class StdPointerPrinter:
     "Print a smart pointer of some kind"
@@ -337,7 +338,16 @@ class StdBitsetPrinter:
     def children (self):
         words = self.val['_M_w']
         wtype = words.type()
-        tsize = wtype.target().sizeof()
+
+        # The _M_w member can be either an unsigned long, or an
+        # array.  This depends on the template specialization used.
+        # If it is a single long, convert to a single element list.
+        if wtype.code () == gdb.TYPE_CODE_ARRAY:
+            tsize = wtype.target ().sizeof ()
+        else:
+            words = [words]
+            tsize = wtype.sizeof () 
+
         nwords = wtype.sizeof() / tsize
         result = []
         byte = 0
@@ -548,56 +558,90 @@ class Tr1UnorderedMapPrinter:
     def display_hint (self):
         return 'map'
 
-def register_libstdcxx_printers(obj):
+def register_libstdcxx_printers (obj):
     "Register libstdc++ pretty-printers with objfile Obj."
 
     if obj == None:
         obj = gdb
 
+    obj.pretty_printers.append (lookup_function)
+
+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.search (typename):
+            return pretty_printers_dict[function] (val)
+        
+    # Cannot find a pretty printer.  Return None.
+    return None
+
+def build_libstdcxx_dictionary ():
     # libstdc++ objects requiring pretty-printing.
     # In order from:
     # http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01847.html
-    obj.pretty_printers['^std::basic_string<char,.*>$'] = lambda val: StdStringPrinter(None, val)
-    obj.pretty_printers['^std::basic_string<wchar_t,.*>$'] = lambda val: StdStringPrinter(target_wide_charset, val)
-    obj.pretty_printers['^std::basic_string<char16_t,.*>$'] = lambda val: StdStringPrinter('UTF-16', val)
-    obj.pretty_printers['^std::basic_string<char32_t,.*>$'] = lambda val: StdStringPrinter('UTF-32', val)
-    obj.pretty_printers['^std::bitset<.*>$'] = StdBitsetPrinter
-    obj.pretty_printers['^std::deque<.*>$'] = StdDequePrinter
-    obj.pretty_printers['^std::list<.*>$'] = StdListPrinter
-    obj.pretty_printers['^std::map<.*>$'] = lambda val: StdMapPrinter("std::map", val)
-    obj.pretty_printers['^std::multimap<.*>$'] = lambda val: StdMapPrinter("std::multimap", val)
-    obj.pretty_printers['^std::multiset<.*>$'] = lambda val: StdSetPrinter("std::multiset", val)
-    obj.pretty_printers['^std::priority_queue<.*>$'] = lambda val: StdStackOrQueuePrinter("std::priority_queue", val)
-    obj.pretty_printers['^std::queue<.*>$'] = lambda val: StdStackOrQueuePrinter("std::queue", val)
-    obj.pretty_printers['^std::set<.*>$'] = lambda val: StdSetPrinter("std::set", val)
-    obj.pretty_printers['^std::stack<.*>$'] = lambda val: StdStackOrQueuePrinter("std::stack", val)
-    obj.pretty_printers['^std::vector<.*>$'] = StdVectorPrinter
+    pretty_printers_dict[re.compile('^std::basic_string<char,.*>$')] = lambda val: StdStringPrinter(None, val)
+    pretty_printers_dict[re.compile('^std::basic_string<wchar_t,.*>$')] = lambda val: StdStringPrinter(target_wide_charset, val)
+    pretty_printers_dict[re.compile('^std::basic_string<char16_t,.*>$')] = lambda val: StdStringPrinter('UTF-16', val)
+    pretty_printers_dict[re.compile('^std::basic_string<char32_t,.*>$')] = lambda val: StdStringPrinter('UTF-32', val)
+    pretty_printers_dict[re.compile('^std::bitset<.*>$')] = StdBitsetPrinter
+    pretty_printers_dict[re.compile('^std::deque<.*>$')] = StdDequePrinter
+    pretty_printers_dict[re.compile('^std::list<.*>$')] = StdListPrinter
+    pretty_printers_dict[re.compile('^std::map<.*>$')] = lambda val: StdMapPrinter("std::map", val)
+    pretty_printers_dict[re.compile('^std::multimap<.*>$')] = lambda val: StdMapPrinter("std::multimap", val)
+    pretty_printers_dict[re.compile('^std::multiset<.*>$')] = lambda val: StdSetPrinter("std::multiset", val)
+    pretty_printers_dict[re.compile('^std::priority_queue<.*>$')] = lambda val: StdStackOrQueuePrinter("std::priority_queue", val)
+    pretty_printers_dict[re.compile('^std::queue<.*>$')] = lambda val: StdStackOrQueuePrinter("std::queue", val)
+    pretty_printers_dict[re.compile('^std::set<.*>$')] = lambda val: StdSetPrinter("std::set", val)
+    pretty_printers_dict[re.compile('^std::stack<.*>$')] = lambda val: StdStackOrQueuePrinter("std::stack", val)
+    pretty_printers_dict[re.compile('^std::vector<.*>$')] = StdVectorPrinter
     # vector<bool>
 
     # C++0x stuff.
     # array - the default seems reasonable
     # smart_ptr?  seems to only be in boost right now
-    obj.pretty_printers['^std::tr1::shared_ptr<.*>$'] = lambda val: StdPointerPrinter ('std::shared_ptr', val)
-    obj.pretty_printers['^std::tr1::weak_ptr<.*>$'] = lambda val: StdPointerPrinter ('std::weak_ptr', val)
-    obj.pretty_printers['^std::tr1::unique_ptr<.*>$'] = UniquePointerPrinter
-    obj.pretty_printers['^std::tr1::unordered_map<.*>$'] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_map', val)
-    obj.pretty_printers['^std::tr1::unordered_set<.*>$'] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_set', val)
-    obj.pretty_printers['^std::tr1::unordered_multimap<.*>$'] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_multimap', val)
-    obj.pretty_printers['^std::tr1::unordered_multiset<.*>$'] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_multiset', val)
+    pretty_printers_dict[re.compile('^std::tr1::shared_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::shared_ptr', val)
+    pretty_printers_dict[re.compile('^std::tr1::weak_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::weak_ptr', val)
+    pretty_printers_dict[re.compile('^std::tr1::unique_ptr<.*>$')] = UniquePointerPrinter
+    pretty_printers_dict[re.compile('^std::tr1::unordered_map<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_map', val)
+    pretty_printers_dict[re.compile('^std::tr1::unordered_set<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_set', val)
+    pretty_printers_dict[re.compile('^std::tr1::unordered_multimap<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_multimap', val)
+    pretty_printers_dict[re.compile('^std::tr1::unordered_multiset<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_multiset', val)
 
     # Extensions.
-    obj.pretty_printers['^__gnu_cxx::slist<.*>$'] = StdSlistPrinter
+    pretty_printers_dict[re.compile('^__gnu_cxx::slist<.*>$')] = StdSlistPrinter
 
     if True:
         # These shouldn't be necessary, if GDB "print *i" worked.
         # But it often doesn't, so here they are.
-        obj.pretty_printers['^std::_List_iterator<.*>$'] = lambda val: StdListIteratorPrinter(val)
-        obj.pretty_printers['^std::_List_const_iterator<.*>$'] = lambda val: StdListIteratorPrinter(val)
-        obj.pretty_printers['^std::_Rb_tree_iterator<.*>$'] = lambda val: StdRbtreeIteratorPrinter(val)
-        obj.pretty_printers['^std::_Rb_tree_const_iterator<.*>$'] = lambda val: StdRbtreeIteratorPrinter(val)
-        obj.pretty_printers['^std::_Deque_iterator<.*>$'] = lambda val: StdDequeIteratorPrinter(val)
-        obj.pretty_printers['^std::_Deque_const_iterator<.*>$'] = lambda val: StdDequeIteratorPrinter(val)
-        obj.pretty_printers['^__gnu_cxx::__normal_iterator<.*>$'] = lambda val: StdVectorIteratorPrinter(val)
-        obj.pretty_printers['^__gnu_cxx::_Slist_iterator<.*>$'] = lambda val: StdSlistIteratorPrinter(val)
-
+        pretty_printers_dict[re.compile('^std::_List_iterator<.*>$')] = lambda val: StdListIteratorPrinter(val)
+        pretty_printers_dict[re.compile('^std::_List_const_iterator<.*>$')] = lambda val: StdListIteratorPrinter(val)
+        pretty_printers_dict[re.compile('^std::_Rb_tree_iterator<.*>$')] = lambda val: StdRbtreeIteratorPrinter(val)
+        pretty_printers_dict[re.compile('^std::_Rb_tree_const_iterator<.*>$')] = lambda val: StdRbtreeIteratorPrinter(val)
+        pretty_printers_dict[re.compile('^std::_Deque_iterator<.*>$')] = lambda val: StdDequeIteratorPrinter(val)
+        pretty_printers_dict[re.compile('^std::_Deque_const_iterator<.*>$')] = lambda val: StdDequeIteratorPrinter(val)
+        pretty_printers_dict[re.compile('^__gnu_cxx::__normal_iterator<.*>$')] = lambda val: StdVectorIteratorPrinter(val)
+        pretty_printers_dict[re.compile('^__gnu_cxx::_Slist_iterator<.*>$')] = lambda val: StdSlistIteratorPrinter(val)
+
+pretty_printers_dict = {}
+
+build_libstdcxx_dictionary ()
 register_libstdcxx_printers (gdb.current_objfile())
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 0608330..12422af 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -161,10 +161,10 @@ int gdbpy_is_value_object (PyObject *obj);
 
 /* Note that these are declared here, and not in python.h with the
    other pretty-printer functions, because they refer to PyObject.  */
-char *apply_varobj_pretty_printer (PyObject *print_obj, struct value *value,
+char *apply_varobj_pretty_printer (PyObject *print_obj,
 				   struct value **replacement);
-PyObject *gdbpy_get_varobj_pretty_printer (struct type *type);
-PyObject *gdbpy_instantiate_printer (PyObject *cons, struct value *value);
+PyObject *gdbpy_get_varobj_pretty_printer (struct value *value);
+PyObject *gdbpy_instantiate_printer (PyObject *cons, PyObject *value);
 char *gdbpy_get_display_hint (PyObject *printer);
 
 extern PyObject *gdbpy_children_cst;
diff --git a/gdb/python/python-membuf.c b/gdb/python/python-membuf.c
index d8a8183..04bf3b4 100644
--- a/gdb/python/python-membuf.c
+++ b/gdb/python/python-membuf.c
@@ -165,7 +165,7 @@ get_seg_count (PyObject *self, Py_ssize_t *lenp)
 Py_ssize_t
 get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr)
 {
-  void *ptr;
+  void *ptr = NULL;
   Py_ssize_t ret;
 
   ret = get_read_buffer (self, segment, &ptr);
diff --git a/gdb/python/python-objfile.c b/gdb/python/python-objfile.c
index a225409..e97d3a2 100644
--- a/gdb/python/python-objfile.c
+++ b/gdb/python/python-objfile.c
@@ -1,6 +1,6 @@
 /* Python interface to objfiles.
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -29,7 +29,7 @@ typedef struct
   /* The corresponding objfile.  */
   struct objfile *objfile;
 
-  /* The pretty-printer dictionary.  */
+  /* The pretty-printer list of functions.  */
   PyObject *printers;
 } objfile_object;
 
@@ -66,7 +66,7 @@ objfpy_new (PyTypeObject *type, PyObject *args, PyObject *keywords)
     {
       self->objfile = NULL;
 
-      self->printers = PyDict_New ();
+      self->printers = PyList_New (0);
       if (!self->printers)
 	{
 	  Py_DECREF (self);
@@ -95,10 +95,10 @@ objfpy_set_printers (PyObject *o, PyObject *value, void *ignore)
       return -1;
     }
 
-  if (! PyDict_Check (value))
+  if (! PyList_Check (value))
     {
       PyErr_SetString (PyExc_TypeError,
-		       "the pretty_printers attribute must be a dictionary");
+		       "the pretty_printers attribute must be a list");
       return -1;
     }
 
@@ -139,7 +139,7 @@ objfile_to_objfile_object (struct objfile *objfile)
 
 	  object->objfile = objfile;
 
-	  object->printers = PyDict_New ();
+	  object->printers = PyList_New (0);
 	  if (!object->printers)
 	    {
 	      Py_DECREF (object);
diff --git a/gdb/python/python-type.c b/gdb/python/python-type.c
index 7396bad..c39ff27 100644
--- a/gdb/python/python-type.c
+++ b/gdb/python/python-type.c
@@ -1,6 +1,6 @@
 /* Python interface to types.
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -234,6 +234,15 @@ typy_tag (PyObject *self, PyObject *args)
   return PyString_FromString (TYPE_TAG_NAME (type));
 }
 
+/* Return the type, stripped of typedefs. */
+static PyObject *
+typy_strip_typedefs (PyObject *self, PyObject *args)
+{
+  struct type *type = ((type_object *) self)->type;
+
+  return type_to_type_object (check_typedef (type));
+}
+
 /* Return a Type object which represents a pointer to SELF.  */
 static PyObject *
 typy_pointer (PyObject *self, PyObject *args)
@@ -712,6 +721,8 @@ Each field is a dictionary." },
     "Return the size of this type, in bytes" },
   { "tag", typy_tag, METH_NOARGS,
     "Return the tag name for this type, or None." },
+  { "strip_typedefs", typy_strip_typedefs, METH_NOARGS,
+    "Return a type stripped of typedefs"},
   { "target", typy_target, METH_NOARGS,
     "Return the target type of this type" },
   { "template_argument", typy_template_argument, METH_VARARGS,
diff --git a/gdb/python/python-utils.c b/gdb/python/python-utils.c
index c6c305f..f9c9486 100644
--- a/gdb/python/python-utils.c
+++ b/gdb/python/python-utils.c
@@ -82,7 +82,11 @@ python_string_to_unicode (PyObject *obj)
   /* If obj is already a unicode string, just return it.
      I wish life was always that simple...  */
   if (PyUnicode_Check (obj))
-    unicode_str = obj;
+    {
+      unicode_str = obj;
+      Py_INCREF (obj);
+    }
+  
   else if (PyString_Check (obj))
     unicode_str = PyUnicode_FromEncodedObject (obj, host_charset (), NULL);
   else
@@ -137,12 +141,15 @@ char *
 python_string_to_target_string (PyObject *obj)
 {
   PyObject *str;
+  char *result;
 
   str = python_string_to_unicode (obj);
   if (str == NULL)
     return NULL;
 
-  return unicode_to_target_string (str);
+  result = unicode_to_target_string (str);
+  Py_DECREF (str);
+  return result;
 }
 
 /* Converts a python string (8-bit or unicode) to a target string in
@@ -153,12 +160,15 @@ char *
 python_string_to_host_string (PyObject *obj)
 {
   PyObject *str;
+  char *result;
 
   str = python_string_to_unicode (obj);
   if (str == NULL)
     return NULL;
 
-  return unicode_to_encoded_string (str, host_charset ());
+  result = unicode_to_encoded_string (str, host_charset ()); 
+  Py_DECREF (str);
+  return result;
 }
 
 /* Converts a target string of LENGTH bytes in the target's charset to a
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 99f9f40..a816fc5 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1056,75 +1056,48 @@ gdbpy_objfiles (PyObject *unused1, PyObject *unused2)
 
 \f
 
-/* Return a string representing TYPE.  */
-static char *
-get_type (struct type *type)
-{
-  struct cleanup *old_chain;
-  struct ui_file *stb;
-  char *thetype;
-  long length;
-
-  stb = mem_fileopen ();
-  old_chain = make_cleanup_ui_file_delete (stb);
-
-  CHECK_TYPEDEF (type);
-
-  type_print (type, "", stb, -1);
-
-  thetype = ui_file_xstrdup (stb, &length);
-  do_cleanups (old_chain);
-  return thetype;
-}
-
 /* Helper function for find_pretty_printer which iterates over a
-   dictionary and tries to find a match.  */
+   list, calls each function and inspects output.  */
 static PyObject *
-search_pp_dictionary (PyObject *dict, char *type_name)
+search_pp_list (PyObject *list, PyObject *value)
 {
-  Py_ssize_t iter;
-  PyObject *key, *func, *found = NULL;
-
-  /* See if the type matches a pretty-printer regexp.  */
-  iter = 0;
-  while (! found && PyDict_Next (dict, &iter, &key, &func))
+  Py_ssize_t pp_list_size, list_index;
+  PyObject *function, *printer = NULL;
+  
+  pp_list_size = PyList_Size (list);
+  for (list_index = 0; list_index < pp_list_size; list_index++)
     {
-      char *rx_str;
+      function = PyList_GetItem (list, list_index);
+      if (! function)
+	return NULL;
 
-      if (! PyString_Check (key))
-	continue;
-      rx_str = PyString_AsString (key);
-      if (re_comp (rx_str) == NULL && re_exec (type_name) == 1)


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


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

end of thread, other threads:[~2009-06-26 13:51 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-30 17:22 [SCM] archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python jkratoch
  -- strict thread matches above, loose matches on Subject: below --
2009-06-26 13:51 jkratoch
2009-03-29 22:42 jkratoch
2009-03-27  0:35 jkratoch
2009-03-25 19:00 jkratoch
2009-03-24 17:33 jkratoch
2009-03-09 17:05 jkratoch
2009-03-06 16:59 jkratoch
2009-03-06 14:26 jkratoch
2009-03-05 21:53 jkratoch
2009-03-05 21:15 jkratoch
2009-03-04 23:54 jkratoch
2009-03-04 22:34 jkratoch
2009-03-04 15:02 jkratoch
2009-03-03 21:46 jkratoch
2009-03-03 21:45 jkratoch
2009-03-02 20:46 jkratoch
2009-03-01 14:38 jkratoch
2009-02-28 19:26 jkratoch
2009-02-26 23:01 jkratoch

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