From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by sourceware.org (Postfix) with ESMTPS id D29A83857C49 for ; Thu, 27 Aug 2020 21:38:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D29A83857C49 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=alves.ped@gmail.com Received: by mail-wr1-f66.google.com with SMTP id d10so5776309wrw.2 for ; Thu, 27 Aug 2020 14:38:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=JGK4wbbMgy1C/IcfixEZd/gtf+jj+yVPWgkZR49wFVc=; b=BlhVRln+oPoZ6Wwnw5IfcqaUpZtT1z8pnp1oiBMEYtuES6+0FahOnZJd+Bpz5juxoK SqIY+K55rYw6GoBkyrJF4j9HV0y+YRr9psRhNG3TCL+JZVPuKA5Q/z1+ozqNKtYX6IP1 bT8JygRJLMNuBse/OBPJfAeHNlRFqf2715rtz+zU1ig8ytKFKXkJqe6+caUktF2p07l3 gUQnD/q8OLUrpiNG2hPTekVp7XH5VrVtV8Mrd4Yidooc65s3n7TV+RUI5PTrihG/FpQw WLXlXKoE9OluqQNhYuMrHi3D7rQKqvbe0B5XVapK8gUAW9x2ZVLV8Jqvafa25AwnIIVH YIOQ== X-Gm-Message-State: AOAM533s3x4IPJ/1wuub6MicI7Knz7rX9bDwarSYDLm6BXmxst5J7Dbg gRT3AYtwTUB6zBEJ8NiHBLzMQsauYY5efK8J X-Google-Smtp-Source: ABdhPJzTGNX/Dcy5Mz976WA58Ph+ugCgtA5gKBg5R+y0/+mX5852H7iqyLRtvVEOtikOjFguwCvgzw== X-Received: by 2002:adf:c50d:: with SMTP id q13mr14366196wrf.175.1598564280901; Thu, 27 Aug 2020 14:38:00 -0700 (PDT) Received: from ?IPv6:2001:8a0:f905:5600:56ee:75ff:fe8d:232b? ([2001:8a0:f905:5600:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id k184sm7602680wme.1.2020.08.27.14.37.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Aug 2020 14:37:59 -0700 (PDT) Subject: Re: [PATCH v2 1/3] gdb: make frame_unwind_got_optimized return a not_lval value To: Simon Marchi , gdb-patches@sourceware.org References: <20200827205724.409603-1-simon.marchi@polymtl.ca> <20200827205724.409603-2-simon.marchi@polymtl.ca> Cc: Scott.Linder@amd.com, Simon Marchi , Zoran.Zaric@amd.com From: Pedro Alves Message-ID: <778c2923-ee09-a47e-74d6-3e01ed0e717a@palves.net> Date: Thu, 27 Aug 2020 22:37:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20200827205724.409603-2-simon.marchi@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Thu, 27 Aug 2020 21:38:03 -0000 On 8/27/20 9:57 PM, Simon Marchi via Gdb-patches wrote: > /* Return a value which indicates that FRAME copied REGNUM into > diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h > index c80ddc84f291..25a601ccf4bb 100644 > --- a/gdb/frame-unwind.h > +++ b/gdb/frame-unwind.h > @@ -133,6 +133,9 @@ typedef void (frame_this_id_ftype) (struct frame_info *this_frame, > may be a lazy reference to memory, a lazy reference to the value of > a register in THIS frame, or a non-lvalue. > > + If the previous frame's register was not saved by THIS_FRAME and is > + therefore undefined, return a not_lval wholly optimized-out value. Super nit: "not_lval wholly optimized-out value" doesn't sound as natural to me as "wholly optimized-out not_lval value" would. It's just like "register optimized-out value" doesn't sound as natural as "optimized-out register value" to me. English adjective order is fun! https://www.theguardian.com/commentisfree/2016/sep/13/sentence-order-adjectives-rule-elements-of-eloquence-dictionary https://www.grammar-monster.com/lessons/order_of_adjectives.htm > + > THIS_PROLOGUE_CACHE can be used to share any prolog analysis data > with the other unwind methods. Memory for that cache should be > allocated using FRAME_OBSTACK_ZALLOC(). */ > diff --git a/gdb/frame.c b/gdb/frame.c > index 7ab3cdcdad41..ccaf97dc7e91 100644 > --- a/gdb/frame.c > +++ b/gdb/frame.c > @@ -1295,7 +1295,7 @@ frame_unwind_register_value (frame_info *next_frame, int regnum) > if (value_optimized_out (value)) > { > fprintf_unfiltered (gdb_stdlog, " "); > - val_print_optimized_out (value, gdb_stdlog); > + val_print_not_saved (gdb_stdlog); > } > else > { > diff --git a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp > index a3e6f28c54f0..4ab7e2dbfc44 100644 > --- a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp > +++ b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp > @@ -74,3 +74,15 @@ for {set f 0} {$f < 3} {incr f} { > "r9\\s+${pattern_r8_r9_info}\\s*"] \ > "Check values of rax, rbx, rcx, r8, r9 in frame ${f}" > } > + > +# Test that the debug log statement in frame_unwind_register_value produces > +# "not saved" and not# "optimized out". Spurious # after "not".