From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id rLwdM+XFAmYy1xYAWB0awg (envelope-from ) for ; Tue, 26 Mar 2024 08:56:05 -0400 Received: by simark.ca (Postfix, from userid 112) id C28FC1E0C0; Tue, 26 Mar 2024 08:56:05 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B1D0F1E030 for ; Tue, 26 Mar 2024 08:56:03 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 62AEC3858416 for ; Tue, 26 Mar 2024 12:56:03 +0000 (GMT) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by sourceware.org (Postfix) with ESMTPS id 0E7463858D38 for ; Tue, 26 Mar 2024 12:55:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0E7463858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0E7463858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711457745; cv=none; b=xGhyh4O1INx3EMpHUP4m4xtfYn9XC+nlBA9f+YuGS+TjpOtKbLa0B6QMooPplnjKuK/xMNdOFaaZBKsn3TRhClHWAXDg0ibtUwMs+xX+UZDWYw8yQa6mLC8ELTskfgAsn7Rv7qELCX0ZnWiv/hk+2l6dfoRvfApsfZmd1pJfAkY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711457745; c=relaxed/simple; bh=g+IzVH67VB38E0YV8TVySUbCDXOwnt0SSrk2BZPxIOQ=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=fSHugSm4nX35uWlL6S3gMV+rNfNBva4CpXIr+5ToZ+G7z5/b9WrnhRP8TwmsTvxA4fILmIGNQaF1GijyGMZDfQNFemQmRqur2K1vxSF/cqoQrRhpAdpnN/28EwNqviWOVI9YXmfgS2B9Wkum+4tVtb9+W1jAgSdoKyTNq9gusdA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4148c6af2d3so8483835e9.1 for ; Tue, 26 Mar 2024 05:55:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711457741; x=1712062541; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fua0v/0I3NycAXxIJxZtLjtKmKq+mP4REOFyVGEg14o=; b=Bbzwks8+KykK/5vlWbcUFWrm6W9iG96HBJcXjkrow8YXHJs1O9Nz4JqHs9il/ghSAZ v0m3fjDt2C8C8frfSo46DmXfbddJaD4IIizbJFHmMqC2ye0RQ0w7gBIvGsSbWit2QGSM ekwFu1mh0EhyI+mENn9WxUn+9AxXqcipLI1F+39tj8cBzNvlt8CoIxpTdiXxBfCOujsJ 1dMSAwOehjSmVvbor5ZOjE5uDBzoUMzctDFq8waKjijkPgE3BAcuIhQjOOhwxMEQOzZH x4X3bAvQpj7/1kLMDM5yLi9U22vfpUTblBIgZLfEASWwBKaw6S8gIdgm7TdTkgvV84KQ WVEw== X-Forwarded-Encrypted: i=1; AJvYcCVs8RtQ9doIH8NhuuYRLAuwhnysggIr1/4xyZpe25MYxSVd3QB4GQ+A2kILQtGZDiHdik94v2Rmab+2njhpYrLN3Dbw77WvDrbYqA== X-Gm-Message-State: AOJu0Yzxp1ZJy9EExcOBqrTDz3zN+XwngUUWTmPo4aehJprLOt2pXB9t IH8rzmjb1J3C+Oxnn1ihrT+PsnERycIBoufnIFt/low2z6CM6zt9FXralXZAV84= X-Google-Smtp-Source: AGHT+IH2sXn9V9Kh6V0gnpljClsJUzKYucvviS4qAkTrqCUxgrVBEbiayOW3fYYClPj73ots+qkx2Q== X-Received: by 2002:adf:f6c5:0:b0:341:bf39:9f8 with SMTP id y5-20020adff6c5000000b00341bf3909f8mr6268108wrp.6.1711457740786; Tue, 26 Mar 2024 05:55:40 -0700 (PDT) Received: from ?IPV6:2001:8a0:f918:ab00:a3cb:34d8:f2e6:d08? ([2001:8a0:f918:ab00:a3cb:34d8:f2e6:d08]) by smtp.gmail.com with ESMTPSA id n13-20020a5d4c4d000000b0033fc06f2d84sm12065967wrt.109.2024.03.26.05.55.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Mar 2024 05:55:40 -0700 (PDT) Message-ID: Date: Tue, 26 Mar 2024 12:55:38 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] Make linux checkpoints work with multiple inferiors Content-Language: en-US To: Kevin Buettner , gdb-patches@sourceware.org References: <20240323203056.1793487-1-kevinb@redhat.com> <20240323203056.1793487-2-kevinb@redhat.com> From: Pedro Alves In-Reply-To: <20240323203056.1793487-2-kevinb@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Hi Kevin, On 2024-03-23 20:27, Kevin Buettner wrote: > info_checkpoints_command used to simply iterate over the list of > forks (checkpoints), printing each one out. It now needs to iterate > over all inferiors and, for those which have checkpoints, it needs > to iterate over the list of checkpoints in that inferior. This > command prints out a '*' preceding the currently active checkpoint. > That's still the case, but it'll now also print out a '+' preceding > the current checkpoint in non-current inferiors. E.g... > > (gdb) info checkpoints > + 4 process 8996 (main process) at 0x401199, file hello.c, line 51 > 5 process 9004 at 0x401199, file hello.c, line 51 > 1 process 9001 (main process) at 0x401258, file goodbye.c, line 62 > + 6 process 9005 at 0x401258, file goodbye.c, line 62 > * 7 process 9006 (main process) at 0x40115c, file hangout.c, line 31 > 9 process 9008 at 0x40115c, file hangout.c, line 31 This is very confusing output/design IMO. Checkpoint numbers aren't sorted, nor is there any indication of which inferior each checkpoint is for. IMO, a much better interface, is to instead make "info checkpoints" multi-inferior-aware like "info threads" is: By making each inferior have its own checkpoint number space. I.e., like threads have a INF.THR id, checkpoints would have an INF.CHKP id. And like you can suppress the inferior number when refering thread ids, i.e,. "thread 1.1" and "thread 1" is the same thread if we're focused on inferior 1, so would "checkpoint 1.1" and "checkpoint 1". And with that, checkpoints for an inferior could always start at 0 (or 1) like today, and also like we always restart the inferior thread ids at 1 when we restart an inferior. So the example above would turn into: (gdb) info checkpoints + 1.0 process 8996 (main process) at 0x401199, file hello.c, line 51 1.1 process 9004 at 0x401199, file hello.c, line 51 2.0 process 9001 (main process) at 0x401258, file goodbye.c, line 62 + 2.1 process 9005 at 0x401258, file goodbye.c, line 62 * 3.0 process 9006 (main process) at 0x40115c, file hangout.c, line 31 3.1 process 9008 at 0x40115c, file hangout.c, line 31 "restart 1" or "restart 3.1" would switch to checkpoint 3.1. "restart 2.1" would switch to checkpoint 1 of inferior 2. With this, if you create a new checkpoint for inferior 2, it gets numbered as checkpoint 2.2 , irrespective of whether which inferior you last created a checkpoint for. I'm also not sure whether "+" is the best interface to indicate which checkpoint is active. I'd think we could do that with a separate column, like, e.g., a state column that indicates which checkpoint is active, and maybe also which one is the main process: (gdb) info checkpoints Id State Target Id Frame 1.0 AM process 8996 at 0x401199, file hello.c, line 51 1.1 process 9004 at 0x401199, file hello.c, line 51 2.0 M process 9001 at 0x401258, file goodbye.c, line 62 2.1 A process 9005 at 0x401258, file goodbye.c, line 62 * 3.0 AM process 9006 at 0x40115c, file hangout.c, line 31 3.1 process 9008 at 0x40115c, file hangout.c, line 31 Though really "main process" info is redundant, as it's always the one with checkpoint id 0: (gdb) info checkpoints Id State Target Id Frame 1.0 A process 8996 at 0x401199, file hello.c, line 51 1.1 process 9004 at 0x401199, file hello.c, line 51 2.0 process 9001 at 0x401258, file goodbye.c, line 62 2.1 A process 9005 at 0x401258, file goodbye.c, line 62 * 3.0 A process 9006 at 0x40115c, file hangout.c, line 31 3.1 process 9008 at 0x40115c, file hangout.c, line 31 Pedro Alves