From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8139 invoked by alias); 27 Jul 2009 16:50:58 -0000 Received: (qmail 8129 invoked by uid 22791); 27 Jul 2009 16:50:58 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Jul 2009 16:50:50 +0000 Received: (qmail 2179 invoked from network); 27 Jul 2009 16:50:46 -0000 Received: from unknown (HELO wind.localnet) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 27 Jul 2009 16:50:46 -0000 From: Vladimir Prus To: tromey@redhat.com Subject: Re: [RFA] Implement -break-commands Date: Mon, 27 Jul 2009 17:38:00 -0000 User-Agent: KMail/1.11.90 (Linux/2.6.24-24-generic; KDE/4.2.90; i686; svn-979530; 2009-06-10) Cc: gdb-patches@sources.redhat.com References: <200907271303.13335.vladimir@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200907272050.41744.vladimir@codesourcery.com> 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-07/txt/msg00653.txt.bz2 On Monday 27 July 2009 Tom Tromey wrote: > >>>>> "Volodya" == Vladimir Prus writes: > > This all looks reasonable to me. I have a few style nits. > > Volodya> -/* Read one line from the input stream. If the command is an "end", > Volodya> - return such an indication to the caller. If PARSE_COMMANDS is true, > Volodya> - strip leading whitespace (trailing whitespace is always stripped) > Volodya> - in the line, attempt to recognize GDB control commands, and also > Volodya> - return an indication if the command is an "else" or a nop. > Volodya> - Otherwise, only "end" is recognized. */ > > Volodya> -static enum misc_command_type > Volodya> -read_next_line (struct command_line **command, int parse_commands) > Volodya> +char * > Volodya> +read_next_line () > > This should be marked `static' (it is declared that way but it is > clearer to mark the definition as well). I think it needs a header > comment. > > Volodya> static enum command_control_type > Volodya> -recurse_read_control_structure (struct command_line *current_cmd) > Volodya> +recurse_read_control_structure (char * (*read_next_line_func) (), > Volodya> + struct command_line *current_cmd) > > The header comment should be updated to mention the new argument. > And if you don't mind, please fix the reference to the non-existing > "parent_control" parameter. > > Volodya> +extern struct command_line *read_command_lines_1 > Volodya> +(char * (*read_next_line_func) (), int parse_commands); > > Indentation on the 2nd line. > > There's some other little style nits in the patch -- over-bracing in the > second patch, mostly. Is that something you want fixed? I do prefer bracing everything, since that is safer in the long run. > > Volodya> +void > Volodya> +breakpoint_set_commands (struct breakpoint *b, struct command_line *commands) > > Needs a header comment. Do we have a policy if function should be documented in header, or implementation? It seems many existing files have comments on implementation. > Volodya> +static char **mi_command_line_array; > Volodya> +static int mi_command_line_array_cnt; > Volodya> +static int mi_command_line_array_ptr; > > [...] > > Volodya> + break_command = read_command_lines_1 (mi_read_next_line, 0); > > I think this would be cleaner if read_command_lines_1 took a "user_data" > argument and then there were no new globals. It would be clearer, though I decided not to do that because it's not likely we'll need another such function, and the use of globals in this context is ugly, but safe. Shall I refactor? Thanks, Volodya