This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to implement gcore on pa-hpux ?


> If you really mean target vector, then this isn't a complication at
> all.  The native case should have its own target vector already, in
> inf-ttrace.c (note the dash in modern sources).  Ideally remote targets
> could gcore; but there's been no interest in implementing that so far,
> so it's not worth concerning ourselves with until someone wants to work
> on it.

I proposed the target vector indeed because I thought that we might want
to let remote targets also do a core dump, eventually. Thinking about it
more, maybe this wasn't the best approach after all.

using the target vector, the native HP/UX case seems to be a no-brainer,
which is always nice. Suppose I add a new method to that vector that
does core file dumping, however. The problem is: How do we set that
method of all the cases where we already support gcore? For instance,
i386-linux.

Seems to me that this should be done during the tdep initialization
phase, where we know what type of architecture we're dealing with.
But then, can we lightly manipulate target vectors like this, and
has the target vector been set at this point? This is a bit of a gray
area for me, at the moment, but I have concerns.

On the other hand, setting the method during the tdep initialization
phase does suggest that maybe a gdbarch method might be better suited.
The current gcore implementation doesn't seem to be depending on
anything native, so the gdbarch method seems well suited for it.
There is the issue of HP/UX however, because in our case, it's
native-only.  Setting the new gdbarch method using ttrace code would
break the tdep/nat separation.

So it leads me to propose the following approach: How about I add
two new methods:

  - 1 new gdbarch method: This would be the prefered method to call
    when trying to dump a core file. This method would be set to
    the current implementation in all the configurations where this
    feature is already supported.

  - 1 new target method: This would be the fallback method when the
    gdbarch method is not implemented. Set to null by default, it
    would be set to ttrace.c:dump_core_file in inf_ttrace_target().

  - In all other cases, we tell the user that this function is not
    implemented on this target.

The rationale would be:

  - If we have a target-dependent implementation, great! Use it.
  - Otherwise, do we have a native-only implementation (in the
    target vector)? If yes, then better than nothing, use it.
  - Otherwise, this feature in unimplemented.

Seems plausible?
-- 
Joel



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]