From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19400 invoked by alias); 3 Aug 2011 17:53:53 -0000 Received: (qmail 19390 invoked by uid 22791); 3 Aug 2011 17:53:51 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Aug 2011 17:53:35 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p73HrXiQ009075 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 3 Aug 2011 13:53:33 -0400 Received: from host1.jankratochvil.net (ovpn-116-16.ams2.redhat.com [10.36.116.16]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p73HrVIw024076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 3 Aug 2011 13:53:32 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p73HrU5u019849; Wed, 3 Aug 2011 19:53:30 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p73HrTTN019847; Wed, 3 Aug 2011 19:53:29 +0200 Date: Wed, 03 Aug 2011 17:53:00 -0000 From: Jan Kratochvil To: Jakub Jelinek Cc: Eli Zaretskii , drow@false.org, gdb-patches@sourceware.org Subject: Re: [RFC 06/12] entryval: Display @entry parameters in bt full Message-ID: <20110803175329.GA19829@host1.jankratochvil.net> References: <20110718201852.GG30496@host1.jankratochvil.net> <20110719103055.GA21344@host1.jankratochvil.net> <20110719114148.GA14146@sunsite.ms.mff.cuni.cz> <20110803172725.GA9502@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110803172725.GA9502@host1.jankratochvil.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 X-SW-Source: 2011-08/txt/msg00052.txt.bz2 Extended by `set print entry-values if-needed' as suggested (not its name) by Jakub. On Wed, 03 Aug 2011 19:27:25 +0200, Jan Kratochvil wrote: On Tue, 19 Jul 2011 13:41:48 +0200, Jakub Jelinek wrote: > There are several possibilities of what info may be available for > a parameter: > 1) the entry value as well as current value of the parameter are known > and known to be equal ="equal" > 2) both entry value and current value of the parameter are known, but are > different ="different" variable "i" (or variable "j") > 3) only entry value is known, current value is optimized out ="validity" parameter "lost" > 4) only current value is known, entry value isn't provided (the value > passed to the function in the caller wasn't saved in any call saved > register or memory slot and wasn't constant, or the compiler didn't > provide call site info for it) ="validity" parameter "born" > 5) neither the entry value nor current value are known (both are > optimized out) ="invalid" > It might be a good idea to give the user for backtraces the ability > to say his preference what kind of values he would like to see and what > information should be printed in all of the above cases, Such full configurability would have about 5 GDB `set' variables and it would not be convenient to choose the practical possibilities from all of those. Most of its combinations would not make sense. If there is an idea for a useful new behavior GDB can be easily extended for it. Is there an agreement upon the output below? `set print entry-values both' shows the real program state. `set print entry-values compact' should be the default option. `set print entry-values preferred' may be possibly the choice for some backtraces. I would like an approval before I rebuild the testfile with it again. The output possibilities are currently limited by the fact that there is no reliable possibility to distinguish CU (Compilation Unit) which was compiled without entry-values support (old gcc -g or new gcc -O0 -g; remember only new gcc -O -g produces entry-values) vs. CU in which there was no valid info to create at least one DW_TAG_GNU_call_site with. The default settings must therefore suppress any @entry values output for -O0 -g CUs - it would be very inconvenient to start printing p=1, p@entry= for all the parameters in -O0 -g CUs. Whether GDB could differentiate such old CU vs. new CU with all call sites is a different question, Jakub did not recommend to differentiate it. (For MI there proposing a new separate list "args_entry" besides the current "args" list so there is nothing to talk about, it always acts as "set print entry-values both", it can be reviewed later in the patch.) Thanks, Jan set print entry-values no Print only actual parameter values, never print values from function entry point. different #0 d (i=31, j=31.5) at ./gdb.arch/amd64-entry-value.cc:34 validity #0 validity (lost=, born=10) at ./gdb.arch/amd64-entry-value.cc:166 invalid #0 d (i=, j=) at ./gdb.arch/amd64-entry-value.cc:34 equal #5 0x00000000004006f5 in amb_a (i=100) at ./gdb.arch/amd64-entry-value.cc:98 set print entry-values only Print only parameter values from function entry point. The actual parameter values are never printed. different #0 d (i@entry=30, j@entry=30.5) at ./gdb.arch/amd64-entry-value.cc:34 validity #0 validity (lost@entry=5, born@entry=) at ./gdb.arch/amd64-entry-value.cc:166 invalid #0 d (i@entry=, j@entry=) at ./gdb.arch/amd64-entry-value.cc:34 equal #5 0x00000000004006f5 in amb_a (i@entry=100) at ./gdb.arch/amd64-entry-value.cc:98 set print entry-values preferred Print only parameter values from function entry point. If value from function entry point is not known while the actual value is known print at least the actual value for such parameter. different #0 d (i@entry=30, j@entry=30.5) at ./gdb.arch/amd64-entry-value.cc:34 validity #0 validity (lost@entry=5, born=10) at ./gdb.arch/amd64-entry-value.cc:166 invalid #0 d (i=, j=) at ./gdb.arch/amd64-entry-value.cc:34 equal #5 0x00000000004006f5 in amb_a (i@entry=100) at ./gdb.arch/amd64-entry-value.cc:98 set print entry-values if-needed Print actual parameter values. If actual parameter value is not known while value from function entry point is known print at least the entry point value for such parameter. different #0 d (i=31, j=31.5) at ./gdb.arch/amd64-entry-value.cc:34 validity #0 validity (lost@entry=5, born=10) at ./gdb.arch/amd64-entry-value.cc:166 invalid #0 d (i=, j=) at ./gdb.arch/amd64-entry-value.cc:34 equal #5 0x00000000004006f5 in amb_a (i=100) at ./gdb.arch/amd64-entry-value.cc:98 set print entry-values both Always print both the actual parameter value and its value from function entry point. Still print both even if one of them or both are . different #0 d (i=31, i@entry=30, j=31.5, j@entry=30.5) at ./gdb.arch/amd64-entry-value.cc:34 validity #0 validity (lost=, lost@entry=5, born=10, born@entry=) at ./gdb.arch/amd64-entry-value.cc:166 invalid #0 d (i=, i@entry=, j=, j@entry=) at ./gdb.arch/amd64-entry-value.cc:34 equal #5 0x00000000004006f5 in amb_a (i=100, i@entry=100) at ./gdb.arch/amd64-entry-value.cc:98 set print entry-values compact Always print the actual parameter value. Print also its value from function entry point but only if it is known. If both values are known and they are equal print the shortened param=param@entry=VALUE notation. different #0 d (i=31, i@entry=30, j=31.5, j@entry=30.5) at ./gdb.arch/amd64-entry-value.cc:34 validity #0 validity (lost=, lost@entry=5, born=10) at ./gdb.arch/amd64-entry-value.cc:166 invalid #0 d (i=, j=) at ./gdb.arch/amd64-entry-value.cc:34 equal #5 0x00000000004006f5 in amb_a (i=i@entry=100) at ./gdb.arch/amd64-entry-value.cc:98