aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>1998-03-13 01:36:59 +0000
committerDoug Evans <dje@google.com>1998-03-13 01:36:59 +0000
commit681a9f4adbd3fb0b5ca24866a84d5b00784c533f (patch)
tree89a1a07223e8d475c2d6ef004bb4e7832e505e11 /gdb
parent89d7d8094b2f11c073035007c92aac5188358440 (diff)
downloadgdb-681a9f4adbd3fb0b5ca24866a84d5b00784c533f.zip
gdb-681a9f4adbd3fb0b5ca24866a84d5b00784c533f.tar.gz
gdb-681a9f4adbd3fb0b5ca24866a84d5b00784c533f.tar.bz2
snapshot
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.asm/.Sanitize5
-rw-r--r--gdb/testsuite/gdb.asm/asm-source.exp71
-rw-r--r--gdb/testsuite/gdb.asm/asmsrc1.s61
-rw-r--r--gdb/testsuite/gdb.asm/asmsrc2.s14
-rwxr-xr-xgdb/testsuite/gdb.asm/configure2
-rw-r--r--gdb/testsuite/gdb.asm/configure.in2
-rw-r--r--gdb/testsuite/gdb.asm/source.exp248
7 files changed, 152 insertions, 251 deletions
diff --git a/gdb/testsuite/gdb.asm/.Sanitize b/gdb/testsuite/gdb.asm/.Sanitize
index d4f93b6..ee595d5 100644
--- a/gdb/testsuite/gdb.asm/.Sanitize
+++ b/gdb/testsuite/gdb.asm/.Sanitize
@@ -26,7 +26,10 @@ Things-to-keep:
Makefile.in
configure.in
configure
-source.exp
+
+asm-source.exp
+asmsrc1.s
+asmsrc2.s
Things-to-lose:
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
new file mode 100644
index 0000000..4fd2d28
--- /dev/null
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -0,0 +1,71 @@
+# Copyright (C) 1998 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.
+#
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+#
+# This file was written by Kendra.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+#
+# test debugging assembly level programs
+#
+
+set prms_id 0
+set bug_id 0
+
+if [istarget "d10v-*-*"] then {
+ ;# nothing to do, yet
+} else {
+ verbose "Skipping assembly source test -- not implemented for this target."
+ return
+}
+
+set testfile "asm-source"
+set binfile ${objdir}/${subdir}/${testfile}
+set src1 ${srcdir}/${subdir}/asmsrc1.s
+set src2 ${srcdir}/${subdir}/asmsrc2.s
+
+if {[gdb_compile ${src1} asmsrc1.o object "additional_flags=-Wa,-gstabs"] != ""} then {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+if {[gdb_compile ${src2} asmsrc2.o object "additional_flags=-Wa,-gstabs"] != ""} then {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if { [gdb_compile "asmsrc1.o asmsrc2.o" ${binfile} executable "ldflags=-nostdlib"] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+remote_exec build "mv asmsrc1.o asmsrc2.o ${objdir}/${subdir}"
+
+
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+#
+# set it up at a breakpoint so we can play with the variable values
+#
+
+if ![runto_main] then {
+ gdb_suppress_tests;
+}
+
+gdb_test "f" "asmsrc1\[.\]s:40.*several_nops"
diff --git a/gdb/testsuite/gdb.asm/asmsrc1.s b/gdb/testsuite/gdb.asm/asmsrc1.s
new file mode 100644
index 0000000..1eba17b
--- /dev/null
+++ b/gdb/testsuite/gdb.asm/asmsrc1.s
@@ -0,0 +1,61 @@
+; "main" routine for assembly source debugging test
+; Eventually this code needs to be made more machine independent
+; (with the actual code coming from macros in some header file)
+; so that the same driver will work for several architectures.
+
+ .macro exit0
+ ldi r4, 1
+ ldi r0, 0
+ trap 15
+ .endm
+
+ .macro several_nops
+ nop
+ nop
+ nop
+ nop
+ .endm
+
+; FIXME: For now we include crt0.
+; For a portable testcase we should use the standard one.
+
+ .globl _start
+_start:
+; set up the stack
+ ldi sp, 0x8000
+ mvtc sp, psw ; psw <- SW
+ ldi sp, 0x7ffe ; 0x7ffe is a magic number known to gdb: "top of stack"
+; Call main, then exit.
+ bl main
+ bl exit
+
+; Program begins here.
+
+ .global main
+main:
+ st r13,@-sp
+
+; Call a macro that consists of several lines of assembler code.
+
+ several_nops
+
+; Call a subroutine in another file.
+
+ bl foo2
+
+; All done.
+
+ exit0
+
+; A routine for foo2 to call.
+
+ .global foo3
+foo3:
+ st r13,@-sp
+
+ ld r13,@sp+
+ jmp r13
+
+ .global exit
+exit:
+ exit0
diff --git a/gdb/testsuite/gdb.asm/asmsrc2.s b/gdb/testsuite/gdb.asm/asmsrc2.s
new file mode 100644
index 0000000..4c22987
--- /dev/null
+++ b/gdb/testsuite/gdb.asm/asmsrc2.s
@@ -0,0 +1,14 @@
+; Second file in assembly source debugging testcase.
+
+ .global foo2
+foo2:
+ st r13,@-sp
+
+; Call someplace else
+
+ bl foo3
+
+; All done, return.
+
+ ld r13,@sp+
+ jmp r13
diff --git a/gdb/testsuite/gdb.asm/configure b/gdb/testsuite/gdb.asm/configure
index 82b54ef..26d7d25 100755
--- a/gdb/testsuite/gdb.asm/configure
+++ b/gdb/testsuite/gdb.asm/configure
@@ -451,7 +451,7 @@ echo > confdefs.h
# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=source.exp
+ac_unique_file=asm-source.exp
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
diff --git a/gdb/testsuite/gdb.asm/configure.in b/gdb/testsuite/gdb.asm/configure.in
index 49e54a7..bded89e 100644
--- a/gdb/testsuite/gdb.asm/configure.in
+++ b/gdb/testsuite/gdb.asm/configure.in
@@ -5,7 +5,7 @@ dnl script appropriate for this directory. For more information, check
dnl any existing configure script.
AC_PREREQ(2.5)
-AC_INIT(source.exp)
+AC_INIT(asm-source.exp)
CC=${CC-cc}
AC_SUBST(CC)
diff --git a/gdb/testsuite/gdb.asm/source.exp b/gdb/testsuite/gdb.asm/source.exp
deleted file mode 100644
index 2d4f695..0000000
--- a/gdb/testsuite/gdb.asm/source.exp
+++ /dev/null
@@ -1,248 +0,0 @@
-# Copyright (C) 1998 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.
-#
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-#
-# This file was written by Kendra.
-
-return
-
-if $tracelevel then {
- strace $tracelevel
-}
-
-#
-# test running programs
-#
-
-set prms_id 0
-set bug_id 0
-
-if [istarget "d10v-*-*"] then {
- set linker_script "${srcdir}/${subdir}/d10v.ld";
-} elseif [istarget "m32r-*-*"] then {
- set linker_script "${srcdir}/${subdir}/m32r.ld";
-} else {
- verbose "Skipping overlay test -- not implemented for this target."
- return
-}
-
-set testfile "overlays"
-set binfile ${objdir}/${subdir}/${testfile}
-set srcfile ${srcdir}/${subdir}/${testfile}.c
-set foo ${srcdir}/${subdir}/foo.c
-set bar ${srcdir}/${subdir}/bar.c
-set baz ${srcdir}/${subdir}/baz.c
-set grbx ${srcdir}/${subdir}/grbx.c
-
-if {[gdb_compile "${srcfile}" "${testfile}.o" object {debug}] != ""} then {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
-}
-if {[gdb_compile "${srcdir}/${subdir}/ovlymgr.c" ovlymgr.o object {debug}] != ""} then {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
-}
-if {[gdb_compile "${foo}" foo.o object {debug} ] != ""} then {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
-}
-
-if {[gdb_compile "${bar}" bar.o object {debug}] != ""} then {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
-}
-if {[gdb_compile "${baz}" baz.o object {debug}] != ""} then {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
-}
-if {[gdb_compile "${grbx}" grbx.o object {debug}] != ""} then {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
-}
-if { [gdb_compile "${testfile}.o ovlymgr.o foo.o bar.o baz.o grbx.o -T${linker_script}" ${binfile} executable ""] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
-}
-
-remote_exec build "mv ${testfile}.o foo.o bar.o baz.o grbx.o ovlymgr.o ${objdir}/${subdir}"
-
-
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
-#
-# set it up at a breakpoint so we can play with the variable values
-#
-
-if ![runto_main] then {
- gdb_suppress_tests;
-}
-
-# couple of convenience variables
-set fptrcast [string_to_regexp "(int (*)(int))"]
-set iptrcast [string_to_regexp "(int *)"]
-
-gdb_test "overlay manual" ""
-gdb_test "overlay list" "No sections are mapped." "List with none mapped"
-
-# capture the LMA addresses of [foo bar baz grbx foox barx bazx grbxx]
-
-gdb_test "print \$foo_lma = &foo" \
- ".* $fptrcast 0x.* <\\*foo\\*>" "foo load addr"
-gdb_test "print \$bar_lma = &bar" \
- ".* $fptrcast 0x.* <\\*bar\\*>" "bar load addr"
-gdb_test "print \$baz_lma = &baz" \
- ".* $fptrcast 0x.* <\\*baz\\*>" "baz load addr"
-gdb_test "print \$grbx_lma = &grbx" \
- ".* $fptrcast 0x.* <\\*grbx\\*>" "grbx load addr"
-gdb_test "print \$foox_lma = &foox" \
- ".* $iptrcast 0x.*" "foox load addr"
-gdb_test "print \$barx_lma = &barx" \
- ".* $iptrcast 0x.*" "barx load addr"
-gdb_test "print \$bazx_lma = &bazx" \
- ".* $iptrcast 0x.*" "bazx load addr"
-gdb_test "print \$grbxx_lma = &grbxx" \
- ".* $iptrcast 0x.*" "grbxx load addr"
-
-# map each overlay successively, and
-# capture the VMA addresses of [foo bar baz grbx foox barx bazx grbxx]
-
-gdb_test "overlay map .ovly0" ""
-gdb_test "overlay list" "Section .ovly0, loaded at.*, mapped at.*" "List ovly0"
-gdb_test "print \$foo_vma = &foo" \
- ".* $fptrcast 0x.* <foo>" "foo runtime addr"
-
-gdb_test "overlay map .ovly1" ""
-gdb_test "overlay list" "Section .ovly1, loaded at.*, mapped at.*" "List ovly1"
-gdb_test "print \$bar_vma = &bar" \
- ".* $fptrcast 0x.* <bar>" "bar runtime addr"
-
-gdb_test "overlay map .ovly2" ""
-gdb_test "overlay list" "Section .ovly2, loaded at.*, mapped at.*" "List ovly2"
-gdb_test "print \$baz_vma = &baz" \
- ".* $fptrcast 0x.* <baz>" "baz runtime addr"
-
-gdb_test "overlay map .ovly3" ""
-gdb_test "overlay list" "Section .ovly3, loaded at.*, mapped at.*" "List ovly3"
-gdb_test "print \$grbx_vma = &grbx" \
- ".* $fptrcast 0x.* <grbx>" "grbx runtime addr"
-
-gdb_test "overlay map .data00" ""
-gdb_test "overlay list" "Section .data00, loaded .*, mapped .*" "List data00"
-gdb_test "print \$foox_vma = &foox" \
- ".* $iptrcast 0x.*" "foox runtime addr"
-
-gdb_test "overlay map .data01" ""
-gdb_test "overlay list" "Section .data01, loaded .*, mapped .*" "List data01"
-gdb_test "print \$barx_vma = &barx" \
- ".* $iptrcast 0x.*" "barx runtime addr"
-
-gdb_test "overlay map .data02" ""
-gdb_test "overlay list" "Section .data02, loaded .*, mapped .*" "List data02"
-gdb_test "print \$bazx_vma = &bazx" \
- ".* $iptrcast 0x.*" "bazx runtime addr"
-
-gdb_test "overlay map .data03" ""
-gdb_test "overlay list" "Section .data03, loaded .*, mapped .*" "List data03"
-gdb_test "print \$grbxx_vma = &grbxx" \
- ".* $iptrcast 0x.*" "grbxx runtime addr"
-
-# Verify that LMA != VMA
-
-gdb_test "print \$foo_lma != \$foo_vma" ".* = 1" "foo's LMA != VMA"
-gdb_test "print \$bar_lma != \$bar_vma" ".* = 1" "bar's LMA != VMA"
-gdb_test "print \$baz_lma != \$baz_vma" ".* = 1" "baz's LMA != VMA"
-gdb_test "print \$grbx_lma != \$grbx_vma" ".* = 1" "grbx's LMA != VMA"
-gdb_test "print \$foox_lma != \$foox_vma" ".* = 1" "foox's LMA != VMA"
-gdb_test "print \$barx_lma != \$barx_vma" ".* = 1" "barx's LMA != VMA"
-gdb_test "print \$bazx_lma != \$bazx_vma" ".* = 1" "bazx's LMA != VMA"
-gdb_test "print \$grbxx_lma != \$grbxx_vma" ".* = 1" "grbxx's LMA != VMA"
-
-# Verify that early-mapped overlays have been bumped out
-# by later-mapped overlays layed over in the same VMA range.
-
-send_gdb "overlay list\n"
-gdb_expect {
- -re ".*ovly0, " { fail ".ovly0 not unmapped by .ovly1" }
- -re ".*ovly2, " { fail ".ovly2 not unmapped by .ovly3" }
- -re ".*data00," { fail ".data00 not unmapped by .data01" }
- -re ".*data02," { fail ".data02 not unmapped by .data03" }
- -re ".*$gdb_prompt $" { pass "Automatic unmapping" }
- timeout { fail "(timeout) Automatic unmapping" }
-}
-
-# test automatic mode
-
-gdb_test "overlay auto" ""
-gdb_test "overlay list" "No sections are mapped." "List none mapped (auto)"
-gdb_test "break foo" "Breakpoint .*at .*file .*foo.c.*" "break foo"
-gdb_test "break bar" "Breakpoint .*at .*file .*bar.c.*" "break bar"
-gdb_test "break baz" "Breakpoint .*at .*file .*baz.c.*" "break baz"
-gdb_test "break grbx" "Breakpoint .*at .*file .*grbx.c.*" "break grbx"
-
-send_gdb "continue\n"
-gdb_expect {
- -re "Breakpoint .* foo .x=1. at .*$gdb_prompt $" { pass "hit foo" }
- -re ".*$gdb_prompt $" { fail "hit foo" }
- timeout { fail "(timeout) hit foo" }
-}
-
-send_gdb "backtrace\n"
-gdb_expect {
- -re "#0 .*foo .*#1 .*main .*$gdb_prompt $" { pass "BT foo" }
- -re ".*$gdb_prompt $" { fail "BT foo" }
- timeout { fail "(timeout) BT foo" }
-}
-
-
-send_gdb "continue\n"
-gdb_expect {
- -re "Breakpoint .* bar .x=1. at .*$gdb_prompt $" { pass "hit bar" }
- -re ".*$gdb_prompt $" { fail "hit bar" }
- timeout { fail "(timeout) hit bar" }
-}
-
-send_gdb "backtrace\n"
-gdb_expect {
- -re "#0 .*bar .*#1 .*main .*$gdb_prompt $" { pass "BT bar" }
- -re ".*$gdb_prompt $" { fail "BT bar" }
- timeout { fail "(timeout) BT bar" }
-}
-
-send_gdb "continue\n"
-gdb_expect {
- -re "Breakpoint .* baz .x=1. at .*$gdb_prompt $" { pass "hit baz" }
- -re ".*$gdb_prompt $" { fail "hit baz" }
- timeout { fail "(timeout) hit baz" }
-}
-
-send_gdb "backtrace\n"
-gdb_expect {
- -re "#0 .*baz .*#1 .*main .*$gdb_prompt $" { pass "BT baz" }
- -re ".*$gdb_prompt $" { fail "BT baz" }
- timeout { fail "(timeout) BT baz" }
-}
-
-send_gdb "continue\n"
-gdb_expect {
- -re "Breakpoint .* grbx .x=1. at .*$gdb_prompt $" { pass "hit grbx" }
- -re ".*$gdb_prompt $" { fail "hit grbx" }
- timeout { fail "(timeout) hit grbx" }
-}
-
-send_gdb "backtrace\n"
-gdb_expect {
- -re "#0 .*grbx .*#1 .*main .*$gdb_prompt $" { pass "BT grbx" }
- -re ".*$gdb_prompt $" { fail "BT grbx" }
- timeout { fail "(timeout) BT grbx" }
-}
-