OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/tags/gnu-src/gdb-7.2/gdb-7.2-or32-1.0rc3/gdb/testsuite/gdb.asm
    from Rev 330 to Rev 513
    Reverse comparison

Rev 330 → Rev 513

/spu.inc
0,0 → 1,42
comment "subroutine prologue"
.macro gdbasm_enter
stqd $lr, 16($sp)
stqd $sp, -32($sp)
ai $sp, $sp, -32
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
ai $sp, $sp, 32
lqd $lr, 16($sp)
bi $lr
.endm
 
.macro gdbasm_call subr
brsl $lr, \subr
.endm
 
.macro gdbasm_several_nops
nop
nop
nop
nop
.endm
 
comment "exit (0)"
.macro gdbasm_exit0
stop 0x2000
stop
stop
stop
.endm
 
comment "startup"
.macro gdbasm_startup
il $0, 0
ila $sp, 16368
stqd $0, 0($sp)
stqd $sp, -32($sp)
ai $sp, $sp, -32
stqd $0, 16($sp)
.endm
/sparc.inc
0,0 → 1,34
comment "subroutine prologue"
.macro gdbasm_enter
save %sp, -112, %sp
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
ret
restore
.endm
 
.macro gdbasm_call subr
call \subr
nop
.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..."
ld [%g0], %i0
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
clr %fp
.endm
 
/mips.inc
0,0 → 1,64
comment "subroutine declare"
.purgem gdbasm_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"
.purgem gdbasm_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
move $fp, $sp
.endm
/Makefile.in
0,0 → 1,19
VPATH = @srcdir@
srcdir = @srcdir@
 
EXECUTABLES =
MISCELLANEOUS = arch.inc
 
all info install-info dvi install uninstall installcheck check:
@echo "Nothing to be done for $@..."
 
clean mostlyclean:
-rm -f *~ *.o a.out *.x *.ci *.tmp
-rm -f core core.coremaker coremaker.core corefile $(EXECUTABLES)
-rm -f $(MISCELLANEOUS)
 
distclean maintainer-clean realclean: clean
-rm -f *~ core
-rm -f Makefile config.status config.log
-rm -f *-init.exp
-rm -fr *.log summary detail *.plog *.sum *.psum site.*
/netbsd.inc
0,0 → 1,12
comment "netbsd .note"
 
.section ".note.netbsd.ident", "a"
.p2align 2
 
.long 7
.long 4
.long 1
.ascii "NetBSD\0\0"
.long 105010000
 
.p2align 2
/m32r-linux.inc
0,0 → 1,34
comment "subroutine prologue"
.macro gdbasm_enter
push fp -> push lr
addi sp,#-4 -> mv fp,sp
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
addi sp,#4 -> pop lr
pop fp -> jmp lr
.endm
 
.macro gdbasm_call subr
bl \subr
.endm
 
.macro gdbasm_several_nops
nop
nop
nop
nop
.endm
 
comment "exit (0)"
.macro gdbasm_exit0
ldi r0,#1 -> ldi r1,#0
ldi r2,#0 -> ldi r3,#0
trap #0 -> nop
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
ldi fp,#0
.endm
/m32r.inc
0,0 → 1,36
comment "subroutine prologue"
.macro gdbasm_enter
push fp -> push lr
addi sp,#-4 -> mv fp,sp
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
addi sp,#4 -> pop lr
pop fp -> jmp lr
.endm
 
.macro gdbasm_call subr
bl \subr
.endm
 
.macro gdbasm_several_nops
nop
nop
nop
nop
.endm
 
comment "exit (0)"
.macro gdbasm_exit0
ldi r0,#1 -> ldi r1,#0
ldi r2,#0 -> ldi r3,#0
trap #0 -> nop
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
seth sp, #shigh(_stack)
add3 sp, sp, #low(_stack)
ldi fp,#0
.endm
/m68k.inc
0,0 → 1,39
comment "subroutine prologue"
.macro gdbasm_enter
link %a6,#0
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
unlk %a6
rts
.endm
 
.macro gdbasm_call subr
jbsr \subr
.endm
 
.macro gdbasm_several_nops
nop
nop
nop
nop
.endm
 
comment "exit (0)"
.macro gdbasm_exit0
illegal
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
lea 0,%a6
.endm
 
comment "Declare a data variable"
.purgem gdbasm_datavar
.macro gdbasm_datavar name value
.data
\name:
.long \value
.endm
/s390x.inc
0,0 → 1,69
### entry point code
.macro gdbasm_startup
 
# Align the stack pointer to an 8-byte boundary.
lghi %r0,-16
ngr %r15,%r0
 
# Reserve space for the standard stack frame:
# back chain, and space for the callee to save its registers.
aghi %r15,-168
# Zero this frame's back chain pointer.
xc 0(8,%r15),0(%r15)
.endm
 
 
### Call a function.
.macro gdbasm_call subr
brasl %r14, \subr
.endm
 
 
### Exit with a zero status.
.macro gdbasm_exit0
lghi %r2, 0
svc 1
.endm
 
