From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11972 invoked by alias); 20 Jul 2011 02:10:30 -0000 Received: (qmail 11962 invoked by uid 22791); 20 Jul 2011 02:10:29 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 20 Jul 2011 02:10:15 +0000 Received: (qmail 1330 invoked from network); 20 Jul 2011 02:10:14 -0000 Received: from unknown (HELO ?192.168.0.100?) (yao@127.0.0.2) by mail.codesourcery.com with ESMTPA; 20 Jul 2011 02:10:14 -0000 Message-ID: <4E263904.8030204@codesourcery.com> Date: Wed, 20 Jul 2011 02:12:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [RFA 7/8] New port: TI C6x: test case fixes Content-Type: multipart/mixed; boundary="------------090805020707090901010105" 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: 2011-07/txt/msg00509.txt.bz2 This is a multi-part message in MIME format. --------------090805020707090901010105 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-length: 655 Two changes in this patch are related to c6x, while the other two are not related to c6x very much, which are about uclinx on NON-MMU machine. Both gdb.base/savedregs.exp and gdb.mi/mi-syn-frame.exp expects to get an exception when access memory of address 0x0. It doesn't work on NON-MMU machine. Actually, this has been discussed in this thread, http://sourceware.org/ml/gdb-patches/2011-06/msg00124.html [patch, testsuite] gdb.base/savedregs.exp: SIGSEGV -> SIGILL The final conclusion is that we use SIGILL for NON-MMU machine, and continue to use SIGSEGV for MMU machine. Changes in this patch is implemented in this way. -- Yao (齐尧) --------------090805020707090901010105 Content-Type: text/x-patch; name="0007-test-case.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0007-test-case.patch" Content-length: 4308 gdb/testsuite/ * gdb.base/maint.exp: set data_section to ".neardata". * gdb.base/savedregs.c (thrower): Trigger SIGILL on NO-MMU machine. * gdb.base/savedregs.exp: Handle SIGILL. (process_saved_regs): Don't check saved register on tic6x-*-* * gdb.mi/mi-syn-frame.c (bar): Trigger SIGILL on NO-MMU machine. --- gdb/testsuite/gdb.base/maint.exp | 4 ++++ gdb/testsuite/gdb.base/savedregs.c | 22 ++++++++++++++++++++++ gdb/testsuite/gdb.base/savedregs.exp | 9 +++++++++ gdb/testsuite/gdb.mi/mi-syn-frame.c | 21 ++++++++++++++++++++- 4 files changed, 55 insertions(+), 1 deletions(-) diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index 61ad439..9ef84af 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -394,6 +394,10 @@ gdb_test_multiple "maint info sections" "maint info sections" { set data_section ER_RW pass "maint info sections" } + -re "Exec file:\r\n.*break($EXEEXT)?., file type.*neardata.*$gdb_prompt $" { + # c6x doesn't have .data section. It has .neardata and .fardata section. + set data_section ".neardata" + } -re "Exec file:\r\n.*break($EXEEXT)?., file type.*$gdb_prompt $" { pass "maint info sections" } diff --git a/gdb/testsuite/gdb.base/savedregs.c b/gdb/testsuite/gdb.base/savedregs.c index 9f302a0..582afc4 100644 --- a/gdb/testsuite/gdb.base/savedregs.c +++ b/gdb/testsuite/gdb.base/savedregs.c @@ -22,6 +22,12 @@ #include #include +#ifdef __UCLIBC__ +#if !(defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_HAS_MMU__)) +#define HAS_NOMMU +#endif +#endif + static volatile int done; extern int @@ -45,11 +51,27 @@ catcher (int sig) static void thrower (void) { +#if defined(HAS_NOMMU) +#if defined(__arm__) + asm(".word 0xf8f00000"); +#elif defined(__TMS320C6X__) + /* 0x56454314 is also an invalid insn but it causes SIGTRAP in kernel. */ + asm(".word 0x56454313"); +#else +#error Please write an invalid instruction here for your target +#endif +#else /* defined(HAS_NOMMU) */ *(char *)0 = 0; +#endif /* defined(HAS_NOMMU) */ } main () { +#if defined(HAS_NOMMU) + signal (SIGILL, catcher); +#else signal (SIGSEGV, catcher); +#endif + thrower (); } diff --git a/gdb/testsuite/gdb.base/savedregs.exp b/gdb/testsuite/gdb.base/savedregs.exp index eeee0ff..4408137 100644 --- a/gdb/testsuite/gdb.base/savedregs.exp +++ b/gdb/testsuite/gdb.base/savedregs.exp @@ -84,6 +84,14 @@ proc process_saved_regs { current inner outer } { # Sigtramp frames don't yet print . set pat "Stack frame at .* Saved registers:.*" } + thrower { + if { [istarget tic6x-*-*] } { + # On tic6x, there is no register saved in function thrower. + set pat "Stack frame at .* in $func .*" + } else { + set pat "Stack frame at .* in $func .* Saved registers:.*" + } + } default { set pat "Stack frame at .* in $func .* Saved registers:.*" } @@ -143,6 +151,7 @@ process_saved_regs thrower { main } { } # Continue to the signal catcher, check main's saved-reg info, capture # catcher's saved-reg info. gdb_test "handle SIGSEGV pass print nostop" +gdb_test "handle SIGILL pass print nostop" gdb_test "advance catcher" "catcher .* at .*" process_saved_regs catcher { sigtramp thrower } { main } diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.c b/gdb/testsuite/gdb.mi/mi-syn-frame.c index ddfc08e..cffc5e0 100644 --- a/gdb/testsuite/gdb.mi/mi-syn-frame.c +++ b/gdb/testsuite/gdb.mi/mi-syn-frame.c @@ -2,6 +2,12 @@ #include #include +#ifdef __UCLIBC__ +#if !(defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_HAS_MMU__)) +#define HAS_NOMMU +#endif +#endif + void foo (void); void bar (void); @@ -25,9 +31,22 @@ foo (void) void bar (void) { - char *nuller = 0; +#if defined(HAS_NOMMU) + +#if defined(__arm__) + asm(".word 0xf8f00000"); +#elif defined(__TMS320C6X__) + /* 0x56454314 is also an invalid insn but it causes SIGTRAP in kernel. */ + asm(".word 0x56454313"); +#else +#error Please write an invalid instruction here for your target +#endif +#else /* defined(HAS_NOMMU) */ + char *nuller = 0; *nuller = 'a'; /* try to cause a segfault */ +#endif + } void -- 1.7.0.4 --------------090805020707090901010105--