* 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.
This commit is contained in:
parent
17c84737fa
commit
8b1d7e37a4
5 changed files with 93 additions and 13 deletions
|
@ -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"
|
||||
|
|
|
@ -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 <arch>.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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
64
gdb/testsuite/gdb.asm/mips.inc
Normal file
64
gdb/testsuite/gdb.asm/mips.inc
Normal file
|
@ -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
|
Loading…
Reference in a new issue