### Standard subroutine prologue.
.macro gdbasm_enter
 
# Save all the callee-saves registers. What the heck.
stmg %r6,%r15,48(%r15)
 
# Allocate the stack frame, and write the back chain pointer.
# Keep the original SP in %r11.
lgr %r11,%r15
aghi %r15,-168
stg %r11,0(%r15)
.endm
 
 
### Standard subroutine epilogue.
.macro gdbasm_leave
 
# Restore all our registers. This also pops the frame, and
# restores our return address.
lmg %r6,%r15,216(%r15)
 
# Jump to the return address.
br %r14
 
.endm
 
### Several nops.
.macro gdbasm_several_nops
lr %r0, %r0
lr %r0, %r0
lr %r0, %r0
lr %r0, %r0
.endm
 
### Declare an `int' variable.
.purgem gdbasm_datavar
.macro gdbasm_datavar name value
.data
\name:
.long \value
.endm
/m68hc11.inc
0,0 → 1,66
comment "subroutine prologue"
.macro gdbasm_enter
ldx _.frame
pshx
sts _.frame
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
pulx
stx _.frame
rts
.endm
 
.macro gdbasm_call subr
jsr \subr
.endm
 
.macro gdbasm_several_nops
nop
nop
nop
nop
.endm
 
comment "exit (0)"
.macro gdbasm_exit0
clra
clrb
wai
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
.sect .data
.globl _.frame
_.frame: .word 0
.previous
lds #0x2000
; the linker script maps the data section in ROM (LMA) for its initial
; content and in RAM (VMA) for its runtime value. We have to do
; what the default crt0 does: copy the ROM part in RAM.
; (otherwise any 'globalvar' appears uninitialized)
ldx #__data_image
ldy #__data_section_start
bra Start_map
Loop:
ldaa 0,x
staa 0,y
inx
iny
Start_map:
cpx #__data_image_end
blo Loop
Done:
clr _.frame
clr _.frame+1
.endm
 
comment "Declare a data variable"
.purgem gdbasm_datavar
.macro gdbasm_datavar name value
.data
\name:
.word \value
.endm
/common.inc
0,0 → 1,40
.macro comment text
.endm
 
comment "Can't rely on assembler comment character so do this."
 
comment "On some platforms (like HPUX), only labels are allowed"
comment "to start at the first column. Beware of this when editing"
comment "the assembly files for this test."
 
.macro include arch file
.include "\arch\file"
.endm
 
comment "Declare a data variable"
.macro gdbasm_datavar name value
.data
\name:
.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"
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 "declare - declare the start of a subroutine"
comment "end - end a subroutine"
/i386.inc
0,0 → 1,40
comment "subroutine prologue"
.macro gdbasm_enter
push %ebp
mov %esp,%ebp
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
pop %ebp
ret
.endm
 
.macro gdbasm_call subr
call \subr
.endm
 
.macro gdbasm_several_nops
nop
nop
nop
nop
.endm
 
comment "exit (0)"
.macro gdbasm_exit0
hlt
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
xor %ebp, %ebp
.endm
 
comment "Declare a data variable"
.purgem gdbasm_datavar
.macro gdbasm_datavar name value
.data
\name:
.long \value
.endm
/x86_64.inc
0,0 → 1,40
comment "subroutine prologue"
.macro gdbasm_enter
push %rbp
mov %rsp,%rbp
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
pop %rbp
ret
.endm
 
.macro gdbasm_call subr
call \subr
.endm
 
.macro gdbasm_several_nops
nop
nop
nop
nop
.endm
 
comment "exit (0)"
.macro gdbasm_exit0
hlt
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
xor %rbp, %rbp
.endm
 
comment "Declare a data variable"
.purgem gdbasm_datavar
.macro gdbasm_datavar name value
.data
\name:
.long \value
.endm
/asm-source.exp
0,0 → 1,444
# Copyright 1998, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This file was written by Kendra.
 
if $tracelevel then {
strace $tracelevel
}
 
#
# Test debugging assembly level programs.
# This file uses asmsrc[12].s for input.
#
 
 
set asm-arch ""
set asm-note "empty"
set asm-flags ""
set link-flags "-e _start"
set debug-flags ""
 
