# Test stepping over permanent breakpoints on i386.
-if { ![is_x86_like_target] } then {
+if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then {
verbose "Skipping skip over permanent breakpoint on i386 tests."
return
}
set testfile "i386-bp_permanent"
-set srcfile i386-prologue.c
+set srcfile i386-bp_permanent.c
set binfile ${objdir}/${subdir}/${testfile}
# some targets have leading underscores on assembly symbols.
return -1
}
-set function standard
+set function "standard"
set retcode [gdb_test_multiple "disassemble $function" "Disassemble function '$function'" {
- -re ".*($hex) <\\+0>.*($hex) <\\+4>.*($hex) <\\+5>.*($hex) <\\+6>.*$gdb_prompt $" {
- set function_start $expect_out(1,string)
- set address $expect_out(2,string)
- set address1 $expect_out(3,string)
- set address2 $expect_out(4,string)
+ -re "($hex) <\\+0>.*($hex) <\\+$decimal>.*int3.*($hex) <\\+$decimal>.*leave.*$gdb_prompt $" {
+ set address_bp $expect_out(2,string)
+ set address_after_bp $expect_out(3,string)
}
}]
return -1
}
-gdb_breakpoint "*$function_start"
+gdb_breakpoint "*$address_bp"
-gdb_breakpoint "*$address"
+gdb_test "continue" "Breakpoint .*, $address_bp in $function.*" \
+ "stop at permanent breakpoint"
-gdb_test "continue" "Breakpoint .*, $function_start in $function.*" \
- "Stop at the '$function' start breakpoint (fetching esp)."
-
-# We want to fetch esp at the start of '$function' function to make sure
-# skip_permanent_breakpoint implementation really skips only the perm.
-# breakpoint. If, for whatever reason, 'leave' instruction doesn't get
-# executed, esp will not have this value.
-set start_esp 0
-gdb_test_multiple "print \$esp" "Fetch esp value." {
+# We want to fetch the stack pointer at the start of '$function'
+# function to make sure the skip_permanent_breakpoint implementation
+# really skips only the permanent breakpoint. If, for whatever
+# reason, the 'leave' instruction executes, the stack pointer will not
+# have this value.
+set start_sp 0
+gdb_test_multiple "print \$sp" "fetch stack pointer value" {
-re "\\\$1.*($hex).*$gdb_prompt $" {
- set start_esp $expect_out(1,string)
+ set start_sp $expect_out(1,string)
}
}
-gdb_test "continue" "Breakpoint .*, $address in $function.*" \
- "Stop at permanent breakpoint."
-
-gdb_test "stepi" "$address1|$address2 in $function.*" \
- "Single stepping past permanent breakpoint."
-
-gdb_test "print \$esp" ".*$start_esp.*" \
- "ESP value does not match - step_permanent_breakpoint wrong."
+gdb_test "stepi" "$address_after_bp in $function.*" \
+ "single-step past permanent breakpoint"
+gdb_test "print \$sp" ".*$start_sp.*" \
+ "stack pointer value matches"