From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id EEC393858D20 for ; Sun, 23 Jul 2023 08:33:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EEC393858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690101217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u1z0kZJ1v1vII07al0GJ/86e/DC26c7R7xdaKYqiQRg=; b=IrfqRytbYCrqA7g4vkAYljd7f79UO622A0FZ/QwLj6PGoff6ytMYLvRxjM/J0S3QODJwZ+ 1AIBAa1VaCZ86L+zJrhbQ+Ddt9K/YzOxRGjehpSVuEsQzSktivajo92Jrj/AC/1pX6HVSs hpbmGvegzaM1b1qrl4JHON3zrcvNYUM= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-113-3rixDrCVP2utzbSLPSyxlg-1; Sun, 23 Jul 2023 04:33:36 -0400 X-MC-Unique: 3rixDrCVP2utzbSLPSyxlg-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3fd2dec82b7so3688755e9.2 for ; Sun, 23 Jul 2023 01:33:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690101214; x=1690706014; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=u1z0kZJ1v1vII07al0GJ/86e/DC26c7R7xdaKYqiQRg=; b=VyoiLrSB3TuVbCMNiKIPplSAJYy+ug93p/FSl+IJnaRmLLkO9kv711aILaOwy18Xnk SVCTOrgzRmm1/noLbLOApnCY0cZCaHT0DCCT3tZ9pZW8WlRpcjEgIkaT9xinQvDlokwu YkZvAdSlAdyHtAi0u88s2BtyYgENnGpGNxuLpW/K2MAQip00gAWtsOGyIssvI61l/Kbs coRzOB35OncdV98Rs18zaRuoB/3+BnDV8z3qvUOM2vOOEBYa+O4s4zXimJn3+Mxu03Ua 3zn2dZLaKRFP89+lL8uEbcbiGhBMRR42Q77UA7kiuyKA7wmWRhcYBk9M12jS3Ao5DUPM Saqg== X-Gm-Message-State: ABy/qLZ7LWeBT5yHVwhl9Fm9eYrpBIW3u9tpOttA+Dq7+ZnhbkSQ1S+G Cy/baPVkv7jHJ4awcL7pYjvsizv05LGxlV9D0fyKy2zL4/eaz/iip60tcEofn1SeUbqNd/p8g0W rBpTBUGW0ctSlPBq+8k0ILTCvUPFP8jjSGNV/o5UpNra3jqV/RhEH8s/uup28BOjRooKacGnziH huHyEQtg== X-Received: by 2002:a7b:c856:0:b0:3fb:dd5d:76b with SMTP id c22-20020a7bc856000000b003fbdd5d076bmr4078603wml.7.1690101214778; Sun, 23 Jul 2023 01:33:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlEIN5qmK3rtZX27DCxpmt9FUDYjqNmKu73UzwBmWhS2DaOX8cpXf60uLxnUzSLdaW6/ZngI3Q== X-Received: by 2002:a7b:c856:0:b0:3fb:dd5d:76b with SMTP id c22-20020a7bc856000000b003fbdd5d076bmr4078592wml.7.1690101214417; Sun, 23 Jul 2023 01:33:34 -0700 (PDT) Received: from localhost (93.72.115.87.dyn.plus.net. [87.115.72.93]) by smtp.gmail.com with ESMTPSA id u19-20020a05600c211300b003fbc30825fbsm6995525wml.39.2023.07.23.01.33.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jul 2023 01:33:34 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PUSHED] gdb: two changes to linux_nat_debug_printf calls in linux-nat.c Date: Sun, 23 Jul 2023 09:33:32 +0100 Message-Id: <8a9da63e407c511df32841abcbe20effe2f3e398.1690101201.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This commit adjusts some of the debug output in linux-nat.c, but makes no other functional changes to GDB. In resume_lwp I've added the word "sibling" to one of the debug messages. All the other debug messages in this function talk about operating on the sibling thread, so I think it makes sense, for consistency, if the message I've updated also talks about the sibling thread. In resume_stopped_resumed_lwps I've reordered the condition checks so that the vfork-parent check now happens after the checks for whether the thread is already resumed or not. This makes no functional difference to GDB, but does, I think, mean we see more helpful debug messages first. Consider the situation where a vfork-parent thread is already resumed, and resume_stopped_resumed_lwps is called. Previously the message saying that the thread was not being resumed due to being a vfork-parent, was printed. This might give the impression that the thread is left in a not resumed state, which is misleading. After this change we now get a message saying that the thread is not being resumed due to it not being stopped (i.e. is already resumed). With this message the already resumed nature of the thread is much clearer. I found this change helpful when debugging some vfork related issues. --- gdb/linux-nat.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 73008a313c0..250a8f43282 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -1550,7 +1550,7 @@ resume_lwp (struct lwp_info *lp, int step, enum gdb_signal signo) if (inf->vfork_child != NULL) { - linux_nat_debug_printf ("Not resuming %s (vfork parent)", + linux_nat_debug_printf ("Not resuming sibling %s (vfork parent)", lp->ptid.to_string ().c_str ()); } else if (!lwp_status_pending_p (lp)) @@ -3359,12 +3359,7 @@ resume_stopped_resumed_lwps (struct lwp_info *lp, const ptid_t wait_ptid) { inferior *inf = find_inferior_ptid (linux_target, lp->ptid); - if (inf->vfork_child != nullptr) - { - linux_nat_debug_printf ("NOT resuming LWP %s (vfork parent)", - lp->ptid.to_string ().c_str ()); - } - else if (!lp->stopped) + if (!lp->stopped) { linux_nat_debug_printf ("NOT resuming LWP %s, not stopped", lp->ptid.to_string ().c_str ()); @@ -3379,6 +3374,11 @@ resume_stopped_resumed_lwps (struct lwp_info *lp, const ptid_t wait_ptid) linux_nat_debug_printf ("NOT resuming LWP %s, has pending status", lp->ptid.to_string ().c_str ()); } + else if (inf->vfork_child != nullptr) + { + linux_nat_debug_printf ("NOT resuming LWP %s (vfork parent)", + lp->ptid.to_string ().c_str ()); + } else { struct regcache *regcache = get_thread_regcache (linux_target, lp->ptid); base-commit: dd82bbc1b3e79fb5e072ce4953cafc789333ce82 -- 2.25.4