blob: a69fb9bc5b8ef2f43e7a45a4788e3b9589f9aaa0 [file] [log] [blame]
# Test macro scoping.
# 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
if $tracelevel then {
strace $tracelevel
}
set prms_id 0
set bug_id 0
set testfile "macscp"
set binfile ${objdir}/${subdir}/${testfile}
set additional_flags "additional_flags=-O3"
if ![istarget "i\[3-6\]86-apple-darwin*"] {
verbose "Skipping x86 inlining tests."
return
}
if [target_info exists darwin64] {
verbose "i386 inlining tests not designed for x86-64, skipping."
return
}
if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${binfile}" executable [list debug $additional_flags]] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
if {$debug_default_format_is_dwarf == 0 } then {
return;
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_file_cmd "${binfile}"
send_gdb "set width 0\n"
gdb_expect -re "$gdb_prompt $"
gdb_test "break main" "Breakpoint 1 at $hex: file.*, line 69\\." "Set breakpoint at main"
gdb_test "run" "Starting program: $binfile *\r\n\Reading symbols for shared libraries \(\[.+\]\)+ done.*Breakpoint 1, main.*" "continue to breakpoint in main()"
gdb_test "next" ".*macscp1_1.*70.*" "Next 0"
gdb_test "next" ".*macscp2_1.*71.*" "Next 1"
gdb_test "next" ".*macscp4_1_from_macscp2.*72.*" "Next 2"
gdb_test "next" ".*macscp4_2_from_macscp2.*73.*" "Next 3"
gdb_test "next" ".*macscp2_2.*74.*" "Next 4"
gdb_test "next" ".*macscp1_2.*75.*" "Next 5"
gdb_test "next" ".*macscp3_1.*76.*" "Next 6"
gdb_test "next" ".*macscp4_1_from_macscp3.*77.*" "Next 7"
gdb_test "next" ".*macscp4_2_from_macscp3.*78.*" "Next 8"
gdb_test "next" ".*macscp3_2.*79.*" "Next 9"
gdb_test "next" ".*80.*" "Next 10"
# gdb_test "next" ".*" "Next 11"
gdb_test "continue" ".*Continuing.*macscp1_3.*Program exited with code" "Continue to end ** THIS IS EXPECTED TO FAIL **"
gdb_test "run" "Starting program:.*Breakpoint 1.*" "Re-starting program"
gdb_test "step" ".*39.*puts.*" "Step 1"
gdb_test "step" "macscp1_1.*70 macscp2_1.*" "Step 2"
gdb_test "step" ".*10 puts.*" "Step 3"
gdb_test "step" "macscp2_1.*71 macscp4_1_from_macscp2.*" "Step 4"
gdb_test "step" ".*24 puts .*" "Step 5"
gdb_test "step" "macscp4_1_from_macscp2.*72 macscp4_2_from_macscp2.*" "Step 6"
gdb_test "step" ".*41 puts.*" "Step 7"
gdb_test "step" "macscp4_2_from_macscp2.*73 macscp2_2.*" "Step 8"
gdb_test "step" ".*22 puts.*" "Step 9"
gdb_test "step" "macscp2_2.*74 macscp1_2.*" "Step 10"
gdb_test "step" ".*51 puts.*" "Step 11"
gdb_test "step" "macscp1_2.*75 macscp3_1.*" "Step 12"
gdb_test "step" ".*10 puts.*" "Step 13"
gdb_test "step" "macscp3_1.*76 macscp4_1_from_macscp3.*" "Step 14"
gdb_test "step" ".*24 puts.*" "Step 15"
gdb_test "step" "macscp4_1_from_macscp3.*77 macscp4_2_from_macscp3.*" "Step 16"
gdb_test "step" ".*41 puts.*" "Step 17"
gdb_test "step" "macscp4_2_from_macscp3.*78 macscp3_2.*" "Step 18"
gdb_test "step" ".*22 puts.*" "Step 19"
gdb_test "step" "macscp3_2.*79.*" "Step 20"
# gdb_test "step" "main.*macscp1.c:79.*79 macscp1_3.*" "Step 21"
gdb_test "step" ".*63 puts.*" "Step 21"
gdb_test "continue" "Continuing..*macscp1_3.*Program exited with code.*" "Continue to end"
#gdb_load ${binfile}
#gdb_test "list macscp4_2_from_macscp2" ".*macscp4_2_, MACSCP4_INCLUSION.*"
#gdb_test "list macscp4_2_from_macscp3" ".*macscp4_2_, MACSCP4_INCLUSION.*"
# Start the program running.
if {! [runto_main]} {
fail "macro tests suppressed: couldn't run to main"
return 0
}