From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28534 invoked by alias); 26 Nov 2003 00:48:36 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 28522 invoked from network); 26 Nov 2003 00:48:35 -0000 Received: from unknown (HELO localhost.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 26 Nov 2003 00:48:35 -0000 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 54A822B8F; Tue, 25 Nov 2003 19:48:31 -0500 (EST) Message-ID: <3FC3F85F.8050007@gnu.org> Date: Wed, 26 Nov 2003 00:48:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030820 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Nick Roberts Cc: gdb-patches@sources.redhat.com Subject: Re: RFC (gdb/mi): -stack-list-locals References: <16319.64137.458928.417189@nick.uklinux.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-11/txt/msg00589.txt.bz2 > Attached is a patch for -stack-list-locals which roughly modifies this command > as I described previously on gdb@sources.redhat.com (Thu, 6 Nov 2003 22:04:22 > +0000). It actually does the following: > > 1) Display the name, type and value for simple data types. > 2) Display the name and type for complex data types. > > I don't really know what make_cleanup_ui_out_tuple_begin_end and do_cleanups > do and I've approximated a simple data type to something that isn't > TYPE_CODE_ARRAY or TYPE_CODE_STRUCT so it's probably a pretty gross hack. > > The idea is that the user can see the value of simple data types immediately > and can create variable objects for complex data types if he wishes to explore > their values in more detail. > > Any comments? Looks like its time to cleanup "values" changing it to an enum or bitmask - too many magic numbers. Would is_integral_type() give you what you want? For the cleanups try the restructured form: { struct cleanup = cleanups = make_cleanup (NULL, null_cleanup); .. do_cleanups (cleanups); } http://sources.redhat.com/gdb/current/onlinedocs/gdbint_13.html#SEC112 make_cleanup_ui_out_tuple_begin_end opens the tuple and then closes it via a cleanup (if an error is thrown the tuple under construction is still finished). Andrew > Nick http://www.nick.uklinux.net > > > > *** mi-cmd-stack.c.~1.19.~ 2003-06-12 23:29:37.000000000 +0100 > --- mi-cmd-stack.c 2003-11-22 23:49:24.000000000 +0000 > *************** > *** 273,292 **** > make_cleanup_ui_out_tuple_begin_end (uiout, NULL); > ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym)); > > ! if (values) > ! { > ! struct symbol *sym2; > ! if (!locals) > ! sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym), > ! block, VAR_DOMAIN, > ! (int *) NULL, > ! 2 (struct symtab **) NULL); > ! else > sym2 = sym; > print_variable_value (sym2, fi, stb->stream); > ui_out_field_stream (uiout, "value", stb); > - do_cleanups (cleanup_tuple); > } > } > } > if (BLOCK_FUNCTION (block)) > --- 273,303 ---- > make_cleanup_ui_out_tuple_begin_end (uiout, NULL); > ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym)); > > ! struct symbol *sym2; > ! if (!locals) > ! sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym), > ! block, VAR_DOMAIN, > ! (int *) NULL, > ! (struct symtab **) NULL); > ! else > sym2 = sym; > + if (values == 2) > + { > + type_print (sym2->type, "", stb->stream, -1); > + ui_out_field_stream (uiout, "type", stb); > + if (TYPE_CODE (sym2->type) != TYPE_CODE_ARRAY && > + TYPE_CODE (sym2->type) != TYPE_CODE_STRUCT) > + { > + print_variable_value (sym2, fi, stb->stream); > + ui_out_field_stream (uiout, "value", stb); > + } > + } > + else if (values) > + { > print_variable_value (sym2, fi, stb->stream); > ui_out_field_stream (uiout, "value", stb); > } > + if (values) do_cleanups (cleanup_tuple); > } > } > if (BLOCK_FUNCTION (block)) >