From ca9efc9063b7e94b26582c5b8d6c0c688d9678b6 Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Tue, 4 Dec 2001 19:45:57 +0000 Subject: [PATCH] 2001-11-30 Michael Snyder * 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. --- gdb/testsuite/ChangeLog | 13 ++++++++ gdb/testsuite/gdb.asm/asm-source.exp | 49 ++++++++++++++++++++++++++++ gdb/testsuite/gdb.asm/asmsrc1.s | 15 +++++++++ gdb/testsuite/gdb.asm/asmsrc2.s | 3 +- gdb/testsuite/gdb.asm/common.inc | 10 ++++++ gdb/testsuite/gdb.asm/d10v.inc | 27 +++++++++++++-- gdb/testsuite/gdb.asm/i386.inc | 7 ++++ 7 files changed, 121 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a57d02f83ac..ff9e9f4b11c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -15,6 +15,19 @@ the S/390 architecture. * gdb.asm/configure: Regenerated. +2001-11-30 Michael Snyder + + * 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 From 2001-11-12 Jackie Smith Cashion : diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index 8e076925e8f..81de92f823f 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.* and ends at.*." \ + "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" ".*:.*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 8bd41ad31ed..f14cd915921 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 22c63d4f298..9d7713fad84 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 7cca3abf04c..51493929765 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 1ad3b9fe351..bd9463fc891 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 1d9670ee2d8..9746646ba62 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 -- 2.30.2