diff options
author | Jonathan Larmour <jifl@eCosCentric.com> | 2000-03-24 21:35:42 +0000 |
---|---|---|
committer | Jonathan Larmour <jifl@eCosCentric.com> | 2000-03-24 21:35:42 +0000 |
commit | c1790a9d97bbf05879cca1e5cfaa9e151927375e (patch) | |
tree | ea5a51e3544ac2a99fe07e7bbecdc7f77d6a2528 | |
parent | c78858285bb60ac2031d4d68fe6d06190803231a (diff) | |
download | gdb-c1790a9d97bbf05879cca1e5cfaa9e151927375e.zip gdb-c1790a9d97bbf05879cca1e5cfaa9e151927375e.tar.gz gdb-c1790a9d97bbf05879cca1e5cfaa9e151927375e.tar.bz2 |
* 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
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/break.exp | 73 |
2 files changed, 79 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index e2d7314..78a0942 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -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> diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index ab050b3..ce36c21 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -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 |