python: Implement btrace Python bindings for record history.
This patch implements the gdb.Record Python object methods and fields for record target btrace. Also, implement a stub for record target full. Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com> gdb/ChangeLog: * Makefile.in (SUBDIR_PYTHON_OBS): Add py-record-btrace.o, py-record-full.o. (SUBDIR_PYTHON_SRCS): Add py-record-btrace.c, py-record-full.c. * python/py-record-btrace.c, python/py-record-btrace.h, python/py-record-full.c, python/py-record-full.h: New file. * python/py-record.c: Add include for py-record-btrace.h and py-record-full.h. (recpy_method, recpy_format, recpy_goto, recpy_replay_position, recpy_instruction_history, recpy_function_call_history, recpy_begin, recpy_end): Use functions from py-record-btrace.c and py-record-full.c. * python/python-internal.h (PyInt_FromSsize_t, PyInt_AsSsize_t): New definition. (gdbpy_initialize_btrace): New export. * python/python.c (_initialize_python): Add gdbpy_initialize_btrace. Change-Id: I8bd893672ffc7e619cc1386767897249e125973a
This commit is contained in:
parent
4726b2d82c
commit
75c0bdf484
8 changed files with 1177 additions and 0 deletions
|
@ -21,6 +21,8 @@
|
|||
#include "inferior.h"
|
||||
#include "record.h"
|
||||
#include "python-internal.h"
|
||||
#include "py-record-btrace.h"
|
||||
#include "py-record-full.h"
|
||||
#include "target.h"
|
||||
|
||||
/* Python Record object. */
|
||||
|
@ -57,6 +59,14 @@ recpy_ptid (PyObject *self, void* closure)
|
|||
static PyObject *
|
||||
recpy_method (PyObject *self, void* closure)
|
||||
{
|
||||
const recpy_record_object * const obj = (recpy_record_object *) self;
|
||||
|
||||
if (obj->method == RECORD_METHOD_FULL)
|
||||
return recpy_full_method (self, closure);
|
||||
|
||||
if (obj->method == RECORD_METHOD_BTRACE)
|
||||
return recpy_bt_method (self, closure);
|
||||
|
||||
return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
|
||||
}
|
||||
|
||||
|
@ -65,6 +75,14 @@ recpy_method (PyObject *self, void* closure)
|
|||
static PyObject *
|
||||
recpy_format (PyObject *self, void* closure)
|
||||
{
|
||||
const recpy_record_object * const obj = (recpy_record_object *) self;
|
||||
|
||||
if (obj->method == RECORD_METHOD_FULL)
|
||||
return recpy_full_format (self, closure);
|
||||
|
||||
if (obj->method == RECORD_METHOD_BTRACE)
|
||||
return recpy_bt_format (self, closure);
|
||||
|
||||
return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
|
||||
}
|
||||
|
||||
|
@ -73,6 +91,11 @@ recpy_format (PyObject *self, void* closure)
|
|||
static PyObject *
|
||||
recpy_goto (PyObject *self, PyObject *value)
|
||||
{
|
||||
const recpy_record_object * const obj = (recpy_record_object *) self;
|
||||
|
||||
if (obj->method == RECORD_METHOD_BTRACE)
|
||||
return recpy_bt_goto (self, value);
|
||||
|
||||
return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
|
||||
}
|
||||
|
||||
|
@ -81,6 +104,11 @@ recpy_goto (PyObject *self, PyObject *value)
|
|||
static PyObject *
|
||||
recpy_replay_position (PyObject *self, void *closure)
|
||||
{
|
||||
const recpy_record_object * const obj = (recpy_record_object *) self;
|
||||
|
||||
if (obj->method == RECORD_METHOD_BTRACE)
|
||||
return recpy_bt_replay_position (self, closure);
|
||||
|
||||
return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
|
||||
}
|
||||
|
||||
|
@ -89,6 +117,11 @@ recpy_replay_position (PyObject *self, void *closure)
|
|||
static PyObject *
|
||||
recpy_instruction_history (PyObject *self, void* closure)
|
||||
{
|
||||
const recpy_record_object * const obj = (recpy_record_object *) self;
|
||||
|
||||
if (obj->method == RECORD_METHOD_BTRACE)
|
||||
return recpy_bt_instruction_history (self, closure);
|
||||
|
||||
return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
|
||||
}
|
||||
|
||||
|
@ -97,6 +130,11 @@ recpy_instruction_history (PyObject *self, void* closure)
|
|||
static PyObject *
|
||||
recpy_function_call_history (PyObject *self, void* closure)
|
||||
{
|
||||
const recpy_record_object * const obj = (recpy_record_object *) self;
|
||||
|
||||
if (obj->method == RECORD_METHOD_BTRACE)
|
||||
return recpy_bt_function_call_history (self, closure);
|
||||
|
||||
return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
|
||||
}
|
||||
|
||||
|
@ -105,6 +143,11 @@ recpy_function_call_history (PyObject *self, void* closure)
|
|||
static PyObject *
|
||||
recpy_begin (PyObject *self, void* closure)
|
||||
{
|
||||
const recpy_record_object * const obj = (recpy_record_object *) self;
|
||||
|
||||
if (obj->method == RECORD_METHOD_BTRACE)
|
||||
return recpy_bt_begin (self, closure);
|
||||
|
||||
return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
|
||||
}
|
||||
|
||||
|
@ -113,6 +156,11 @@ recpy_begin (PyObject *self, void* closure)
|
|||
static PyObject *
|
||||
recpy_end (PyObject *self, void* closure)
|
||||
{
|
||||
const recpy_record_object * const obj = (recpy_record_object *) self;
|
||||
|
||||
if (obj->method == RECORD_METHOD_BTRACE)
|
||||
return recpy_bt_end (self, closure);
|
||||
|
||||
return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue