Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: randolph@tausq.org
Cc: gdb-patches@sources.redhat.com
Subject: Re: [hppa-hpux] Core file support for hppa64-hp-hpux11.11
Date: Thu, 17 Nov 2005 16:02:00 -0000	[thread overview]
Message-ID: <200511171446.jAHEkDim026595@elgar.sibelius.xs4all.nl> (raw)
In-Reply-To: <437C7E07.5050804@tausq.org> (message from Randolph Chung on Thu, 17 Nov 2005 20:56:39 +0800)

> 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);
}


  reply	other threads:[~2005-11-17 14:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-17 12:56 Randolph Chung
2005-11-17 14:46 ` Mark Kettenis
2005-11-17 15:52   ` Randolph Chung
2005-11-17 16:02     ` Mark Kettenis [this message]
2005-11-18  3:37       ` Randolph Chung
2005-11-18  4:44         ` Mark Kettenis
2005-11-18 13:49           ` Randolph Chung
2005-11-18 15:30             ` Mark Kettenis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200511171446.jAHEkDim026595@elgar.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=gdb-patches@sources.redhat.com \
    --cc=randolph@tausq.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox