From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13671 invoked by alias); 4 Sep 2002 20:43:14 -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 13654 invoked from network); 4 Sep 2002 20:43:13 -0000 Received: from unknown (HELO valrhona.uglyboxes.com) (64.1.192.220) by sources.redhat.com with SMTP; 4 Sep 2002 20:43:13 -0000 Received: from localhost.localdomain (IDENT:HnyBQmROpURfBDViyeJcu+wurl7aLcau@localhost.localdomain [127.0.0.1]) by valrhona.uglyboxes.com (8.11.6/8.11.6) with ESMTP id g84Kjv115070 for ; Wed, 4 Sep 2002 13:45:57 -0700 Date: Wed, 04 Sep 2002 13:43:00 -0000 From: Keith Seitz X-X-Sender: keiths@valrhona.uglyboxes.com To: gdb-patches@sources.redhat.com Subject: [RFA/MI testsuite] mi_run_to_main/mi_next/mi_step Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-09/txt/msg00057.txt.bz2 Hi, The following patch fixes several shortcomings in the mi support for running to main, stepping and nexting. For mi_run_to_main, it removes the assumption that main has no arguments. It also adds an ignore pattern to the beginning of the "000*stopped" regexp. This is needed, for example, to ignore async output which could show up when running threaded applications under MI. It also fixes mi_next and mi_step, which, as far as I can tell, never worked. The regexp pattern is wrong. Keith ChangeLog 2002-09-04 Keith Seitz * lib/mi-support.exp (mi_run_to_main): Allow anything to precede regexp for stopping at main. Could have multiple event notifications. Don't assume that main was declared with no parameters. (mi_step_next_helper): New procedure to do step/next. (mi_next): Use mi_step_next_helper. (mi_step): Ditto. Patch Index: testsuite/lib/mi-support.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v retrieving revision 1.14 diff -p -r1.14 mi-support.exp *** testsuite/lib/mi-support.exp 29 Aug 2002 16:10:13 -0000 1.14 --- testsuite/lib/mi-support.exp 4 Sep 2002 20:36:10 -0000 *************** *** 1,4 **** ! # Copyright 1999, 2000 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by --- 1,4 ---- ! # Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by *************** proc mi_run_to_main { } { *** 640,646 **** mi_run_cmd gdb_expect { ! -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"main\",args=\(\\\[\\\]\|\{\}\),file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" { pass "$test" return 0 } --- 640,646 ---- mi_run_cmd gdb_expect { ! -re ".*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"\[0-9\]+\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"main\",args=\(\\\[.*\\\]\|\{.*\}\),file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" { pass "$test" return 0 } *************** proc mi_run_to_main { } { *** 655,701 **** } # Next to the next statement proc mi_next { test } { ! global suppress_flag ! if { $suppress_flag } { ! return -1 ! } ! global mi_gdb_prompt ! send_gdb "220-exec-next\n" ! gdb_expect { ! -re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"end-stepping-range\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{].*[\\\]\}\],file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" { ! pass "$test" ! return 0 ! } ! timeout { ! fail "$test" ! return -1 ! } ! } } # Step to the next statement proc mi_step { test } { ! global suppress_flag ! if { $suppress_flag } { ! return -1 ! } ! global mi_gdb_prompt ! send_gdb "220-exec-step\n" ! gdb_expect { ! -re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"end-stepping-range\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" { ! pass "$test" ! return 0 ! } ! timeout { ! fail "$test" ! return -1 ! } ! } } # cmd should not include the number or newline (i.e. "exec-step 3", not --- 655,699 ---- } + # Helper function for mi_next and mi_step + # CMD is either "step" or "next" + # TEST is the name of the test (passed to dejagnu's pass/fail) + # Returns: + # 0 if passed + # 1 if failed/timeout + proc mi_step_next_helper {cmd test} { + global suppress_flag + if { $suppress_flag } { + return 1 + } + + global mi_gdb_prompt decimal hex + send_gdb "220-exec-$cmd\n" + gdb_expect { + -re ".*220\\^running\r\n$mi_gdb_prompt.*220\\*stopped,reason=\"end-stepping-range\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\(\\\[.*\\\]\|\{.*\}\),file=\".*\",line=\"$decimal\"\}\r\n$mi_gdb_prompt$" { + pass "$test" + return 0 + } + timeout { + fail "$test" + return 1 + } + } + } + # Next to the next statement + # For return values, see mi_step_next_helper proc mi_next { test } { ! return [mi_step_next_helper next $test] } # Step to the next statement + # For return values, see mi_step_next_helper proc mi_step { test } { ! return [mi_step_next_helper step $test] } # cmd should not include the number or newline (i.e. "exec-step 3", not