From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20470 invoked by alias); 9 Aug 2011 15:17:28 -0000 Received: (qmail 20462 invoked by uid 22791); 9 Aug 2011 15:17:28 -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 sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 09 Aug 2011 15:17:14 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id p79FFpFP015780; Tue, 9 Aug 2011 17:15:51 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id p79FFoUs007220; Tue, 9 Aug 2011 17:15:50 +0200 (CEST) Date: Tue, 09 Aug 2011 15:17:00 -0000 Message-Id: <201108091515.p79FFoUs007220@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: yao@codesourcery.com CC: gdb-patches@sourceware.org In-reply-to: <4E414C49.9020507@codesourcery.com> (message from Yao Qi on Tue, 09 Aug 2011 23:03:37 +0800) Subject: Re: [RFA 7/8] New port: TI C6x: test case fixes References: <4E263904.8030204@codesourcery.com> <4E2D1AC1.9070102@codesourcery.com> <201108091522.12881.pedro@codesourcery.com> <4E414C49.9020507@codesourcery.com> 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-08/txt/msg00184.txt.bz2 > Date: Tue, 09 Aug 2011 23:03:37 +0800 > From: Yao Qi I really think your approach is rather fragile... > 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 (); > } Why depend on this NOMMU-magic? Just install the signal handler for bth SIGSEGV and SIGILL, try a store to (or perhaps a read from) address 0, and then fall through to executing an illegal instruction.