From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18512 invoked by alias); 9 Oct 2009 01:36:16 -0000 Received: (qmail 18503 invoked by uid 22791); 9 Oct 2009 01:36:16 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_FAIL X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Oct 2009 01:36:12 +0000 Received: (qmail 14631 invoked from network); 9 Oct 2009 01:36:11 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 9 Oct 2009 01:36:11 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Put a NT_PSTATUS note on solaris cores. Date: Fri, 09 Oct 2009 01:36:00 -0000 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200910090236.10584.pedro@codesourcery.com> 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: 2009-10/txt/msg00188.txt.bz2 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, I see that pstatus_t is assumed to be defined when NEW_PROC_API is defined, so I think this is safe to not break builds. NEW_PROC_API is also always defined on unixware hosts. I'm not caring for older solaris not using the new proc api. That bit of ifdefed code wasn't building without the stop_signal tweak, meaning that the unixware build has been broken for months and nobody complained. Checked in. -- Pedro Alves 2009-10-09 Pedro Alves gdb/ * procfs.c (procfs_make_note_section): Always output a NT_PSTATUS note when NEW_PROC_API is defined. --- gdb/procfs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) Index: src/gdb/procfs.c =================================================================== --- src.orig/gdb/procfs.c 2009-08-08 14:38:01.000000000 +0100 +++ src/gdb/procfs.c 2009-10-09 02:24:06.000000000 +0100 @@ -6126,6 +6126,7 @@ procfs_make_note_section (bfd *obfd, int struct procfs_corefile_thread_data thread_args; gdb_byte *auxv; int auxv_len; + enum target_signal stop_signal; if (get_exec_file (0)) { @@ -6150,7 +6151,9 @@ procfs_make_note_section (bfd *obfd, int fname, psargs); -#ifdef UNIXWARE + stop_signal = find_stop_signal (); + +#ifdef NEW_PROC_API fill_gregset (get_current_regcache (), &gregs, -1); note_data = elfcore_write_pstatus (obfd, note_data, note_size, PIDGET (inferior_ptid), @@ -6160,7 +6163,7 @@ procfs_make_note_section (bfd *obfd, int thread_args.obfd = obfd; thread_args.note_data = note_data; thread_args.note_size = note_size; - thread_args.stop_signal = find_stop_signal (); + thread_args.stop_signal = stop_signal; proc_iterate_over_threads (pi, procfs_corefile_thread_callback, &thread_args); /* There should be always at least one thread. */