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: Simon Marchi <simon dot marchi at ericsson dot com>
- To: Phil Muldoon <pmuldoon at redhat dot com>, Keith Seitz <keiths at redhat dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Mon, 16 Oct 2017 14:32:56 -0400
- Subject: Re: [python] Allow explicit locations in breakpoints.
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=simon dot marchi at ericsson dot com;
- References: <04ccc2c4-7827-eedc-d8db-a83a0167acb6@redhat.com> <d1899991-db61-b663-7601-86dfa38449a2@redhat.com> <58311250-9ab1-39d1-99b6-07478bc8c2ab@redhat.com> <4768c7ad-cc3d-5702-fa93-40e9760d4ee8@ericsson.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 2017-10-16 02:23 PM, Simon Marchi wrote:
> I think for Python it would make sense to support the two paradigms. If you
> are writing a Python command that ends up installing a breakpoint, it would
> be nice if you could directly pass what you received to the gdb.Breakpoint
> constructor and have it parse it (including explicit locations). For example,
>
> (gdb) special-break -file foo.c -line 17
>
> But it would also be nice to have a keywords based API, for when the line/file/function
> information is already split. It would avoid having to build an explicit linespec
> string just to have GDB parse it after.
>
> In terms of API, I think the "spec" argument could be mutually exclusive with
> the function/file/line/etc keywork arguments, which would be added. An error
> would be thrown if you try to use both ways at the same time.
>
> About the line="+3" issue, because this is Python, the line keyword could
> probably accept integers and strings. And if it's a string, there could
> be some validation on the format.
>
> Simon
Btw, if we went with the idea described above, I think your patch would be
acceptable as-is, and the work to do add keyword arguments could be done separately
(by you or somebody else).
Simon