the S/390 architecture.
* gdb.asm/configure: Regenerated.
+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.
+
2001-11-26 Fernando Nasser <fnasser@redhat.com>
From 2001-11-12 Jackie Smith Cashion <jsmith@redhat.com>:
# 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"
# 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"
+
.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
foo2:
gdbasm_enter
-comment "Call someplace else."
+comment "Call someplace else (several times)."
gdbasm_call foo3
+ gdbasm_call foo3
comment "All done, return."
.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"
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"
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
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
.macro gdbasm_startup
xor %ebp, %ebp
.endm
+
+ comment "Declare a data variable"
+ .macro gdbasm_datavar name value
+ .data
+\name:
+ .long \value
+ .endm