From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5015 invoked by alias); 18 Oct 2002 22:11:50 -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 4987 invoked from network); 18 Oct 2002 22:11:47 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 18 Oct 2002 22:11:47 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id g9ILolw07789 for ; Fri, 18 Oct 2002 17:50:47 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g9IMBlf29509 for ; Fri, 18 Oct 2002 18:11:47 -0400 Received: from localhost.redhat.com (IDENT:3PdfWeDXXBKLw7ikwHa0HHxL+h4pXXW0@tooth.toronto.redhat.com [172.16.14.29]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g9IMBkT13200 for ; Fri, 18 Oct 2002 18:11:46 -0400 Received: by localhost.redhat.com (Postfix, from userid 469) id EC441FF79; Fri, 18 Oct 2002 18:09:05 -0400 (EDT) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15792.34433.416187.996315@localhost.redhat.com> Date: Fri, 18 Oct 2002 15:11:00 -0000 To: Jason Molenda Cc: gdb-patches@sources.redhat.com Subject: Re: RFC a little redundancy removal I'd like in gdb.mi In-Reply-To: <20021010160547.A36555@molenda.com> References: <20021010160547.A36555@molenda.com> X-SW-Source: 2002-10/txt/msg00311.txt.bz2 Jason Molenda writes: > Hi all, > > I'm looking at the gdb.mi testsuite a bit. There are nearly thirty > cases in the testsuite where code waits for a *stopped message and > matches the stopped location, e.g. > Hmm yes, true. I think most of those, if not all, could be substituted by the already existing "mi_runto function_to_stop_at" mechanism. If so, we don't need this new function. I think this is an artifact of how the testsuite got written. Only after a while we thought of writing the mi version of the runto function. Elena > mi_run_cmd > # The running part has been checked already by mi_run_cmd > gdb_expect { > -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id > =\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\". > *var-cmd.c\",line=\"154\"\}\r\n$mi_gdb_prompt$" { > pass "run to do_block_tests" > } > -re ".*$mi_gdb_prompt$" {fail "run to do_block_tests (2)"} > timeout {fail "run to do_block_tests (timeout 2)"} > } > > I replaced all of these a function, mi_get_stopped - > > proc mi_get_stopped { reason thread args func file line message } { > > and a shorthand version for stopping at a breakpoint, > > proc mi_get_bp_stopped { bkptno thread args func file line message } { > > (I should have also made a mi_get_wp_stopped shorthand for the few > watchpoint tests which are nearly identical). > > This seems like a reasonable submission to the FSF gdb so I wanted to > bounce the idea off the list - I expect no one will really care either > way, except for maybe wanting a different function name used. :-) > > Problems with my change include > > mi_get_stopped doesn't look for a specific result code, just the *stopped > message. > > mi_get_stopped doesn't eat up ^running text, so some cases where the > test case does a send_gdb "-exec-next\n", you need something like > gdb_expect { > -re "\\^running\r\n${mi_gdb_prompt}" { > mi_get_stopped "end-stepping-range" "\[01\]" "" "main" "func.c" "10" \ > "step in main" > } > timeout { fail "step in main (timeout)" } > } > > It's used inconsistently, but there are numbers after fail messages > when there are multiple possible failure points. Like the above example, > where we can fail to step correctly, or we can fail to get the ^running > response. mi_get_stopped doesn't currently give any indication about > where you lost, but I don't think it's all that hard to figure it out > from the gdb.log output.. > > Finally I require a ARGS field for mi_get_stopped, but it is nil for > all calls but one (and that one uses ".*"). I require the thread ID, > but it's [01] in all calls but one, where it's [0-9]. I don't think we'd > loosen the tests too much if these were just .* and [0-9] for all the > cases. > > > The motivation behind this is purely code clean-up. I promise! Oh OK, > it's not really - at Apple we have different *stopped messages and I > wanted to change one location instead of 30. Nevertheless, I think this > is change has merit all on its own. > > Any comments?