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: [hppa-hpux] Core file support for hppa64-hp-hpux11.11


> Date: Thu, 17 Nov 2005 20:56:39 +0800
> From: Randolph Chung <randolph@tausq.org>
> 
> Well, the osabi sniffer doesn't say that it's a corefile, it just says 
> it's a HPUX ELF file. As for whether "elf64-hppa" means hpux, currently 
> bfd/elf64-hppa.c only supports two targets, hpux and linux, and linux is 
> "elf64-hppa-linux". I know this is not very nice. Do you have any other 
> suggestions?

Ok, so your problem is that the core file is marked as "UNIX - System
V", so there's no way to tell that this is a HP-UX core file.

What I'd do, is create BFD sections out of those HP_CORE_XXX program
headers, and then in GDB, check for one of those sections.  There's
one program header that looks particularly promising: HP_CORE_KERNEL.
That one contains the string HP-UX.  That'd certainly convince me that
this is a HP-UX core file.

Actually I think it makes sense to modify your BFD patch such that it
gives all HP_CORE_XXX program headers a sensible name:


/* Support HP specific sections for core files.  */
static bfd_boolean
elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index,
                              const char *typename)
{
  switch (hdr->p_type)
    {
    case PT_HP_CORE_VERSION:
      typename = "core.version";
      break;
    case PT_HP_CORE_KERNEL:
      typename = "core.kernel";
      break;
    case PT_HP_CORE_PROC:

      ...

    }

  if (hdr->p_type == PT_HP_CORE_PROC)
    {
      int sig;

      if (bfd_seek (abfd, hdr->p_offset, SEEK_SET) != 0)
        return FALSE;
      if (bfd_bread (&sig, 4, abfd) != 4)
        return FALSE;

      elf_tdata (abfd)->core_signal = sig;

      /* gdb uses the ".reg" section to read register contents.  */
      if (!_bfd_elfcore_make_pseudosection (abfd, ".reg", hdr->p_filesz,
	  				    hdr->p_offset))
        return FALSE;
    }

  if (hdr->p_type == PT_HP_CORE_LOADABLE
      || hdr->p_type == PT_HP_CORE_STACK
      || hdr->p_type == PT_HP_CORE_MMF)
    hdr->p_type = PT_LOAD;

  return _bfd_elf_make_section_from_phdr (abfd, hdr, index, typename);
}


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