From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5918 invoked by alias); 15 Oct 2013 23:45:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 5906 invoked by uid 89); 15 Oct 2013 23:45:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f201.google.com Received: from mail-pd0-f201.google.com (HELO mail-pd0-f201.google.com) (209.85.192.201) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 15 Oct 2013 23:45:36 +0000 Received: by mail-pd0-f201.google.com with SMTP id v10so933033pde.2 for ; Tue, 15 Oct 2013 16:45:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:mime-version:content-type :content-transfer-encoding:message-id:date:to:cc:subject:in-reply-to :references; bh=OHP7/T8RpYqtErbhy7BohHE84alSB+SMfUMaY9JIPgQ=; b=KqlDOT/4jFegYcbw0xiaHbLUV9INfn7TCLI2nvf4IeCVaEE6FByENar7vf10HcyUaQ gf7lIH0lhJHoBMNN/QNd65Q6o8Qme9UPWFBKcAAIgLDvfa6kl94M1FJuVlOp+cnWrn6l Q7trJb9JXk9K72056KQ0VyelK5pGD4O3e7hutHGT85sv988GRMhIxPESGTRjWruBMBdW 7JSiHAE/gSZJ8wXXsPX2kcReavPJUM6mkyC/0M02SEeeMygCEbfinHnXU1lNx1+cFNUl f98tyFWO3GbtvVzyxDh0L9JhashcPGk4MaixcqPBC0f/t+wVknypSCd0z48nRXUd0nfz g6IQ== X-Gm-Message-State: ALoCoQlhqVFROZ4AOe3ccwdc0ntumqdvlGB0nvPFER7CEeb+eW+/eb/qjyZMltSCGkf6iET0ApLhkQUPU46HxPneHIp9kO/c67BYZzmRnBDy3s4pKtHtIrGQMUdsZUjskc7weDzRX4VIXG5Cri7T22XRRxJmG+w1ij5dG3BaZVUzAX09yNzgN2Pf6tOIQUtURpdnNS7ch9P0etsHL8F+HGL4uKnw3kX9wA== X-Received: by 10.66.161.40 with SMTP id xp8mr167643pab.39.1381880734287; Tue, 15 Oct 2013 16:45:34 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id z45si4239201yha.7.1969.12.31.16.00.00 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Tue, 15 Oct 2013 16:45:34 -0700 (PDT) Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.17.128.44]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id AC1C431C226; Tue, 15 Oct 2013 16:45:33 -0700 (PDT) From: Doug Evans MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <21085.54173.143927.913006@ruffy.mtv.corp.google.com> Date: Tue, 15 Oct 2013 23:45:00 -0000 To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Print nonexisting/optimized out static fields gracefully. In-Reply-To: <1381429510-14825-1-git-send-email-palves@redhat.com> References: <1381429510-14825-1-git-send-email-palves@redhat.com> X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00463.txt.bz2 Pedro Alves writes: > With: > > struct static_struct { static int aaa; }; > struct static_struct sss; > int main () { return 0; } > > We get: > > (gdb) p sss > $1 = {static aaa = } > (gdb) p sss.aaa > field aaa is nonexistent or has been optimized out > > Note that the "field aaa ..." message is an error being thrown. > > GDB is graceful everywhere else when printing optimized out values. > IOW it usually prints an value and puts that in the > value history. I see no reason for here to be different, more so that > when the print the whole "containing" object (well, it's a static > field, so it's not really a container), we already print out>. > > After the patch: > > (gdb) p sss > $1 = {static aaa = } > (gdb) p sss.aaa > field aaa is nonexistent or has been optimized out > (gdb) p sss.aaa > $2 = > > The value_entirely_optimized_out checks are there to preserve > behavior. Without those, if the static field is a struct/union, GDB > would go and print its fields one by one (and print > for each). > > Tested on x86_64 Fedora 17. > > gdb/ > 2013-10-10 Pedro Alves > > * cp-valprint.c (cp_print_value_fields): No longer handle a NULL > static field value. > (cp_print_static_field): If the value is entirely optimized out, > print here. > * jv-valprint.c (java_print_value_fields): No longer handle a NULL > static field value. > * p-valprint.c (pascal_object_print_static_field): If the value is > entirely optimized out, print here. > * valops.c (do_search_struct_field) > (value_struct_elt_for_reference): No longer handle a NULL static > field value. > * value.c (value_static_field): Return an optimized out value > instead of NULL. > > gdb/testsuite/ > 2013-10-10 Pedro Alves > > * gdb.cp/m-static.exp: Adjust expected output of printing a > nonexistent or optimized out static field. Also test printing the > the "container" object. "works for me" [modulo nit noticed by Yao]