switch -glob -- [istarget] {
"alpha*-*-*" {
set asm-arch alpha
# ??? Won't work with ecoff systems like Tru64, but then we also
# don't have any other -g flag that creates mdebug output.
set asm-flags "-no-mdebug -I${srcdir}/${subdir} -I${objdir}/${subdir}"
set debug-flags "-gdwarf-2"
}
"*arm-*-*" {
set asm-arch arm
}
"xscale-*-*" {
set asm-arch arm
}
"frv-*-*" {
set asm-arch frv
}
"s390-*-*" {
set asm-arch s390
}
"s390x-*-*" {
set asm-arch s390x
}
"x86_64-*-*" {
set asm-arch x86_64
set debug-flags "-gdwarf-2"
}
"i\[3456\]86-*-*" {
set asm-arch i386
}
"lm32-*" {
set asm-arch lm32
}
"m32r*-linux*" {
set asm-arch m32r-linux
}
"m32c-*-*" {
set asm-arch m32c
}
"m32r*-*" {
set asm-arch m32r
append link-flags "--whole-archive -lgloss --no-whole-archive"
}
"m6811-*-*" {
set asm-arch m68hc11
set asm-flags "-mshort-double -m68hc11 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}"
set debug-flags "-gdwarf-2"
# This asm test is specific and uses the linker directly.
# We must not use the target board linker script defined for other
# tests. Remove it and restore it later on.
set board [target_info name]
set old_ldscript [board_info $board ldscript]
unset_board_info "ldscript"
}
"m6812-*-*" {
set asm-arch m68hc11
set asm-flags "-mshort-double -m68hc12 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}"
set debug-flags "-gdwarf-2"
# This asm test is specific and uses the linker directly.
# We must not use the target board linker script defined for other
# tests. Remove it and restore it later on.
set board [target_info name]
set old_ldscript [board_info $board ldscript]
set_board_info ldscript ""
}
"mips*-*" {
set asm-arch mips
}
"powerpc*-*" {
set asm-arch powerpc
}
"sh*-*-*" {
set asm-arch sh
set debug-flags "-gdwarf-2"
}
"sparc-*-*" {
set asm-arch sparc
}
"sparc64-*-*" {
set asm-arch sparc64
set asm-flags "-xarch=v9 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
set debug-flags "-gdwarf-2"
}
"spu*-*-*" {
set asm-arch spu
set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir} --no-warn"
set debug-flags "-gdwarf-2"
}
"xstormy16-*-*" {
set asm-arch xstormy16
set debug-flags "-gdwarf-2"
}
"v850-*-*" {
set asm-arch v850
set gdb_wrapper_initialized 1
}
"m68k-*-*" {
set asm-arch m68k
}
"ia64-*-*" {
set asm-arch ia64
set debug-flags "-gdwarf-2"
}
"iq2000-*-*" {
set asm-arch iq2000
}
"hppa*-linux-*" {
set asm-arch pa
set debug-flags "-gdwarf-2"
}
"hppa-*-openbsd*" {
set asm-arch pa
set debug-flags "-gdwarf-2"
}
"hppa64-*-hpux*" {
set asm-arch pa64
set debug-flags "-gdwarf-2"
}
"h83*-*" {
set asm-arch h8300
set debug-flags "-gdwarf-2"
}
}
 
if { "${asm-arch}" == "" } {
untested asm-source.exp
return -1
}
 
# On NetBSD/ELF we need a special NetBSD-identifying note section.
if { [istarget "*-*-netbsdelf*"]
|| [istarget "alpha-*-netbsd*"]
|| [istarget "mips*-*-netbsd*"]
|| [istarget "powerpc-*-netbsd*"]
|| [istarget "x86_64-*-netbsd*"] } then {
set asm-note "netbsd"
}
 
# On OpenBSD/ELF we need a similar note section. We make no attempt
# of handing a.out here since most OpenBSD/a.out systems use a rather
# outdated assembler that doesn't assemble this test's code anyway.
if { [istarget "*-*-openbsd*"] } then {
set asm-note "openbsd"
}
 
# Watch out, we are invoking the assembler, but the testsuite sets multilib
# switches according to compiler syntax. If we pass these options straight
# to the assembler, they won't always make sense. If we don't pass them to
# the assembler, the final link will complain that the object files were
# built with different defaults. So no matter what we do, we lose. We may as
# well get out of this test sooner rather than later.
set dest [target_info name]
if [board_info $dest exists multilib_flags] {
set multilib_flags [board_info $dest multilib_flags]
if { "${multilib_flags}" != "" } {
untested asm-source.exp
return -1
return;
}
}
 
set testfile "asm-source"
set binfile ${objdir}/${subdir}/${testfile}
set srcfile1 asmsrc1.s
set srcfile2 asmsrc2.s
 
remote_exec build "rm -f ${subdir}/arch.inc"
remote_download host ${srcdir}/${subdir}/${asm-arch}.inc ${subdir}/arch.inc
remote_exec build "rm -f ${subdir}/note.inc"
remote_download host ${srcdir}/${subdir}/${asm-note}.inc ${subdir}/note.inc
 
if { [string equal ${asm-flags} ""] } {
set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}"
}
 
if { [string equal ${debug-flags} ""] } {
set debug-flags "-gstabs"
}
 
# Allow the target board to override the debug flags.
if { [board_info $dest exists debug_flags] } then {
set debug-flags "[board_info $dest debug_flags]"
}
 
# The debug flags are in the format that gcc expects:
# "-gdwarf-2", "-gstabs+", or "-gstabs". To be compatible with the
# other languages in the test suite, we accept this input format.
# So the user can run the test suite with:
#
# runtest --target_board unix/gdb:debug_flags=-gdwarf-2
# make check RUNTESTFLAGS="--target_board unix/gdb:debug_flags=-gdwarf-2"
#
# However, the GNU assembler has different spellings than gcc.
# So I adjust the debug flags here.
 
