This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH 06/10] python: Add clear_trace() to gdb.Record.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]