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.133.124]) by sourceware.org (Postfix) with ESMTPS id E26D53852A40 for ; Thu, 8 Dec 2022 08:51:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E26D53852A40 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=1670489504; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JnOxi7pha4RXHV/tJ24B2OvlCQwoJ1yow07YgvecGZo=; b=jJswZtIG+6Ml32FqNaZPkuzMzls6Xo+qbBCbXJFy3LgegRWxFSTYYtyc4J7lMkGG07BBM+ uPjnCx3cmJFX/q0qeakqzftmRQh66MhPY5D2WiX94fEiBQQJjwYcu9+IYWCgsHb4/V0nRM KkLa1N+U4Qbnf11jiVlk696FzkB5Udw= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-556-vOY5iVeTM3uXwOXbwdYFUg-1; Thu, 08 Dec 2022 03:51:41 -0500 X-MC-Unique: vOY5iVeTM3uXwOXbwdYFUg-1 Received: by mail-wm1-f69.google.com with SMTP id j2-20020a05600c1c0200b003cf7397fc9bso502176wms.5 for ; Thu, 08 Dec 2022 00:51:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=JnOxi7pha4RXHV/tJ24B2OvlCQwoJ1yow07YgvecGZo=; b=ysiArk+HouUYig7csnY6/5tQ2GjDKoBYOKOr+WFuHSZyNQhAo1+cWcaoA62iUlPD/b QHVidWzyU3Ehxm+++sfyzwcSiCaDRPDM1OYjKB5GFnvAvyn617TxZPDTazj3RRcpzmvG 6DcFPrRismMwFVB8CZF+Vfu/yio+WPOr6GUL0EyDPf+hNgrEYD0PXYrFA1qr7Z9SD5v1 6fBj1Sex2gDdj4VCfgG6gdgGHxgdya/44WN1jK89jEt9E/KJUs/L66Y2ANw443lF/k9u jixGcrVhVRcQlV5mX2HLbP09apr4IavoRz8XmJtqE1YQHtBn5RQ+yyP6QkpbsDLaS3ol LivA== X-Gm-Message-State: ANoB5pm9y1FBSCUsFHL0eIaz543245ZzwLi8K2w9EqRsjMyZPrLJL4Ax ClDvS5f/YVVVyzH0xxFwh2VZDQxZBPn8mua/M6EKBoIPKJmZGNRq/07C6LjWY4IersGMbk+I87+ 6LmtxcN3zFPtHq6+e6SO/kQ== X-Received: by 2002:a5d:58e2:0:b0:242:1df1:b3ec with SMTP id f2-20020a5d58e2000000b002421df1b3ecmr26792244wrd.697.1670489500398; Thu, 08 Dec 2022 00:51:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf7oHTAajCmJqKJF9HyZXWo0ID8SBPVBcv/VyT+D3Edjt21276k49VeSK/EP4bH+ab/+W3oKDQ== X-Received: by 2002:a5d:58e2:0:b0:242:1df1:b3ec with SMTP id f2-20020a5d58e2000000b002421df1b3ecmr26792237wrd.697.1670489500120; Thu, 08 Dec 2022 00:51:40 -0800 (PST) Received: from [192.168.0.45] (ip-62-245-66-121.bb.vodafone.cz. [62.245.66.121]) by smtp.gmail.com with ESMTPSA id bg9-20020a05600c3c8900b003c6f3f6675bsm4975631wmb.26.2022.12.08.00.51.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Dec 2022 00:51:39 -0800 (PST) Message-ID: <91de9931-4031-42b2-c441-87e1c30b20ee@redhat.com> Date: Thu, 8 Dec 2022 09:51:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH 5/6] gdb: make frame_info_ptr grab frame level and id on construction To: Simon Marchi , gdb-patches@sourceware.org References: <20221202180052.212745-1-simon.marchi@polymtl.ca> <20221202180052.212745-6-simon.marchi@polymtl.ca> From: Bruno Larsen In-Reply-To: <20221202180052.212745-6-simon.marchi@polymtl.ca> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP 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: On 02/12/2022 19:00, Simon Marchi via Gdb-patches wrote: > This is the first step of making frame_info_ptr automatic. Remove the > frame_info_ptr::prepare_reinflate method, move that code to the > constructor. I'm still trying to review the rest of the series, but this patch looks pretty simple, and I'm happy that you managed to do what I wanted but couldn't. Reviewed-By: Bruno Larsen -- Cheers, Bruno > Change-Id: I85cdae3ab1c043c70e2702e7fb38e9a4a8a675d8 > --- > gdb/frame-info.c | 18 +++++++++++------- > gdb/frame-info.h | 9 +-------- > gdb/infcmd.c | 1 - > gdb/mi/mi-cmd-stack.c | 1 - > gdb/stack.c | 10 ---------- > 5 files changed, 12 insertions(+), 27 deletions(-) > > diff --git a/gdb/frame-info.c b/gdb/frame-info.c > index d61fb7ed0e95..8ab5f54f8202 100644 > --- a/gdb/frame-info.c > +++ b/gdb/frame-info.c > @@ -31,14 +31,19 @@ intrusive_list frame_info_ptr::frame_list; > > /* See frame-info-ptr.h. */ > > -void > -frame_info_ptr::prepare_reinflate () > +frame_info_ptr::frame_info_ptr (struct frame_info *ptr) > + : m_ptr (ptr) > { > - m_cached_level = frame_relative_level (*this); > + frame_list.push_back (*this); > > - if (m_cached_level != 0 > - || (m_ptr != nullptr && frame_is_user_created (m_ptr))) > - m_cached_id = get_frame_id (*this); > + if (m_ptr != nullptr) > + { > + m_cached_level = frame_relative_level (m_ptr); > + > + if (m_cached_level != 0 > + || (m_ptr != nullptr && frame_is_user_created (m_ptr))) > + m_cached_id = get_frame_id (m_ptr); > + } > } > > /* See frame-info-ptr.h. */ > @@ -91,7 +96,6 @@ test_user_created_frame () > SELF_CHECK (id.code_addr_p); > SELF_CHECK (id.code_addr == 0x5678); > > - frame.prepare_reinflate (); > reinit_frame_cache (); > frame.reinflate (); > > diff --git a/gdb/frame-info.h b/gdb/frame-info.h > index 8f01ee007914..224a553ac040 100644 > --- a/gdb/frame-info.h > +++ b/gdb/frame-info.h > @@ -38,11 +38,7 @@ class frame_info_ptr : public intrusive_list_node > { > public: > /* Create a frame_info_ptr from a raw pointer. */ > - explicit frame_info_ptr (struct frame_info *ptr) > - : m_ptr (ptr) > - { > - frame_list.push_back (*this); > - } > + explicit frame_info_ptr (struct frame_info *ptr); > > /* Create a null frame_info_ptr. */ > frame_info_ptr () > @@ -142,9 +138,6 @@ class frame_info_ptr : public intrusive_list_node > m_ptr = nullptr; > } > > - /* Cache the frame_id that the pointer will use to reinflate. */ > - void prepare_reinflate (); > - > /* Use the cached frame_id to reinflate the pointer. */ > void reinflate (); > > diff --git a/gdb/infcmd.c b/gdb/infcmd.c > index a27d3577b3aa..ee3d97b585dd 100644 > --- a/gdb/infcmd.c > +++ b/gdb/infcmd.c > @@ -1837,7 +1837,6 @@ finish_command (const char *arg, int from_tty) > frame = get_prev_frame (get_selected_frame (_("No selected frame."))); > if (frame == 0) > error (_("\"finish\" not meaningful in the outermost frame.")); > - frame.prepare_reinflate (); > > clear_proceed_status (0); > > diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c > index f0af7c9a0143..186d53156730 100644 > --- a/gdb/mi/mi-cmd-stack.c > +++ b/gdb/mi/mi-cmd-stack.c > @@ -176,7 +176,6 @@ mi_cmd_stack_list_frames (const char *command, char **argv, int argc) > i++, fi = get_prev_frame (fi)) > { > QUIT; > - fi.prepare_reinflate (); > /* Print the location and the address always, even for level 0. > If args is 0, don't print the arguments. */ > print_frame_info (user_frame_print_options, > diff --git a/gdb/stack.c b/gdb/stack.c > index 4ad51c2eb50e..126ce0b8cc2a 100644 > --- a/gdb/stack.c > +++ b/gdb/stack.c > @@ -362,7 +362,6 @@ print_stack_frame (frame_info_ptr frame, int print_level, > if (current_uiout->is_mi_like_p ()) > print_what = LOC_AND_ADDRESS; > > - frame.prepare_reinflate (); > try > { > print_frame_info (user_frame_print_options, > @@ -744,11 +743,6 @@ print_frame_args (const frame_print_options &fp_opts, > = (print_names > && fp_opts.print_frame_arguments != print_frame_arguments_none); > > - /* If one of the arguments has a pretty printer that calls a > - function of the inferior to print it, the pointer must be > - reinflatable. */ > - frame.prepare_reinflate (); > - > /* Temporarily change the selected frame to the given FRAME. > This allows routines that rely on the selected frame instead > of being given a frame as parameter to use the correct frame. */ > @@ -1047,8 +1041,6 @@ print_frame_info (const frame_print_options &fp_opts, > int location_print; > struct ui_out *uiout = current_uiout; > > - frame.prepare_reinflate (); > - > if (!current_uiout->is_mi_like_p () > && fp_opts.print_frame_info != print_frame_info_auto) > { > @@ -1682,7 +1674,6 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p) > gdb_printf (" %d args: ", numargs); > } > > - fi.prepare_reinflate (); > print_frame_args (user_frame_print_options, > func, fi, numargs, gdb_stdout); > fi.reinflate (); > @@ -2075,7 +2066,6 @@ backtrace_command_1 (const frame_print_options &fp_opts, > for (fi = trailing; fi && count--; fi = get_prev_frame (fi)) > { > QUIT; > - fi.prepare_reinflate (); > > /* Don't use print_stack_frame; if an error() occurs it probably > means further attempts to backtrace would fail (on the other