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 ?


> The "gcore" command is actually defined in gcore.c.  If someone
> (hpux) wanted to define it differently, it should be as simple as
> linking in your own (eg.) hpux-gcore.c module, *instead of* the
> generic gcore.c module.
> 
> Current targets that implement gcore in the generic way
> do so by adding gcore.o to the NATDEPFILES.

That's almost the approach I took. The problem with the above
is that you end up rewriting a bunch of code that could have
been reused (namely the code that adds the "gcore" command,
and the part of gcore_command that deals with arguments).

If you really want to know, I did

gcore_command (...)
{
  [part that deals with arguments]

#ifdef HAVE_TTRACE
  dump_core_file (...);
  return;
#endif

  [rest of the regular gcore_command]
}

This is why I'm suggesting that the part that writes the core file
become a method. That way, we can have several types of gcore
implementations.

One variation of your proposal is maybe to extract out the part
that writes the core file from gcore.c, move it to gcore-elf.c
(is this elf only????), and then have a gcore-hpux.c. I'm not too
fond of this approach, though, because eventually we want to be
able to have support for multiple targets in the same debugger.
Say we have a HP/UX native debugger that also supports a target
that the current gcore module supports. We'd have to choose one
or the other, but we couldn't have both.

-- 
Joel



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