Message ID | 1400017636-28020-1-git-send-email-simon.marchi@ericsson.com |
---|---|
State | Committed |
Headers |
Return-Path: <x14314964@homiemail-mx21.g.dreamhost.com> X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (peon2454.g.dreamhost.com [208.113.200.127]) by wilcox.dreamhost.com (Postfix) with ESMTP id 7B74336007B for <siddhesh@wilcox.dreamhost.com>; Tue, 13 May 2014 14:47:28 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14314964) id D784519E0A36; Tue, 13 May 2014 14:47:27 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id 6EC7B19E0A4B for <gdb@patchwork.siddhesh.in>; Tue, 13 May 2014 14:47:27 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-type; q=dns; s=default; b=NBMSH2eguIlqoeSH Vd/+mJ6j56SXNJNYzk2EpG8OiVlnfSAYphiSJW98fvL0M4GWxWs4crRSNc8Mg4VY NHW5w0BXXzl8yhHRt2m9ONll83MutUWU/eOpfaXN0+NOde5eIT/JU7I4ANVggJ30 B58nxY3m1wMhpXn1HAQcad8nrRs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-type; s=default; bh=gekCwhqU5GB8tZwJ4fON4h JnM6U=; b=PY/kcZfdW4+/Skp81Rmr8vxDwcBnKTXbg5Ycn8bIjY7SAEpuH5JR2Q XMRsPKfC5PfOJjQOSFLbMEyLAT5/VK83XWsricCC1gCV1W18RHrwVRm95rFYRdZM sZH7SCdz+Z36L426QLY2g4svySzIW8Zo4os7GLpHF4Wn3omF/XQLs= Received: (qmail 32237 invoked by alias); 13 May 2014 21:47:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-gdb=patchwork.siddhesh.in@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 32228 invoked by uid 89); 13 May 2014 21:47:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 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, 13 May 2014 21:47:23 +0000 Received: from EUSAAHC006.ericsson.se (Unknown_Domain [147.117.188.90]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id 88.E6.02831.32142735; Tue, 13 May 2014 17:58:28 +0200 (CEST) Received: from simark-hp.mo.ca.am.ericsson.se (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, 13 May 2014 17:47:20 -0400 From: Simon Marchi <simon.marchi@ericsson.com> To: <gdb-patches@sourceware.org> CC: Simon Marchi <simon.marchi@ericsson.com> Subject: [PATCH v2] Fix argument passing in mi_run_cmd_full Date: Tue, 13 May 2014 17:47:16 -0400 Message-ID: <1400017636-28020-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in |
Commit Message
Simon Marchi
May 13, 2014, 9:47 p.m. UTC
Again, this patch was accepted almost a year ago, I want to make sure that it is still OK. Original submission: https://sourceware.org/ml/gdb-patches/2013-06/msg00739.html Passing arguments did not work when use_mi_command was set. gdb/testsuite/ChangeLog: 2014-05-13 Simon Marchi <simon.marchi@ericsson.com> * lib/mi-support.exp (mi_run_cmd_full): Set arguments by calling "-exec-arguments" or "set args" before running the inferior. --- gdb/testsuite/lib/mi-support.exp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
Comments
>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
Simon> Again, this patch was accepted almost a year ago, I want to make sure
Simon> that it is still OK.
Simon> Original submission:
Simon> https://sourceware.org/ml/gdb-patches/2013-06/msg00739.html
Simon> 2014-05-13 Simon Marchi <simon.marchi@ericsson.com>
Simon> * lib/mi-support.exp (mi_run_cmd_full): Set arguments by calling
Simon> "-exec-arguments" or "set args" before running the inferior.
Yes, still ok, thank you.
Tom
On 14-05-15 02:40 PM, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes: > > Simon> Again, this patch was accepted almost a year ago, I want to make sure > Simon> that it is still OK. > > Simon> Original submission: > Simon> https://sourceware.org/ml/gdb-patches/2013-06/msg00739.html > > Simon> 2014-05-13 Simon Marchi <simon.marchi@ericsson.com> > > Simon> * lib/mi-support.exp (mi_run_cmd_full): Set arguments by calling > Simon> "-exec-arguments" or "set args" before running the inferior. > > Yes, still ok, thank you. > > Tom > Pushed, thanks!
>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
Simon> 2014-05-13 Simon Marchi <simon.marchi@ericsson.com>
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:
Running ../../../binutils-gdb/gdb/testsuite/gdb.mi/mi-start.exp ...
FAIL: gdb.mi/mi-start.exp: run to main (unknown output after running)
This failure isn't present in the previous revision.
I've appended the relevant section of gdb.log in case that is helpful.
Tom
(gdb)
220-exec-run
=thread-group-started,id="i1",pid="21201"
=thread-created,id="1",group-id="i1"
220^running
*running,thread-id="all"
(gdb)
mi_expect_stop: expecting: \*stopped,reason="breakpoint-hit",disp="del",bkptno="
[0-9]+",frame={addr="0x[0-9A-Fa-f]+",func="main",args=\[\],(?:file="[^
]*.*mi-start.c",fullname="(/[^\n]*/|\\\\[^\\]+\\[^\n]+\\|\\[^\\][^\n]*\\|[a-zA-Z
]:[^\n]*\\).*mi-start.c",line="[0-9]+"|from=".*mi-start.c")},thread-id="[0-9]+",
stopped-threads=[^
]*
(=thread-selected,id="[0-9]+"
|=(?:breakpoint-created|breakpoint-deleted)[^
]+"
)*[(]gdb[)]
$
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x8
6-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-gro
up="i1"
=library-loaded,id="/lib64/libm.so.6",target-name="/lib64/libm.so.6",host-name="
/lib64/libm.so.6",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib64/libc.so.6",target-name="/lib64/libc.so.6",host-name="
/lib64/libc.so.6",symbols-loaded="0",thread-group="i1"
=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1",exit-code="0"
*stopped,reason="exited-normally"
(gdb)
got =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linu
x-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread
-group="i1"
=library-loaded,id="/lib64/libm.so.6",target-name="/lib64/libm.so.6",host-name="
/lib64/libm.so.6",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib64/libc.so.6",target-name="/lib64/libc.so.6",host-name="
/lib64/libc.so.6",symbols-loaded="0",thread-group="i1"
=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1",exit-code="0"
*stopped,reason="exited-normally"
(gdb)
FAIL: gdb.mi/mi-start.exp: run to main (unknown output after running)
On Mon 19 May 2014 03:39:09 PM EDT, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes: > > Simon> 2014-05-13 Simon Marchi <simon.marchi@ericsson.com> > 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. > Running ../../../binutils-gdb/gdb/testsuite/gdb.mi/mi-start.exp ... > FAIL: gdb.mi/mi-start.exp: run to main (unknown output after running) > > This failure isn't present in the previous revision. > > I've appended the relevant section of gdb.log in case that is helpful. > > Tom > > (gdb) > 220-exec-run > =thread-group-started,id="i1",pid="21201" > =thread-created,id="1",group-id="i1" > 220^running > *running,thread-id="all" > (gdb) > mi_expect_stop: expecting: \*stopped,reason="breakpoint-hit",disp="del",bkptno=" > [0-9]+",frame={addr="0x[0-9A-Fa-f]+",func="main",args=\[\],(?:file="[^ > ]*.*mi-start.c",fullname="(/[^\n]*/|\\\\[^\\]+\\[^\n]+\\|\\[^\\][^\n]*\\|[a-zA-Z > ]:[^\n]*\\).*mi-start.c",line="[0-9]+"|from=".*mi-start.c")},thread-id="[0-9]+", > stopped-threads=[^ > ]* > (=thread-selected,id="[0-9]+" > |=(?:breakpoint-created|breakpoint-deleted)[^ > ]+" > )*[(]gdb[)] > $ > =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x8 > 6-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-gro > up="i1" > =library-loaded,id="/lib64/libm.so.6",target-name="/lib64/libm.so.6",host-name=" > /lib64/libm.so.6",symbols-loaded="0",thread-group="i1" > =library-loaded,id="/lib64/libc.so.6",target-name="/lib64/libc.so.6",host-name=" > /lib64/libc.so.6",symbols-loaded="0",thread-group="i1" > =thread-exited,id="1",group-id="i1" > =thread-group-exited,id="i1",exit-code="0" > *stopped,reason="exited-normally" > (gdb) > got =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linu > x-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread > -group="i1" > =library-loaded,id="/lib64/libm.so.6",target-name="/lib64/libm.so.6",host-name=" > /lib64/libm.so.6",symbols-loaded="0",thread-group="i1" > =library-loaded,id="/lib64/libc.so.6",target-name="/lib64/libc.so.6",host-name=" > /lib64/libc.so.6",symbols-loaded="0",thread-group="i1" > =thread-exited,id="1",group-id="i1" > =thread-group-exited,id="i1",exit-code="0" > *stopped,reason="exited-normally" > (gdb) > > FAIL: gdb.mi/mi-start.exp: run to main (unknown output after running)
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 <simon.marchi@ericsson.com> writes: >> >> Simon> 2014-05-13 Simon Marchi <simon.marchi@ericsson.com> >> 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
On 05/20/2014 11:24 PM, Simon Marchi wrote: > 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 agree, because it's also the simplest, and as you say, > 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. nothing is actually making use of the original fix. If we end up needing to pass program arguments to mi_run_cmd in MI mode, we can revisit. Thanks,
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index ad58775..b27b268 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -818,9 +818,11 @@ proc mi_run_cmd_full {use_mi_command args} { if {$use_mi_command} { set run_prefix "220-exec-" set run_match "220" + set set_args_cmd "-exec-arguments" } else { set run_prefix "" set run_match "" + set set_args_cmd "set args" } if [target_info exists gdb_init_command] { @@ -862,7 +864,16 @@ proc mi_run_cmd_full {use_mi_command args} { return 0 } - send_gdb "${run_prefix}run $args\n" + send_gdb "${set_args_cmd} $args\n" + gdb_expect { + -re "$mi_gdb_prompt$" { } + default { + perror "settings args failed" + return -1 + } + } + + send_gdb "${run_prefix}run\n" gdb_expect { -re "${run_match}\\^running\r\n(\\*running,thread-id=\"\[^\"\]+\"\r\n|=thread-created,id=\"1\",group-id=\"\[0-9\]+\"\r\n)*(${library_loaded_re})*(${thread_selected_re})?${mi_gdb_prompt}" { }