Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Aleksandar Ristovski <aristovski@qnx.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] core: use core_pid
Date: Tue, 26 Feb 2008 20:15:00 -0000	[thread overview]
Message-ID: <47C46E0F.2040309@qnx.com> (raw)
In-Reply-To: <20080226194502.GA1523@caradoc.them.org>

Daniel Jacobowitz wrote:
> On Tue, Feb 26, 2008 at 02:37:58PM -0500, Aleksandar Ristovski wrote:
>> +  gdb_assert (abfd != NULL && elf_tdata (abfd) != NULL);
> 
> What if it's not an ELF core file?
> 
Didn't think about that (our core can only be ELF).

In that case, do you think something like this would work?

@@ -232,20 +233,24 @@ static void
  add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
  {
    int thread_id;
+  ptid_t ptid;
    asection *reg_sect = (asection *) reg_sect_arg;

    if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) != 0)
      return;

    thread_id = atoi (bfd_section_name (abfd, asect) + 5);
-
-  add_thread (pid_to_ptid (thread_id));
+  if (abfd != NULL && elf_tdata (abfd) != NULL)
+    ptid = ptid_build (elf_tdata (abfd)->core_pid, 0, thread_id);
+  else
+    ptid = ptid_build (42, 0, thread_id);
+  add_thread (ptid);

  /* Warning, Will Robinson, looking at BFD private data! */

    if (reg_sect != NULL
        && asect->filepos == reg_sect->filepos)  /* Did we find .reg? */
-    inferior_ptid = pid_to_ptid (thread_id);   /* Yes, make it current */
+    inferior_ptid = ptid;      /* Yes, make it current */
  }

  /* This routine opens and sets up the core file bfd.  */


  reply	other threads:[~2008-02-26 19:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-26 19:45 Aleksandar Ristovski
2008-02-26 19:53 ` Daniel Jacobowitz
2008-02-26 20:15   ` Aleksandar Ristovski [this message]
2008-04-10 15:16     ` Daniel Jacobowitz

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=47C46E0F.2040309@qnx.com \
    --to=aristovski@qnx.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.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