+2010-11-24 Edjunior Machado <emachado@br.ibm.com>
+
+ * gdb.asm/asm-source.exp: Add new target "powerpc64"; expect leading `.'
+ on ppc64's symbols; "finish" and "return" commands must accept to
+ show the caller line again as well as the line after.
+ * gdb.asm/powerpc64.inc: New file.
+
2010-11-23 Doug Evans <dje@google.com>
* lib/gdb.exp (gdb_test_sequence): New function.
2010-11-23 Phil Muldoon <pmuldoon@redhat.com>
- PR python/12212
+ PR python/12212
* gdb.python/python.exp: Check that selected_thread raises an
error when no inferior is loaded.
set asm-arch mips
}
"powerpc*-*" {
- set asm-arch powerpc
+ if { [is_lp64_target] } {
+ set asm-arch powerpc64
+ set asm-flags "-a64 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ append link-flags " -m elf64ppc"
+ } else {
+ set asm-arch powerpc
+ set asm-flags "-a32 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ append link-flags " -m elf32ppc"
+ }
}
"sh*-*-*" {
set asm-arch sh
"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"
+# Some architectures will have one or more instructions after the
+# call instruction which still is part of the call sequence, so we
+# must be prepared for a "finish" to show us the caller line
+# again as well as the statement after.
+gdb_test_multiple "finish" "finish from foo3" {
+ -re "Run till exit from.*\[\r\n\]$line_call_foo3\[ \t\]+gdbasm_call foo3.*$gdb_prompt $" {
+ pass "finish from foo3"
+ gdb_test "s" ".*" "s after finish"
+ }
+ -re "Run till exit from.*\[\r\n\]$line_call_foo3_again\[ \t\]+gdbasm_call foo3.*$gdb_prompt $" {
+ pass "finish from foo3"
+ }
+}
# Try 'info source' from asmsrc2.s
gdb_test "info source" \
# Try 'info line'
gdb_test "info line" \
- "Line $line_call_foo3_again of.*asmsrc2.s.*starts at.*<foo2+.*> and ends at.*<foo2+.*>." \
+ "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"
+# Like "finish", "return" command also can return to the caller
+# line again or the statement after, depending on the architecture.
+gdb_test_multiple "return" "return from foo2" {
+ -re "Make (foo2|selected stack frame) return now\?.*" {
+ send_gdb "y\n"
+ exp_continue
+ }
+ -re "\#0.*main .*$line_call_foo2\[ \t\]+gdbasm_call foo2.*$gdb_prompt $" {
+ pass "return from foo2"
+ gdb_test "s" ".*" "s after return"
+ }
+ -re "\#0.*main .*$line_main_exit\[ \t\]+gdbasm_exit0.*$gdb_prompt $" {
+ pass "return from foo2"
+ }
+}
# Disassemble something, check the output
proc test_dis { command var } {
--- /dev/null
+ comment "subroutine declare"
+ .purgem gdbasm_declare
+ .macro gdbasm_declare name
+ .section ".opd","aw"
+\name:
+ .quad .\name, .TOC.@tocbase, 0
+ .section ".text"
+ .type \name, @function
+.\name:
+ .endm
+
+ comment "subroutine prologue"
+ .macro gdbasm_enter
+ stdu 1, -112(1)
+ mflr 0
+ std 0, 128(1)
+ .endm
+
+ comment "subroutine epilogue"
+ .macro gdbasm_leave
+ ld 0, 128(1)
+ mtlr 0
+ ld 1, 0(1)
+ blr
+ .endm
+
+ .macro gdbasm_call subr
+ bl \subr
+ nop
+ .endm
+
+ .macro gdbasm_several_nops
+ nop
+ nop
+ nop
+ nop
+ .endm
+
+ comment "exit (0)"
+ .macro gdbasm_exit0
+ comment "sys_exit"
+ li 0, 1
+ sc
+ .endm
+
+ comment "crt0 startup"
+ .macro gdbasm_startup
+ .p2align 2
+ .endm
+
+ comment "Declare a data variable"
+ .purgem gdbasm_datavar
+ .macro gdbasm_datavar name value
+ .section ".data"
+\name:
+ .long \value
+ .endm