This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [python] Allow explicit locations in breakpoints.
- From: Keith Seitz <keiths at redhat dot com>
- To: Phil Muldoon <pmuldoon at redhat dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 23 Aug 2017 10:51:36 -0700
- Subject: Re: [python] Allow explicit locations in breakpoints.
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=keiths at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7F6BA81DF9
- References: <04ccc2c4-7827-eedc-d8db-a83a0167acb6@redhat.com>
On 08/23/2017 06:58 AM, Phil Muldoon wrote:
> diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
> index 6156eb6179..8431bed939 100644
> --- a/gdb/python/py-breakpoint.c
> +++ b/gdb/python/py-breakpoint.c
> @@ -681,7 +681,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
> case bp_breakpoint:
> {
> event_location_up location
> - = string_to_event_location_basic (©, current_language);
> + = string_to_event_location (©, current_language);
> create_breakpoint (python_gdbarch,
> location.get (), NULL, -1, NULL,
> 0,
This binds python interfaces to the CLI, and I don't think we want that. I would have expected (perhaps naively) to see explicit locations supported using a more natural python convention, such as using PyArg_ParseTupleAndKeywords.
For example, in MI (mi_cmd_break_insert_1) , we do not use string_to_event_location. We support MI-centric calling conventions by using mi_getopt for argument processing. While MI does use the same option names, they don't (or didn't) have to be. The comments for string_to_event_location should be clearer that this is a CLI-specific implementation. [Perhaps that entire function could be moved to somewhere in cli/?]
I admit, like the MI case, it is almost busywork, but it does (at least) isolate those interfaces from any internal API churn that GDB might undergo.
WDYT?
Keith