From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8605 invoked by alias); 26 Feb 2008 19:53:13 -0000 Received: (qmail 8596 invoked by uid 22791); 26 Feb 2008 19:53:12 -0000 X-Spam-Check-By: sourceware.org Received: from qnxmail.qnx.com (HELO qnxmail.qnx.com) (209.226.137.76) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 26 Feb 2008 19:52:51 +0000 Received: from smtp.ott.qnx.com (smtp.ott.qnx.com [10.42.96.5]) by hub.ott.qnx.com (8.9.3/8.9.3) with ESMTP id OAA02205; Tue, 26 Feb 2008 14:36:11 -0500 Received: from [10.42.100.129] (dhcp-100-129 [10.42.100.129]) by smtp.ott.qnx.com (8.8.8/8.6.12) with ESMTP id OAA25298; Tue, 26 Feb 2008 14:52:48 -0500 Message-ID: <47C46E0F.2040309@qnx.com> Date: Tue, 26 Feb 2008 20:15:00 -0000 From: Aleksandar Ristovski User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Daniel Jacobowitz CC: gdb-patches@sourceware.org Subject: Re: [patch] core: use core_pid References: <47C46A96.9060105@qnx.com> <20080226194502.GA1523@caradoc.them.org> In-Reply-To: <20080226194502.GA1523@caradoc.them.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-02/txt/msg00404.txt.bz2 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. */