From 4726b2d82c89fe6f8e769d1ae9f9e5e528f91156 Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Mon, 21 Nov 2016 16:39:57 +0100 Subject: python: Create Python bindings for record history. This patch adds three new functions to the gdb module in Python: - start_recording - stop_recording - current_recording start_recording and current_recording return an object of the new type gdb.Record, which can be used to access the recorded data. Signed-off-by: Tim Wiederhake gdb/ChangeLog * Makefile.in (SUBDIR_PYTHON_OBS): Add python/py-record.o. (SUBDIR_PYTHON_SRCS): Add python/py-record.c. * python/py-record.c: New file. * python/python-internal.h (gdbpy_start_recording, gdbpy_current_recording, gdpy_stop_recording, gdbpy_initialize_record): New export. * python/python.c (_initialize_python): Add gdbpy_initialize_record. (python_GdbMethods): Add gdbpy_start_recording, gdbpy_current_recording and gdbpy_stop_recording. Change-Id: I772aa9aa068621443f10a330b11dc7dc9a63face --- gdb/python/python.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gdb/python/python.c') diff --git a/gdb/python/python.c b/gdb/python/python.c index 1f5ab42..f8b9f7e 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -1628,6 +1628,7 @@ do_start_initialization () || gdbpy_initialize_values () < 0 || gdbpy_initialize_frames () < 0 || gdbpy_initialize_commands () < 0 + || gdbpy_initialize_record () < 0 || gdbpy_initialize_symbols () < 0 || gdbpy_initialize_symtabs () < 0 || gdbpy_initialize_blocks () < 0 @@ -1910,6 +1911,18 @@ Return the selected frame object." }, "stop_reason_string (Integer) -> String.\n\ Return a string explaining unwind stop reason." }, + { "start_recording", gdbpy_start_recording, METH_VARARGS, + "start_recording ([method] [, format]) -> gdb.Record.\n\ +Start recording with the given method. If no method is given, will fall back\n\ +to the system default method. If no format is given, will fall back to the\n\ +default format for the given method."}, + { "current_recording", gdbpy_current_recording, METH_NOARGS, + "current_recording () -> gdb.Record.\n\ +Return current recording object." }, + { "stop_recording", gdbpy_stop_recording, METH_NOARGS, + "stop_recording () -> None.\n\ +Stop current recording." }, + { "lookup_type", (PyCFunction) gdbpy_lookup_type, METH_VARARGS | METH_KEYWORDS, "lookup_type (name [, block]) -> type\n\ -- cgit v1.1