From 8b1d7e37a41413cc941f3a31f470165ab0cb466e Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Tue, 22 Oct 2002 01:43:37 +0000 Subject: [PATCH] * gdb.asm/asm-source.exp: Add "mips*-*" pattern. Update line numbers. Allow "foo2|selected stack frame". * gdb.asm/asmsrc1.s: Use gdbasm_declare and gdbasm_end. * gdb.asm/asmsrc2.s: Likewise. * gdb.asm/common.inc: Define gdbasm_declare and gdbasm_end. Update comments. * gdb.asm/mips.inc: New file. --- gdb/testsuite/gdb.asm/asm-source.exp | 9 ++-- gdb/testsuite/gdb.asm/asmsrc1.s | 16 ++++--- gdb/testsuite/gdb.asm/asmsrc2.s | 3 +- gdb/testsuite/gdb.asm/common.inc | 14 ++++-- gdb/testsuite/gdb.asm/mips.inc | 64 ++++++++++++++++++++++++++++ 5 files changed, 93 insertions(+), 13 deletions(-) create mode 100644 gdb/testsuite/gdb.asm/mips.inc diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index f10f4ae2a62..deb4b5f9559 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -57,6 +57,9 @@ if [istarget "i\[3456\]86-*-*"] then { if [istarget "m32r*-*"] then { set asm-arch m32r } +if [istarget "mips*-*"] then { + set asm-arch mips +} if [istarget "powerpc*-*"] then { set asm-arch powerpc } @@ -194,7 +197,7 @@ gdb_test "list $entry_symbol" ".*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" + "40\[ \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" @@ -219,7 +222,7 @@ gdb_test "s" "" "s 2" 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" +gdb_test "bt 3" "\#0.*foo3.*asmsrc1\[.\]s:45.*\#1.*foo2.*asmsrc2\[.\]s:12.*\#2.*main.*asmsrc1\[.\]s:33.*" "bt 3 in foo3" # Try 'info source' from asmsrc1.s gdb_test "info source" \ @@ -277,7 +280,7 @@ 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" + "Make (foo2|selected stack frame) return now\?.*" "y" # See if we can look at a global variable gdb_test "print globalvar" ".* = 11" "look at global variable" diff --git a/gdb/testsuite/gdb.asm/asmsrc1.s b/gdb/testsuite/gdb.asm/asmsrc1.s index f14cd915921..cba0e90ec2a 100644 --- a/gdb/testsuite/gdb.asm/asmsrc1.s +++ b/gdb/testsuite/gdb.asm/asmsrc1.s @@ -10,18 +10,18 @@ comment "This file is not linked with crt0." comment "Provide very simplistic equivalent." .global _start -_start: +gdbasm_declare _start gdbasm_startup gdbasm_call main gdbasm_exit0 - + gdbasm_end _start comment "main routine for assembly source debugging test" comment "This particular testcase uses macros in .inc to achieve" comment "machine independence." .global main -main: +gdbasm_declare main gdbasm_enter comment "Call a macro that consists of several lines of assembler code." @@ -35,23 +35,27 @@ comment "Call a subroutine in another file." comment "All done." gdbasm_exit0 + gdbasm_end main comment "A routine for foo2 to call." .global foo3 -foo3: +gdbasm_declare foo3 gdbasm_enter gdbasm_leave + gdbasm_end foo3 .global exit -exit: +gdbasm_declare exit gdbasm_exit0 + gdbasm_end exit comment "A static function" -foostatic: +gdbasm_declare foostatic gdbasm_enter gdbasm_leave + gdbasm_end foostatic comment "A global variable" diff --git a/gdb/testsuite/gdb.asm/asmsrc2.s b/gdb/testsuite/gdb.asm/asmsrc2.s index 9d7713fad84..4366536acbe 100644 --- a/gdb/testsuite/gdb.asm/asmsrc2.s +++ b/gdb/testsuite/gdb.asm/asmsrc2.s @@ -4,7 +4,7 @@ comment "Second file in assembly source debugging testcase." .global foo2 -foo2: +gdbasm_declare foo2 gdbasm_enter comment "Call someplace else (several times)." @@ -15,3 +15,4 @@ comment "Call someplace else (several times)." comment "All done, return." gdbasm_leave + gdbasm_end foo2 diff --git a/gdb/testsuite/gdb.asm/common.inc b/gdb/testsuite/gdb.asm/common.inc index 51493929765..04f08ff9cce 100644 --- a/gdb/testsuite/gdb.asm/common.inc +++ b/gdb/testsuite/gdb.asm/common.inc @@ -14,6 +14,15 @@ .word \value .endm + comment "Declare a subroutine" + .macro gdbasm_declare name +\name: + .endm + + comment "End a subroutine" + .macro gdbasm_end name + .endm + comment "arch.inc is responsible for defining the following macros:" comment "enter - subroutine prologue" comment "leave - subroutine epilogue" @@ -23,6 +32,5 @@ 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 "declare - declare the start of a subroutine" +comment "end - end a subroutine" diff --git a/gdb/testsuite/gdb.asm/mips.inc b/gdb/testsuite/gdb.asm/mips.inc new file mode 100644 index 00000000000..751f73f859b --- /dev/null +++ b/gdb/testsuite/gdb.asm/mips.inc @@ -0,0 +1,64 @@ + comment "subroutine declare" + .macro gdbasm_declare name + .align 2 + .ent \name + .type \name,@function +\name: + .endm + + comment "subroutine prologue" + .macro gdbasm_enter + .frame $fp, 32, $31 + .mask 0xd0000000,-4 + .set noreorder + .cpload $25 + .set reorder + subu $sp, $sp, 32 + .cprestore 16 + sw $31, 28($sp) + sw $fp, 24($sp) + sw $28, 20($sp) + move $fp, $sp + .endm + + comment "subroutine epilogue" + .macro gdbasm_leave + lw $31, 28($sp) + lw $fp, 24($sp) + .set noreorder + .set nomacro + j $31 + addu $sp, $sp, 32 + .set macro + .set reorder + .endm + + comment "subroutine end" + .macro gdbasm_end name + .end \name + .endm + + .macro gdbasm_call subr + la $25, \subr + jal $31, $25 + .endm + + .macro gdbasm_several_nops + nop + nop + nop + nop + .endm + + comment "exit (0)" + .macro gdbasm_exit0 + comment "Don't know how to exit, but this will certainly halt..." + lw $2, 0($0) + .endm + + comment "crt0 startup" + .macro gdbasm_startup + .global __start +__start: + move $fp, $sp + .endm -- 2.30.2