# The GNU assembler spells "dwarf-2" as "dwarf2".
regsub "--" "-gdwarf-2" "${debug-flags}" "-gdwarf2" debug-flags
 
# The GNU assembler before 2.15 did not support "stabs+".
regsub "--" "-gstabs\[+\]" "${debug-flags}" "-gstabs" debug-flags
 
# The GNU assembler does not support level options like "-g2" or "-g3".
regsub "--" "-g\[0-9\]" "${debug-flags}" "" debug-flags
 
if {[target_assemble ${srcdir}/${subdir}/${srcfile1} asmsrc1.o "${asm-flags} ${debug-flags}"] != ""} then {
untested asm-source.exp
return -1
}
if {[target_assemble ${srcdir}/${subdir}/${srcfile2} asmsrc2.o "${asm-flags} ${debug-flags}"] != ""} then {
untested asm-source.exp
return -1
}
 
# We deliberately don't use gdb_compile here to link together the
# assembled object files. Using gdb_compile, and therefore the C
# compiler, is conceptually wrong, since we're testing raw assembler
# code here that provides its own startup code. Using target_link
# also avoids a lot of problems on many systems, most notably on
# *-*-*bsd* and *-*-solaris2*.
if {[target_link "asmsrc1.o asmsrc2.o" "${binfile}" ${link-flags}] != "" } then {
untested asm-source.exp
return -1
}
 
# Restore the target board linker script for HC11/HC12.
if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } {
set_board_info ldscript $old_ldscript
}
 
remote_exec build "mv asmsrc1.o asmsrc2.o ${objdir}/${subdir}"
 
# Collect some line numbers.
set line_main [expr [gdb_get_line_number "main start" "asmsrc1.s"] + 1]
set line_call_foo2 [expr [gdb_get_line_number "call foo2" "asmsrc1.s"] + 1]
set line_search_comment [expr [gdb_get_line_number "search" "asmsrc1.s"] + 1]
set line_foo3 [expr [gdb_get_line_number "foo3 start" "asmsrc1.s"] + 1]
set line_main_exit [expr [gdb_get_line_number "main exit" "asmsrc1.s"] + 1]
set line_foo2 [expr [gdb_get_line_number "foo2 start" "asmsrc2.s"] + 1]
set line_call_foo3 [expr [gdb_get_line_number "call foo3" "asmsrc2.s"] + 1]
set line_call_foo3_again [expr $line_call_foo3 + 1]
set line_foo2_leave [expr [gdb_get_line_number "foo2 leave" "asmsrc2.s"] + 1]
 
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
 
#
# Run to `main' where we begin our tests.
#
 
if ![runto_main] then {
gdb_suppress_tests
}
 
# Execute the `f' command and see if the result includes source info.
gdb_test "f" "asmsrc1\[.\]s:$line_main.*several_nops" "f at main"
 
# See if we properly `next' over a macro with several insns.
gdb_test "n" "$line_call_foo2\[ \]*.*foo2" "next over macro"
 
# See if we can properly `step' into a subroutine call.
gdb_test "s" "$line_foo2\[ \]*.*" "step into foo2"
 
# Test 'info target', and incidentally capture the entry point address.
set entry_point 0
gdb_test_multiple "info target" "info target" {
-re "Symbols from .*asm-source.*Entry point: 0x(\[01232456789abcdefABCDEF\]+).*$gdb_prompt $" {
set entry_point $expect_out(1,string)
pass "info target"
}
}
 
# Capture the start symbol (may be '_start' or 'start')
set entry_symbol ""
gdb_test_multiple "info symbol 0x$entry_point" "info symbol" {
-re "info symbol 0x$entry_point\[\r\n\]+(\[^\r\n\]*) in section .*$gdb_prompt $" {
# We match the echoed `info symbol' command here, to help us
# reliably identify the beginning of the start symbol in the
# command's output. You might think we could just use '^' to
# start matching at the beginning of the line, but
# unfortunately, in Expect, '^' matches the beginning of the
# input that hasn't been matched by any expect clause yet. If
# every expect clause consumes a complete line, along with its
# terminating CR/LF, this is equivalent to the beginning of a
# line. But expect clauses that end with `.*' will consume as
# much as happened to arrive from the TTY --- exactly where
# they leave you depends on inter-process timing. :(
set entry_symbol $expect_out(1,string)
pass "info symbol"
}
}
 
# Now try a 'list' from the other source file.
gdb_test "list $entry_symbol" ".*gdbasm_startup.*" "list"
 
# Now try a source file search
gdb_test "search A routine for foo2 to call" \
"$line_search_comment\[ \t\]+comment \"A routine for foo2 to call.\"" "search"
 
# See if `f' prints the right source file.
gdb_test "f" ".*asmsrc2\[.\]s:$line_foo2.*" "f in foo2"
 
# `next' one insn (or macro) to set up our stackframe (for the following bt).
gdb_test "n" "$line_call_foo3\[ \]*.*foo3" "n in foo2"
 
