From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4951 invoked by alias); 2 Dec 2003 03:14:01 -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 4651 invoked from network); 2 Dec 2003 03:13:58 -0000 Received: from unknown (HELO nick.uklinux.net) (194.247.51.105) by sources.redhat.com with SMTP; 2 Dec 2003 03:13:58 -0000 Received: by nick.uklinux.net (Postfix, from userid 501) id 39D0F75FDE; Tue, 2 Dec 2003 03:06:16 +0000 (GMT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16332.423.456414.834703@nick.uklinux.net> Date: Tue, 02 Dec 2003 03:14:00 -0000 To: Andrew Cagney Cc: gdb-patches@sources.redhat.com Subject: Re: RFC (gdb/mi): -stack-list-locals + PATCH In-Reply-To: <3FC3F85F.8050007@gnu.org> References: <16319.64137.458928.417189@nick.uklinux.net> <3FC3F85F.8050007@gnu.org> X-SW-Source: 2003-12/txt/msg00036.txt.bz2 ... > > 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. I see now that I've also inadvertantly defined "-stack-list-arguments 2". I don't know what magic numbers are but clearly better structure is desirable. > Would is_integral_type() give you what you want? For a simple data type? I don't think so. What about float? Perhaps I'm missing your point. > > 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). I understand make_cleanup_ui_out_tuple_begin_end but not the above restructured form. Do I have to call make_cleanup (or relatives) each time I allocated memory i.e for each call to ui_out_field_stream? While I'm thinking about the above, here is a basic patch for mi-cmd-stack.c. Currently if -stack-list-locals is invoked then it gives a segmentation fault (Segmentation fault (core dumped)). This is inconvenient and the patch changes this to give an output similar to that of cli: &"No frame selected.\n" ^error,msg="No frame selected." (gdb) 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-02 02:43:04.000000000 +0000 *************** *** 138,147 **** --- 138,150 ---- mi_cmd_stack_list_locals (char *command, char **argv, int argc) { 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; }