This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH 06/10] python: Add clear_trace() to gdb.Record.
- From: "Metzger, Markus T" <markus dot t dot metzger at intel dot com>
- To: "Willgerodt, Felix" <felix dot willgerodt at intel dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 4 Jun 2019 12:36:14 +0000
- Subject: RE: [PATCH 06/10] python: Add clear_trace() to gdb.Record.
- References: <1559119673-30516-1-git-send-email-felix.willgerodt@intel.com> <1559119673-30516-7-git-send-email-felix.willgerodt@intel.com>
Hello Felix,
> diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c
> index 81e43a00516..2a4af551146 100644
> --- a/gdb/python/py-record-btrace.c
> +++ b/gdb/python/py-record-btrace.c
> @@ -811,6 +811,19 @@ recpy_bt_goto (PyObject *self, PyObject *args)
> Py_RETURN_NONE;
> }
>
> +/* Implementation of BtraceRecord.clear (self) -> None. */
This does not match the documentation, which uses 'clear_trace'. More
instances below.
Personally, I like 'clear' better since it is shorter and the context should be
clear enough given that it is a Record method.
> @@ -127,6 +127,19 @@ recpy_goto (PyObject *self, PyObject *value)
> return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
> }
>
> +/* Implementation of record.clear_trace () -> None. */
> +
> +static PyObject *
> +recpy_clear (PyObject *self, PyObject *value)
Comment and function name don't match.
> diff --git a/gdb/testsuite/gdb.python/py-record-btrace.exp
> b/gdb/testsuite/gdb.python/py-record-btrace.exp
> index f6267d664a4..72bb69d5908 100644
> --- a/gdb/testsuite/gdb.python/py-record-btrace.exp
> +++ b/gdb/testsuite/gdb.python/py-record-btrace.exp
> @@ -90,7 +90,11 @@ with_test_prefix "instruction " {
> }
> gdb_test "python print(i.decoded)" ".*"
> gdb_test "python print(i.size)" "$decimal"
> - gdb_test "python print(i.is_speculative)" "False"
> + gdb_test "python print(i.is_speculative)" "False"
> + gdb_test_no_output "python gdb.current_recording().clear_trace()"
Why are we not using 'r' as we do below?
I wonder what would happen if we accessed 'i', 'c', 'insn', or 'call' here.
> + gdb_test "python insn = r.instruction_history"
> + gdb_test_no_output "python i = insn\[0\]"
> + gdb_test "python print(i.size)" "$decimal"
> }
>
> with_test_prefix "function call" {
> --
> 2.20.1
Thanks,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928