Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: yao@codesourcery.com
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA 7/8] New port: TI C6x:  test case fixes
Date: Tue, 09 Aug 2011 15:17:00 -0000	[thread overview]
Message-ID: <201108091515.p79FFoUs007220@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <4E414C49.9020507@codesourcery.com> (message from Yao Qi on Tue,	09 Aug 2011 23:03:37 +0800)

> Date: Tue, 09 Aug 2011 23:03:37 +0800
> From: Yao Qi <yao@codesourcery.com>

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 <signal.h>
>  #include <sys/time.h>
>  
> +#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.


  reply	other threads:[~2011-08-09 15:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20  2:12 Yao Qi
2011-07-25 11:37 ` Yao Qi
2011-08-09 14:22   ` Pedro Alves
2011-08-09 15:03     ` Yao Qi
2011-08-09 15:17       ` Mark Kettenis [this message]
2011-08-09 15:25         ` Yao Qi
2011-08-10 12:28           ` Mark Kettenis
2011-08-10 14:05             ` Yao Qi
2011-08-14 16:24               ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201108091515.p79FFoUs007220@glazunov.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox