From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30545 invoked by alias); 10 Dec 2012 18:02:31 -0000 Received: (qmail 30525 invoked by uid 22791); 10 Dec 2012 18:02:28 -0000 X-SWARE-Spam-Status: No, hits=-7.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 Dec 2012 18:02:18 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBAI2HQc013338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 10 Dec 2012 13:02:17 -0500 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBAI2GbQ021695 for ; Mon, 10 Dec 2012 13:02:17 -0500 Subject: [PATCH 1/2] Put a NT_PSTATUS note on solaris cores. To: gdb-patches@sourceware.org From: Pedro Alves Date: Mon, 10 Dec 2012 18:02:00 -0000 Message-ID: <20121210180216.3932.48633.stgit@brno.lan> In-Reply-To: <50C6115C.4090509@redhat.com> References: <50C6115C.4090509@redhat.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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: 2012-12/txt/msg00263.txt.bz2 This is basically the same patch I once posted at: http://sourceware.org/ml/gdb-patches/2009-10/msg00188.html Rationale: This patch makes is to that cores generated with gdb's gcore on solaris also get an NT_PSTATUS note. It is from this note that gdb can extract the original pid of the process from the core. From higher up on procfs.c, we see that pstatus_t is assumed to be defined when NEW_PROC_API is defined, so this should be safe to not break builds on supported hosts. NEW_PROC_API is also always defined on unixware hosts. Older Solaris not using the the new proc api are unaffected. I had applied the patch back in 2009, and then shortly afterwards backed it out, because it broke Solaris builds. A patch to bfd this depended on was missing: http://sourceware.org/ml/gdb-patches/2009-10/msg00214.html The bfd patch when in 2010-01-04, but I never got back to pushing the GDB bit in. I no longer have easy access to Solaris hosts to test on though... Anyone interested in trying this, and seeing it in? The user visible change is just that GDB will know the real PID the process that dumped core had (visible when you load the core, and in "info inferiors"). The next patch removes all #ifdef UNIXWARE code, and that would remove this pstatus note code too. 2012-12-10 Pedro Alves gdb/ * procfs.c (procfs_make_note_section): Always output a NT_PSTATUS note when NEW_PROC_API is defined. --- gdb/procfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/procfs.c b/gdb/procfs.c index 82c7cd0..da5e158 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -5544,7 +5544,7 @@ procfs_make_note_section (bfd *obfd, int *note_size) stop_signal = find_stop_signal (); -#ifdef UNIXWARE +#ifdef NEW_PROC_API fill_gregset (get_current_regcache (), &gregs, -1); note_data = elfcore_write_pstatus (obfd, note_data, note_size, PIDGET (inferior_ptid),