cachedsym-proc.exp [plain text]
# Copyright 2003
# 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 Serena Hartoog (hartoog@apple.com)
#
###-------------------------------------------------------------------------------------------------------
# building my own library
###-------------------------------------------------------------------------------------------------------
proc build_library { args } {
global srcdir
global subdir
global srcfile
global libfile
global libbinfile
set more_opts [lindex $args 0]
set additional_flags "additional_flags=-dynamiclib $more_opts"
if { [gdb_compile "${srcdir}/${subdir}/${libfile}.c" "${libbinfile}" executable [list debug $additional_flags]] != "" } {
gdb_suppress_entire_file "Testcase library compile failed, so all tests in this file will automatically fail."
}
verbose "\[DEBUG: in build_library\] $additional_flags" 1
verbose "\[DEBUG: in build_library\] libfile=$libfile libbinfile=$libbinfile" 1
return 0
}
###-------------------------------------------------------------------------------------------------------
# Comparing file modify times.
# return -1, if either of the file does not exist
# return 1, if file1 modify time is later than file2
# return 0, if file2 modify time is later than file1
###-------------------------------------------------------------------------------------------------------
proc newer { file1 file2 } {
verbose "\[DEBUG: in newer\] file1=$file1 file2=$file2" 1
if {![file exists $file1 ] || ![file exists $file2 ]} {
if {![file exists $file1 ]} {
verbose "\[DEBUG: in newer\] file1 does not exist" 1
return -1
}
if { ![file exists $file2 ]} {
verbose "\[DEBUG: in newer\] file2 does not exist" 1
return -1
}
} else {
# return 1, if file1 modify time is later than file2
# return 0, if file2 modify time is later than file1
return [expr {[file mtime $file1] > [file mtime $file2]} ]
}
}
###-------------------------------------------------------------------------------------------------------
# Create tmp dir for testing cached-symfile-path
###-------------------------------------------------------------------------------------------------------
proc createtmpdir { $mytmp $myLib $myCached } {
global objdir
global mytmp
global myLib
global myCached
# my top tmp dir
file mkdir $mytmp
if ![ file exists $mytmp ] {
perror "Directory doesn't exist: $mytmp"
}
# my symbol lib path
verbose "my cached symlib dir is $myLib" 1
remote_exec build "rm -rf $myLib"
file mkdir $myLib
if ![ file exists $myLib ] {
perror "Directory doesn't exist: $myLib"
}
# my cached symfile path
verbose "my cached symfiles path is $myCached" 1
remote_exec build "rm -rf $myCached"
file mkdir $myCached
if ![ file exists $myCached ] {
perror "Directory doesn't exist: $myCached"
}
}