Re: [RFC] TARGET_OBJECT_WCOOKIE

Daniel Jacobowitz
2004-02-02T19:26:14Z

On Mon, Feb 02, 2004 at 02:01:48PM -0500, Andrew Cagney wrote:
>
> >>The second issue I'd like your opinion on is related to the patch. I
> >>followed the example set by TARGET_OBJECT_UNWIND_TABLE in having a
> >>macro (NATIVE_XFER_WCOOKIE) to invoke the native-specific function
> >>that fetches the cookie. This macro would be defined in the nm.h
> >>file, but wasn't it our goal to get rid of the nm.h file sooner rather
> >>than later? Shouldn't we add another method for these kinds of hooks?
> >>The obvious alternatives are:
> >>
> >>a) Use a public function pointer, which is initialized to some
> >> do-nothing-and-return-minus-one function by default. This function
> >> pointer would be overridden by some code in the appropraite *-nat.c
> >> files.
> >>b) Use a private function pointer, and provide a function to set that
> >> pointer, along the lines of inftarg_set_find_memory_regions().
> >>Opinions?
>
> It sux less than some of the other existing alternatives - in particular
> the way certain /proc or ptrace specific functions just happen to be
> linked in. Makes a real mess of the idea of having both /proc and
> ptrace support in a single executable.
>
> >Personally, I think the -nat files should have a chance to edit
> >child_ops, or provide their own version of child_ops. This would
> >eliminate 90% of the gunk in nm* files which is checked in the various
> >inf* files implementing child_ops.
>
> Have "proc" and "ptrace" export functions for creating fairly generic
> target ops and then have *-nat "inherit" from it (or push on-top of it)?

Yeah, something like that.

At the very least, we could reduce the existing mess of macros to one.
After child_ops is initialized, call a native macro which can override
elements of it.

Then, later on, we can remove explicit references to child_ops (they're
scattered all over GDB last time I checked) and make the native targets
fill in their own ops.

Sound good?

--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer