blob: a7614f54796b8ab456f3d7674fc44de608dbc7fc [file] [log] [blame]
# Copyright 2003, 2004, 2005
# 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 was written by Jason Molenda (jmolenda@apple.com)
if $tracelevel then {
strace $tracelevel
}
set prms_id 0
set bug_id 0
set testfile "a.out"
set binfile ${objdir}/${subdir}/${testfile}
set timeout 30
set arch "i386"
if [target_info exists darwin64] {
set arch "x86_64"
}
if [istarget "powerpc-apple-darwin*"] {
set arch "ppc"
}
remote_exec build "sh ${srcdir}/${subdir}/../set-up-objdir.sh ${srcdir}/${subdir} ${objdir}/${subdir}"
remote_exec build "make ARCH=${arch} -C ${objdir}/${subdir} stage1"
load_lib mi-support.exp
set MIFLAGS "-i=mi1"
gdb_exit
mi_gdb_start
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
if [mi_run_to_main] then {
fail "small c fix and continue MI tests suppressed"
return -1
}
mi_next "first next"
# Build a new b.c
remote_exec build "make ARCH=${arch} -C $objdir/$subdir stage2"
# mi_gdb_test "shell make ARCH=${arch} -C $objdir/$subdir stage2" ".*gcc.*b.o.*b-bundlized.o.*b.o.*\\^done" "make version 2 of b.c"
mi_gdb_test "38-file-fix-file $objdir/$subdir/b-bundlized.o2 $objdir/$subdir/b.c" ".*38\\^done,replaced-functions=\\\[\\\]" "Bring in fixed b.c version 2"
# Step down into a combination of to-be-fixed and not-to-be-fixed functions.
mi_gdb_test "-exec-step" ".*" "step into bar()"
mi_gdb_test "32-stack-list-frames 0 0" "32\\^done.*\"bar\".*" "verify that we're in bar()"
mi_next "next over print statement"
mi_next "next over increment"
mi_gdb_test "-exec-step" ".*" "step into fred()"
mi_gdb_test "34-stack-list-frames 0 0" "34\\^done.*\"fred\".*" "verify that we're in fred()"
mi_next "step over fred print statement"
mi_gdb_test "-exec-step" ".*" "step into slurry()"
mi_gdb_test "35-stack-list-frames 0 0" "35\\^done.*\"slurry\".*" "verify that we're in slurry()"
# Build a new verison of b.c
remote_exec build "make ARCH=${arch} -C $objdir/$subdir stage3"
# mi_gdb_test "shell make ARCH=${arch} -C $objdir/$subdir stage3" ".*gcc.*b.o.*b-bundlized.o.*b.o.*\\^done" "make version 3 of b.c"
mi_gdb_test "838-file-fix-file $objdir/$subdir/b-bundlized.o3 $objdir/$subdir/b.c" ".*838\\^done,replaced-functions=\\\[\{thread-id=\"1\",replaced=\\\[frame=\{level=\"2\",addr=\"$hex\",fp=\"$hex\",func=\"bar\",file=\"b.c\",line=\"2\[67\]\",dir=\".*\"\},frame=\{level=\"0\",addr=\"$hex\",fp=\"$hex\",func=\"slurry\",file=\"b.c\",line=\"40\",dir=\".*\"\}\\\]\}\\\]" "Bring in fixed b.c version 3"
mi_gdb_test "183-thread-set-pc 1 b.c:36" ".*183\\^done,frame=.*,func=\"slurry\",.*line=\"40\".*" "Set \$pc to the new slurry"
remote_exec build "make ARCH=${arch} -C $objdir/$subdir stage21"
mi_gdb_test "839-file-fix-file $objdir/$subdir/b-bundlized.o21 $objdir/$subdir/b.c" ".*839\\^done,replaced-functions=\\\[\{thread-id=\"1\",replaced=\\\[frame=\{level=\"2\",addr=\"$hex\",fp=\"$hex\",func=\"bar\",file=\"b.c\",line=\"2\[67\]\",dir=\".*\"\},frame=\{level=\"0\",addr=\"$hex\",fp=\"$hex\",func=\"slurry\",file=\"b.c\",line=\"40\",dir=\".*\"\}\\\]\}\\\]" "Bring in fixed b.c version 21"
mi_gdb_test "213-thread-set-pc 1 b.c:62" ".*213\\^done,frame=.*,func=\"slurry\",.*line=\"62\".*" "Set \$pc to the new slurry"
mi_gdb_test "840-break-insert static_printer" ".*840\\^done,bkpt.*" "set breakpoint in static_printer #1"
mi_gdb_test "841-exec-continue" ".*stopped.*" "continue into static_printer"
remote_exec build "make ARCH=${arch} -C $objdir/$subdir stage22"
mi_gdb_test "842-file-fix-file $objdir/$subdir/b-bundlized.o22 $objdir/$subdir/b.c" ".*842\\^done,replaced-functions=.*" "Bring in fixed b.c version 22"
# mi_gdb_test "843-break-insert static_printer" ".*843\\^done,bkpt.*" "set breakpoint in static_printer #2"
mi_gdb_test "844-thread-set-pc -f 1 b.c:51" ".*844\\^done,frame=.*,func=\"static_printer\",.*line=\"51\".*" "Set \$pc to the new static_printer"
mi_gdb_test "845-exec-finish" ".*hi there.*especially when picbase.*this should upset things.*" "finish out of static_printer, look for correct strings (picbase register setup test)"
gdb_exit
return 0