diff options
author | Tim Wiederhake <tim.wiederhake@intel.com> | 2016-11-21 16:39:57 +0100 |
---|---|---|
committer | Tim Wiederhake <tim.wiederhake@intel.com> | 2017-02-14 10:57:56 +0100 |
commit | 75c0bdf484b7a949a53b04edd95edca5f4662184 (patch) | |
tree | 7c1029d63d7d27e89d6b76d1ea2033257e90b9dd /gdb/python/py-record.c | |
parent | 4726b2d82c89fe6f8e769d1ae9f9e5e528f91156 (diff) | |
download | binutils-75c0bdf484b7a949a53b04edd95edca5f4662184.zip binutils-75c0bdf484b7a949a53b04edd95edca5f4662184.tar.gz binutils-75c0bdf484b7a949a53b04edd95edca5f4662184.tar.bz2 |
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
Diffstat (limited to 'gdb/python/py-record.c')
-rw-r--r-- | gdb/python/py-record.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gdb/python/py-record.c b/gdb/python/py-record.c index 27ecbb6..72922a4 100644 --- a/gdb/python/py-record.c +++ b/gdb/python/py-record.c @@ -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.")); } |