2010-04-16 03:54:13 +08:00
|
|
|
|
/* Python interface to program spaces.
|
|
|
|
|
|
2018-01-01 12:43:02 +08:00
|
|
|
|
Copyright (C) 2010-2018 Free Software Foundation, Inc.
|
2010-04-16 03:54:13 +08:00
|
|
|
|
|
|
|
|
|
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 "python-internal.h"
|
|
|
|
|
#include "charset.h"
|
|
|
|
|
#include "progspace.h"
|
|
|
|
|
#include "objfiles.h"
|
|
|
|
|
#include "language.h"
|
2010-12-18 10:08:43 +08:00
|
|
|
|
#include "arch-utils.h"
|
2017-01-12 07:28:43 +08:00
|
|
|
|
#include "py-ref.h"
|
2010-04-16 03:54:13 +08:00
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
PyObject_HEAD
|
|
|
|
|
|
|
|
|
|
/* The corresponding pspace. */
|
|
|
|
|
struct program_space *pspace;
|
|
|
|
|
|
2014-10-31 08:05:17 +08:00
|
|
|
|
/* Dictionary holding user-added attributes.
|
|
|
|
|
This is the __dict__ attribute of the object. */
|
|
|
|
|
PyObject *dict;
|
|
|
|
|
|
2010-04-16 03:54:13 +08:00
|
|
|
|
/* The pretty-printer list of functions. */
|
|
|
|
|
PyObject *printers;
|
* NEWS: Update.
* data-directory/Makefile.in (PYTHON_FILES): Add
type_printers.py.
* python/lib/gdb/command/type_printers.py: New file.
* python/lib/gdb/command/types.py (TypePrinter): New class.
(_get_some_type_recognizers, get_type_recognizers,
apply_type_recognizers, register_type_printer): New
functions.
* python/py-objfile.c (objfile_object) <type_printers>: New
field.
(objfpy_dealloc): Decref new field.
(objfpy_new): Set new field.
(objfpy_get_type_printers, objfpy_set_type_printers): New
functions.
(objfile_to_objfile_object): Set new field.
(objfile_getset): Add "type_printers".
* python/py-progspace.c (pspace_object) <type_printers>: New
field.
(pspy_dealloc): Decref new field.
(pspy_new): Set new field.
(pspy_get_type_printers, pspy_set_type_printers): New functions.
(pspace_to_pspace_object): Set new field.
(pspace_getset): Add "type_printers".
* python/python.c (start_type_printers, apply_type_printers,
free_type_printers): New functions.
(_initialize_python): Set gdb.type_printers.
* python/python.h (start_type_printers, apply_type_printers,
free_type_printers): Declare.
* typeprint.c (type_print_raw_options, default_ptype_flags):
Update for new fields.
(do_free_global_table, create_global_typedef_table,
find_global_typedef): New functions.
(find_typedef_in_hash): Use find_global_typedef.
(whatis_exp): Use create_global_typedef_table. Change cleanup
handling.
* typeprint.h (struct type_print_options) <global_typedefs,
global_printers>: New fields.
doc
* gdb.texinfo (Symbols): Document "info type-printers",
"enable type-printer" and "disable type-printer".
(Python API): Add new node to menu.
(Type Printing API): New node.
(Progspaces In Python): Document type_printers field.
(Objfiles In Python): Likewise.
(gdb.types) <get_type_recognizers, apply_type_recognizers,
register_type_printer, TypePrinter>: Document.
testsuite
* gdb.base/completion.exp: Update for "info type-printers".
* gdb.python/py-typeprint.cc: New file.
* gdb.python/py-typeprint.exp: New file.
* gdb.python/py-typeprint.py: New file.
2012-11-13 01:41:59 +08:00
|
|
|
|
|
2013-05-10 Phil Muldoon <pmuldoon@redhat.com>
* stack.c (backtrace_command_1): Add "no-filters", and Python frame
filter logic.
(backtrace_command): Add "no-filters" option parsing.
(_initialize_stack): Alter help to reflect "no-filters" option.
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-framefilter.o
(SUBDIR_PYTHON_SRCS): Add py-framefilter.c
(py-frame.o): Add target
* data-directory/Makefile.in (PYTHON_DIR): Add Python frame
filter files.
* python/python.h: Add new frame filter constants, and flag enum.
(apply_frame_filter): Add definition.
* python/python.c (apply_frame_filter): New non-Python
enabled function.
* python/py-utils.c (py_xdecref): New function.
(make_cleanup_py_xdecref): Ditto.
* python/py-objfile.c: Declare frame_filters dictionary.
(objfpy_dealloc): Add frame_filters dealloc.
(objfpy_new): Initialize frame_filters attribute.
(objfile_to_objfile_object): Ditto.
(objfpy_get_frame_filters): New function.
(objfpy_set_frame_filters): New function.
* python/py-progspace.c: Declare frame_filters dictionary.
(pspy_dealloc): Add frame_filters dealloc.
(pspy_new): Initialize frame_filters attribute.
(pspacee_to_pspace_object): Ditto.
(pspy_get_frame_filters): New function.
(pspy_set_frame_filters): New function.
* python/py-framefilter.c: New file.
* python/lib/gdb/command/frame_filters.py: New file.
* python/lib/gdb/frames.py: New file.
* python/lib/gdb/__init__.py: Initialize global frame_filters
dictionary
* python/lib/gdb/FrameDecorator.py: New file.
* python/lib/gdb/FrameIterator.py: New file.
* mi/mi-cmds.c (mi_cmds): Add frame filters command.
* mi/mi-cmds.h: Declare.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Add
--no-frame-filter logic, and Python frame filter logic.
(stack_enable_frame_filters): New function.
(parse_no_frame_option): Ditto.
(mi_cmd_stack_list_frames): Add --no-frame-filter and Python frame
filter logic.
(mi_cmd_stack_list_locals): Ditto.
(mi_cmd_stack_list_args): Ditto.
(mi_cmd_stack_list_variables): Ditto.
* NEWS: Add frame filter note.
2013-05-10 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-framefilter.py: New File.
* gdb.python/py-framefilter-mi.exp: Ditto.
* gdb.python/py-framefilter.c: Ditto.
* gdb.python/py-framefilter-mi.exp: Ditto.
* gdb.python/py-framefilter-mi.c: Ditto,
* gdb.python/py-framefilter-gdb.py.in: Ditto.
2013-05-10 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Backtrace): Add "no-filter" argument.
(Python API): Add Frame Filters API, Frame Wrapper API,
Writing a Frame Filter/Wrapper, Managing Management of Frame
Filters chapter entries.
(Frame Filters API): New Node.
(Frame Wrapper API): New Node.
(Writing a Frame Filter): New Node.
(Managing Frame Filters): New Node.
(Progspaces In Python): Add note about frame_filters attribute.
(Objfiles in Python): Ditto.
(GDB/MI Stack Manipulation): Add -enable-frame-filters command,
@anchors and --no-frame-filters option to -stack-list-variables,
-stack-list-frames, -stack-list-locals and -stack-list-arguments
commands.
2013-05-10 18:26:03 +08:00
|
|
|
|
/* The frame filter list of functions. */
|
|
|
|
|
PyObject *frame_filters;
|
2015-04-02 02:49:12 +08:00
|
|
|
|
|
|
|
|
|
/* The frame unwinder list. */
|
|
|
|
|
PyObject *frame_unwinders;
|
|
|
|
|
|
* NEWS: Update.
* data-directory/Makefile.in (PYTHON_FILES): Add
type_printers.py.
* python/lib/gdb/command/type_printers.py: New file.
* python/lib/gdb/command/types.py (TypePrinter): New class.
(_get_some_type_recognizers, get_type_recognizers,
apply_type_recognizers, register_type_printer): New
functions.
* python/py-objfile.c (objfile_object) <type_printers>: New
field.
(objfpy_dealloc): Decref new field.
(objfpy_new): Set new field.
(objfpy_get_type_printers, objfpy_set_type_printers): New
functions.
(objfile_to_objfile_object): Set new field.
(objfile_getset): Add "type_printers".
* python/py-progspace.c (pspace_object) <type_printers>: New
field.
(pspy_dealloc): Decref new field.
(pspy_new): Set new field.
(pspy_get_type_printers, pspy_set_type_printers): New functions.
(pspace_to_pspace_object): Set new field.
(pspace_getset): Add "type_printers".
* python/python.c (start_type_printers, apply_type_printers,
free_type_printers): New functions.
(_initialize_python): Set gdb.type_printers.
* python/python.h (start_type_printers, apply_type_printers,
free_type_printers): Declare.
* typeprint.c (type_print_raw_options, default_ptype_flags):
Update for new fields.
(do_free_global_table, create_global_typedef_table,
find_global_typedef): New functions.
(find_typedef_in_hash): Use find_global_typedef.
(whatis_exp): Use create_global_typedef_table. Change cleanup
handling.
* typeprint.h (struct type_print_options) <global_typedefs,
global_printers>: New fields.
doc
* gdb.texinfo (Symbols): Document "info type-printers",
"enable type-printer" and "disable type-printer".
(Python API): Add new node to menu.
(Type Printing API): New node.
(Progspaces In Python): Document type_printers field.
(Objfiles In Python): Likewise.
(gdb.types) <get_type_recognizers, apply_type_recognizers,
register_type_printer, TypePrinter>: Document.
testsuite
* gdb.base/completion.exp: Update for "info type-printers".
* gdb.python/py-typeprint.cc: New file.
* gdb.python/py-typeprint.exp: New file.
* gdb.python/py-typeprint.py: New file.
2012-11-13 01:41:59 +08:00
|
|
|
|
/* The type-printer list. */
|
|
|
|
|
PyObject *type_printers;
|
2014-05-20 21:53:04 +08:00
|
|
|
|
|
|
|
|
|
/* The debug method list. */
|
|
|
|
|
PyObject *xmethods;
|
2010-04-16 03:54:13 +08:00
|
|
|
|
} pspace_object;
|
|
|
|
|
|
Fix redefinition errors in C++ mode
In C, we can forward declare static structure instances. That doesn't
work in C++ though. C++ treats these as definitions. So then the
compiler complains about symbol redefinition, like:
src/gdb/elfread.c:1569:29: error: redefinition of ‘const sym_fns elf_sym_fns_lazy_psyms’
src/gdb/elfread.c:53:29: error: ‘const sym_fns elf_sym_fns_lazy_psyms’ previously declared here
The intent of static here is naturally to avoid making these objects
visible outside the compilation unit. The equivalent in C++ would be
to instead define the objects in the anonymous namespace. But given
that it's desirable to leave the codebase compiling as both C and C++
for a while, this just makes the objects extern.
(base_breakpoint_ops is already declared in breakpoint.h, so we can
just remove the forward declare from breakpoint.c)
gdb/ChangeLog:
2015-02-11 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
* breakpoint.c (base_breakpoint_ops): Delete.
* dwarf2loc.c (dwarf_expr_ctx_funcs): Make extern.
* elfread.c (elf_sym_fns_gdb_index, elf_sym_fns_lazy_psyms): Make extern.
* guile/guile.c (guile_extension_script_ops, guile_extension_ops): Make extern.
* ppcnbsd-tdep.c (ppcnbsd2_sigtramp): Make extern.
* python/py-arch.c (arch_object_type): Make extern.
* python/py-block.c (block_syms_iterator_object_type): Make extern.
* python/py-bpevent.c (breakpoint_event_object_type): Make extern.
* python/py-cmd.c (cmdpy_object_type): Make extern.
* python/py-continueevent.c (continue_event_object_type)
* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove 'qual'
parameter. Update all callers.
* python/py-evtregistry.c (eventregistry_object_type): Make extern.
* python/py-exitedevent.c (exited_event_object_type): Make extern.
* python/py-finishbreakpoint.c (finish_breakpoint_object_type): Make extern.
* python/py-function.c (fnpy_object_type): Make extern.
* python/py-inferior.c (inferior_object_type, membuf_object_type): Make extern.
* python/py-infevents.c (call_pre_event_object_type)
(inferior_call_post_event_object_type).
(memory_changed_event_object_type): Make extern.
* python/py-infthread.c (thread_object_type): Make extern.
* python/py-lazy-string.c (lazy_string_object_type): Make extern.
* python/py-linetable.c (linetable_entry_object_type)
(linetable_object_type, ltpy_iterator_object_type): Make extern.
* python/py-newobjfileevent.c (new_objfile_event_object_type)
(clear_objfiles_event_object_type): Make extern.
* python/py-objfile.c (objfile_object_type): Make extern.
* python/py-param.c (parmpy_object_type): Make extern.
* python/py-progspace.c (pspace_object_type): Make extern.
* python/py-signalevent.c (signal_event_object_type): Make extern.
* python/py-symtab.c (symtab_object_type, sal_object_type): Make extern.
* python/py-type.c (type_object_type, field_object_type)
(type_iterator_object_type): Make extern.
* python/python.c (python_extension_script_ops)
(python_extension_ops): Make extern.
* stap-probe.c (stap_probe_ops): Make extern.
2015-02-11 19:20:21 +08:00
|
|
|
|
extern PyTypeObject pspace_object_type
|
2013-05-21 04:09:01 +08:00
|
|
|
|
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pspace_object");
|
2010-04-16 03:54:13 +08:00
|
|
|
|
|
|
|
|
|
static const struct program_space_data *pspy_pspace_data_key;
|
|
|
|
|
|
2018-09-14 03:40:41 +08:00
|
|
|
|
/* Require that PSPACE_OBJ be a valid program space ID. */
|
|
|
|
|
#define PSPY_REQUIRE_VALID(pspace_obj) \
|
|
|
|
|
do { \
|
|
|
|
|
if (pspace_obj->pspace == nullptr) \
|
|
|
|
|
{ \
|
|
|
|
|
PyErr_SetString (PyExc_RuntimeError, \
|
|
|
|
|
_("Program space no longer exists.")); \
|
|
|
|
|
return NULL; \
|
|
|
|
|
} \
|
|
|
|
|
} while (0)
|
2010-04-16 03:54:13 +08:00
|
|
|
|
|
|
|
|
|
/* An Objfile method which returns the objfile's file name, or None. */
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
pspy_get_filename (PyObject *self, void *closure)
|
|
|
|
|
{
|
|
|
|
|
pspace_object *obj = (pspace_object *) self;
|
2010-05-18 05:23:25 +08:00
|
|
|
|
|
2010-04-16 03:54:13 +08:00
|
|
|
|
if (obj->pspace)
|
|
|
|
|
{
|
|
|
|
|
struct objfile *objfile = obj->pspace->symfile_object_file;
|
2010-05-18 05:23:25 +08:00
|
|
|
|
|
2010-09-23 04:00:53 +08:00
|
|
|
|
if (objfile)
|
2016-03-30 14:48:35 +08:00
|
|
|
|
return host_string_to_python_string (objfile_name (objfile));
|
2010-04-16 03:54:13 +08:00
|
|
|
|
}
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
pspy_dealloc (PyObject *self)
|
|
|
|
|
{
|
|
|
|
|
pspace_object *ps_self = (pspace_object *) self;
|
2010-05-18 05:23:25 +08:00
|
|
|
|
|
2014-10-31 08:05:17 +08:00
|
|
|
|
Py_XDECREF (ps_self->dict);
|
2010-04-16 03:54:13 +08:00
|
|
|
|
Py_XDECREF (ps_self->printers);
|
2013-05-10 Phil Muldoon <pmuldoon@redhat.com>
* stack.c (backtrace_command_1): Add "no-filters", and Python frame
filter logic.
(backtrace_command): Add "no-filters" option parsing.
(_initialize_stack): Alter help to reflect "no-filters" option.
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-framefilter.o
(SUBDIR_PYTHON_SRCS): Add py-framefilter.c
(py-frame.o): Add target
* data-directory/Makefile.in (PYTHON_DIR): Add Python frame
filter files.
* python/python.h: Add new frame filter constants, and flag enum.
(apply_frame_filter): Add definition.
* python/python.c (apply_frame_filter): New non-Python
enabled function.
* python/py-utils.c (py_xdecref): New function.
(make_cleanup_py_xdecref): Ditto.
* python/py-objfile.c: Declare frame_filters dictionary.
(objfpy_dealloc): Add frame_filters dealloc.
(objfpy_new): Initialize frame_filters attribute.
(objfile_to_objfile_object): Ditto.
(objfpy_get_frame_filters): New function.
(objfpy_set_frame_filters): New function.
* python/py-progspace.c: Declare frame_filters dictionary.
(pspy_dealloc): Add frame_filters dealloc.
(pspy_new): Initialize frame_filters attribute.
(pspacee_to_pspace_object): Ditto.
(pspy_get_frame_filters): New function.
(pspy_set_frame_filters): New function.
* python/py-framefilter.c: New file.
* python/lib/gdb/command/frame_filters.py: New file.
* python/lib/gdb/frames.py: New file.
* python/lib/gdb/__init__.py: Initialize global frame_filters
dictionary
* python/lib/gdb/FrameDecorator.py: New file.
* python/lib/gdb/FrameIterator.py: New file.
* mi/mi-cmds.c (mi_cmds): Add frame filters command.
* mi/mi-cmds.h: Declare.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Add
--no-frame-filter logic, and Python frame filter logic.
(stack_enable_frame_filters): New function.
(parse_no_frame_option): Ditto.
(mi_cmd_stack_list_frames): Add --no-frame-filter and Python frame
filter logic.
(mi_cmd_stack_list_locals): Ditto.
(mi_cmd_stack_list_args): Ditto.
(mi_cmd_stack_list_variables): Ditto.
* NEWS: Add frame filter note.
2013-05-10 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-framefilter.py: New File.
* gdb.python/py-framefilter-mi.exp: Ditto.
* gdb.python/py-framefilter.c: Ditto.
* gdb.python/py-framefilter-mi.exp: Ditto.
* gdb.python/py-framefilter-mi.c: Ditto,
* gdb.python/py-framefilter-gdb.py.in: Ditto.
2013-05-10 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Backtrace): Add "no-filter" argument.
(Python API): Add Frame Filters API, Frame Wrapper API,
Writing a Frame Filter/Wrapper, Managing Management of Frame
Filters chapter entries.
(Frame Filters API): New Node.
(Frame Wrapper API): New Node.
(Writing a Frame Filter): New Node.
(Managing Frame Filters): New Node.
(Progspaces In Python): Add note about frame_filters attribute.
(Objfiles in Python): Ditto.
(GDB/MI Stack Manipulation): Add -enable-frame-filters command,
@anchors and --no-frame-filters option to -stack-list-variables,
-stack-list-frames, -stack-list-locals and -stack-list-arguments
commands.
2013-05-10 18:26:03 +08:00
|
|
|
|
Py_XDECREF (ps_self->frame_filters);
|
2015-04-02 02:49:12 +08:00
|
|
|
|
Py_XDECREF (ps_self->frame_unwinders);
|
* NEWS: Update.
* data-directory/Makefile.in (PYTHON_FILES): Add
type_printers.py.
* python/lib/gdb/command/type_printers.py: New file.
* python/lib/gdb/command/types.py (TypePrinter): New class.
(_get_some_type_recognizers, get_type_recognizers,
apply_type_recognizers, register_type_printer): New
functions.
* python/py-objfile.c (objfile_object) <type_printers>: New
field.
(objfpy_dealloc): Decref new field.
(objfpy_new): Set new field.
(objfpy_get_type_printers, objfpy_set_type_printers): New
functions.
(objfile_to_objfile_object): Set new field.
(objfile_getset): Add "type_printers".
* python/py-progspace.c (pspace_object) <type_printers>: New
field.
(pspy_dealloc): Decref new field.
(pspy_new): Set new field.
(pspy_get_type_printers, pspy_set_type_printers): New functions.
(pspace_to_pspace_object): Set new field.
(pspace_getset): Add "type_printers".
* python/python.c (start_type_printers, apply_type_printers,
free_type_printers): New functions.
(_initialize_python): Set gdb.type_printers.
* python/python.h (start_type_printers, apply_type_printers,
free_type_printers): Declare.
* typeprint.c (type_print_raw_options, default_ptype_flags):
Update for new fields.
(do_free_global_table, create_global_typedef_table,
find_global_typedef): New functions.
(find_typedef_in_hash): Use find_global_typedef.
(whatis_exp): Use create_global_typedef_table. Change cleanup
handling.
* typeprint.h (struct type_print_options) <global_typedefs,
global_printers>: New fields.
doc
* gdb.texinfo (Symbols): Document "info type-printers",
"enable type-printer" and "disable type-printer".
(Python API): Add new node to menu.
(Type Printing API): New node.
(Progspaces In Python): Document type_printers field.
(Objfiles In Python): Likewise.
(gdb.types) <get_type_recognizers, apply_type_recognizers,
register_type_printer, TypePrinter>: Document.
testsuite
* gdb.base/completion.exp: Update for "info type-printers".
* gdb.python/py-typeprint.cc: New file.
* gdb.python/py-typeprint.exp: New file.
* gdb.python/py-typeprint.py: New file.
2012-11-13 01:41:59 +08:00
|
|
|
|
Py_XDECREF (ps_self->type_printers);
|
2014-05-20 21:53:04 +08:00
|
|
|
|
Py_XDECREF (ps_self->xmethods);
|
2012-12-13 00:47:30 +08:00
|
|
|
|
Py_TYPE (self)->tp_free (self);
|
2010-04-16 03:54:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-14 03:24:54 +08:00
|
|
|
|
/* Initialize a pspace_object.
|
|
|
|
|
The result is a boolean indicating success. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
pspy_initialize (pspace_object *self)
|
|
|
|
|
{
|
|
|
|
|
self->pspace = NULL;
|
2016-05-19 11:19:17 +08:00
|
|
|
|
|
|
|
|
|
self->dict = PyDict_New ();
|
|
|
|
|
if (self->dict == NULL)
|
|
|
|
|
return 0;
|
2014-10-14 03:24:54 +08:00
|
|
|
|
|
|
|
|
|
self->printers = PyList_New (0);
|
|
|
|
|
if (self->printers == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
self->frame_filters = PyDict_New ();
|
|
|
|
|
if (self->frame_filters == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
2015-04-02 02:49:12 +08:00
|
|
|
|
self->frame_unwinders = PyList_New (0);
|
|
|
|
|
if (self->frame_unwinders == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
2014-10-14 03:24:54 +08:00
|
|
|
|
self->type_printers = PyList_New (0);
|
|
|
|
|
if (self->type_printers == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
self->xmethods = PyList_New (0);
|
|
|
|
|
if (self->xmethods == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-16 03:54:13 +08:00
|
|
|
|
static PyObject *
|
|
|
|
|
pspy_new (PyTypeObject *type, PyObject *args, PyObject *keywords)
|
|
|
|
|
{
|
2017-01-12 07:28:43 +08:00
|
|
|
|
gdbpy_ref<pspace_object> self ((pspace_object *) type->tp_alloc (type, 0));
|
2010-05-18 05:23:25 +08:00
|
|
|
|
|
2017-01-12 07:28:43 +08:00
|
|
|
|
if (self != NULL)
|
2010-04-16 03:54:13 +08:00
|
|
|
|
{
|
2017-01-12 07:28:43 +08:00
|
|
|
|
if (!pspy_initialize (self.get ()))
|
|
|
|
|
return NULL;
|
2010-04-16 03:54:13 +08:00
|
|
|
|
}
|
2014-10-14 03:24:54 +08:00
|
|
|
|
|
2017-01-12 07:28:43 +08:00
|
|
|
|
return (PyObject *) self.release ();
|
2010-04-16 03:54:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
|
pspy_get_printers (PyObject *o, void *ignore)
|
|
|
|
|
{
|
|
|
|
|
pspace_object *self = (pspace_object *) o;
|
2010-05-18 05:23:25 +08:00
|
|
|
|
|
2010-04-16 03:54:13 +08:00
|
|
|
|
Py_INCREF (self->printers);
|
|
|
|
|
return self->printers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
pspy_set_printers (PyObject *o, PyObject *value, void *ignore)
|
|
|
|
|
{
|
|
|
|
|
PyObject *tmp;
|
|
|
|
|
pspace_object *self = (pspace_object *) o;
|
2010-05-18 05:23:25 +08:00
|
|
|
|
|
2010-04-16 03:54:13 +08:00
|
|
|
|
if (! value)
|
|
|
|
|
{
|
|
|
|
|
PyErr_SetString (PyExc_TypeError,
|
|
|
|
|
"cannot delete the pretty_printers attribute");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! PyList_Check (value))
|
|
|
|
|
{
|
|
|
|
|
PyErr_SetString (PyExc_TypeError,
|
|
|
|
|
"the pretty_printers attribute must be a list");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Take care in case the LHS and RHS are related somehow. */
|
|
|
|
|
tmp = self->printers;
|
|
|
|
|
Py_INCREF (value);
|
|
|
|
|
self->printers = value;
|
|
|
|
|
Py_XDECREF (tmp);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-10 Phil Muldoon <pmuldoon@redhat.com>
* stack.c (backtrace_command_1): Add "no-filters", and Python frame
filter logic.
(backtrace_command): Add "no-filters" option parsing.
(_initialize_stack): Alter help to reflect "no-filters" option.
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-framefilter.o
(SUBDIR_PYTHON_SRCS): Add py-framefilter.c
(py-frame.o): Add target
* data-directory/Makefile.in (PYTHON_DIR): Add Python frame
filter files.
* python/python.h: Add new frame filter constants, and flag enum.
(apply_frame_filter): Add definition.
* python/python.c (apply_frame_filter): New non-Python
enabled function.
* python/py-utils.c (py_xdecref): New function.
(make_cleanup_py_xdecref): Ditto.
* python/py-objfile.c: Declare frame_filters dictionary.
(objfpy_dealloc): Add frame_filters dealloc.
(objfpy_new): Initialize frame_filters attribute.
(objfile_to_objfile_object): Ditto.
(objfpy_get_frame_filters): New function.
(objfpy_set_frame_filters): New function.
* python/py-progspace.c: Declare frame_filters dictionary.
(pspy_dealloc): Add frame_filters dealloc.
(pspy_new): Initialize frame_filters attribute.
(pspacee_to_pspace_object): Ditto.
(pspy_get_frame_filters): New function.
(pspy_set_frame_filters): New function.
* python/py-framefilter.c: New file.
* python/lib/gdb/command/frame_filters.py: New file.
* python/lib/gdb/frames.py: New file.
* python/lib/gdb/__init__.py: Initialize global frame_filters
dictionary
* python/lib/gdb/FrameDecorator.py: New file.
* python/lib/gdb/FrameIterator.py: New file.
* mi/mi-cmds.c (mi_cmds): Add frame filters command.
* mi/mi-cmds.h: Declare.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Add
--no-frame-filter logic, and Python frame filter logic.
(stack_enable_frame_filters): New function.
(parse_no_frame_option): Ditto.
(mi_cmd_stack_list_frames): Add --no-frame-filter and Python frame
filter logic.
(mi_cmd_stack_list_locals): Ditto.
(mi_cmd_stack_list_args): Ditto.
(mi_cmd_stack_list_variables): Ditto.
* NEWS: Add frame filter note.
2013-05-10 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-framefilter.py: New File.
* gdb.python/py-framefilter-mi.exp: Ditto.
* gdb.python/py-framefilter.c: Ditto.
* gdb.python/py-framefilter-mi.exp: Ditto.
* gdb.python/py-framefilter-mi.c: Ditto,
* gdb.python/py-framefilter-gdb.py.in: Ditto.
2013-05-10 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Backtrace): Add "no-filter" argument.
(Python API): Add Frame Filters API, Frame Wrapper API,
Writing a Frame Filter/Wrapper, Managing Management of Frame
Filters chapter entries.
(Frame Filters API): New Node.
(Frame Wrapper API): New Node.
(Writing a Frame Filter): New Node.
(Managing Frame Filters): New Node.
(Progspaces In Python): Add note about frame_filters attribute.
(Objfiles in Python): Ditto.
(GDB/MI Stack Manipulation): Add -enable-frame-filters command,
@anchors and --no-frame-filters option to -stack-list-variables,
-stack-list-frames, -stack-list-locals and -stack-list-arguments
commands.
2013-05-10 18:26:03 +08:00
|
|
|
|
/* Return the Python dictionary attribute containing frame filters for
|
|
|
|
|
this program space. */
|
|
|
|
|
PyObject *
|
|
|
|
|
pspy_get_frame_filters (PyObject *o, void *ignore)
|
|
|
|
|
{
|
|
|
|
|
pspace_object *self = (pspace_object *) o;
|
|
|
|
|
|
|
|
|
|
Py_INCREF (self->frame_filters);
|
|
|
|
|
return self->frame_filters;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set this object file's frame filters dictionary to FILTERS. */
|
|
|
|
|
static int
|
|
|
|
|
pspy_set_frame_filters (PyObject *o, PyObject *frame, void *ignore)
|
|
|
|
|
{
|
|
|
|
|
PyObject *tmp;
|
|
|
|
|
pspace_object *self = (pspace_object *) o;
|
|
|
|
|
|
|
|
|
|
if (! frame)
|
|
|
|
|
{
|
|
|
|
|
PyErr_SetString (PyExc_TypeError,
|
|
|
|
|
"cannot delete the frame filter attribute");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! PyDict_Check (frame))
|
|
|
|
|
{
|
|
|
|
|
PyErr_SetString (PyExc_TypeError,
|
|
|
|
|
"the frame filter attribute must be a dictionary");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Take care in case the LHS and RHS are related somehow. */
|
|
|
|
|
tmp = self->frame_filters;
|
|
|
|
|
Py_INCREF (frame);
|
|
|
|
|
self->frame_filters = frame;
|
|
|
|
|
Py_XDECREF (tmp);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-02 02:49:12 +08:00
|
|
|
|
/* Return the list of the frame unwinders for this program space. */
|
|
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
|
pspy_get_frame_unwinders (PyObject *o, void *ignore)
|
|
|
|
|
{
|
|
|
|
|
pspace_object *self = (pspace_object *) o;
|
|
|
|
|
|
|
|
|
|
Py_INCREF (self->frame_unwinders);
|
|
|
|
|
return self->frame_unwinders;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set this program space's list of the unwinders to UNWINDERS. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
pspy_set_frame_unwinders (PyObject *o, PyObject *unwinders, void *ignore)
|
|
|
|
|
{
|
|
|
|
|
PyObject *tmp;
|
|
|
|
|
pspace_object *self = (pspace_object *) o;
|
|
|
|
|
|
|
|
|
|
if (!unwinders)
|
|
|
|
|
{
|
|
|
|
|
PyErr_SetString (PyExc_TypeError,
|
|
|
|
|
"cannot delete the frame unwinders list");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!PyList_Check (unwinders))
|
|
|
|
|
{
|
|
|
|
|
PyErr_SetString (PyExc_TypeError,
|
|
|
|
|
"the frame unwinders attribute must be a list");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Take care in case the LHS and RHS are related somehow. */
|
|
|
|
|
tmp = self->frame_unwinders;
|
|
|
|
|
Py_INCREF (unwinders);
|
|
|
|
|
self->frame_unwinders = unwinders;
|
|
|
|
|
Py_XDECREF (tmp);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
* NEWS: Update.
* data-directory/Makefile.in (PYTHON_FILES): Add
type_printers.py.
* python/lib/gdb/command/type_printers.py: New file.
* python/lib/gdb/command/types.py (TypePrinter): New class.
(_get_some_type_recognizers, get_type_recognizers,
apply_type_recognizers, register_type_printer): New
functions.
* python/py-objfile.c (objfile_object) <type_printers>: New
field.
(objfpy_dealloc): Decref new field.
(objfpy_new): Set new field.
(objfpy_get_type_printers, objfpy_set_type_printers): New
functions.
(objfile_to_objfile_object): Set new field.
(objfile_getset): Add "type_printers".
* python/py-progspace.c (pspace_object) <type_printers>: New
field.
(pspy_dealloc): Decref new field.
(pspy_new): Set new field.
(pspy_get_type_printers, pspy_set_type_printers): New functions.
(pspace_to_pspace_object): Set new field.
(pspace_getset): Add "type_printers".
* python/python.c (start_type_printers, apply_type_printers,
free_type_printers): New functions.
(_initialize_python): Set gdb.type_printers.
* python/python.h (start_type_printers, apply_type_printers,
free_type_printers): Declare.
* typeprint.c (type_print_raw_options, default_ptype_flags):
Update for new fields.
(do_free_global_table, create_global_typedef_table,
find_global_typedef): New functions.
(find_typedef_in_hash): Use find_global_typedef.
(whatis_exp): Use create_global_typedef_table. Change cleanup
handling.
* typeprint.h (struct type_print_options) <global_typedefs,
global_printers>: New fields.
doc
* gdb.texinfo (Symbols): Document "info type-printers",
"enable type-printer" and "disable type-printer".
(Python API): Add new node to menu.
(Type Printing API): New node.
(Progspaces In Python): Document type_printers field.
(Objfiles In Python): Likewise.
(gdb.types) <get_type_recognizers, apply_type_recognizers,
register_type_printer, TypePrinter>: Document.
testsuite
* gdb.base/completion.exp: Update for "info type-printers".
* gdb.python/py-typeprint.cc: New file.
* gdb.python/py-typeprint.exp: New file.
* gdb.python/py-typeprint.py: New file.
2012-11-13 01:41:59 +08:00
|
|
|
|
/* Get the 'type_printers' attribute. */
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
pspy_get_type_printers (PyObject *o, void *ignore)
|
|
|
|
|
{
|
|
|
|
|
pspace_object *self = (pspace_object *) o;
|
|
|
|
|
|
|
|
|
|
Py_INCREF (self->type_printers);
|
|
|
|
|
return self->type_printers;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-20 21:53:04 +08:00
|
|
|
|
/* Get the 'xmethods' attribute. */
|
|
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
|
pspy_get_xmethods (PyObject *o, void *ignore)
|
|
|
|
|
{
|
|
|
|
|
pspace_object *self = (pspace_object *) o;
|
|
|
|
|
|
|
|
|
|
Py_INCREF (self->xmethods);
|
|
|
|
|
return self->xmethods;
|
|
|
|
|
}
|
|
|
|
|
|
* NEWS: Update.
* data-directory/Makefile.in (PYTHON_FILES): Add
type_printers.py.
* python/lib/gdb/command/type_printers.py: New file.
* python/lib/gdb/command/types.py (TypePrinter): New class.
(_get_some_type_recognizers, get_type_recognizers,
apply_type_recognizers, register_type_printer): New
functions.
* python/py-objfile.c (objfile_object) <type_printers>: New
field.
(objfpy_dealloc): Decref new field.
(objfpy_new): Set new field.
(objfpy_get_type_printers, objfpy_set_type_printers): New
functions.
(objfile_to_objfile_object): Set new field.
(objfile_getset): Add "type_printers".
* python/py-progspace.c (pspace_object) <type_printers>: New
field.
(pspy_dealloc): Decref new field.
(pspy_new): Set new field.
(pspy_get_type_printers, pspy_set_type_printers): New functions.
(pspace_to_pspace_object): Set new field.
(pspace_getset): Add "type_printers".
* python/python.c (start_type_printers, apply_type_printers,
free_type_printers): New functions.
(_initialize_python): Set gdb.type_printers.
* python/python.h (start_type_printers, apply_type_printers,
free_type_printers): Declare.
* typeprint.c (type_print_raw_options, default_ptype_flags):
Update for new fields.
(do_free_global_table, create_global_typedef_table,
find_global_typedef): New functions.
(find_typedef_in_hash): Use find_global_typedef.
(whatis_exp): Use create_global_typedef_table. Change cleanup
handling.
* typeprint.h (struct type_print_options) <global_typedefs,
global_printers>: New fields.
doc
* gdb.texinfo (Symbols): Document "info type-printers",
"enable type-printer" and "disable type-printer".
(Python API): Add new node to menu.
(Type Printing API): New node.
(Progspaces In Python): Document type_printers field.
(Objfiles In Python): Likewise.
(gdb.types) <get_type_recognizers, apply_type_recognizers,
register_type_printer, TypePrinter>: Document.
testsuite
* gdb.base/completion.exp: Update for "info type-printers".
* gdb.python/py-typeprint.cc: New file.
* gdb.python/py-typeprint.exp: New file.
* gdb.python/py-typeprint.py: New file.
2012-11-13 01:41:59 +08:00
|
|
|
|
/* Set the 'type_printers' attribute. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
pspy_set_type_printers (PyObject *o, PyObject *value, void *ignore)
|
|
|
|
|
{
|
|
|
|
|
PyObject *tmp;
|
|
|
|
|
pspace_object *self = (pspace_object *) o;
|
|
|
|
|
|
|
|
|
|
if (! value)
|
|
|
|
|
{
|
|
|
|
|
PyErr_SetString (PyExc_TypeError,
|
|
|
|
|
"cannot delete the type_printers attribute");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! PyList_Check (value))
|
|
|
|
|
{
|
|
|
|
|
PyErr_SetString (PyExc_TypeError,
|
|
|
|
|
"the type_printers attribute must be a list");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Take care in case the LHS and RHS are related somehow. */
|
|
|
|
|
tmp = self->type_printers;
|
|
|
|
|
Py_INCREF (value);
|
|
|
|
|
self->type_printers = value;
|
|
|
|
|
Py_XDECREF (tmp);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-14 03:40:41 +08:00
|
|
|
|
/* Implement the objfiles method. */
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
pspy_get_objfiles (PyObject *self_, PyObject *args)
|
|
|
|
|
{
|
|
|
|
|
pspace_object *self = (pspace_object *) self_;
|
|
|
|
|
|
|
|
|
|
PSPY_REQUIRE_VALID (self);
|
|
|
|
|
|
|
|
|
|
return build_objfiles_list (self->pspace).release ();
|
|
|
|
|
}
|
2010-04-16 03:54:13 +08:00
|
|
|
|
|
|
|
|
|
/* Clear the PSPACE pointer in a Pspace object and remove the reference. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
py_free_pspace (struct program_space *pspace, void *datum)
|
|
|
|
|
{
|
2014-05-21 04:06:26 +08:00
|
|
|
|
/* This is a fiction, but we're in a nasty spot: The pspace is in the
|
|
|
|
|
process of being deleted, we can't rely on anything in it. Plus
|
|
|
|
|
this is one time when the current program space and current inferior
|
|
|
|
|
are not in sync: All inferiors that use PSPACE may no longer exist.
|
|
|
|
|
We don't need to do much here, and since "there is always an inferior"
|
|
|
|
|
using target_gdbarch suffices.
|
|
|
|
|
Note: We cannot call get_current_arch because it may try to access
|
|
|
|
|
the target, which may involve accessing data in the pspace currently
|
|
|
|
|
being deleted. */
|
|
|
|
|
struct gdbarch *arch = target_gdbarch ();
|
2010-04-16 03:54:13 +08:00
|
|
|
|
|
2016-11-08 07:08:36 +08:00
|
|
|
|
gdbpy_enter enter_py (arch, current_language);
|
2017-01-12 07:28:43 +08:00
|
|
|
|
gdbpy_ref<pspace_object> object ((pspace_object *) datum);
|
2010-04-16 03:54:13 +08:00
|
|
|
|
object->pspace = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a borrowed reference to the Python object of type Pspace
|
|
|
|
|
representing PSPACE. If the object has already been created,
|
|
|
|
|
return it. Otherwise, create it. Return NULL and set the Python
|
|
|
|
|
error on failure. */
|
|
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
|
pspace_to_pspace_object (struct program_space *pspace)
|
|
|
|
|
{
|
2017-01-12 07:28:43 +08:00
|
|
|
|
gdbpy_ref<pspace_object> object
|
|
|
|
|
((pspace_object *) program_space_data (pspace, pspy_pspace_data_key));
|
|
|
|
|
if (object == NULL)
|
2010-04-16 03:54:13 +08:00
|
|
|
|
{
|
2017-01-12 07:28:43 +08:00
|
|
|
|
object.reset (PyObject_New (pspace_object, &pspace_object_type));
|
|
|
|
|
if (object != NULL)
|
2010-04-16 03:54:13 +08:00
|
|
|
|
{
|
2017-01-12 07:28:43 +08:00
|
|
|
|
if (!pspy_initialize (object.get ()))
|
|
|
|
|
return NULL;
|
2014-05-20 21:53:04 +08:00
|
|
|
|
|
2014-10-14 03:24:54 +08:00
|
|
|
|
object->pspace = pspace;
|
2017-01-12 07:28:43 +08:00
|
|
|
|
set_program_space_data (pspace, pspy_pspace_data_key, object.get ());
|
2010-04-16 03:54:13 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-12 07:28:43 +08:00
|
|
|
|
return (PyObject *) object.release ();
|
2010-04-16 03:54:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
* python/py-arch.c (gdbpy_initialize_arch): Return 'int'.
Check errors.
* python/py-auto-load.c (gdbpy_initialize_auto_load): Return 'int'.
* python/py-block.c (gdbpy_initialize_blocks): Return 'int'.
Check errors.
* python/py-breakpoint.c (gdbpy_initialize_breakpoints): Return 'int'.
Check errors.
* python/py-cmd.c (gdbpy_initialize_commands): Return 'int'.
Check errors.
* python/py-event.c (gdbpy_initialize_event): Return 'int'.
Check errors.
* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Change generated
init function to return 'int'.
* python/py-evtregistry.c (gdbpy_initialize_eventregistry):
Return 'int'. Check errors.
* python/py-evts.c (gdbpy_initialize_py_events): Return 'int'.
Check errors.
* python/py-finishbreakpoint.c (gdbpy_initialize_finishbreakpoints):
Return 'int'. Check errors.
* python/py-frame.c (gdbpy_initialize_frames): Return 'int'.
Check errors.
* python/py-function.c (gdbpy_initialize_functions): Return 'int'.
Check errors.
* python/py-gdb-readline.c (gdbpy_initialize_gdb_readline):
Check errors.
* python/py-inferior.c (gdbpy_initialize_inferior): Return 'int'.
Check errors.
* python/py-infthread.c (gdbpy_initialize_thread): Return 'int'.
Check errors.
* python/py-lazy-string.c (gdbpy_initialize_lazy_string): Return 'int'.
Check errors.
* python/py-objfile.c (gdbpy_initialize_objfile): Return 'int'.
Check errors.
* python/py-param.c (gdbpy_initialize_parameters): Return 'int'.
Check errors.
* python/py-progspace.c (gdbpy_initialize_pspace): Return 'int'.
Check errors.
* python/py-symbol.c (gdbpy_initialize_symbols): Return 'int'.
Check errors.
* python/py-symtab.c (gdbpy_initialize_symtabs): Return 'int'.
Check errors.
* python/py-type.c (gdbpy_initialize_types): Return 'int'.
Check errors.
* python/py-value.c (gdbpy_initialize_values): Return 'int'.
Check errors.
* python/python-internal.h (gdbpy_initialize_auto_load,
gdbpy_initialize_values, gdbpy_initialize_frames,
gdbpy_initialize_symtabs, gdbpy_initialize_commands,
gdbpy_initialize_symbols, gdbpy_initialize_symtabs,
gdbpy_initialize_blocks, gdbpy_initialize_types,
gdbpy_initialize_functions, gdbpy_initialize_pspace,
gdbpy_initialize_objfile, gdbpy_initialize_breakpoints,
gdbpy_initialize_finishbreakpoints,
gdbpy_initialize_lazy_string, gdbpy_initialize_parameters,
gdbpy_initialize_thread, gdbpy_initialize_inferior,
gdbpy_initialize_eventregistry, gdbpy_initialize_event,
gdbpy_initialize_py_events, gdbpy_initialize_stop_event,
gdbpy_initialize_signal_event,
gdbpy_initialize_breakpoint_event,
gdbpy_initialize_continue_event,
gdbpy_initialize_exited_event, gdbpy_initialize_thread_event,
gdbpy_initialize_new_objfile_event, gdbpy_initialize_arch):
Update. Use CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION.
* python/python.c (gdb_python_initialized): New global.
(gdbpy_initialize_events): Return 'int'. Check errors.
(_initialize_python): Check errors. Set
gdb_python_initialized.
2013-05-21 04:28:52 +08:00
|
|
|
|
int
|
2010-04-16 03:54:13 +08:00
|
|
|
|
gdbpy_initialize_pspace (void)
|
|
|
|
|
{
|
|
|
|
|
pspy_pspace_data_key
|
* auto-load.c (_initialize_auto_load): Update.
* solib-svr4.c (_initialize_svr4_solib): Update
* solib-dsbt.c (_initialize_dsbt_solib): Update.
* solib-darwin.c (_initialize_darwin_solib): Update.
* registry.h: New file.
* python/py-progspace.c (gdbpy_initialize_pspace): Update.
* python/py-inferior.c (gdbpy_initialize_inferior): Update.
* progspace.h: Include registry.h. Use DECLARE_REGISTRY.
(register_program_space_data_with_cleanup)
(register_program_space_data, program_space_alloc_data)
(clear_program_space_data, set_program_space_data)
(program_space_data): Don't declare.
* progspace.c: Use DEFINE_REGISTRY.
(struct program_space_data, struct
program_space_data_registration, struct
program_space_data_registry, program_space_data_registry)
(register_program_space_data_with_cleanup)
(register_program_space_data, program_space_alloc_data)
(program_space_free_data, clear_program_space_data)
(set_program_space_data, program_space_data): Remove.
* objfiles.h: Include registry.h. Use DECLARE_REGISTRY.
(struct objfile) <data, num_data>: Replace with REGISTRY_FIELDS.
(register_objfile_data_with_cleanup, register_objfile_data)
(clear_objfile_data, set_objfile_data, objfile_data): Don't
declare.
* objfiles.c: Use DEFINE_REGISTRY.
(struct objfile_data, struct objfile_data_registration, struct
objfile_data_registry, objfile_data_registry)
(register_objfile_data_with_cleanup, register_objfile_data)
(objfile_alloc_data, objfile_free_data, clear_objfile_data)
(set_objfile_data, objfile_data): Remove.
(_initialize_objfiles): Update.
* jit.c (_initialize_jit): Update.
* inflow.c (_initialize_inflow): Update.
* inferior.h: Include registry.h. Use DECLARE_REGISTRY.
(struct inferior) <data, num_data>: Replace with REGISTRY_FIELDS.
(register_inferior_data_with_cleanup, register_inferior_data)
(clear_inferior_data, set_inferior_data, inferior_data): Don't
declare.
* inferior.c: Use DEFINE_REGISTRY.
(struct inferior_data, struct inferior_data_registration, struct
inferior_data_registry, inferior_data_registry)
(register_inferior_data_with_cleanup, register_inferior_data)
(inferior_alloc_data, inferior_free_data clear_inferior_data)
(set_inferior_data, inferior_data): Remove.
* auxv.c (_initialize_auxv): Update.
* ada-lang.c (_initialize_ada_language): Update.
* breakpoint.c (_initialize_breakpoint): Update.
* i386-nat.c (i386_use_watchpoints): Update.
2012-08-22 23:17:21 +08:00
|
|
|
|
= register_program_space_data_with_cleanup (NULL, py_free_pspace);
|
2010-04-16 03:54:13 +08:00
|
|
|
|
|
|
|
|
|
if (PyType_Ready (&pspace_object_type) < 0)
|
* python/py-arch.c (gdbpy_initialize_arch): Return 'int'.
Check errors.
* python/py-auto-load.c (gdbpy_initialize_auto_load): Return 'int'.
* python/py-block.c (gdbpy_initialize_blocks): Return 'int'.
Check errors.
* python/py-breakpoint.c (gdbpy_initialize_breakpoints): Return 'int'.
Check errors.
* python/py-cmd.c (gdbpy_initialize_commands): Return 'int'.
Check errors.
* python/py-event.c (gdbpy_initialize_event): Return 'int'.
Check errors.
* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Change generated
init function to return 'int'.
* python/py-evtregistry.c (gdbpy_initialize_eventregistry):
Return 'int'. Check errors.
* python/py-evts.c (gdbpy_initialize_py_events): Return 'int'.
Check errors.
* python/py-finishbreakpoint.c (gdbpy_initialize_finishbreakpoints):
Return 'int'. Check errors.
* python/py-frame.c (gdbpy_initialize_frames): Return 'int'.
Check errors.
* python/py-function.c (gdbpy_initialize_functions): Return 'int'.
Check errors.
* python/py-gdb-readline.c (gdbpy_initialize_gdb_readline):
Check errors.
* python/py-inferior.c (gdbpy_initialize_inferior): Return 'int'.
Check errors.
* python/py-infthread.c (gdbpy_initialize_thread): Return 'int'.
Check errors.
* python/py-lazy-string.c (gdbpy_initialize_lazy_string): Return 'int'.
Check errors.
* python/py-objfile.c (gdbpy_initialize_objfile): Return 'int'.
Check errors.
* python/py-param.c (gdbpy_initialize_parameters): Return 'int'.
Check errors.
* python/py-progspace.c (gdbpy_initialize_pspace): Return 'int'.
Check errors.
* python/py-symbol.c (gdbpy_initialize_symbols): Return 'int'.
Check errors.
* python/py-symtab.c (gdbpy_initialize_symtabs): Return 'int'.
Check errors.
* python/py-type.c (gdbpy_initialize_types): Return 'int'.
Check errors.
* python/py-value.c (gdbpy_initialize_values): Return 'int'.
Check errors.
* python/python-internal.h (gdbpy_initialize_auto_load,
gdbpy_initialize_values, gdbpy_initialize_frames,
gdbpy_initialize_symtabs, gdbpy_initialize_commands,
gdbpy_initialize_symbols, gdbpy_initialize_symtabs,
gdbpy_initialize_blocks, gdbpy_initialize_types,
gdbpy_initialize_functions, gdbpy_initialize_pspace,
gdbpy_initialize_objfile, gdbpy_initialize_breakpoints,
gdbpy_initialize_finishbreakpoints,
gdbpy_initialize_lazy_string, gdbpy_initialize_parameters,
gdbpy_initialize_thread, gdbpy_initialize_inferior,
gdbpy_initialize_eventregistry, gdbpy_initialize_event,
gdbpy_initialize_py_events, gdbpy_initialize_stop_event,
gdbpy_initialize_signal_event,
gdbpy_initialize_breakpoint_event,
gdbpy_initialize_continue_event,
gdbpy_initialize_exited_event, gdbpy_initialize_thread_event,
gdbpy_initialize_new_objfile_event, gdbpy_initialize_arch):
Update. Use CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION.
* python/python.c (gdb_python_initialized): New global.
(gdbpy_initialize_events): Return 'int'. Check errors.
(_initialize_python): Check errors. Set
gdb_python_initialized.
2013-05-21 04:28:52 +08:00
|
|
|
|
return -1;
|
2010-04-16 03:54:13 +08:00
|
|
|
|
|
2013-05-21 04:36:19 +08:00
|
|
|
|
return gdb_pymodule_addobject (gdb_module, "Progspace",
|
|
|
|
|
(PyObject *) &pspace_object_type);
|
2010-04-16 03:54:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-Wwrite-strings: Wrap PyGetSetDef for construction with string literals
Unfortunately, PyGetSetDef's 'name' and 'doc' members are 'char *'
instead of 'const char *', meaning that in order to list-initialize
PyGetSetDef arrays using string literals requires writing explicit
'char *' casts. For example:
static PyGetSetDef value_object_getset[] = {
- { "address", valpy_get_address, NULL, "The address of the value.",
+ { (char *) "address", valpy_get_address, NULL,
+ (char *) "The address of the value.",
NULL },
- { "is_optimized_out", valpy_get_is_optimized_out, NULL,
- "Boolean telling whether the value is optimized "
+ { (char *) "is_optimized_out", valpy_get_is_optimized_out, NULL,
+ (char *) "Boolean telling whether the value is optimized "
"out (i.e., not available).",
NULL },
- { "type", valpy_get_type, NULL, "Type of the value.", NULL },
- { "dynamic_type", valpy_get_dynamic_type, NULL,
- "Dynamic type of the value.", NULL },
- { "is_lazy", valpy_get_is_lazy, NULL,
- "Boolean telling whether the value is lazy (not fetched yet\n\
+ { (char *) "type", valpy_get_type, NULL,
+ (char *) "Type of the value.", NULL },
+ { (char *) "dynamic_type", valpy_get_dynamic_type, NULL,
+ (char *) "Dynamic type of the value.", NULL },
+ { (char *) "is_lazy", valpy_get_is_lazy, NULL,
+ (char *) "Boolean telling whether the value is lazy (not fetched yet\n\
from the inferior). A lazy value is fetched when needed, or when\n\
the \"fetch_lazy()\" method is called.", NULL },
{NULL} /* Sentinel */
We have ~20 such arrays, and I first wrote a patch that fixed all of
them like that... It's not pretty...
One way to make these a bit less ugly would be add a new macro that
hides the casts, like:
#define GDBPY_GSDEF(NAME, GET, SET, DOC, CLOSURE) \
{ (char *) NAME, GET, SET, (char *) DOC, CLOSURE }
and then use it like:
static PyGetSetDef value_object_getset[] = {
GDBPY_GSDEF ("address", valpy_get_address, NULL,
"The address of the value.", NULL),
GDBPY_GSDEF ("is_optimized_out", valpy_get_is_optimized_out, NULL,
"Boolean telling whether the value is optimized ", NULL),
{NULL} /* Sentinel */
};
But since we have C++11, which gives us constexpr and list
initialization, I thought of a way that requires no changes where the
arrays are initialized:
We add a new type that extends PyGetSetDef (called gdb_PyGetSetDef),
and add constexpr constructors that accept const 'name' and 'doc', and
then list/aggregate initialization simply "calls" these matching
constructors instead.
I put "calls" in quotes, because given "constexpr", it's all done at
compile time, and there's no overhead either in binary size or at run
time. In fact, we get identical binaries, before/after this change.
Unlike the fixes that fix some old Python API to match the API of more
recent Python, this switches to using explicit "gdb_PyGetSetDef"
everywhere, just to be clear that we are using our own version of it.
gdb/ChangeLog:
2017-04-05 Pedro Alves <palves@redhat.com>
* python/python-internal.h (gdb_PyGetSetDef): New type.
* python/py-block.c (block_object_getset)
(breakpoint_object_getset): Now a gdb_PyGetSetDef array.
* python/py-event.c (event_object_getset)
(finish_breakpoint_object_getset): Likewise.
* python/py-inferior.c (inferior_object_getset): Likewise.
* python/py-infthread.c (thread_object_getset): Likewise.
* python/py-lazy-string.c (lazy_string_object_getset): Likewise.
* python/py-linetable.c (linetable_entry_object_getset): Likewise.
* python/py-objfile.c (objfile_getset): Likewise.
* python/py-progspace.c (pspace_getset): Likewise.
* python/py-record-btrace.c (btpy_insn_getset, btpy_call_getset):
Likewise.
* python/py-record.c (recpy_record_getset): Likewise.
* python/py-symbol.c (symbol_object_getset): Likewise.
* python/py-symtab.c (symtab_object_getset, sal_object_getset):
Likewise.
* python/py-type.c (type_object_getset, field_object_getset):
Likewise.
* python/py-value.c (value_object_getset): Likewise.
2017-04-06 02:21:36 +08:00
|
|
|
|
static gdb_PyGetSetDef pspace_getset[] =
|
2010-04-16 03:54:13 +08:00
|
|
|
|
{
|
2014-10-31 08:05:17 +08:00
|
|
|
|
{ "__dict__", gdb_py_generic_dict, NULL,
|
|
|
|
|
"The __dict__ for this progspace.", &pspace_object_type },
|
2010-04-16 03:54:13 +08:00
|
|
|
|
{ "filename", pspy_get_filename, NULL,
|
|
|
|
|
"The progspace's main filename, or None.", NULL },
|
|
|
|
|
{ "pretty_printers", pspy_get_printers, pspy_set_printers,
|
|
|
|
|
"Pretty printers.", NULL },
|
2013-05-10 Phil Muldoon <pmuldoon@redhat.com>
* stack.c (backtrace_command_1): Add "no-filters", and Python frame
filter logic.
(backtrace_command): Add "no-filters" option parsing.
(_initialize_stack): Alter help to reflect "no-filters" option.
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-framefilter.o
(SUBDIR_PYTHON_SRCS): Add py-framefilter.c
(py-frame.o): Add target
* data-directory/Makefile.in (PYTHON_DIR): Add Python frame
filter files.
* python/python.h: Add new frame filter constants, and flag enum.
(apply_frame_filter): Add definition.
* python/python.c (apply_frame_filter): New non-Python
enabled function.
* python/py-utils.c (py_xdecref): New function.
(make_cleanup_py_xdecref): Ditto.
* python/py-objfile.c: Declare frame_filters dictionary.
(objfpy_dealloc): Add frame_filters dealloc.
(objfpy_new): Initialize frame_filters attribute.
(objfile_to_objfile_object): Ditto.
(objfpy_get_frame_filters): New function.
(objfpy_set_frame_filters): New function.
* python/py-progspace.c: Declare frame_filters dictionary.
(pspy_dealloc): Add frame_filters dealloc.
(pspy_new): Initialize frame_filters attribute.
(pspacee_to_pspace_object): Ditto.
(pspy_get_frame_filters): New function.
(pspy_set_frame_filters): New function.
* python/py-framefilter.c: New file.
* python/lib/gdb/command/frame_filters.py: New file.
* python/lib/gdb/frames.py: New file.
* python/lib/gdb/__init__.py: Initialize global frame_filters
dictionary
* python/lib/gdb/FrameDecorator.py: New file.
* python/lib/gdb/FrameIterator.py: New file.
* mi/mi-cmds.c (mi_cmds): Add frame filters command.
* mi/mi-cmds.h: Declare.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Add
--no-frame-filter logic, and Python frame filter logic.
(stack_enable_frame_filters): New function.
(parse_no_frame_option): Ditto.
(mi_cmd_stack_list_frames): Add --no-frame-filter and Python frame
filter logic.
(mi_cmd_stack_list_locals): Ditto.
(mi_cmd_stack_list_args): Ditto.
(mi_cmd_stack_list_variables): Ditto.
* NEWS: Add frame filter note.
2013-05-10 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-framefilter.py: New File.
* gdb.python/py-framefilter-mi.exp: Ditto.
* gdb.python/py-framefilter.c: Ditto.
* gdb.python/py-framefilter-mi.exp: Ditto.
* gdb.python/py-framefilter-mi.c: Ditto,
* gdb.python/py-framefilter-gdb.py.in: Ditto.
2013-05-10 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Backtrace): Add "no-filter" argument.
(Python API): Add Frame Filters API, Frame Wrapper API,
Writing a Frame Filter/Wrapper, Managing Management of Frame
Filters chapter entries.
(Frame Filters API): New Node.
(Frame Wrapper API): New Node.
(Writing a Frame Filter): New Node.
(Managing Frame Filters): New Node.
(Progspaces In Python): Add note about frame_filters attribute.
(Objfiles in Python): Ditto.
(GDB/MI Stack Manipulation): Add -enable-frame-filters command,
@anchors and --no-frame-filters option to -stack-list-variables,
-stack-list-frames, -stack-list-locals and -stack-list-arguments
commands.
2013-05-10 18:26:03 +08:00
|
|
|
|
{ "frame_filters", pspy_get_frame_filters, pspy_set_frame_filters,
|
|
|
|
|
"Frame filters.", NULL },
|
2015-04-02 02:49:12 +08:00
|
|
|
|
{ "frame_unwinders", pspy_get_frame_unwinders, pspy_set_frame_unwinders,
|
|
|
|
|
"Frame unwinders.", NULL },
|
* NEWS: Update.
* data-directory/Makefile.in (PYTHON_FILES): Add
type_printers.py.
* python/lib/gdb/command/type_printers.py: New file.
* python/lib/gdb/command/types.py (TypePrinter): New class.
(_get_some_type_recognizers, get_type_recognizers,
apply_type_recognizers, register_type_printer): New
functions.
* python/py-objfile.c (objfile_object) <type_printers>: New
field.
(objfpy_dealloc): Decref new field.
(objfpy_new): Set new field.
(objfpy_get_type_printers, objfpy_set_type_printers): New
functions.
(objfile_to_objfile_object): Set new field.
(objfile_getset): Add "type_printers".
* python/py-progspace.c (pspace_object) <type_printers>: New
field.
(pspy_dealloc): Decref new field.
(pspy_new): Set new field.
(pspy_get_type_printers, pspy_set_type_printers): New functions.
(pspace_to_pspace_object): Set new field.
(pspace_getset): Add "type_printers".
* python/python.c (start_type_printers, apply_type_printers,
free_type_printers): New functions.
(_initialize_python): Set gdb.type_printers.
* python/python.h (start_type_printers, apply_type_printers,
free_type_printers): Declare.
* typeprint.c (type_print_raw_options, default_ptype_flags):
Update for new fields.
(do_free_global_table, create_global_typedef_table,
find_global_typedef): New functions.
(find_typedef_in_hash): Use find_global_typedef.
(whatis_exp): Use create_global_typedef_table. Change cleanup
handling.
* typeprint.h (struct type_print_options) <global_typedefs,
global_printers>: New fields.
doc
* gdb.texinfo (Symbols): Document "info type-printers",
"enable type-printer" and "disable type-printer".
(Python API): Add new node to menu.
(Type Printing API): New node.
(Progspaces In Python): Document type_printers field.
(Objfiles In Python): Likewise.
(gdb.types) <get_type_recognizers, apply_type_recognizers,
register_type_printer, TypePrinter>: Document.
testsuite
* gdb.base/completion.exp: Update for "info type-printers".
* gdb.python/py-typeprint.cc: New file.
* gdb.python/py-typeprint.exp: New file.
* gdb.python/py-typeprint.py: New file.
2012-11-13 01:41:59 +08:00
|
|
|
|
{ "type_printers", pspy_get_type_printers, pspy_set_type_printers,
|
|
|
|
|
"Type printers.", NULL },
|
2014-05-20 21:53:04 +08:00
|
|
|
|
{ "xmethods", pspy_get_xmethods, NULL,
|
|
|
|
|
"Debug methods.", NULL },
|
2010-04-16 03:54:13 +08:00
|
|
|
|
{ NULL }
|
|
|
|
|
};
|
|
|
|
|
|
2018-09-14 03:40:41 +08:00
|
|
|
|
static PyMethodDef progspace_object_methods[] =
|
|
|
|
|
{
|
|
|
|
|
{ "objfiles", pspy_get_objfiles, METH_NOARGS,
|
|
|
|
|
"Return a sequence of objfiles associated to this program space." },
|
|
|
|
|
{ NULL }
|
|
|
|
|
};
|
|
|
|
|
|
Fix redefinition errors in C++ mode
In C, we can forward declare static structure instances. That doesn't
work in C++ though. C++ treats these as definitions. So then the
compiler complains about symbol redefinition, like:
src/gdb/elfread.c:1569:29: error: redefinition of ‘const sym_fns elf_sym_fns_lazy_psyms’
src/gdb/elfread.c:53:29: error: ‘const sym_fns elf_sym_fns_lazy_psyms’ previously declared here
The intent of static here is naturally to avoid making these objects
visible outside the compilation unit. The equivalent in C++ would be
to instead define the objects in the anonymous namespace. But given
that it's desirable to leave the codebase compiling as both C and C++
for a while, this just makes the objects extern.
(base_breakpoint_ops is already declared in breakpoint.h, so we can
just remove the forward declare from breakpoint.c)
gdb/ChangeLog:
2015-02-11 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
* breakpoint.c (base_breakpoint_ops): Delete.
* dwarf2loc.c (dwarf_expr_ctx_funcs): Make extern.
* elfread.c (elf_sym_fns_gdb_index, elf_sym_fns_lazy_psyms): Make extern.
* guile/guile.c (guile_extension_script_ops, guile_extension_ops): Make extern.
* ppcnbsd-tdep.c (ppcnbsd2_sigtramp): Make extern.
* python/py-arch.c (arch_object_type): Make extern.
* python/py-block.c (block_syms_iterator_object_type): Make extern.
* python/py-bpevent.c (breakpoint_event_object_type): Make extern.
* python/py-cmd.c (cmdpy_object_type): Make extern.
* python/py-continueevent.c (continue_event_object_type)
* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove 'qual'
parameter. Update all callers.
* python/py-evtregistry.c (eventregistry_object_type): Make extern.
* python/py-exitedevent.c (exited_event_object_type): Make extern.
* python/py-finishbreakpoint.c (finish_breakpoint_object_type): Make extern.
* python/py-function.c (fnpy_object_type): Make extern.
* python/py-inferior.c (inferior_object_type, membuf_object_type): Make extern.
* python/py-infevents.c (call_pre_event_object_type)
(inferior_call_post_event_object_type).
(memory_changed_event_object_type): Make extern.
* python/py-infthread.c (thread_object_type): Make extern.
* python/py-lazy-string.c (lazy_string_object_type): Make extern.
* python/py-linetable.c (linetable_entry_object_type)
(linetable_object_type, ltpy_iterator_object_type): Make extern.
* python/py-newobjfileevent.c (new_objfile_event_object_type)
(clear_objfiles_event_object_type): Make extern.
* python/py-objfile.c (objfile_object_type): Make extern.
* python/py-param.c (parmpy_object_type): Make extern.
* python/py-progspace.c (pspace_object_type): Make extern.
* python/py-signalevent.c (signal_event_object_type): Make extern.
* python/py-symtab.c (symtab_object_type, sal_object_type): Make extern.
* python/py-type.c (type_object_type, field_object_type)
(type_iterator_object_type): Make extern.
* python/python.c (python_extension_script_ops)
(python_extension_ops): Make extern.
* stap-probe.c (stap_probe_ops): Make extern.
2015-02-11 19:20:21 +08:00
|
|
|
|
PyTypeObject pspace_object_type =
|
2010-04-16 03:54:13 +08:00
|
|
|
|
{
|
2012-12-13 00:47:30 +08:00
|
|
|
|
PyVarObject_HEAD_INIT (NULL, 0)
|
2010-04-16 03:54:13 +08:00
|
|
|
|
"gdb.Progspace", /*tp_name*/
|
|
|
|
|
sizeof (pspace_object), /*tp_basicsize*/
|
|
|
|
|
0, /*tp_itemsize*/
|
|
|
|
|
pspy_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*/
|
|
|
|
|
0, /*tp_str*/
|
|
|
|
|
0, /*tp_getattro*/
|
|
|
|
|
0, /*tp_setattro*/
|
|
|
|
|
0, /*tp_as_buffer*/
|
|
|
|
|
Py_TPFLAGS_DEFAULT, /*tp_flags*/
|
|
|
|
|
"GDB progspace object", /* tp_doc */
|
|
|
|
|
0, /* tp_traverse */
|
|
|
|
|
0, /* tp_clear */
|
|
|
|
|
0, /* tp_richcompare */
|
|
|
|
|
0, /* tp_weaklistoffset */
|
|
|
|
|
0, /* tp_iter */
|
|
|
|
|
0, /* tp_iternext */
|
2018-09-14 03:40:41 +08:00
|
|
|
|
progspace_object_methods, /* tp_methods */
|
2010-04-16 03:54:13 +08:00
|
|
|
|
0, /* tp_members */
|
|
|
|
|
pspace_getset, /* tp_getset */
|
|
|
|
|
0, /* tp_base */
|
|
|
|
|
0, /* tp_dict */
|
|
|
|
|
0, /* tp_descr_get */
|
|
|
|
|
0, /* tp_descr_set */
|
2014-10-31 08:05:17 +08:00
|
|
|
|
offsetof (pspace_object, dict), /* tp_dictoffset */
|
2010-04-16 03:54:13 +08:00
|
|
|
|
0, /* tp_init */
|
|
|
|
|
0, /* tp_alloc */
|
|
|
|
|
pspy_new, /* tp_new */
|
|
|
|
|
};
|