From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id 1FCBE3864845 for ; Wed, 28 Jul 2021 18:35:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1FCBE3864845 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id E98AB80E57; Wed, 28 Jul 2021 18:35:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZj575wcTz4mqs; Wed, 28 Jul 2021 18:35:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 6EDAF495D; Wed, 28 Jul 2021 18:35:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: [RFC PATCH] Add a new 'info proc time' subcommand of 'info proc'. To: Rustam Kovhaev Cc: gdb-patches@sourceware.org References: From: John Baldwin Message-ID: <2bb73de7-8690-7ee5-99d3-f3ed737b979e@FreeBSD.org> Date: Wed, 28 Jul 2021 11:35:05 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jul 2021 18:35:09 -0000 On 7/28/21 8:06 AM, Rustam Kovhaev wrote: > Hi John, > > On Wed, Jul 28, 2021 at 08:00:28AM -0700, John Baldwin wrote: >> On 7/27/21 3:08 PM, Rustam Kovhaev via Gdb-patches wrote: >>> Sometimes (unfortunately) I have to review windows user-space cores in >>> windbg, and there is one feature that I really want to implement in gdb, >>> but I don't know whether it is a good idea or not, and why it has not >>> yet been implemented in gdb. >>> >>> In wdbg there is a .time command that gives me time when core was taken. >>> I could not find the same functionality in gdb and in elf core. >>> I know about kernel core_pattern and timestamp, and there are user-space >>> daemons that write the timestamp, and sometimes if I am lucky I can get >>> timestamp from modified/created file attributes and this solves the >>> problem most of the time, but quite often I get only core.PID file + >>> some app log and there is no way for me to figure out when exactly the >>> core was taken. >>> >>> Current patch does not take into account lots of things like endianness, >>> cpu archs other than x86, other code paths, etc, and there is also >>> kernel side to modify and coordinate, but it does work in my lab, and I >>> was pretty happy to learn a little bit about the project. >> >> Does the Linux kernel write out NT_TIME notes when creating core dumps >> or would this command only work on cores generated by a patched gdb's >> 'gcore' command? > > It does not. Linux kernel will need to be patched too, but before > sending a kernel RFC patch I wanted to run this proposal by gdb > mainteners. I suspect that in general it's probably best to coordinate so that the kernel agrees to the value of NT_TIME, etc. I work on FreeBSD myself rather than Linux, but I wouldn't want to commit something to gdb to support a new note unless the specific ABI (e.g. note layout, NT_ value) was confirmed with the kernel folks as well. Even if the Linux kernel doesn't adopt the note, it needs to agree to reserving the value for NT_TIME so it doesn't get reused in the future for something else. Also, changes to binutils and bfd need to be sent to binutils@ for their review. -- John Baldwin