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.
This commit is contained in:
Phil Muldoon 2013-05-10 10:26:03 +00:00
parent 3ecb733811
commit 1e611234ee
29 changed files with 4846 additions and 88 deletions

View file

@ -35,6 +35,8 @@ typedef struct
/* The pretty-printer list of functions. */
PyObject *printers;
/* The frame filter list of functions. */
PyObject *frame_filters;
/* The type-printer list. */
PyObject *type_printers;
} pspace_object;
@ -69,6 +71,7 @@ pspy_dealloc (PyObject *self)
pspace_object *ps_self = (pspace_object *) self;
Py_XDECREF (ps_self->printers);
Py_XDECREF (ps_self->frame_filters);
Py_XDECREF (ps_self->type_printers);
Py_TYPE (self)->tp_free (self);
}
@ -89,6 +92,13 @@ pspy_new (PyTypeObject *type, PyObject *args, PyObject *keywords)
return NULL;
}
self->frame_filters = PyDict_New ();
if (!self->frame_filters)
{
Py_DECREF (self);
return NULL;
}
self->type_printers = PyList_New (0);
if (!self->type_printers)
{
@ -137,6 +147,47 @@ pspy_set_printers (PyObject *o, PyObject *value, void *ignore)
return 0;
}
/* 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;
}
/* Get the 'type_printers' attribute. */
static PyObject *
@ -221,6 +272,13 @@ pspace_to_pspace_object (struct program_space *pspace)
return NULL;
}
object->frame_filters = PyDict_New ();
if (!object->frame_filters)
{
Py_DECREF (object);
return NULL;
}
object->type_printers = PyList_New (0);
if (!object->type_printers)
{
@ -257,6 +315,8 @@ static PyGetSetDef pspace_getset[] =
"The progspace's main filename, or None.", NULL },
{ "pretty_printers", pspy_get_printers, pspy_set_printers,
"Pretty printers.", NULL },
{ "frame_filters", pspy_get_frame_filters, pspy_set_frame_filters,
"Frame filters.", NULL },
{ "type_printers", pspy_get_type_printers, pspy_set_type_printers,
"Type printers.", NULL },
{ NULL }