public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-python: Remove python/py-membuf.c (Changed merged into py-inferior.c)
@ 2011-01-07 12:50 pmuldoon
  0 siblings, 0 replies; only message in thread
From: pmuldoon @ 2011-01-07 12:50 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-python has been updated
       via  80f8c090d6b00419813d32e5ac2d0b7a17df8c8a (commit)
      from  7adfc93ccd622f3f54ca0800c5b77a904d27ea9f (commit)

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

- Log -----------------------------------------------------------------
commit 80f8c090d6b00419813d32e5ac2d0b7a17df8c8a
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Fri Jan 7 12:47:42 2011 +0000

    Remove python/py-membuf.c (Changed merged into py-inferior.c)

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

Summary of changes:
 gdb/python/py-membuf.c |  268 ------------------------------------------------
 1 files changed, 0 insertions(+), 268 deletions(-)
 delete mode 100644 gdb/python/py-membuf.c

First 500 lines of diff:
diff --git a/gdb/python/py-membuf.c b/gdb/python/py-membuf.c
deleted file mode 100644
index 7bc294c..0000000
--- a/gdb/python/py-membuf.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/* Python interface to the inferior memory.
-
-   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include "defs.h"
-#include "exceptions.h"
-#include "gdbcore.h"
-#include "python-internal.h"
-
-typedef struct {
-  PyObject_HEAD
-  void *buffer;
-
-  /* These are kept just for mbpy_str.  */
-  CORE_ADDR addr;
-  CORE_ADDR length;
-} membuf_object;
-
-static PyTypeObject membuf_object_type;
-
-/* Implementation of gdb.read_memory (address, length).
-   Returns a Python buffer object with LENGTH bytes of the inferior's memory
-   at ADDRESS. Both arguments are integers.  */
-
-PyObject *
-gdbpy_read_memory (PyObject *self, PyObject *args)
-{
-  int error = 0;
-  CORE_ADDR addr, length;
-  void *buffer = NULL;
-  membuf_object *membuf_obj;
-  PyObject *addr_obj, *length_obj;
-  struct cleanup *cleanups = NULL;
-  volatile struct gdb_exception except;
-
-  if (! PyArg_ParseTuple (args, "OO", &addr_obj, &length_obj))
-    return NULL;
-
-  TRY_CATCH (except, RETURN_MASK_ALL)
-    {
-      if (!get_addr_from_python (addr_obj, &addr)
-	  || !get_addr_from_python (length_obj, &length))
-	{
-	  error = 1;
-	  break;
-	}
-
-      buffer = xmalloc (length);
-      cleanups = make_cleanup (xfree, buffer);
-
-      read_memory (addr, buffer, length);
-    }
-  GDB_PY_HANDLE_EXCEPTION (except);
-
-  if (error)
-    return NULL;
-
-  discard_cleanups (cleanups);
-
-  membuf_obj = PyObject_New (membuf_object, &membuf_object_type);
-  if (membuf_obj == NULL)
-    {
-      xfree (buffer);
-      PyErr_SetString (PyExc_MemoryError,
-		       "Could not allocate memory buffer object.");
-      return NULL;
-    }
-
-  membuf_obj->buffer = buffer;
-  membuf_obj->addr = addr;
-  membuf_obj->length = length;
-
-  return PyBuffer_FromReadWriteObject ((PyObject *) membuf_obj, 0,
-				       Py_END_OF_BUFFER);
-}
-
-/* Implementation of gdb.write_memory (address, buffer [, length]).
-   Writes the contents of BUFFER (a Python object supporting the read buffer
-   protocol) at ADDRESS in the inferior's memory.  Write LENGTH bytes from
-   BUFFER, or its entire contents if the argument is not provided.  The
-   function returns nothing.  */
-
-PyObject *
-gdbpy_write_memory (PyObject *self, PyObject *args)
-{
-  int buf_len, error = 0;
-  const char *buffer;
-  CORE_ADDR addr, length;
-  PyObject *addr_obj, *length_obj = NULL;
-  volatile struct gdb_exception except;
-
-  if (! PyArg_ParseTuple (args, "Os#|O", &addr_obj, &buffer, &buf_len,
-			  &length_obj))
-    return NULL;
-
-  TRY_CATCH (except, RETURN_MASK_ALL)
-    {
-      if (!get_addr_from_python (addr_obj, &addr))
-	{
-	  error = 1;
-	  break;
-	}
-      
-      if (!length_obj)
-	length = buf_len;
-      else if (!get_addr_from_python (length_obj, &length))
-	{
-	  error = 1;
-	  break;
-	}
-
-      write_memory (addr, buffer, length);
-    }
-  GDB_PY_HANDLE_EXCEPTION (except);
-
-  if (error)
-    return NULL;
-
-  Py_RETURN_NONE;
-}
-
-/* Destructor of Membuf objects.  */
-
-static void
-mbpy_dealloc (PyObject *self)
-{
-  xfree (((membuf_object *) self)->buffer);
-  self->ob_type->tp_free (self);
-}
-
-/* Return a description of the Membuf object.  */
-
-static PyObject *
-mbpy_str (PyObject *self)
-{
-  membuf_object *membuf_obj = (membuf_object *) self;
-
-  return PyString_FromFormat ("memory buffer for address %s, %s bytes long",
-			      paddress (membuf_obj->addr),
-			      pulongest (membuf_obj->length));
-}
-
-static Py_ssize_t
-get_read_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr)
-{
-  membuf_object *membuf_obj = (membuf_object *) self;
-
-  if (segment)
-    {
-      PyErr_SetString (PyExc_SystemError,
-		       "The memory buffer supports only one segment.");
-      return -1;
-    }
-
-  *ptrptr = membuf_obj->buffer;
-
-  return membuf_obj->length;
-}
-
-static Py_ssize_t
-get_write_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr)
-{
-  return get_read_buffer (self, segment, ptrptr);
-}
-
-static Py_ssize_t
-get_seg_count (PyObject *self, Py_ssize_t *lenp)
-{
-  if (lenp)
-    *lenp = ((membuf_object *) self)->length;
-
-  return 1;
-}
-
-static Py_ssize_t
-get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr)
-{
-  void *ptr = NULL;
-  Py_ssize_t ret;
-
-  ret = get_read_buffer (self, segment, &ptr);
-  *ptrptr = (char *) ptr;
-
-  return ret;
-}
-
-/* Python doesn't provide a decent way to get compatibility here.  */
-#if HAVE_LIBPYTHON2_4
-#define CHARBUFFERPROC_NAME getcharbufferproc
-#else
-#define CHARBUFFERPROC_NAME charbufferproc
-#endif
-
-static PyBufferProcs buffer_procs = {
-  get_read_buffer,
-  get_write_buffer,
-  get_seg_count,
-  /* The cast here works around a difference between Python 2.4 and
-     Python 2.5.  */
-  (CHARBUFFERPROC_NAME) get_char_buffer
-};
-
-static PyTypeObject membuf_object_type = {
-  PyObject_HEAD_INIT (NULL)
-  0,				  /*ob_size*/
-  "gdb.Membuf",			  /*tp_name*/
-  sizeof (membuf_object),	  /*tp_basicsize*/
-  0,				  /*tp_itemsize*/
-  mbpy_dealloc,			  /*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*/
-  mbpy_str,			  /*tp_str*/
-  0,				  /*tp_getattro*/
-  0,				  /*tp_setattro*/
-  &buffer_procs,		  /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT,		  /*tp_flags*/
-  "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 */
-  0,				  /* tp_members */
-  0,				  /* tp_getset */
-  0,				  /* tp_base */
-  0,				  /* tp_dict */
-  0,				  /* tp_descr_get */
-  0,				  /* tp_descr_set */
-  0,				  /* tp_dictoffset */
-  0,				  /* tp_init */
-  0,				  /* tp_alloc */
-  PyType_GenericNew		  /* tp_new */
-};
-
-void
-gdbpy_initialize_membuf (void)
-{
-  if (PyType_Ready (&membuf_object_type) < 0)
-    return;
-
-  Py_INCREF (&membuf_object_type);
-  PyModule_AddObject (gdb_module, "Membuf", (PyObject *) &membuf_object_type);
-}


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


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

only message in thread, other threads:[~2011-01-07 12:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-07 12:50 [SCM] archer-tromey-python: Remove python/py-membuf.c (Changed merged into py-inferior.c) pmuldoon

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