This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] [python] PR python/15461 (gate architecture calls)
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: Paul_Koning at Dell dot com
- Cc: tromey at redhat dot com, gdb-patches at sourceware dot org
- Date: Wed, 28 Aug 2013 19:45:52 +0100
- Subject: Re: [patch] [python] PR python/15461 (gate architecture calls)
- Authentication-results: sourceware.org; auth=none
- References: <521DE761 dot 6010403 at redhat dot com> <87d2oxvgye dot fsf at fleche dot redhat dot com> <C75A84166056C94F84D238A44AF9F6AD034CBA4D at AUSX10MPC103 dot AMER dot DELL dot COM>
On 28/08/13 19:13, Paul_Koning@Dell.com wrote:
>
> On Aug 28, 2013, at 1:54 PM, Tom Tromey <tromey@redhat.com> wrote:
>
>> Phil> Something I thought about is not allowing gdb.Architecture to be
>> Phil> instantiated directly, but I could not think of a clean way to do
>> Phil> this.
>>
>> Did you think of any way?
>> It seems like a good thing to prevent.
>
> Ditto for all the existing types for which direct instantiation doesn't do anything useful.
>
> I haven't tried this, but judging from the Python docs, if you point the tp_new field of the type object to a function that sets a suitable Python exception, that should do the job.
I was not able to make the tp_new call figure out where it was being
instantiated from.
So I could not tell the difference between:
foo = gdb.selected_frame()
and
foo = gdb.Frame()
There is a way if the class constructor takes arguments (ie, foo =
gdb.Value(2), but that case is valid in any case).
But I only spent a very brief time on it. I am sure there is a way to
do it. I will look at it in a little more detail now we think we
should make this happen.
Cheers
Ohil