aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.asm
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2001-12-04 19:45:57 +0000
committerMichael Snyder <msnyder@vmware.com>2001-12-04 19:45:57 +0000
commitca9efc9063b7e94b26582c5b8d6c0c688d9678b6 (patch)
treefb564fcc0a0dc3869a289d85c59a0b04fe38caa9 /gdb/testsuite/gdb.asm
parent5b5cd1b0faeeda7083dd2ddee4e395202b40ac63 (diff)
downloadgdb-ca9efc9063b7e94b26582c5b8d6c0c688d9678b6.zip
gdb-ca9efc9063b7e94b26582c5b8d6c0c688d9678b6.tar.gz
gdb-ca9efc9063b7e94b26582c5b8d6c0c688d9678b6.tar.bz2
2001-11-30 Michael Snyder <msnyder@redhat.com>
* gdb.asm/asm-source.exp: Add tests for list, search, finish, return, next, info source, info sources, info line, global and static variables, and static functions. * gdb.asm/common.inc: New macro gdbasm_datavar (default definition). * gdb.asm/i386.inc: Override default definition of gdbasm_datavar. * gdb.asm/asmsrc1.s: Add a static function and some variables. * gdb.asm/asmsrc2.s: Make foo2 call foo3 twice (to test 'next'). * gdb.asm/d10v.inc (gdbasm_enter): Set up frame pointer. (gdbasm_leave): Restore frame pointer. (gdbasm_startup): Copy stack set-up from crt0.S.
Diffstat (limited to 'gdb/testsuite/gdb.asm')
-rw-r--r--gdb/testsuite/gdb.asm/asm-source.exp49
-rw-r--r--gdb/testsuite/gdb.asm/asmsrc1.s15
-rw-r--r--gdb/testsuite/gdb.asm/asmsrc2.s3
-rw-r--r--gdb/testsuite/gdb.asm/common.inc10
-rw-r--r--gdb/testsuite/gdb.asm/d10v.inc27
-rw-r--r--gdb/testsuite/gdb.asm/i386.inc7
6 files changed, 108 insertions, 3 deletions
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index 8e07692..81de92f 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -99,6 +99,13 @@ gdb_test "n" "33\[ \]*.*foo2" "next over macro"
# See if we can properly `step' into a subroutine call.
gdb_test "s" "8\[ \]*.*" "step into foo2"
+# Now try a 'list' from the other source file.
+gdb_test "list _start" ".*gdbasm_startup.*" "list"
+
+# Now try a source file search
+gdb_test "search A routine for foo2 to call" \
+ "39\[ \t\]+comment \"A routine for foo2 to call.\"" "search"
+
# See if `f' prints the right source file.
gdb_test "f" ".*asmsrc2\[.\]s:8.*" "f in foo2"
@@ -123,3 +130,45 @@ gdb_test "n" "" "n 2"
# Now see if a capped `bt' is correct.
gdb_test "bt 3" "\#0.*foo3.*asmsrc1\[.\]s:44.*\#1.*foo2.*asmsrc2\[.\]s:12.*\#2.*main.*asmsrc1\[.\]s:33.*" "bt 3 in foo3"
+
+# Try 'info source' from asmsrc1.s
+gdb_test "info source" \
+ "Current source file is .*asmsrc1.s.*Source language is asm.*" \
+ "info source asmsrc1.s"
+
+# Try 'finishing' from foo3
+gdb_test "finish" "Run till exit from.*\[\r\n\]13\[ \t\]+gdbasm_call foo3" \
+ "finish from foo3"
+
+# Try 'info source' from asmsrc2.s
+gdb_test "info source" \
+ "Current source file is .*asmsrc2.s.*Source language is asm.*" \
+ "info source asmsrc2.s"
+
+# Try 'info sources'
+gdb_test "info sources" \
+ "Source files .*asmsrc\[12\].s.*asmsrc\[12\].s.*" \
+ "info sources"
+
+# Try 'info line'
+gdb_test "info line" \
+ "Line 13 of.*asmsrc2.s.*starts at.*<foo2+.*> and ends at.*<foo2+.*>." \
+ "info line"
+
+# Try 'nexting' over next call to foo3
+gdb_test "next" "17\[ \t\]+gdbasm_leave" "next over foo3"
+
+# Try 'return' from foo2
+gdb_test "return" "\#0 main .*37\[ \t\]+gdbasm_exit0" "return from foo2" \
+ "Make selected stack frame return now\?.*" "y"
+
+# See if we can look at a global variable
+gdb_test "print globalvar" ".* = 11" "look at global variable"
+
+# See if we can look at a static variable
+gdb_test "print staticvar" ".* = 5" "look at static variable"
+
+# See if we can look at a static function
+gdb_test "disassem foostatic" ".*<foostatic>:.*End of assembler dump." \
+ "look at static function"
+
diff --git a/gdb/testsuite/gdb.asm/asmsrc1.s b/gdb/testsuite/gdb.asm/asmsrc1.s
index 8bd41ad..f14cd91 100644
--- a/gdb/testsuite/gdb.asm/asmsrc1.s
+++ b/gdb/testsuite/gdb.asm/asmsrc1.s
@@ -46,3 +46,18 @@ foo3:
.global exit
exit:
gdbasm_exit0
+
+comment "A static function"
+
+foostatic:
+ gdbasm_enter
+ gdbasm_leave
+
+comment "A global variable"
+
+ .global globalvar
+gdbasm_datavar globalvar 11
+
+comment "A static variable"
+
+gdbasm_datavar staticvar 5
diff --git a/gdb/testsuite/gdb.asm/asmsrc2.s b/gdb/testsuite/gdb.asm/asmsrc2.s
index 22c63d4..9d7713f 100644
--- a/gdb/testsuite/gdb.asm/asmsrc2.s
+++ b/gdb/testsuite/gdb.asm/asmsrc2.s
@@ -7,9 +7,10 @@ comment "Second file in assembly source debugging testcase."
foo2:
gdbasm_enter
-comment "Call someplace else."
+comment "Call someplace else (several times)."
gdbasm_call foo3
+ gdbasm_call foo3
comment "All done, return."
diff --git a/gdb/testsuite/gdb.asm/common.inc b/gdb/testsuite/gdb.asm/common.inc
index 7cca3ab..5149392 100644
--- a/gdb/testsuite/gdb.asm/common.inc
+++ b/gdb/testsuite/gdb.asm/common.inc
@@ -7,6 +7,13 @@
.include "\arch\file"
.endm
+ comment "Declare a data variable"
+ .macro gdbasm_datavar name value
+ .data
+\name:
+ .word \value
+ .endm
+
comment "arch.inc is responsible for defining the following macros:"
comment "enter - subroutine prologue"
comment "leave - subroutine epilogue"
@@ -14,5 +21,8 @@ comment "call - call a named subroutine"
comment "several_nops - execute several (typically 4) nops"
comment "exit0 - exit (0)"
+comment "arch.inc may also override the default definitions of:"
+comment "datavar - define a data variable"
+
comment "macros to label a subroutine may also eventually be needed"
comment "i.e. .global foo\nfoo:\n"
diff --git a/gdb/testsuite/gdb.asm/d10v.inc b/gdb/testsuite/gdb.asm/d10v.inc
index 1ad3b9f..bd9463f 100644
--- a/gdb/testsuite/gdb.asm/d10v.inc
+++ b/gdb/testsuite/gdb.asm/d10v.inc
@@ -1,12 +1,16 @@
comment "subroutine prologue"
.macro gdbasm_enter
+ st r11,@-sp
st r13,@-sp
+ mv r11,sp
.endm
comment "subroutine epilogue"
.macro gdbasm_leave
- ld r13,@sp+
- jmp r13
+ add3 sp,r11,0
+ ld r13,@sp+
+ ld r11,@sp+
+ jmp r13
.endm
.macro gdbasm_call subr
@@ -29,4 +33,23 @@
comment "crt0 startup"
.macro gdbasm_startup
+; R14 always contains memory base address (0)
+
+ ldi r14,0
+
+; Set the USER and SYSTEM stack pointers.
+
+ ldi r0, 0 ; zero arguments
+ ldi r1, 0
+ mvtc r0, psw ; select SPI and set it
+ ldi sp, _stack
+ ldi r10, 0x8000 ; select SPU/FP and set it
+ mvtc r10, psw || ldi r11, 0; clear stack frame
+ ldi sp, _stack - 0x200
+ ldi r13, 0
+
+ st r11, @-sp
+ st r13, @-sp
+; mv r11, sp
+
.endm
diff --git a/gdb/testsuite/gdb.asm/i386.inc b/gdb/testsuite/gdb.asm/i386.inc
index 1d9670e..9746646 100644
--- a/gdb/testsuite/gdb.asm/i386.inc
+++ b/gdb/testsuite/gdb.asm/i386.inc
@@ -30,3 +30,10 @@
.macro gdbasm_startup
xor %ebp, %ebp
.endm
+
+ comment "Declare a data variable"
+ .macro gdbasm_datavar name value
+ .data
+\name:
+ .long \value
+ .endm