# Copyright 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. # This file was written by Jason Molenda (jmolenda@apple.com) # Try to prevent regressions on the function prologue analyzer code. if $tracelevel then { strace $tracelevel } set prms_id 0 set bug_id 0 set testfile "prologue-x86" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} global hex decimal if ![istarget "i\[3-6\]86-apple-darwin*"] { verbose "Skipping x86 prologue tests." return } if [target_info exists darwin64] { verbose "This test file not yet adapted for x86-64, skipping." return } if { [gdb_compile "${srcdir}/${subdir}/$srcfile" "${binfile}" executable {debug}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this fil e 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 "prologue-x86 tests suppressed" return -1 } gdb_test "set backtrace past-main 1" "" "enable past-main backtracing" gdb_test "bt" "#0 main \\(argc=$decimal, argv=$hex, envp=$hex\\) at .*prologue-x86.*#1 $hex in start \\(\\)\[\r\n\]+" "backtrace up to start()" gdb_test "set backtrace past-main 0" "" "disable past-main backtracing" gdb_test "b handler" "Breakpoint $decimal at 0x.*" "set breakpoint on handler" gdb_test "b func_under_mov_imm32_reg_in_prologue" "Breakpoint $decimal at 0x.*" "set breakpoint on func_under_mov_imm32_reg_in_prologue" gdb_test "b func_under_cmpl_in_prologue" "Breakpoint $decimal at 0x.*" "set breakpoint on func_under_cmpl_in_prologue" gdb_test "continue" "Continuing.*Breakpoint $decimal, handler .sig=14. at .*prologue-x86.*" "continue to handler" gdb_test "bt" ".*#0 handler \\(sig=14\\) at .*prologue-x86.*#1 <signal handler called>.*#2 $hex in __semwait_signal_nocancel \\(\\).*#3 $hex in nanosleep.* \\(\\).*#4 $hex in sleep.* \\(\\).*#5 $hex in signal_thrower \\(in=52042\\).*#6 $hex in func_over_signal_thrower \\(d=5.2.*" "backtrace in handler" gdb_test "fin" ".*Run till exit from #0 handler.*" "finish from handler to _sigtramp" gdb_test "bt" ".*#0 <signal handler called>.*#1 $hex in __semwait_signal_nocancel \\(\\).*#2 $hex in nanosleep.* \\(\\).*#3 $hex in sleep.* \\(\\).*#4 $hex in signal_thrower \\(in=52042\\).*#5 $hex in func_over_signal_thrower \\(d=5.2.*" "backtrace in _sigtramp" gdb_test "fin" ".*Run till exit from #0 <signal handler called>.*" "finish from _sigtramp to __semwait_signal_nocancel" gdb_test "bt" ".*#0 $hex in __semwait_signal_nocancel \\(\\).*#1 $hex in nanosleep.* \\(\\).*#2 $hex in sleep.* \\(\\).*#3 $hex in signal_thrower \\(in=52042\\).*#4 $hex in func_over_signal_thrower \\(d=5.2.*" "backtrace in mach_wait_until" gdb_test "continue" "Continuing.*Breakpoint $decimal, func_under_mov_imm32_reg_in_prologue .in=157. at .*prologue-x86.*" "continue to func_under_mov_imm32_reg_in_prologue" gdb_test "bt" ".*#0 func_under_mov_imm32_reg_in_prologue \\(in=157\\) at .*prologue-x86.*#1 $hex in mov_imm32_reg_in_prologue \\(\\) at .*prologue.*#2 $hex in func_over_mov_imm32_addr_in_prologue \\(in=4\\) at .*prologue.*#3 $hex in main .argc=1.*" "backtrace in func_under_mov_imm32_reg_in_prologue" gdb_test "fin" ".*Run till exit from #0 func_under_mov_imm32_reg_in_prologue.*" "finish from func_under_mov_imm32_reg_in_prologue to mov_imm32_reg_in_prologue" gdb_test "bt" ".*#0 $hex in mov_imm32_reg_in_prologue \\(\\) at .*prologue.*#1 $hex in func_over_mov_imm32_addr_in_prologue \\(in=4\\) at .*prologue.*#2 $hex in main .argc=1.*" "backtrace in mov_imm32_reg_in_prologue" gdb_test "continue" "Continuing.*Breakpoint $decimal, func_under_cmpl_in_prologue .in=5. at .*prologue-x86.*" "continue to func_under_cmpl_in_prologue" gdb_test "bt" ".*#0 func_under_cmpl_in_prologue \\(in=5\\) at .*pro.*#1 $hex in cmpl_in_prologue \\(\\) at .*prologue.*#2 $hex in func_over_cmpl_in_prologue .d=5, f=10. at .*prologue.*#3 $hex in main \\(argc=1.*" "backtrace in func_under_cmpl_in_prologue" gdb_test "fin" ".*Run till exit from #0 func_under_cmpl_in_prologue.*" "finish from func_under_cmpl_in_prologue to cmpl_in_prologue" gdb_test "bt" ".*#0 $hex in cmpl_in_prologue \\(\\) at .*prologue.*#1 $hex in func_over_cmpl_in_prologue .d=5, f=10. at .*prologue.*#2 $hex in main \\(argc=1.*" "backtrace in cmpl_in_prologue" gdb_exit return 0