From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4018 invoked by alias); 26 Feb 2008 19:38:23 -0000 Received: (qmail 4010 invoked by uid 22791); 26 Feb 2008 19:38:22 -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:38:06 +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 OAA02105 for ; Tue, 26 Feb 2008 14:21:22 -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 OAA19081 for ; Tue, 26 Feb 2008 14:38:00 -0500 Message-ID: <47C46A96.9060105@qnx.com> Date: Tue, 26 Feb 2008 19:45:00 -0000 From: Aleksandar Ristovski User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [patch] core: use core_pid Content-Type: multipart/mixed; boundary="------------060101050806070706050109" 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/msg00402.txt.bz2 This is a multi-part message in MIME format. --------------060101050806070706050109 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 616 Hello, This patch fixes minor issue: in corelow.c (add_to_thread_list) we use thread_id as pid and we ignore core_pid which is available. This gives confusing output from "info threads" since threads appear to belong to different processes. The patch rectifies this situation. Thanks, Aleksandar Ristovski QNX Software Systems 2008-02-26 Aleksandar Ristovski * Makefile.in (corelow.o): Add elf_bfd_h. * corelow.c (elf-bfd.h): Add include. (add_to_thread_list): Use core_pid instead of using tid as pid. (get_core_register_section): Use tid from inferior_ptid instead of pid. --------------060101050806070706050109 Content-Type: text/plain; name="corelow.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="corelow.c.diff" Content-length: 2501 Index: gdb/Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.984 diff -u -p -r1.984 Makefile.in --- gdb/Makefile.in 20 Feb 2008 15:45:20 -0000 1.984 +++ gdb/Makefile.in 26 Feb 2008 19:20:38 -0000 @@ -1996,7 +1996,7 @@ corelow.o: corelow.c $(defs_h) $(arch_ut $(inferior_h) $(symtab_h) $(command_h) $(bfd_h) $(target_h) \ $(gdbcore_h) $(gdbthread_h) $(regcache_h) $(regset_h) $(symfile_h) \ $(exec_h) $(readline_h) $(gdb_assert_h) \ - $(exceptions_h) $(solib_h) $(filenames_h) + $(exceptions_h) $(solib_h) $(filenames_h) $(elf_bfd_h) core-regset.o: core-regset.c $(defs_h) $(command_h) $(gdbcore_h) \ $(inferior_h) $(target_h) $(regcache_h) $(gdb_string_h) $(gregset_h) cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(command_h) $(gdbcmd_h) \ Index: gdb/corelow.c =================================================================== RCS file: /cvs/src/src/gdb/corelow.c,v retrieving revision 1.73 diff -u -p -r1.73 corelow.c --- gdb/corelow.c 9 Feb 2008 13:45:33 -0000 1.73 +++ gdb/corelow.c 26 Feb 2008 19:20:43 -0000 @@ -45,6 +45,7 @@ #include "exceptions.h" #include "solib.h" #include "filenames.h" +#include "elf-bfd.h" #ifndef O_LARGEFILE @@ -232,20 +233,22 @@ 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)); + gdb_assert (abfd != NULL && elf_tdata (abfd) != NULL); + ptid = ptid_build (elf_tdata (abfd)->core_pid, 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. */ @@ -424,8 +427,8 @@ get_core_register_section (struct regcac char *contents; xfree (section_name); - if (PIDGET (inferior_ptid)) - section_name = xstrprintf ("%s/%d", name, PIDGET (inferior_ptid)); + if (ptid_get_tid (inferior_ptid)) + section_name = xstrprintf ("%s/%ld", name, ptid_get_tid (inferior_ptid)); else section_name = xstrdup (name); --------------060101050806070706050109--