checkpoint.exp   [plain text]


# Copyright 2006
# 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

if $tracelevel then {
        strace $tracelevel
}

verbose "Checkpoing tests currently suppressed."
return

set timeout 30

set prms_id 0
set bug_id 0

set testfile "checkpoint"
set binfile ${objdir}/${subdir}/${testfile}
set srcfile ${testfile}.c

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

# Start with a fresh gdb

gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}

if ![runto_main] then { 
  fail "checkpoint tests suppressed"
  return -1
}

# Test low-level operations.

gdb_test "create-checkpoint" "Checkpoint 1 created" "create checkpoint manually"
gdb_test "step" ".*" "step one"
gdb_test "cc" "Checkpoint 2 created" "create second checkpoint manually"
gdb_test "info checkpoints" "\[$hex\] M  1: pc=0x.*\r\n\[$hex\] M..2: pc=0x.*" "display the checkpoints so far"

gdb_test "set checkpointing on" "" "enabling auto-checkpointing"

gdb_test "step" ".*" "step two"
gdb_test "step" ".*" "step three"
gdb_test "step" ".*" "step four"
gdb_test "step" ".*" "step five"

gdb_test "print globa" ".* = 3" "first check of globa"

gdb_test "undo" ".*" "first undo"

gdb_test "print globa" ".* = 2" "second check of globa"

gdb_test "undo" ".*" "second undo"
gdb_test "undo" ".*" "third undo"

gdb_test "print globa" ".* = 0" "third check of globa"

gdb_test "break subsub" ".*" "break at subsub"

gdb_test "continue" ".*" "continue to subsub"

gdb_test "undo" "globa = a;" "undo from subsub"

gdb_test "continue" ".*" "continue again"

gdb_test "finish" ".*" "finish with subsub"

gdb_exit
return 0