From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29306 invoked by alias); 20 May 2014 22:24:25 -0000 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 Received: (qmail 29293 invoked by uid 89); 20 May 2014 22:24:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 20 May 2014 22:24:23 +0000 Received: from EUSAAHC006.ericsson.se (Unknown_Domain [147.117.188.90]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id CA.B6.11744.3F38B735; Tue, 20 May 2014 18:33:56 +0200 (CEST) Received: from [142.133.110.254] (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.90) with Microsoft SMTP Server (TLS) id 14.3.174.1; Tue, 20 May 2014 18:24:20 -0400 Message-ID: <537BD614.5030600@ericsson.com> Date: Tue, 20 May 2014 22:24:00 -0000 From: Simon Marchi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Tom Tromey CC: Subject: Re: [PATCH v2] Fix argument passing in mi_run_cmd_full References: <1400017636-28020-1-git-send-email-simon.marchi@ericsson.com> <87ha4lwobm.fsf@fleche.redhat.com> <537B8561.6010603@ericsson.com> In-Reply-To: <537B8561.6010603@ericsson.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg00449.txt.bz2 On Tue 20 May 2014 12:40:01 PM EDT, Simon Marchi wrote: > On Mon 19 May 2014 03:39:09 PM EDT, Tom Tromey wrote: >>>>>>> "Simon" == Simon Marchi writes: >> >> Simon> 2014-05-13 Simon Marchi >> Simon> * lib/mi-support.exp (mi_run_cmd_full): Set arguments by calling >> Simon> "-exec-arguments" or "set args" before running the inferior. >> >> This patch causes a test failure here: > > Ehh, that's what I get for not re-running the testsuite, even after a > year. I will send something soon about that. mi-start.exp passes "--start" to mi_run_cmd, which is intended to be an argument to -exec-run. My understanding was that the parameter "args" of mi_run_cmd_full was for arguments to pass to the test program (hence, my patch). A quick grep shows that mi-start.exp is the only place where arguments are actually passed to mi_run_cmd. At the time the patch was written, nowhere in the test suite were parameters passed to mi_run_cmd, so I just assumed that this was the intended behavior. I ended up not even using this fix, since Pedro suggested that to modify the behavior of a test program, I should stop at a breakpoint and modify the value of a global variable instead. Perhaps the original behavior was not bad after all: $args is passed to the command used to run the program, "run" or "-exec-run", depending on the value of $use_mi_command. Therefore, the meaning/semantic of the $args parameter changes based on the value of $use_mi_command: arguments passed to the test program if false, arguments to -exec-run (such as --start) if true. If you use MI and want to pass arguments to the test program, then you need to manually call -exec-arguments before (or a helper proc could be created for that). If documented properly, I think this way is good. If we decide to stay with the current behavior where $args always means the arguments to pass to the test program, then we'll need to add a separate parameter to mi_run_cmd_full, mi_run_cmd and mi_run_with_cli to convey the arguments to pass to the run command (to be able to pass the --start). This makes things a little bit messy: proc mi_run_cmd {args} will become proc mi_run_cmd {test_program_args run_command_args} which means that most calls to mi_run_cmd will have to be changed from mi_run_cmd to mi_run_cmd "" "" because of the special vararg-like meaning of the parameter named "args". In my opinion, I think the old behavior was fine, it just needs to be documented better (clarify what $args means in the mi_run_* procedures). I would like to hear what you think about this. Thanks, Simon