From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4347 invoked by alias); 9 Dec 2003 02:42:25 -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 3795 invoked from network); 9 Dec 2003 02:42:22 -0000 Received: from unknown (HELO nick.uklinux.net) (194.247.50.166) by sources.redhat.com with SMTP; 9 Dec 2003 02:42:22 -0000 Received: by nick.uklinux.net (Postfix, from userid 501) id E74DE75FDE; Tue, 9 Dec 2003 02:34:39 +0000 (GMT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16341.13503.256676.933542@nick.uklinux.net> Date: Tue, 09 Dec 2003 02:42:00 -0000 To: gdb-patches@sources.redhat.com Subject: Re: RFC (gdb/mi): -stack-list-locals + REVISED PATCH In-Reply-To: <16332.423.456414.834703@nick.uklinux.net> References: <16319.64137.458928.417189@nick.uklinux.net> <3FC3F85F.8050007@gnu.org> <16332.423.456414.834703@nick.uklinux.net> X-SW-Source: 2003-12/txt/msg00270.txt.bz2 This patch: 1) Follows Jim Ingham's advice of using check_typedef to guard against the case of TYPE_CODE_TYPEDEF. 2) Avoids a segmentation fault if -stack-list-locals is invoked before the inferior has started execution. 3) Still introduces "-stack-list-locals 2". I'm not sure how to simplify this as any change must presumably be beackward compatible. I don't think using different numbers to mean different things is a problem here as mi commands are not intended for the user and so don't need to be remembered by him/her. 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-12-09 02:12:45.000000000 +0000 *************** *** 140,145 **** --- 140,148 ---- if (argc != 1) error ("mi_cmd_stack_list_locals: Usage: PRINT_VALUES"); + if (!deprecated_selected_frame) + error ("No frame selected."); + list_args_or_locals (1, atoi (argv[0]), deprecated_selected_frame); return MI_CMD_DONE; } *************** *** 273,288 **** 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, ! (struct symtab **) NULL); ! else sym2 = sym; print_variable_value (sym2, fi, stb->stream); ui_out_field_stream (uiout, "value", stb); do_cleanups (cleanup_tuple); --- 276,304 ---- 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 (check_typedef (sym2->type)) != TYPE_CODE_ARRAY + && + TYPE_CODE (check_typedef (sym2->type)) != TYPE_CODE_STRUCT) + { + print_variable_value (sym2, fi, stb->stream); + ui_out_field_stream (uiout, "value", stb); + } + do_cleanups (cleanup_tuple); + } + else if (values) + { print_variable_value (sym2, fi, stb->stream); ui_out_field_stream (uiout, "value", stb); do_cleanups (cleanup_tuple);