mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2025-01-27 03:54:29 +00:00
Introduce test setup helpers.
* lib/gdb.exp (build_executable, clean_restart) (prepare_for_testing): New. * gdb.base/break.exp: Use prepare_for_testing, and clean_restart. * gdb.base/return.exp: Likewise. * gdb.base/ending-run.exp: Likewise.
This commit is contained in:
parent
f04cc279d0
commit
dbc5282291
@ -1,3 +1,12 @@
|
||||
2008-04-07 Vladimir Prus <vladimir@codesourcery.com>
|
||||
|
||||
Introduce test setup helpers.
|
||||
* lib/gdb.exp (build_executable, clean_restart)
|
||||
(prepare_for_testing): New.
|
||||
* gdb.base/break.exp: Use prepare_for_testing, and clean_restart.
|
||||
* gdb.base/return.exp: Likewise.
|
||||
* gdb.base/ending-run.exp: Likewise.
|
||||
|
||||
2008-04-07 Nick Roberts <nickrob@snap.net.nz>
|
||||
|
||||
* gdb.mi/mi-async.exp: New test for asynchronous Machine
|
||||
|
@ -19,49 +19,11 @@
|
||||
|
||||
# This file was written by Rob Savoye. (rob@cygnus.com)
|
||||
|
||||
if $tracelevel then {
|
||||
strace $tracelevel
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# test running programs
|
||||
#
|
||||
set prms_id 0
|
||||
set bug_id 0
|
||||
|
||||
set testfile "break"
|
||||
set srcfile ${testfile}.c
|
||||
set srcfile1 ${testfile}1.c
|
||||
set binfile ${objdir}/${subdir}/${testfile}
|
||||
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
|
||||
untested break.exp
|
||||
return -1
|
||||
}
|
||||
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
|
||||
untested break.exp
|
||||
return -1
|
||||
}
|
||||
|
||||
if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
|
||||
untested break.exp
|
||||
return -1
|
||||
}
|
||||
|
||||
if [get_compiler_info ${binfile}] {
|
||||
if { [prepare_for_testing break.exp "break" {break.c break1.c} {debug nowarnings}] } {
|
||||
return -1
|
||||
}
|
||||
|
||||
gdb_exit
|
||||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
|
||||
if [target_info exists gdb_stub] {
|
||||
gdb_step_for_stub;
|
||||
}
|
||||
set srcfile break.c
|
||||
set srcfile1 break1.c
|
||||
#
|
||||
# test simple breakpoint setting commands
|
||||
#
|
||||
@ -857,36 +819,10 @@ 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}" "${binfile}O0.o" object {debug nowarnings optimize=-O2}] != "" } {
|
||||
untested break.exp
|
||||
return -1
|
||||
}
|
||||
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}O1.o" object {debug nowarnings optimize=-O2}] != "" } {
|
||||
untested break.exp
|
||||
return -1
|
||||
}
|
||||
|
||||
if { [gdb_compile "${binfile}O0.o ${binfile}O1.o" "${binfileo2}" executable {debug nowarnings}] != "" } {
|
||||
untested break.exp
|
||||
return -1
|
||||
}
|
||||
|
||||
if [get_compiler_info ${binfileo2}] {
|
||||
if { [prepare_for_testing break.exp "breako2" {break.c break1.c} {debug nowarnings optimize=-O2}] } {
|
||||
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
|
||||
#
|
||||
@ -955,15 +891,7 @@ gdb_expect {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gdb_exit
|
||||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
|
||||
if [target_info exists gdb_stub] {
|
||||
gdb_step_for_stub;
|
||||
}
|
||||
clean_restart breako2
|
||||
|
||||
#
|
||||
# test that 'rbreak' on a symbol that may be from a shared library doesn't
|
||||
|
@ -22,30 +22,11 @@
|
||||
|
||||
# ending-run.exp -- Expect script to test ending a test run in gdb
|
||||
|
||||
if $tracelevel then {
|
||||
strace $tracelevel
|
||||
if { [prepare_for_testing ending-run.exp ending-run] } {
|
||||
return -1
|
||||
}
|
||||
|
||||
set testfile ending-run
|
||||
set srcfile ${testfile}.c
|
||||
set binfile ${objdir}/${subdir}/${testfile}
|
||||
|
||||
remote_exec build "rm -f ${binfile}"
|
||||
remote_exec build "rm -f core"
|
||||
|
||||
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
untested ending-run.exp
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
|
||||
gdb_exit
|
||||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
|
||||
# CHFts23469: Test that you can "clear" a bp set at
|
||||
# a line _before_ the routine (which will default to the
|
||||
# first line in the routine, which turns out to correspond
|
||||
|
@ -18,19 +18,8 @@
|
||||
|
||||
# This file was written by Jeff Law. (law@cs.utah.edu)
|
||||
|
||||
if $tracelevel then {
|
||||
strace $tracelevel
|
||||
}
|
||||
|
||||
set prms_id 0
|
||||
set bug_id 0
|
||||
|
||||
set testfile "return"
|
||||
set srcfile ${testfile}.c
|
||||
set binfile ${objdir}/${subdir}/${testfile}
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
untested return.exp
|
||||
return -1
|
||||
if { [prepare_for_testing return.exp "return"] } {
|
||||
return -1
|
||||
}
|
||||
|
||||
proc return_tests { } {
|
||||
@ -104,13 +93,5 @@ proc return_tests { } {
|
||||
gdb_test "p tmp3" ".* = 5.*" "correct value returned double test (known problem with sparc solaris)"
|
||||
}
|
||||
|
||||
|
||||
# Start with a fresh gdb.
|
||||
|
||||
gdb_exit
|
||||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
|
||||
set timeout 30
|
||||
return_tests
|
||||
|
@ -2653,3 +2653,69 @@ proc test_prefix_command_help { command_list expected_initial_lines args } {
|
||||
help_test_raw "help ${command}" $l_entire_body
|
||||
}
|
||||
}
|
||||
|
||||
# Build executable named EXECUTABLE, from SOURCES. If SOURCES are not
|
||||
# provided, uses $EXECUTABLE.c. The TESTNAME paramer is the name of test
|
||||
# to pass to untested, if something is wrong. OPTIONS are passed
|
||||
# to gdb_compile directly.
|
||||
proc build_executable { testname executable {sources ""} {options {debug}} } {
|
||||
|
||||
global objdir
|
||||
global subdir
|
||||
global srcdir
|
||||
if {[llength $sources]==0} {
|
||||
set sources ${executable}.c
|
||||
}
|
||||
|
||||
set binfile ${objdir}/${subdir}/${executable}
|
||||
|
||||
set objects {}
|
||||
for {set i 0} "\$i<[llength $sources]" {incr i} {
|
||||
set s [lindex $sources $i]
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $options] != "" } {
|
||||
untested $testname
|
||||
return -1
|
||||
}
|
||||
lappend objects "${binfile}${i}.o"
|
||||
}
|
||||
|
||||
if { [gdb_compile $objects "${binfile}" executable $options] != "" } {
|
||||
untested $testname
|
||||
return -1
|
||||
}
|
||||
|
||||
if [get_compiler_info ${binfile}] {
|
||||
return -1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
# Starts fresh GDB binary and loads EXECUTABLE into GDB. EXECUTABLE is
|
||||
# the name of binary in ${objdir}/${subdir}.
|
||||
proc clean_restart { executable } {
|
||||
global srcdir
|
||||
global objdir
|
||||
global subdir
|
||||
set binfile ${objdir}/${subdir}/${executable}
|
||||
|
||||
gdb_exit
|
||||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
|
||||
if [target_info exists gdb_stub] {
|
||||
gdb_step_for_stub;
|
||||
}
|
||||
}
|
||||
|
||||
# Prepares for testing, by calling build_executable, and then clean_restart.
|
||||
# Please refer to build_executable for parameter description.
|
||||
proc prepare_for_testing { testname executable {sources ""} {options {debug}}} {
|
||||
|
||||
if {[build_executable $testname $executable $sources] == -1} {
|
||||
return -1
|
||||
}
|
||||
clean_restart $executable
|
||||
|
||||
return 0
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user