From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17824 invoked by alias); 24 Mar 2009 21:27:45 -0000 Received: (qmail 17815 invoked by uid 22791); 24 Mar 2009 21:27:44 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 Mar 2009 21:27:39 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 6742A2BABF1 for ; Tue, 24 Mar 2009 17:27:36 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id a-RHHdMYtUEh for ; Tue, 24 Mar 2009 17:27:36 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 28CEB2BABEE for ; Tue, 24 Mar 2009 17:27:36 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id AEAB5F5898; Tue, 24 Mar 2009 14:27:30 -0700 (PDT) Date: Tue, 24 Mar 2009 21:40:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [RFC] Change "set print frame-arguments"'s default to scalars Message-ID: <20090324212730.GU9472@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="6sX45UoQRIJXqkqR" Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) 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: 2009-03/txt/msg00533.txt.bz2 --6sX45UoQRIJXqkqR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 2477 This is a slight change in behavior that we made at AdaCore which everyone seemed to have enjoyed. The proposal is to change the default for "set print frame-arguments" to "scalars" in order to unclutter frames a bit. For instance, I found the following example in our testsuite. The debugger hit a breakpoing inside a function where some of the arguments are structs. It looks like this: > Breakpoint 7, sum_array_print (seed=10, linked_list1={next_index = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, values = {4, 6, 8, 10, 12, 14, 16, 18, 20, 22}, head = 0}, linked_list2={next_index = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, values = {8, 10, 12, 14, 16, 18, 20, 22, 24, 26}, head = 0}, linked_list3={next_index = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, values = {10, 12, 14, 16, 18, 20, 22, 24, 26, 28}, head = 0}, linked_list4={next_index = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, values = {20, 22, 24, 26, 28, 30, 32, 34, 36, 38}, head = 0}) at /home/brobecke/act/gdb-public/gdb/testsuite/gdb.base/call-ar-st.c:1105^M (you should see what the above looks like when it's inside a backtrace) The idea is that, most of the time, people are mostly interested in knowing the name of the function where they stopped, and don't care (yet!) about the value for their parameters. So simplifying the output above to the following should be more productive most of the time: > Breakpoint 7, sum_array_print (seed=10, linked_list1=..., linked_list2=..., linked_list3=..., linked_list4=...) at /home/brobecke/act/gdb-public/gdb/testsuite/gdb.base/call-ar-st.c:1105^M If the user needs to know the value of one of the non-scalar parameters, he needs to use "print". From my personal experience, even if the parameter value was printed in the frame, the frame is so cluttered at this point that I would manaully get the parameter value with a print anyway. To put things back into perspective, I think it's relatively uncommon to pass structs by argument unless they are small. When bigger, I suspect that the typical approach is to pass its address. So I don't think this change would impact C users much. I'm not sure about C++, in particular I'm not sure about how classes/objects are passed. I guess references, which probably means little impact as well. In Ada, however, passing structs as arguments is a common idiom, and changing the default seems to have improved the life of many developers. I suspect that the same will be true of Pascal users, but I can't say for sure. Yay? Nay? Thanks, -- Joel --6sX45UoQRIJXqkqR Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="frame-args-scalars.diff" Content-length: 718 commit ab83cdc6d0d12c1fcfd718e8c81038be77f02491 Author: Joel Brobecker Date: Tue Mar 24 14:10:08 2009 -0700 Change the default value for "set print frame-arguments" to scalars. * stack.c (print_frame_arguments): Set initial value to "scalars". diff --git a/gdb/stack.c b/gdb/stack.c index f185841..814e271 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -58,7 +58,7 @@ void (*deprecated_selected_frame_level_changed_hook) (int); static const char *print_frame_arguments_choices[] = {"all", "scalars", "none", NULL}; -static const char *print_frame_arguments = "all"; +static const char *print_frame_arguments = "scalars"; /* Prototypes for local functions. */ --6sX45UoQRIJXqkqR--