This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] add more methods to gdb.Progspace


On Tue, Jun 17, 2014 at 6:33 PM, Tom Tromey <tromey@redhat.com> wrote:
> There are a number of global functions in the gdb Python module which
> really should be methods on Progspace.  This patch adds new methods to
> Progspace and then redefines these globals in terms of these new
> methods.  It also adds an Inferior.progspace attribute so that the
> association between inferiors and progspaces is obvious; this lets us
> apply the same treatment to current_progspace.
>
> Built and regtested on x86-64 Fedora 20.
>
> Needs a doc review.
>
> 2014-06-17  Tom Tromey  <tromey@redhat.com>
>
>         * python/lib/gdb/__init__.py (current_progspace, objfiles)
>         (solib_name, block_for_pc, find_pc_line): New functions.
>         * python/py-block.c (gdbpy_block_for_pc): Remove.
>         * python/py-inferior.c (infpy_get_progspace): New function.
>         (inferior_object_getset) <progspace>: Add.
>         * python/py-progspace.c (PSPY_REQUIRE_VALID): New macro.
>         (pspy_objfiles, pspy_solib_name, pspy_block_for_pc)
>         (pspy_find_pc_line, pspy_is_valid): New functions.
>         (pspace_object_methods): New global.
>         (pspace_object_type): Reference pspace_object_methods.
>         * python/python-internal.h (gdbpy_block_for_pc): Don't declare.
>         * python/python.c: Don't include solib.h.
>         (gdbpy_solib_name, gdbpy_find_pc_line)
>         (gdbpy_get_current_progspace, gdbpy_objfiles): Remove.
>         (GdbMethods) <current_progspace, objfiles, block_for_pc,
>         solib_name, find_pc_line>: Remove entries.

Hi.  A few comments inline.

solib_name(pc)

This doesn't feel right as an element of the API.
What if pc is in the main executable?  Can't the answer be found via
other means?
We've exported objfiles, so what does this bring to the table that,
say, objfile_name (pc) doesn't?
Or even better(?), symtab_and_line(pc) is all that's really needed, isn't it?
[since one can, I think, get the objfile from the symtab; and if not
we should provide that]

