From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20737 invoked by alias); 23 Nov 2010 18:44:00 -0000 Received: (qmail 20722 invoked by uid 22791); 23 Nov 2010 18:43:57 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e24smtp01.br.ibm.com (HELO e24smtp01.br.ibm.com) (32.104.18.85) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 23 Nov 2010 18:43:42 +0000 Received: from mailhub3.br.ibm.com (mailhub3.br.ibm.com [9.18.232.110]) by e24smtp01.br.ibm.com (8.14.4/8.13.1) with ESMTP id oANJ39SX011472 for ; Tue, 23 Nov 2010 17:03:09 -0200 Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.8.31.93]) by mailhub3.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oANIoX6v1335330 for ; Tue, 23 Nov 2010 16:50:33 -0200 Received: from d24av02.br.ibm.com (loopback [127.0.0.1]) by d24av02.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oANIhKZr002301 for ; Tue, 23 Nov 2010 16:43:20 -0200 Received: from evol.ibm.com ([9.18.197.83]) by d24av02.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id oANIhGqg002234; Tue, 23 Nov 2010 16:43:17 -0200 From: Edjunior Barbosa Machado To: gdb-patches@sourceware.org Cc: brobecker@adacore.com Subject: Re: [PATCH] testsuite: asm-source.exp: add powerpc64 support Date: Tue, 23 Nov 2010 18:44:00 -0000 Message-Id: <1290537758-28943-1-git-send-email-emachado@linux.vnet.ibm.com> In-Reply-To: <20101120053408.GQ2634@adacore.com> References: <20101120053408.GQ2634@adacore.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-11/txt/msg00364.txt.bz2 Thanks Joel for the feedback. I'm sending the first part of the patch related to the powerpc64 support on the asm-source.exp testcase. Thanks, -- Edjunior gdb/testsuite/ 2010-11-23 Edjunior Machado * 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. * powerpc64.inc: New file --- gdb/testsuite/gdb.asm/asm-source.exp | 44 ++++++++++++++++++++++--- gdb/testsuite/gdb.asm/powerpc64.inc | 57 ++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 gdb/testsuite/gdb.asm/powerpc64.inc diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index ca342bd..9053711 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -101,7 +101,15 @@ switch -glob -- [istarget] { 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 @@ -362,8 +370,19 @@ gdb_test "info source" \ "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" \ @@ -400,15 +419,28 @@ gdb_test_multiple "info sources" "info sources" { # Try 'info line' gdb_test "info line" \ - "Line $line_call_foo3_again of.*asmsrc2.s.*starts at.* and ends at.*." \ + "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 } { diff --git a/gdb/testsuite/gdb.asm/powerpc64.inc b/gdb/testsuite/gdb.asm/powerpc64.inc new file mode 100644 index 0000000..7265c07 --- /dev/null +++ b/gdb/testsuite/gdb.asm/powerpc64.inc @@ -0,0 +1,57 @@ + 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 -- 1.7.1