This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v4 3/9] add target method delegation
- From: Tom Tromey <tromey at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 16 Dec 2013 14:21:11 -0700
- Subject: Re: [PATCH v4 3/9] add target method delegation
- Authentication-results: sourceware.org; auth=none
- References: <1382464769-2465-1-git-send-email-tromey at redhat dot com> <1382464769-2465-4-git-send-email-tromey at redhat dot com> <526E8B54 dot 8040104 at redhat dot com> <87eh75cmig dot fsf at fleche dot redhat dot com> <87a9htcme3 dot fsf at fleche dot redhat dot com> <87habz7q6g dot fsf at fleche dot redhat dot com> <527D1A84 dot 9040106 at redhat dot com> <87lhzr11wz dot fsf at fleche dot redhat dot com> <87a9g623cw dot fsf at fleche dot redhat dot com> <871u1gz9q2 dot fsf at fleche dot redhat dot com> <52AEFB0A dot 3090104 at redhat dot com>
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>> 3. de_fault will be completely eliminated. INHERIT will be limited to
>> the smallest possible list of fields, like to_shortname. Nearly
>> every current_target method will simply delegate.
Pedro> Sounds like the squashed target will end up mostly unused? It sounds
Pedro> to me that even for those (data fields) we wouldn't need INHERIT. As
Pedro> all targets have a name, e.g., target_shortname could be made a method
Pedro> that returns the name of the currently topmost target in the stack
Pedro> (not the squashed target).
Yeah. The squashed target may still need to exist, or the debug target
would have to be recast as a new stratum.
>> 5. Any given to_* method implementation will be guaranteed to be called
>> with the target_ops with which it was registered. (This rule is
>> handy on multi-target, where I split out the target_ops vtable from
>> the object itself.)
FWIW I wrote a script to add all the missing "this" arguments -- not
just to target.h but to every method implementation in the tree.
This yields 103 patches -- one per converted method. (I may zap a few
of these, the bulk of them seem to make sense...) I'm not quite sure
how to submit it. I mean, email is doable, but it seems a bit large.
>> This is a bit difficult since I don't have access to many targets. I'm
>> not sure what to do about this aspect.
Pedro> What I've done in that past for this sort of thing is just go ahead
Pedro> and do the almost mechanical adjustment across the board, and don't
Pedro> fret about it if something breaks. Publish git test branches, IOW,
Pedro> make it very easy for people to test, report issues and hopefully
Pedro> help with targets they care about should help drive this through
Pedro> faster.
Yeah. It doesn't quite sit right but it does seem like the best way.
The nice thing about these refactorings is that the needed changes are
usually trivial anyhow.
Tom