[RFC/MI] interpreter testsuite (fwd)

Keith Seitz keiths@redhat.com
Fri Sep 6 08:42:00 GMT 2002


Ping.

Last merge of trunk into kseitz_interps-20020528-branch was done on 29 Aug
2002.
---------- Forwarded message ----------
Date: Wed, 28 Aug 2002 17:26:26 -0700 (PDT)
From: Keith Seitz <keiths@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFC/MI] interpreter testsuite

Ok,

Well, you guys seems to want the whole thing, even though without 10,000 
other patches, none of it will do anything.

Ok, you asked for it. This is the testsuite file for mi which tests the 
interpreter stuff, including event mechanisms, uiout switching and much 
more. It will not run at all without many other changes (like a bunch of 
changes to gdb/testsuite/lib/mi-support.exp). If you want to run it, I 
suggest picking up a copy of kseitz_interps-20020528-branch.

Would everyone prefer I just merge CVS head into my branch and post one 
giant diff? (1/8 :-)

Keith

ChangeLog
2002-08-28  Keith Seitz  <keiths@redhat.com>

	* mi-cli.exp: New file to test MI/CLI interpreter interactions.

"Patch"
# Copyright 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  

# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu

# This file tests that GDB's console can be accessed via the MI.
# Specifically, we are testing the "interpreter-exec" command and that
# the commands that are executed via this command are properly executed.
# Console commands executed via MI should use MI output wrappers, MI event
# handlers, etc.

load_lib mi-support.exp
set MIFLAGS "-i=mi"

gdb_exit
if [mi_gdb_start] {
    continue
}

set testfile "basics"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}

mi_gdb_reinitialize_dir $srcdir/$subdir

mi_gdb_test "-interpreter-exec" \
  {\^error,msg="mi_cmd_interpreter_exec: Usage: -interpreter-exec interp command"} \
  "-interpreter-exec with no arguments"

mi_gdb_test "-interpreter-exec console" \
  {\^error,msg="mi_cmd_interpreter_exec: Usage: -interpreter-exec interp command"} \
  "-interpreter-exec with one argument"

mi_gdb_test "-interpreter-exec bogus command" \
  {\^error,msg="mi_cmd_interpreter_exec: could not find interpreter \\\"bogus\\\""} \
  "-interpreter-exec with bogus interpreter"

set msg {Undefined command: \\\"bogus\\\"\.  Try \\\"help\\\"\.}
mi_gdb_test "-interpreter-exec console bogus" \
    "&\\\"$msg\\\\n\\\".*\\^error,msg=\\\"$msg\\\".*" \
  "-interpreter-exec console bogus"

mi_gdb_test "-interpreter-exec console \"file $binfile\"" \
  {(=.*)+\^done} \
  "-interpreter-exec console \"file \$binfile\""

mi_run_to_main

mi_gdb_test "-interpreter-exec console \"set args foobar\"" \
  {\^done} \
  "-interpreter-exec console \"set args foobar\""

mi_gdb_test "-interpreter-exec console \"show args\"" \
  {\~"Argument list to give program being debugged when it is started is \\\"foobar\\\"\.\\n".*\^done} \
  "-interpreter-exec console \"show args\""

mi_gdb_test "-interpreter-exec console \"break callee4\"" \
  {(&.*)*.*~"Breakpoint 2 at.*\\n".*=breakpoint-create,number="2".*\^done} \
  "-interpreter-exec console \"break callee4\""

mi_gdb_test "-interpreter-exec console \"info break\"" \
  {\~"Num[ \t]*Type[ \t]*Disp[ \t]*Enb[ \t]*Address[ \t]*What\\n".*~"2[ \t]*breakpoint[ \t]*keep[ \t]*y[ \t]*0x[0-9A-Fa-f]+[ \t]*in callee4 at .*basics.c:[0-9]+\\n".*\^done} \
  "-interpreter-exec console \"info break\""

mi_gdb_test "-interpreter-exec console \"set listsize 1\"" \
  {\^done} \
  "-interpreter-exec console \"set listsize 1\""

mi_gdb_test "-interpreter-exec console \"list\"" \
  {.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done} \
  "-interpreter-exec console \"list\""

mi_gdb_test "-exec-continue" \
  {.*\*stopped,reason="breakpoint-hit",.*func="callee4".*file=".*basics.c",line="8"\}} \
  "-interpreter-exec console \"continue to callee4\""

mi_gdb_test "-interpreter-exec console \"delete 2\"" \
  {.*=breakpoint-delete,number=\"2\".*\^done} \
  "-interpreter-exec console \"delete 2\""

mi_gdb_test "-interpreter-exec console \"up\"" \
  {.*=selected-frame-level-changed,level="1".*\^done} \
  "-interpreter-exec console \"up\""

mi_gdb_test "-interpreter-exec console \"down\"" \
  {.*=selected-frame-level-changed,level="0".*\^done} \
  "-interpreter-exec console \"down\""

mi_gdb_test "-interpreter-exec console \"frame 2\"" \
  {.*=selected-frame-level-changed,level="2".*\^done} \
  "-interpreter-exec console \"frame 2\""

mi_gdb_test "-stack-select-frame 0" \
  {.*=selected-frame-level-changed,level="0".*\^done} \
  "-stack-select-frame 0"

mi_gdb_test "-break-insert -t basics.c:35" \
  {.*=breakpoint-create,number="3".*\^done} \
  "-break-insert -t basics.c:35"

mi_gdb_test "-exec-continue" \
  {.*\*stopped.*,file=".*basics.c",line="35"\}} \
  "-exec-continue to line 35"

mi_gdb_test "-exec-next" \
  {.*\*stopped,reason="end-stepping-range",.*,file=".*basics.c",line="37"\}} \
  "-exec-next to line 37"

mi_gdb_test "-interpreter-exec console \"list\"" \
  {\~"37[ \t(\\t)]*return 0;\\n".*\^done} \
  "-interpreter-exec console \"list\" at basics.c:37"

mi_gdb_test "-interpreter-exec console \"help set args\"" \
  {\~"Set argument list to give program being debugged when it is started\.\\nFollow this command with any number of args, to be passed to the program\.".*\^done} \
  "-interpreter-exec console \"help set args\""

mi_gdb_test "-interpreter-exec console \"set \$pc=0x0\"" \
  {.*=target-changed.*\^done} \
  "-interpreter-exec console \"set \$pc=0x0\""

mi_gdb_exit
return 0




More information about the Gdb-patches mailing list