I realize there is already an solib_name, but IIUC you're adding
another one to gdb.Progspace.
Until I see a compelling reason to have it (what problem does it solve
that can't already be solved via other means?) I'd rather not add
another.  Instead, let's just deprecate the old one.
[Maybe there is a compelling reason to have it that I'm not seeing though.]


> 2014-06-17  Tom Tromey  <tromey@redhat.com>
>
>         * python.texi (Basic Python): Update docs for find_pc_line,
>         solib_name.
>         (Inferiors In Python): Document Inferior.progspace.
>         (Progspaces In Python): Update docs for current_progspace.
>         Document block_for_pc, find_pc_line, is_valid, objfiles,
>         solib_name.
>         (Objfiles In Python): Update docs for gdb.objfiles.
>[...]
> diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
> index 4688783..6961d46 100644
> --- a/gdb/doc/python.texi
> +++ b/gdb/doc/python.texi
> @@ -285,7 +285,9 @@ Return the @code{gdb.Symtab_and_line} object corresponding to the
>  @var{pc} value.  @xref{Symbol Tables In Python}.  If an invalid
>  value of @var{pc} is passed as an argument, then the @code{symtab} and
>  @code{line} attributes of the returned @code{gdb.Symtab_and_line} object
> -will be @code{None} and 0 respectively.
> +will be @code{None} and 0 respectively.  This is identical to
> +@code{current_progspace().find_pc_line(pc)} and is included for
> +historical compatibility.
>  @end defun
>
>  @findex gdb.post_event
> @@ -405,7 +407,9 @@ never returned.
>  @findex gdb.solib_name
>  @defun gdb.solib_name (address)
>  Return the name of the shared library holding the given @var{address}
> -as a string, or @code{None}.
> +as a string, or @code{None}.  This is identical to
> +@code{current_progspace().solib_name(address)} and is included for
> +historical compatibility.
>  @end defun

This doesn't specify what name is.
Is it basename, fullpath, realpath, or ... ?
[I realize fixing this is arguably part of a separate patch set.
I'm mentioning it now for reference sake.]

>
>  @findex gdb.decode_line
> @@ -2551,6 +2555,9 @@ Process ID of the inferior, as assigned by the underlying operating
>  system.
>  @end defvar
>
> +@defvar Inferior.progspace
> +The inferior's program space.  @xref{Progspaces in Python}.
> +
>  @defvar Inferior.was_attached
>  Boolean signaling whether the inferior was created using `attach', or
>  started by @value{GDBN} itself.
> @@ -3320,8 +3327,10 @@ The following progspace-related functions are available in the
>
>  @findex gdb.current_progspace
>  @defun gdb.current_progspace ()
> -This function returns the program space of the currently selected inferior.
> -@xref{Inferiors and Programs}.
> +This function returns the program space of the currently selected
> +inferior.  @xref{Inferiors and Programs}.  This is identical to
> +@code{selected_inferior().progspace} (@pxref{Inferiors In Python}) and
> +is included for historical compatibility.
>  @end defun
>
>  @findex gdb.progspaces
> @@ -3355,6 +3364,46 @@ The @code{frame_filters} attribute is a dictionary of frame filter
>  objects.  @xref{Frame Filter API}, for more information.
>  @end defvar
>
> +A program space has the following methods:
> +
> +@findex Progspace.block_for_pc
> +@defun Progspace.block_for_pc (pc)
> +Return the innermost @code{gdb.Block} containing the given @var{pc}
> +value.  If the block cannot be found for the @var{pc} value specified,
> +the function will return @code{None}.
> +@end defun
> +
> +@findex Progspace.find_pc_line
> +@defun Progspace.find_pc_line (pc)
> +Return the @code{gdb.Symtab_and_line} object corresponding to the
> +@var{pc} value.  @xref{Symbol Tables In Python}.  If an invalid value
> +of @var{pc} is passed as an argument, then the @code{symtab} and
> +@code{line} attributes of the returned @code{gdb.Symtab_and_line}
> +object will be @code{None} and 0 respectively.
> +@end defun
> +
> +@findex Progspace.is_valid
> +@defun Progspace.is_valid ()
> +Returns @code{True} if the @code{gdb.Progspace} object is valid,
> +@code{False} if not.  A @code{gdb.Progspace} object can become invalid
> +if the program space file it refers to is not referenced by any
> +inferior.  All other @code{gdb.Progspace} methods will throw an
> +exception if it is invalid at the time the method is called.
> +@end defun
> +
> +@findex Progspace.objfiles
> +@defun Progspace.objfiles ()
> +Return a sequence of all the objfiles referenced by this program
> +space.  @xref{Objfiles In Python}.

This should specify that the entries in the sequence are in arbitrary
order (or some such).

> +@end defun
> +
> +@findex Progspace.solib_name
> +@defun Progspace.solib_name (address)
> +Return the name of the shared library holding the given @var{address}
> +as a string, or @code{None}.
> +@end defun
> +
> +
>  @node Objfiles In Python
>  @subsubsection Objfiles In Python
>
> @@ -3381,7 +3430,9 @@ this function returns @code{None}.
>  @findex gdb.objfiles
>  @defun gdb.objfiles ()
>  Return a sequence of all the objfiles current known to @value{GDBN}.
> -@xref{Objfiles In Python}.
> +@xref{Objfiles In Python}.  This is identical to
> +@code{gdb.current_progspace().objfiles()} (@pxref{Progspaces in
> +Python}) and is included for historical compatibility.
>  @end defun
>
>  Each objfile is represented by an instance of the @code{gdb.Objfile}
> @@ -3674,7 +3725,9 @@ module:
>  @defun gdb.block_for_pc (pc)
>  Return the innermost @code{gdb.Block} containing the given @var{pc}
>  value.  If the block cannot be found for the @var{pc} value specified,
> -the function will return @code{None}.
> +the function will return @code{None}.  This is identical to
> +@code{current_progspace().block_for_pc(pc)} and is included for
> +historical compatibility.
>  @end defun
>
>  A @code{gdb.Block} object has the following methods:
> diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py
> index 557e168..37510d4 100644
> --- a/gdb/python/lib/gdb/__init__.py
> +++ b/gdb/python/lib/gdb/__init__.py
> @@ -126,3 +126,25 @@ def GdbSetPythonDirectory(dir):
>      # attributes
>      reload(__import__(__name__))
>      auto_load_packages()
> +
> +def current_progspace():
> +    "Return the current Progspace."
> +    return selected_inferior().progspace
> +
> +def objfiles():
> +    "Return a sequence of the current program space's objfiles."
> +    return current_progspace().objfiles()
> +
> +def solib_name (addr):
> +    """solib_name (Long) -> String.\n\
> +Return the name of the shared library holding a given address, or None."""
> +    return current_progspace().solib_name(addr)
> +
> +def block_for_pc(pc):
> +    "Return the block containing the given pc value, or None."
> +    return current_progspace().block_for_pc(pc)
> +
> +def find_pc_line(pc):
> +    """find_pc_line (pc) -> Symtab_and_line.
> +Return the gdb.Symtab_and_line object corresponding to the pc value."""
> +    return current_progspace().find_pc_line(pc)
> diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
> index e5e136b..f7e3776 100644
> --- a/gdb/python/py-block.c
> +++ b/gdb/python/py-block.c
> @@ -365,43 +365,6 @@ blpy_iter_is_valid (PyObject *self, PyObject *args)
>    Py_RETURN_TRUE;
>  }
>
> -/* Return the innermost lexical block containing the specified pc value,
> -   or 0 if there is none.  */
> -PyObject *
> -gdbpy_block_for_pc (PyObject *self, PyObject *args)
> -{
> -  gdb_py_ulongest pc;
> -  struct block *block = NULL;
> -  struct obj_section *section = NULL;
> -  struct symtab *symtab = NULL;
> -  volatile struct gdb_exception except;
> -
> -  if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc))
> -    return NULL;
> -
> -  TRY_CATCH (except, RETURN_MASK_ALL)
> -    {
> -      section = find_pc_mapped_section (pc);
> -      symtab = find_pc_sect_symtab (pc, section);
> -
> -      if (symtab != NULL && symtab->objfile != NULL)
> -       block = block_for_pc (pc);
> -    }
> -  GDB_PY_HANDLE_EXCEPTION (except);
> -
> -  if (!symtab || symtab->objfile == NULL)
> -    {
> -      PyErr_SetString (PyExc_RuntimeError,
> -                      _("Cannot locate object file for block."));
> -      return NULL;
> -    }
> -
> -  if (block)
> -    return block_to_block_object (block, symtab->objfile);
> -
> -  Py_RETURN_NONE;
> -}
> -
>  /* This function is called when an objfile is about to be freed.
>     Invalidate the block as further actions on the block would result
>     in bad data.  All access to obj->symbol should be gated by
> diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
> index 9b8b8f5..8d5efaa 100644
> --- a/gdb/python/py-inferior.c
> +++ b/gdb/python/py-inferior.c
> @@ -363,6 +363,23 @@ infpy_get_pid (PyObject *self, void *closure)
>    return PyLong_FromLong (inf->inferior->pid);
>  }
>
> +/* Implement the "progspace" method.  */
> +
> +static PyObject *
> +infpy_get_progspace (PyObject *self, void *closure)
> +{
> +  inferior_object *inf = (inferior_object *) self;
> +  PyObject *result;
> +
> +  INFPY_REQUIRE_VALID (inf);
> +
> +  result = pspace_to_pspace_object (inf->inferior->pspace);
> +  if (result != NULL)
> +    Py_INCREF (result);
> +
> +  return result;
> +}
> +
>  static PyObject *
>  infpy_get_was_attached (PyObject *self, void *closure)
>  {
> @@ -810,6 +827,8 @@ static PyGetSetDef inferior_object_getset[] =
>    { "num", infpy_get_num, NULL, "ID of inferior, as assigned by GDB.", NULL },
>    { "pid", infpy_get_pid, NULL, "PID of inferior, as assigned by the OS.",
>      NULL },
> +  { "progspace", infpy_get_progspace, NULL, "Progspace of inferior.",
> +    NULL },
>    { "was_attached", infpy_get_was_attached, NULL,
>      "True if the inferior was created using 'attach'.", NULL },
>    { NULL }
> diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c
> index b0092c5..b72b6a6 100644
> --- a/gdb/python/py-progspace.c
> +++ b/gdb/python/py-progspace.c
> @@ -24,6 +24,8 @@
>  #include "objfiles.h"
>  #include "language.h"
>  #include "arch-utils.h"
> +#include "solib.h"
> +#include "block.h"
>
>  typedef struct
>  {
> @@ -49,6 +51,17 @@ static PyTypeObject pspace_object_type
>
>  static const struct program_space_data *pspy_pspace_data_key;
>
> +/* Require that PSPACE be a valid program space ID.  */
> +#define PSPY_REQUIRE_VALID(Pspace)                             \
> +  do {                                                         \
> +    if (!Pspace->pspace)                                       \
> +      {                                                                \
> +       PyErr_SetString (PyExc_RuntimeError,                    \
> +                        _("program space no longer exists.")); \
> +       return NULL;                                            \
> +      }                                                                \
> +  } while (0)
> +

Excessive number of blank lines here.

>
>
>  /* An Objfile method which returns the objfile's file name, or None.  */
> @@ -254,6 +267,160 @@ pspy_set_type_printers (PyObject *o, PyObject *value, void *ignore)
>    return 0;
>  }
>
> +/* Return a sequence holding all the Objfiles.  */
> +
> +static PyObject *
> +pspy_objfiles (PyObject *o, PyObject *args)
> +{
> +  PyObject *list;
> +  pspace_object *self = (pspace_object *) o;
> +
> +  list = PyList_New (0);
> +  if (!list)
> +    return NULL;
> +
> +  if (self->pspace != NULL)
> +    {
> +      struct objfile *objf;
> +
> +      ALL_PSPACE_OBJFILES (self->pspace, objf)
> +       {
> +         PyObject *item = objfile_to_objfile_object (objf);
> +
> +         if (!item || PyList_Append (list, item) == -1)
> +           {
> +             Py_DECREF (list);
> +             return NULL;
> +           }
> +       }
> +    }
> +
> +  return list;
> +}
> +
> +/* Implementation of solib_name (Long) -> String.
> +   Returns the name of the shared library holding a given address, or None.  */
> +
> +static PyObject *
> +pspy_solib_name (PyObject *o, PyObject *args)
> +{
> +  char *soname;
> +  PyObject *str_obj;
> +  gdb_py_longest pc;
> +  pspace_object *self = (pspace_object *) o;
> +
> +  PSPY_REQUIRE_VALID (self);
> +
> +  if (!PyArg_ParseTuple (args, GDB_PY_LL_ARG, &pc))
> +    return NULL;
> +
> +  soname = solib_name_from_address (self->pspace, pc);
> +  if (soname)
> +    str_obj = PyString_Decode (soname, strlen (soname), host_charset (), NULL);
> +  else
> +    {
> +      str_obj = Py_None;
> +      Py_INCREF (Py_None);
> +    }
> +
> +  return str_obj;
> +}
> +
> +/* Return the innermost lexical block containing the specified pc value,
> +   or 0 if there is none.  */
> +static PyObject *
> +pspy_block_for_pc (PyObject *o, PyObject *args)
> +{
> +  gdb_py_ulongest pc;
> +  struct block *block = NULL;
> +  struct obj_section *section = NULL;
> +  struct symtab *symtab = NULL;
> +  volatile struct gdb_exception except;
> +  pspace_object *self = (pspace_object *) o;
> +
> +  PSPY_REQUIRE_VALID (self);
> +
> +  if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc))
> +    return NULL;
> +
> +  TRY_CATCH (except, RETURN_MASK_ALL)
> +    {
> +      struct cleanup *cleanup = save_current_space_and_thread ();
> +
> +      set_current_program_space (self->pspace);
> +
> +      section = find_pc_mapped_section (pc);
> +      symtab = find_pc_sect_symtab (pc, section);
> +
> +      if (symtab != NULL && symtab->objfile != NULL)
> +       block = block_for_pc (pc);
> +
> +      do_cleanups (cleanup);
> +    }
> +  GDB_PY_HANDLE_EXCEPTION (except);
> +
> +  if (!symtab || symtab->objfile == NULL)
> +    {
> +      PyErr_SetString (PyExc_RuntimeError,
> +                      _("Cannot locate object file for block."));
> +      return NULL;
> +    }
> +
> +  if (block)
> +    return block_to_block_object (block, symtab->objfile);
> +
> +  Py_RETURN_NONE;
> +}
> +
> +/* Implementation of the find_pc_line function.
> +   Returns the gdb.Symtab_and_line object corresponding to a PC value.  */
> +
> +static PyObject *
> +pspy_find_pc_line (PyObject *o, PyObject *args)
> +{
> +  gdb_py_ulongest pc_llu;
> +  volatile struct gdb_exception except;
> +  PyObject *result = NULL; /* init for gcc -Wall */
> +  pspace_object *self = (pspace_object *) o;
> +
> +  PSPY_REQUIRE_VALID (self);
> +
> +  if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc_llu))
> +    return NULL;
> +
> +  TRY_CATCH (except, RETURN_MASK_ALL)
> +    {
> +      struct symtab_and_line sal;
> +      CORE_ADDR pc;
> +      struct cleanup *cleanup = save_current_space_and_thread ();
> +
> +      set_current_program_space (self->pspace);
> +
> +      pc = (CORE_ADDR) pc_llu;
> +      sal = find_pc_line (pc, 0);
> +      result = symtab_and_line_to_sal_object (sal);
> +
> +      do_cleanups (cleanup);
> +    }
> +  GDB_PY_HANDLE_EXCEPTION (except);
> +
> +  return result;
> +}
> +
> +/* Implementation of is_valid (self) -> Boolean.
> +   Returns True if this program space still exists in GDB.  */
> +
> +static PyObject *
> +pspy_is_valid (PyObject *o, PyObject *args)
> +{
> +  pspace_object *self = (pspace_object *) o;
> +
> +  if (self->pspace == NULL)
> +    Py_RETURN_FALSE;
> +
> +  Py_RETURN_TRUE;
> +}
> +

Excessive number of blank lines here.

>
>  /* Clear the PSPACE pointer in a Pspace object and remove the reference.  */
> @@ -363,6 +530,24 @@ static PyGetSetDef pspace_getset[] =
>    { NULL }
>  };
>
> +static PyMethodDef pspace_object_methods[] =
> +{
> +  { "objfiles", pspy_objfiles, METH_NOARGS,
> +    "Return a sequence of the program space's objfiles." },
> +  { "solib_name", pspy_solib_name, METH_VARARGS,
> +    "solib_name (Long) -> String.\n\
> +Return the name of the shared library holding a given address, or None." },
> +  { "block_for_pc", pspy_block_for_pc, METH_VARARGS,
> +    "Return the block containing the given pc value, or None." },
> +  { "find_pc_line", pspy_find_pc_line, METH_VARARGS,
> +    "find_pc_line (pc) -> Symtab_and_line.\n\
> +Return the gdb.Symtab_and_line object corresponding to the pc value." },
> +  { "is_valid", pspy_is_valid, METH_NOARGS,
> +    "is_valid () -> Boolean.\n\
> +Return true if this program space is valid, false if not." },
> +  { NULL }
> +};
> +
>  static PyTypeObject pspace_object_type =
>  {
>    PyVarObject_HEAD_INIT (NULL, 0)
> @@ -392,7 +577,7 @@ static PyTypeObject pspace_object_type =
>    0,                             /* tp_weaklistoffset */
>    0,                             /* tp_iter */
>    0,                             /* tp_iternext */
> -  0,                             /* tp_methods */
> +  pspace_object_methods,         /* tp_methods */
>    0,                             /* tp_members */
>    pspace_getset,                 /* tp_getset */
>    0,                             /* tp_base */
> diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
> index b7298d9..4bda3d0 100644
> --- a/gdb/python/python-internal.h
> +++ b/gdb/python/python-internal.h
> @@ -360,7 +360,6 @@ PyObject *gdbpy_lookup_global_symbol (PyObject *self, PyObject *args,
>                                       PyObject *kw);
>  PyObject *gdbpy_newest_frame (PyObject *self, PyObject *args);
>  PyObject *gdbpy_selected_frame (PyObject *self, PyObject *args);
> -PyObject *gdbpy_block_for_pc (PyObject *self, PyObject *args);
>  PyObject *gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw);
>  int gdbpy_is_field (PyObject *obj);
>  PyObject *gdbpy_create_lazy_string_object (CORE_ADDR address, long length,
> diff --git a/gdb/python/python.c b/gdb/python/python.c
> index 369a249..32769aa 100644
> --- a/gdb/python/python.c
> +++ b/gdb/python/python.c
> @@ -90,7 +90,6 @@ const struct extension_language_defn extension_language_python =
>  #include "cli/cli-decode.h"
>  #include "charset.h"
>  #include "top.h"
> -#include "solib.h"
>  #include "python-internal.h"
>  #include "linespec.h"
>  #include "source.h"
> @@ -680,31 +679,6 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
>    Py_RETURN_NONE;
>  }
>
> -/* Implementation of gdb.solib_name (Long) -> String.
> -   Returns the name of the shared library holding a given address, or None.  */
> -
> -static PyObject *
> -gdbpy_solib_name (PyObject *self, PyObject *args)
> -{
> -  char *soname;
> -  PyObject *str_obj;
> -  gdb_py_longest pc;
> -
> -  if (!PyArg_ParseTuple (args, GDB_PY_LL_ARG, &pc))
> -    return NULL;
> -
> -  soname = solib_name_from_address (current_program_space, pc);
> -  if (soname)
> -    str_obj = PyString_Decode (soname, strlen (soname), host_charset (), NULL);
> -  else
> -    {
> -      str_obj = Py_None;
> -      Py_INCREF (Py_None);
> -    }
> -
> -  return str_obj;
> -}
> -
>  /* A Python function which is a wrapper for decode_line_1.  */
>
>  static PyObject *
> @@ -838,33 +812,6 @@ gdbpy_parse_and_eval (PyObject *self, PyObject *args)
>    return value_to_value_object (result);
>  }
>
> -/* Implementation of gdb.find_pc_line function.
> -   Returns the gdb.Symtab_and_line object corresponding to a PC value.  */
> -
> -static PyObject *
> -gdbpy_find_pc_line (PyObject *self, PyObject *args)
> -{
> -  gdb_py_ulongest pc_llu;
> -  volatile struct gdb_exception except;
> -  PyObject *result = NULL; /* init for gcc -Wall */
> -
> -  if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc_llu))
> -    return NULL;
> -
> -  TRY_CATCH (except, RETURN_MASK_ALL)
> -    {
> -      struct symtab_and_line sal;
> -      CORE_ADDR pc;
> -
> -      pc = (CORE_ADDR) pc_llu;
> -      sal = find_pc_line (pc, 0);
> -      result = symtab_and_line_to_sal_object (sal);
> -    }
> -  GDB_PY_HANDLE_EXCEPTION (except);
> -
> -  return result;
> -}
> -
>  /* Read a file as Python code.
>     This is the extension_language_script_ops.script_sourcer "method".
>     FILE is the file to load.  FILENAME is name of the file FILE.
> @@ -1220,20 +1167,6 @@ gdbpy_print_stack (void)
>
>
>
> -/* Return the current Progspace.
> -   There always is one.  */
> -
> -static PyObject *
> -gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2)
> -{
> -  PyObject *result;
> -
> -  result = pspace_to_pspace_object (current_program_space);
> -  if (result)
> -    Py_INCREF (result);
> -  return result;
> -}
> -
>  /* Return a sequence holding all the Progspaces.  */
>
>  static PyObject *
> @@ -1308,32 +1241,6 @@ gdbpy_get_current_objfile (PyObject *unused1, PyObject *unused2)
>    return result;
>  }
>
> -/* Return a sequence holding all the Objfiles.  */
> -
> -static PyObject *
> -gdbpy_objfiles (PyObject *unused1, PyObject *unused2)
> -{
> -  struct objfile *objf;
> -  PyObject *list;
> -
> -  list = PyList_New (0);
> -  if (!list)
> -    return NULL;
> -
> -  ALL_OBJFILES (objf)
> -  {
> -    PyObject *item = objfile_to_objfile_object (objf);
> -
> -    if (!item || PyList_Append (list, item) == -1)
> -      {
> -       Py_DECREF (list);
> -       return NULL;
> -      }
> -  }
> -
> -  return list;
> -}
> -
>  /* Compute the list of active python type printers and store them in
>     EXT_PRINTERS->py_type_printers.  The product of this function is used by
>     gdbpy_apply_type_printers, and freed by gdbpy_free_type_printers.
> @@ -1919,15 +1826,11 @@ set to True." },
>    { "default_visualizer", gdbpy_default_visualizer, METH_VARARGS,
>      "Find the default visualizer for a Value." },
>
> -  { "current_progspace", gdbpy_get_current_progspace, METH_NOARGS,
> -    "Return the current Progspace." },
>    { "progspaces", gdbpy_progspaces, METH_NOARGS,
>      "Return a sequence of all progspaces." },
>
>    { "current_objfile", gdbpy_get_current_objfile, METH_NOARGS,
>      "Return the current Objfile being loaded, or None." },
> -  { "objfiles", gdbpy_objfiles, METH_NOARGS,
> -    "Return a sequence of all loaded objfiles." },
>
>    { "newest_frame", gdbpy_newest_frame, METH_NOARGS,
>      "newest_frame () -> gdb.Frame.\n\
> @@ -1953,11 +1856,6 @@ a boolean indicating if name is a field of the current implied argument\n\
>      METH_VARARGS | METH_KEYWORDS,
>      "lookup_global_symbol (name [, domain]) -> symbol\n\
>  Return the symbol corresponding to the given name (or None)." },
> -  { "block_for_pc", gdbpy_block_for_pc, METH_VARARGS,
> -    "Return the block containing the given pc value, or None." },
> -  { "solib_name", gdbpy_solib_name, METH_VARARGS,
> -    "solib_name (Long) -> String.\n\
> -Return the name of the shared library holding a given address, or None." },
>    { "decode_line", gdbpy_decode_line, METH_VARARGS,
>      "decode_line (String) -> Tuple.  Decode a string argument the way\n\
>  that 'break' or 'edit' does.  Return a tuple containing two elements.\n\
> @@ -1969,9 +1867,6 @@ gdb.Symtab_and_line objects (or None)."},
>      "parse_and_eval (String) -> Value.\n\
>  Parse String as an expression, evaluate it, and return the result as a Value."
>    },
> -  { "find_pc_line", gdbpy_find_pc_line, METH_VARARGS,
> -    "find_pc_line (pc) -> Symtab_and_line.\n\
> -Return the gdb.Symtab_and_line object corresponding to the pc value." },
>
>    { "post_event", gdbpy_post_event, METH_VARARGS,
>      "Post an event into gdb's event loop." },
> --
> 1.9.3
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]