* gdb.base/break.exp: Add new test for setting breakpoints on
optimized code so we can test breakpoints work even when function prologues may be optimized away
This commit is contained in:
parent
c78858285b
commit
c1790a9d97
2 changed files with 79 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2000-03-24 Jonathan Larmour <jlarmour@redhat.co.uk>
|
||||
|
||||
* gdb.base/break.exp: Add new test for setting breakpoints on
|
||||
optimized code so we can test breakpoints work even when function
|
||||
prologues may be optimized away
|
||||
|
||||
2000-03-23 Fernando Nasser <fnasser@totem.to.cygnus.com>
|
||||
|
||||
From David Whedon <dwhedon@gordian.com>
|
||||
|
|
|
@ -801,6 +801,79 @@ proc test_next_with_recursion {} {
|
|||
test_clear_command
|
||||
test_next_with_recursion
|
||||
|
||||
|
||||
#********
|
||||
|
||||
# build a new file with optimization enabled so that we can try breakpoints
|
||||
# on targets with optimized prologues
|
||||
|
||||
set binfileo2 ${objdir}/${subdir}/${testfile}o2
|
||||
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfileo2}" executable {debug additional_flags="-O2" }] != "" } {
|
||||
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
}
|
||||
|
||||
if [get_compiler_info ${binfileo2}] {
|
||||
return -1
|
||||
}
|
||||
|
||||
gdb_exit
|
||||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfileo2}
|
||||
|
||||
if [target_info exists gdb_stub] {
|
||||
gdb_step_for_stub;
|
||||
}
|
||||
|
||||
#
|
||||
# test break at function
|
||||
#
|
||||
gdb_test "break main" \
|
||||
"Breakpoint.*at.* file .*$srcfile, line.*" \
|
||||
"breakpoint function, optimized file"
|
||||
|
||||
#
|
||||
# test break at function
|
||||
#
|
||||
gdb_test "break marker4" \
|
||||
"Breakpoint.*at.* file .*$srcfile, line.*" \
|
||||
"breakpoint small function, optimized file"
|
||||
|
||||
#
|
||||
# run until the breakpoint at main is hit. For non-stubs-using targets.
|
||||
#
|
||||
if ![target_info exists use_gdb_stub] {
|
||||
if [istarget "*-*-vxworks*"] then {
|
||||
send_gdb "run vxmain \"2\"\n"
|
||||
set timeout 120
|
||||
verbose "Timeout is now $timeout seconds" 2
|
||||
} else {
|
||||
send_gdb "run\n"
|
||||
}
|
||||
gdb_expect {
|
||||
-re "The program .* has been started already.*y or n. $" {
|
||||
send_gdb "y\n"
|
||||
exp_continue
|
||||
}
|
||||
-re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:75.*75\[\t \]+if .argc.* \{.*$gdb_prompt $"\
|
||||
{ pass "run until function breakpoint, optimized file" }
|
||||
-re ".*$gdb_prompt $" { fail "run until function breakpoint, optimized file" }
|
||||
timeout { fail "run until function breakpoint, optimized file (timeout)" }
|
||||
}
|
||||
} else {
|
||||
if ![target_info exists gdb_stub] {
|
||||
gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:75.*75\[\t \]+if .argc.*\{.*" "stub continue, optimized file"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# run until the breakpoint at a small function
|
||||
#
|
||||
gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, marker4 \\(d=177601976\\) at .*$srcfile:51.*51\[\t \]+void.*marker4.*" \
|
||||
"run until breakpoint set at small function, optimized file"
|
||||
|
||||
|
||||
# Reset the default arguments for VxWorks
|
||||
if [istarget "*-*-vxworks*"] {
|
||||
set timeout 10
|
||||
|
|
Loading…
Reference in a new issue