# See if a simple `bt' prints the right source files and
# doesn't fall off the stack.
 
gdb_test "bt 10" \
"\#0.*foo2.*asmsrc2\[.\]s:$line_call_foo3.*\#1.*main.*asmsrc1\[.\]s:$line_call_foo2" \
"bt ALL in foo2"
 
# See if a capped `bt' prints the right source files.
gdb_test "bt 2" "\#0.*foo2.*asmsrc2\[.\]s:$line_call_foo3.*\#1.*main.*asmsrc1\[.\]s:$line_call_foo2.*" "bt 2 in foo2"
 
# Step into another subroutine which lives back in the first source file.
gdb_test "s" ".*" "s 2"
 
# Next over insns to set up the stack frame.
gdb_test "n" ".*" "n 2"
 
# Now see if a capped `bt' is correct.
gdb_test "bt 3" "\#0.*foo3.*asmsrc1\[.\]s:$line_foo3.*\#1.*foo2.*asmsrc2\[.\]s:$line_call_foo3.*\#2.*main.*asmsrc1\[.\]s:$line_call_foo2.*" "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\]$line_call_foo3_again\[ \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'. This can produce a lot of output on systems
# with dynamic linking, where the system's shared libc was compiled
# with debugging info; for example, on Linux, this produces 47kb of
# output. So we consume it as we go.
set seen_asmsrc_1 0
set seen_asmsrc_2 0
gdb_test_multiple "info sources" "info sources" {
-re "^\[^,\]*asmsrc1.s(, |\[\r\n\]+)" {
set seen_asmsrc_1 1
exp_continue
}
-re "^\[^,\]*asmsrc2.s(, |\[\r\n\]+)" {
set seen_asmsrc_2 1
exp_continue
}
-re ", " {
exp_continue
}
-re "$gdb_prompt $" {
if {$seen_asmsrc_1 && $seen_asmsrc_2} {
pass "info sources"
} else {
fail "info sources"
}
}
}
 
# Try 'info line'
gdb_test "info line" \
"Line $line_call_foo3_again of.*asmsrc2.s.*starts at.*<foo2+.*> and ends at.*<foo2+.*>." \
"info line"
 
# Try 'nexting' over next call to foo3
gdb_test "next" "$line_foo2_leave\[ \t\]+gdbasm_leave" "next over foo3"
 
# Try 'return' from foo2
gdb_test "return" "\#0 main .*$line_main_exit\[ \t\]+gdbasm_exit0" "return from foo2" \
"Make (foo2|selected stack frame) return now\?.*" "y"
 
# Disassemble something, check the output
proc test_dis { command var } {
global gdb_prompt
gdb_test_multiple "${command}" "${command}" {
-re "${var}.*:.*(Cannot access|Bad address)" {
# The "disassembler" was only accessing the local
# executable and that would cause attempts to disassemble
# variables to fail (memory not valid).
fail "${command} (memory read error)"
}
-re "${var}.*:.*${gdb_prompt}" {
pass "${command}"
}
}
}
 
# See if we can look at a global variable, three ways
gdb_test "print globalvar" ".* = 11" "look at global variable"
test_dis "x/i &globalvar" "globalvar"
test_dis "disassem &globalvar, &globalvar+1" "globalvar"
 
# See if we can look at a static variable, three ways
gdb_test "print staticvar" ".* = 5" "look at static variable"
test_dis "x/i &staticvar" "staticvar"
test_dis "disassem &staticvar, &staticvar+1" "staticvar"
 
# See if we can look at a static function
gdb_test "disassem foostatic" ".*<\\+0>:.*End of assembler dump." \
"look at static function"
 
remote_exec build "rm -f ${subdir}/arch.inc"
remote_exec build "rm -f ${subdir}/note.inc"
/v850.inc
0,0 → 1,41
comment "subroutine prologue"
.macro gdbasm_enter
add -8,sp
st.w r31,4[sp]
st.w r29,0[sp]
mov sp,r29
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
mov r29,sp
ld.w 0[sp],r29
ld.w 4[sp],r31
add 8,sp
jmp [r31]
.endm
 
.macro gdbasm_call subr
jarl \subr,r31
.endm
 
.macro gdbasm_several_nops
nop
nop
nop
nop
.endm
 
comment "exit (0)"
.macro gdbasm_exit0
halt
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
movea 255,r0,r20
mov r0, r21
ori 65535, r0, r21
movhi 32, r0, sp
.endm
 
/h8300.inc
0,0 → 1,50
comment "subroutine prologue"
.macro gdbasm_enter
mov.w r6,@-r7
mov.w r7,r6
subs #2,r7
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
adds #2,r7
mov.w @r7+,r6
rts
.endm
 
.macro gdbasm_call subr
jsr @\subr
.endm
 
.macro gdbasm_several_nops
nop
nop
nop
nop
.endm
 
