From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id S1OTBmHrH2qH7DEAWB0awg (envelope-from ) for ; Wed, 03 Jun 2026 04:52:49 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gUjFSLhB; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 0A05D1E062; Wed, 03 Jun 2026 04:52:49 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (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 4A07A1E062 for ; Wed, 03 Jun 2026 04:52:48 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 147A14BA2E1B for ; Wed, 3 Jun 2026 08:52:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 147A14BA2E1B Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gUjFSLhB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id C9D174BA5436 for ; Wed, 3 Jun 2026 08:52:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C9D174BA5436 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C9D174BA5436 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780476739; cv=none; b=TV3Ocj6/Ehic6EOxZElMIXQjcfNvGNT7OWEN9yLVeSlt03Uck6bKX5uRCJ00+8jZ1YpLOZFnCYOuKxwF04th+ofCFvxEG613dDi+SPK2ivxLYtdRtDLGS/4YDDzAX7sJSxTidOaJKgpI/3w8rWDutNOaUrXAaFDWQeMLF4NO6YQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780476739; c=relaxed/simple; bh=DAeoLFet5zRx+LLd9gzxj0dBJ4xGuUEXn8MxzShPW1Y=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=w/cOM3N35fk/j1VG6sOxxz2c3dx9eLOn7nhkPJGwWDdWWWkV7hbcg1dZ407Sq6w0LSYXPjXFLpaYzYaH8OvdfRxD3FZ+3gQSbcDI1XDhKz+HlOYp1+hQEN9xhq93DOmDMujXkZHKOqIVT+M3FtIp8kRc1Ix5Zb8Ds5M+wltoFkA= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gUjFSLhB DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C9D174BA5436 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780476739; 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=VoDh/imIiYXP3AEyjYPmbwcfYuf73+JeormgECBe7HU=; b=gUjFSLhBzPnrHAmHHOW48P26FAbC5R8fl7pnNN1YkUlV8oCCf1jyVUPZ7hwyqF7Ecm21W1 xnzuKRT+9eHYsWu0WGHgsyKEhuDXTiBYV0mZIY4Ww6jKwDgGJHwAJxazHe7kdOSpQ/++nA smNjbpuND3d7c2GMEFsycq6WAszD9qo= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-352-hZ1epHCfNbmzuPlBheIrOA-1; Wed, 03 Jun 2026 04:52:18 -0400 X-MC-Unique: hZ1epHCfNbmzuPlBheIrOA-1 X-Mimecast-MFC-AGG-ID: hZ1epHCfNbmzuPlBheIrOA_1780476737 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-490ae3bcf4cso11660915e9.3 for ; Wed, 03 Jun 2026 01:52:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780476737; x=1781081537; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VoDh/imIiYXP3AEyjYPmbwcfYuf73+JeormgECBe7HU=; b=gAT9Y/OmcMvMaF/j2HGijo6tc32/iBTYftTeYrofA4ubFx+Etuzs3Vg/ooEBbQlP/x hlGjc3S3u4bfVnBCNHKUKnGI96H/lV8YxFMOzvjEShtk2G0M+JM6YzJ00in5zNmPgKB3 PRyfCc0HaSfQvxc4l4ZsHnb1yak4OH6WUMDRXavU0vJ0P32mS/97P0AaVhGnWccfjzOF XIay74gAdQPwj6c6sK+xy/LzkfdF2+dbH6SPSRqcwcKiMT7Ghf4eks03xJx3wpUhoAJy tIAUhp9Q8OzkYidKITN37pxcsYJ/i/ZxMO/Ga1cTxM2XoHJkR8ZWFhPEbh07gYmHGbDg gIGQ== X-Gm-Message-State: AOJu0Yxe2Vde586FKfTM5N/ruSPGyCziUj/rNjXdd1ZFeIjn3x/q7Nwh r33Nhse5wnCzW6CQcNc2M97cd47pJ9nKbOOcHQPEK2SdJ47xRz3SKrGmeqWkCRZUZdSwqav1qBf oWt/godZJsshlJA1PnbN+zwzicwXM+G5faMTux9j/WRBhpUA0RIM0F6xRB4xDrivnmHfm6jhX6K hWTSaLLbMx1+vZePzuoV++pDGIoN21CIDkbSRcrmr5oTYd7yo= X-Gm-Gg: Acq92OGlXcw7jrz1auWuCwEjU2bq2CdT0r35UHZ2vGNjDphBe3eSA0d0VarIXKaq9p3 fda/IlgJqEqwk1jNxdyn1YZRkRQh9rbiaB0jxAs/S4VfCA7ytUPTmhP9ntvzVdA5Sgy+FKe9Esy H3pDahXO3pKkEZdfuz8CMQEUOf4T23cnwclwLg+I9kI/y0gKELS/WnTyhj2xwhpj4Cy/XW+q6XK Uiq9mMyz3Pe+6OqTw5jSwBkjjUZY2ro/ol7TC1EE9sLW1Tp9IgzKocHZPNirur2mMIrHpfkoTzj bE9bUOHbGm1rN85aTEckK/dwLx60l+tZRisGoRrK8AI75DRLfH7O3qbBdRnsYUVt0AuWzcHHsUX wmDZnBFHzYY67JpbDVZSqKhne62C3GA== X-Received: by 2002:a05:600c:4e92:b0:48e:60a3:220a with SMTP id 5b1f17b1804b1-490b5d43ff0mr40064645e9.0.1780476736772; Wed, 03 Jun 2026 01:52:16 -0700 (PDT) X-Received: by 2002:a05:600c:4e92:b0:48e:60a3:220a with SMTP id 5b1f17b1804b1-490b5d43ff0mr40063985e9.0.1780476736135; Wed, 03 Jun 2026 01:52:16 -0700 (PDT) Received: from localhost ([109.144.220.194]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490b444f4fesm73654935e9.12.2026.06.03.01.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2026 01:52:15 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb/frame: add FRAME_SCOPED_DEBUG_START_END Date: Wed, 3 Jun 2026 09:52:13 +0100 Message-Id: <2ce7d5465de836f6180411a699471dc165e61b74.1780476716.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 0Igfh4H1fezKOWftWWioahK69OOBeN78mU1_pP4sl1Y_1780476737 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 Add the FRAME_SCOPED_DEBUG_START_END macro, and make use of it in a couple of places. I find the frame debug output a little noisy, and it could be easier to match up the entry/exit lines, by making use of FRAME_SCOPED_DEBUG_START_END to print the frame level. While I was adding the FRAME_SCOPED_DEBUG_START_END calls, there were a couple of places where I also moved a variable declaration from the top the a function into the function body. And in another couple of places there was some debug output that could be removed, where the existing debug just printed the frame level (this is now handled by the START/END macro). There should be no user visible changes after this commit unless 'set debug frame on' is used of course. --- gdb/frame.c | 24 ++++++------------------ gdb/frame.h | 5 +++++ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/gdb/frame.c b/gdb/frame.c index 61d37316c6a..179e251eb1f 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -619,7 +619,7 @@ skip_tailcall_frames (const frame_info_ptr &initial_frame) static void compute_frame_id (const frame_info_ptr &fi) { - FRAME_SCOPED_DEBUG_ENTER_EXIT; + FRAME_SCOPED_DEBUG_START_END ("fi=%d", fi->level); gdb_assert (fi->this_id.p == frame_id_status::NOT_COMPUTED); @@ -630,8 +630,6 @@ compute_frame_id (const frame_info_ptr &fi) /* Mark this frame's id as "being computed. */ fi->this_id.p = frame_id_status::COMPUTING; - frame_debug_printf ("fi=%d", fi->level); - /* Find the unwinder. */ if (fi->unwind == NULL) frame_unwind_find_by_frame (fi, &fi->prologue_cache); @@ -2349,18 +2347,10 @@ get_prev_frame_maybe_check_cycle (const frame_info_ptr &this_frame) static frame_info_ptr get_prev_frame_always_1 (const frame_info_ptr &this_frame) { - FRAME_SCOPED_DEBUG_ENTER_EXIT; + FRAME_SCOPED_DEBUG_START_END ("fi=%d", this_frame->level); gdb_assert (this_frame != NULL); - if (frame_debug) - { - if (this_frame != NULL) - frame_debug_printf ("this_frame=%d", this_frame->level); - else - frame_debug_printf ("this_frame=nullptr"); - } - struct gdbarch *gdbarch = get_frame_arch (this_frame); /* Only try to do the unwind once. */ @@ -2593,7 +2583,7 @@ get_prev_frame_always (const frame_info_ptr &this_frame) static frame_info_ptr get_prev_frame_raw (const frame_info_ptr &this_frame) { - frame_info *prev_frame; + FRAME_SCOPED_DEBUG_START_END ("fi=%d", this_frame->level); /* Allocate the new frame but do not wire it in to the frame chain. Some (bad) code in INIT_FRAME_EXTRA_INFO tries to look along @@ -2605,7 +2595,7 @@ get_prev_frame_raw (const frame_info_ptr &this_frame) quickly reclaimed when the frame cache is flushed, and the `we've been here before' check above will stop repeated memory allocation calls. */ - prev_frame = frame_obstack_zalloc (); + frame_info *prev_frame = frame_obstack_zalloc (); prev_frame->level = this_frame->level + 1; /* For now, assume we don't have frame chains crossing address @@ -2729,16 +2719,14 @@ inside_entry_func (const frame_info_ptr &this_frame) frame_info_ptr get_prev_frame (const frame_info_ptr &this_frame) { - FRAME_SCOPED_DEBUG_ENTER_EXIT; - - std::optional frame_pc; + FRAME_SCOPED_DEBUG_START_END ("fi=%d", this_frame->level); /* There is always a frame. If this assertion fails, suspect that something should be calling get_selected_frame() or get_current_frame(). */ gdb_assert (this_frame != NULL); - frame_pc = get_frame_pc_if_available (this_frame); + std::optional frame_pc = get_frame_pc_if_available (this_frame); /* tausq/2004-12-07: Dummy frames are skipped because it doesn't make much sense to stop unwinding at a dummy frame. One place where a dummy diff --git a/gdb/frame.h b/gdb/frame.h index 00485e6d1e2..f6553fb7b6d 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -125,6 +125,11 @@ extern bool frame_debug; #define FRAME_SCOPED_DEBUG_ENTER_EXIT \ scoped_debug_enter_exit (frame_debug, "frame") +/* Print "frame" start/end debug statements. */ + +#define FRAME_SCOPED_DEBUG_START_END(fmt, ...) \ + scoped_debug_start_end (frame_debug, "frame", fmt, ##__VA_ARGS__) + /* Construct a frame ID. The first parameter is the frame's constant stack address (typically the outer-bound), and the second the frame's constant code address (typically the entry point). base-commit: 663cb9c0428068165fc98675599442163d302d41 -- 2.25.4