comment "exit (0)"
.macro gdbasm_exit0
mov.w #0xdead,r1
mov.w #0xbeef,r2
mov.w #0,r0
sleep
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
.section .stack
_stack: .long 1
.section .text
.global _start
_start:
mov.w #0,r6
mov.w #_stack,sp ; or mov.l #_stack,sp
mov.w #_edata,r0
mov.w #_end,r1
sub.w r2,r2
.loop: mov.w r2,@r0
adds #2,r0
cmp r1,r0
blo .loop
.endm
/pa64.inc
0,0 → 1,46
comment "subroutine prologue"
.macro gdbasm_enter
std %rp, -16(%sp)
copy %r3, %r1
copy %sp, %r3
std,ma %r1, 128(%sp)
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
ldd -16(%r3), %rp
bve (%rp)
ldd,mb -128(%sp), %r3
.endm
 
.macro gdbasm_call subr
b,l \subr , %rp
nop
.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..."
ldw 0(%r0), %r1
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
.align 8
.endm
 
comment "Declare a data variable"
.purgem gdbasm_datavar
.macro gdbasm_datavar name value
.data
\name:
.long \value
.endm
 
/sh.inc
0,0 → 1,88
# You'll find a bunch of nop opcodes in the below macros. They are
# there to keep the code correctly aligned. Be careful to maintain
# them when changing the code.
 
comment "subroutine declare"
.purgem gdbasm_declare
.macro gdbasm_declare name
.align 1
.global \name
\name:
.endm
 
comment "subroutine prologue"
.macro gdbasm_enter
mov.l r14,@-r15
sts.l pr,@-r15
mov r15,r14
nop
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
mov r14,r15
lds.l @r15+,pr
mov.l @r15+,r14
rts
nop
nop
.endm
 
comment "subroutine end"
.purgem gdbasm_end
.macro gdbasm_end name
.size \name, .-_foo1
.align 1
.endm
 
comment "subroutine call"
.macro gdbasm_call subr
mov.l .Lconst\@,r1
bra .Lafterconst\@
nop
nop
.Lconst\@:
.align 2
.long \subr
.align 1
.Lafterconst\@:
jsr @r1
nop
.endm
 
.macro gdbasm_several_nops
nop
nop
nop
nop
.endm
 
comment "exit (0)"
.macro gdbasm_exit0
sleep
nop
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
mov.l .stackaddr,r15
bra .afterstackaddr
nop
nop
.align 2
.stackaddr:
.long 196608 ! 0x30000
.align 1
.afterstackaddr:
.endm
 
comment "Declare a data variable"
.purgem gdbasm_datavar
.macro gdbasm_datavar name value
.data
.align 2
.type \name, @object
.size \name, 4
\name:
.long \value
.endm
/iq2000.inc
0,0 → 1,41
comment "subroutine prologue"
.macro gdbasm_enter
addiu %29, %29, 0xfffc
sw %31,0(%29)
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
lw %31,0(%29)
addiu %29, %29, 4
jr %31
nop
.endm
 
.macro gdbasm_call subr
jal \subr
nop
.endm
 
.macro gdbasm_several_nops
nop
nop
nop
nop
.endm
 
comment "exit (0)"
.macro gdbasm_exit0
ori %4, %0, 1 # SYS_exit
ori %5, %0, 0 # normal exit code
ori %6, %0, 0
ori %7, %0, 0
syscall
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
andi %0, %0, 0
addiu %29, %0, 0xffc
.endm
 
/arm.inc
0,0 → 1,35
comment "subroutine prologue"
.macro gdbasm_enter
mov ip, sp
stmdb sp!, {fp, ip, lr, pc}
sub fp, ip, #4
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
ldmea fp, {fp, sp, pc}
.endm
 
.macro gdbasm_call subr
bl \subr
.endm
 
.macro gdbasm_several_nops
nop
nop
nop
nop
.endm
 
comment "exit (0)"
.macro gdbasm_exit0
mov r0, #0
swi 0x00123456
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
mov fp, #0
mov r7, #0
.endm
 
/powerpc.inc
0,0 → 1,48
comment "subroutine prologue"
.macro gdbasm_enter
stwu 1, -16(1)
stw 31, 8(1)
mr 31, 1
mflr 0
stw 0, 20(1)
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
lwz 0, 20(1)
mtlr 0
lwz 31, 8(1)
lwz 1, 0(1)
blr
.endm
 
.macro gdbasm_call subr
bl \subr
.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..."
li 0, 0
lwz 0, 0(0)
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
.p2align 2
.endm
 
comment "Declare a data variable"
.purgem gdbasm_datavar
.macro gdbasm_datavar name value
.data
\name:
.long \value
.endm
/sparc64.inc
0,0 → 1,34
comment "subroutine prologue"
.macro gdbasm_enter
save %sp, -192, %sp
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
return %i7 + 8
nop
.endm
 
.macro gdbasm_call subr
call \subr
nop
.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..."
ldx [%g0], %i0
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
clr %fp
.endm
 
/alpha.inc
0,0 → 1,65
comment "subroutine declare"
.purgem gdbasm_declare
.macro gdbasm_declare name
.ent \name
\name:
.endm
 
comment "subroutine prologue"
.macro gdbasm_enter
.frame $30, 16, $26, 0
.mask 0x04000000, -16
ldgp $gp, 0($27)
subq $sp, 16, $sp
stq $26, 0($sp)
.prologue 1
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
ldq $26, 0($sp)
addq $sp, 16, $sp
ret
.endm
 
comment "subroutine end"
.purgem gdbasm_end
.macro gdbasm_end name
.end \name
.endm
 
comment "subroutine call"
/* Can't use ldgp here because the finish-frame test expects the
pc to wind up on the next line. That's ok, we're all local. */
.macro gdbasm_call subr
jsr $26, \subr
.endm
 
.macro gdbasm_several_nops
nop
nop
nop
nop
.endm
 
comment "exit (0)"
.macro gdbasm_exit0
lda $16, 0($31)
lda $0, 1($31)
callsys
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
.frame $31, 0, $31, 0
.prologue
ldgp $gp, 0($27)
.endm
 
comment "Declare a data variable"
.purgem gdbasm_datavar
.macro gdbasm_datavar name value
.data
\name:
.long \value
.endm
/openbsd.inc
0,0 → 1,12
comment "openbsd .note"
 
.section ".note.openbsd.ident", "a"
.p2align 2
 
.long 8
.long 4
.long 1
.ascii "OpenBSD\0\0"
.long 200311
 
.p2align 2
/xstormy16.inc
0,0 → 1,34
comment "subroutine prologue"
.macro gdbasm_enter
push r13
mov r13,r15
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
pop r13
ret
.endm
 
.macro gdbasm_call subr
callf \subr
.endm
 
.macro gdbasm_several_nops
add r0,#0
add r0,#0
add r0,#0
add r0,#0
.endm
 
comment "exit (0)"
.macro gdbasm_exit0
mov.w r2,#0
halt
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
mov r15,#2
.endm
 
/frv.inc
0,0 → 1,55
comment "subroutine prologue"
.macro gdbasm_enter
addi sp,#-16,sp
sti fp, @(sp,0)
mov sp, fp
movsg lr, gr5
sti gr5, @(fp,8)
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
ldi @(fp,8), gr5
ld @(fp,gr0), fp
addi sp,#16,sp
jmpl @(gr5,gr0)
.endm
 
.macro gdbasm_call subr
call \subr
.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..."
ldi @(gr0,0), gr5
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
call .Lcall
.Lcall: movsg lr, gr4
sethi #gprelhi(.Lcall), gr5
setlo #gprello(.Lcall), gr5
sub gr4, gr5, gr16
 
sethi #gprelhi(_stack), sp
setlo #gprello(_stack), sp
setlos #0, fp
add sp, gr16, sp
.endm
 
comment "Declare a data variable"
.purgem gdbasm_datavar
.macro gdbasm_datavar name value
.data
\name:
.long \value
.endm
/empty.inc
0,0 → 1,55
comment "empty"
/s390.inc
0,0 → 1,76
### entry point code
.macro gdbasm_startup
 
# Align the stack pointer to an 8-byte boundary.
lhi %r0,-8
nr %r15,%r0
 
# Reserve space for the standard stack frame:
# back chain, and space for the callee to save its registers.
ahi %r15,-104
# Zero this frame's back chain pointer.
xc 0(4,%r15),0(%r15)
.endm
 
 
### Call a function.
.macro gdbasm_call subr
 
# Put the address of the constant in %r1, load the constant
# (SUBR's address), and jump to it.
bras %r1, .Lafterconst\@
.long \subr
.Lafterconst\@:
l %r1,0(%r1)
basr %r14,%r1
.endm
 
 
### Exit with a zero status.
.macro gdbasm_exit0
lhi %r2, 0
svc 1
.endm
 
### Standard subroutine prologue.
.macro gdbasm_enter
 
# Save all the callee-saves registers. What the heck.
stm %r6,%r15,24(%r15)
 
# Allocate the stack frame, and write the back chain pointer.
# Keep the original SP in %r11.
lr %r1,%r15
ahi %r15,-96
st %r1,0(%r15)
.endm
 
 
### Standard subroutine epilogue.
.macro gdbasm_leave
 
# Restore all our registers. This also pops the frame, and
# restores our return address.
lm %r6,%r15,120(%r15)
 
# Jump to the return address.
br %r14
 
.endm
 
### Several nops.
.macro gdbasm_several_nops
lr %r0, %r0
lr %r0, %r0
lr %r0, %r0
lr %r0, %r0
.endm
 
### Declare an `int' variable.
.purgem gdbasm_datavar
.macro gdbasm_datavar name value
.data
\name:
.long \value
.endm
/pa.inc
0,0 → 1,45
comment "subroutine prologue"
.macro gdbasm_enter
stw %rp, -20(%sp)
copy %r3, %r1
copy %sp, %r3
stwm %r1, 64(%sp)
.endm
 
comment "subroutine epilogue"
.macro gdbasm_leave
ldw -20(%r3), %rp
bv %r0(%rp)
ldwm -64(%sp), %r3
.endm
 
.macro gdbasm_call subr
bl \subr , %rp
nop
.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..."
ldw 0(%r0), %r1
.endm
 
comment "crt0 startup"
.macro gdbasm_startup
.align 4
.endm
 
comment "Declare a data variable"
.purgem gdbasm_datavar
.macro gdbasm_datavar name value
.data
\name:
.long \value
.endm
/asmsrc1.s
0,0 → 1,86
.include "common.inc"
.include "arch.inc"
 
comment "WARNING: asm-source.exp checks for line numbers printed by gdb."
comment "Be careful about changing this file without also changing"
comment "asm-source.exp."
 
comment "This file is not linked with crt0."
comment "Provide very simplistic equivalent."
.global _start
gdbasm_declare _start
gdbasm_startup
gdbasm_call main
gdbasm_exit0
gdbasm_end _start
 
comment "Displaced stepping requires scratch space at _start"
comment "at least as large as the largest instruction. No"
comment "breakpoints should be set within the scratch space."
gdbasm_several_nops
gdbasm_several_nops
gdbasm_several_nops
gdbasm_several_nops
gdbasm_several_nops
gdbasm_several_nops
gdbasm_several_nops
gdbasm_several_nops
 
comment "main routine for assembly source debugging test"
comment "This particular testcase uses macros in <arch>.inc to achieve"
comment "machine independence."
 
.global main
gdbasm_declare main
gdbasm_enter
 
comment "Call a macro that consists of several lines of assembler code."
 
comment "mark: main start"
gdbasm_several_nops
 
comment "Call a subroutine in another file."
 
comment "mark: call foo2"
gdbasm_call foo2
 
comment "All done."
 
comment "mark: main exit"
gdbasm_exit0
gdbasm_end main
 
comment "mark: search"
comment "A routine for foo2 to call."
 
.global foo3
gdbasm_declare foo3
gdbasm_enter
comment "mark: foo3 start"
gdbasm_leave
gdbasm_end foo3
 
.global exit
gdbasm_declare exit
gdbasm_exit0
gdbasm_end exit
 
comment "A static function"
 
gdbasm_declare foostatic
gdbasm_enter
gdbasm_leave
gdbasm_end foostatic
 
comment "A global variable"
 
.global globalvar
gdbasm_datavar globalvar 11
 
comment "A static variable"
 
gdbasm_datavar staticvar 5
 
.include "note.inc"
asmsrc1.s Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ia64.inc =================================================================== --- ia64.inc (nonexistent) +++ ia64.inc (revision 513) @@ -0,0 +1,51 @@ + comment "subroutine prologue" + .macro gdbasm_enter + alloc r33=ar.pfs,0,2,0,0 + mov r32=b0 + nop.i 0 + .endm + + comment "subroutine epilogue" + .macro gdbasm_leave + nop.m 0 + mov ar.pfs=r33 + mov b0=r32 + nop.m 0 + nop.f 0 + br.ret.sptk.many b0 + .endm + + .macro gdbasm_call subr + nop.m 0 + nop.f 0 + br.call.sptk.many b0=\subr + .endm + + .macro gdbasm_several_nops + nop.m 0 + nop.i 0 + nop.i 0 + .endm + + comment "exit (0)" + .macro gdbasm_exit0 + break.m 0x0 + nop.m 0 + nop.i 0 + .endm + + comment "crt0 startup" + .macro gdbasm_startup + gdbasm_enter + mov r32=r0 + nop.i 0 + nop.i 0 + .endm + + comment "Declare a data variable" + .purgem gdbasm_datavar + .macro gdbasm_datavar name value + .data +\name: + .long \value + .endm Index: asmsrc2.s =================================================================== --- asmsrc2.s (nonexistent) +++ asmsrc2.s (revision 513) @@ -0,0 +1,21 @@ + .include "common.inc" + .include "arch.inc" + + comment "Second file in assembly source debugging testcase." + + .global foo2 + gdbasm_declare foo2 + comment "mark: foo2 start" + gdbasm_enter + + comment "Call someplace else (several times)." + + comment "mark: call foo3" + gdbasm_call foo3 + gdbasm_call foo3 + + comment "All done, return." + + comment "mark: foo2 leave" + gdbasm_leave + gdbasm_end foo2
asmsrc2.s Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: m32c.inc =================================================================== --- m32c.inc (nonexistent) +++ m32c.inc (revision 513) @@ -0,0 +1,33 @@ + comment "subroutine prologue" + .macro gdbasm_enter + enter #0 + .endm + + comment "subroutine epilogue" + .macro gdbasm_leave + exitd + .endm + + .macro gdbasm_call subr + jsr.a \subr + .endm + + .macro gdbasm_several_nops + nop + nop + nop + nop + .endm + + comment "exit (0)" + .macro gdbasm_exit0 + mov.w #0, r1 + mov.b #1, r0l + ste.b r0l,0xe0000 + .endm + + comment "crt0 startup" + .macro gdbasm_startup + ldc #0xfc00, sp + .endm +

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.