Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch V2, testsuite] gdb.base/savedregs.exp: SIGSEGV -> SIGALRM
Date: Mon, 20 Jun 2011 15:07:00 -0000	[thread overview]
Message-ID: <4DFF6239.9090203@codesourcery.com> (raw)
In-Reply-To: <201106201110.p5KBAvb1025773@glazunov.sibelius.xs4all.nl>

On 06/20/2011 07:10 PM, Mark Kettenis wrote:
> My concern with using SIGILL (apart from generating an instruction
> that forces SIGALL on all architectures we support) is that you're
> going to end up testing a different unwinder as well.  Typically in
> the SIGSEGV case you'll end up at the faulting instruction, which is
> defenitely in the function body, where we should be using the DWARF
> CFI unwinder.  But for SIGILL you could end up at the instruction
> after the trapping instruction, which is likely to be in the function
> epilogue which may be handled by an epilogue unwinder.

Oh, I don't know PC could be the next instruction of that illegal
instruction.  At least, some years ago, when I was working on PowerPC,
PC still points to the illegal instruction when SIGILL is triggered.

> 
>> > Maybe, another option is to define invalid instruction for each targets
>> > in test case.
> Perhaps a reasonable compromise is to do something like:
> 
> static void
> thrower (void)
> {
>   *(char *)0 = 0;
> #ifdef __arm__
>   asm(".word 0xffff");
> #endif
> }
> 
> and then handle both SIGSEGV and SIGILL.

Yes, that looks good to me in general.  It can be like this,

#ifdef __UCLIBC__
#if !(defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_HAS_MMU__))
#define HAS_NOMMU
#endif
#endif

static void
thrower (void)
{
#if defined(HAS_NOMMU)

#if defined(__arm__)
  asm(".word 0xffff");
#elif defined(__foo__)
  asm(".word 0xeeeee"); // invalid instruction for port foo.
#else
#error Please write an invalid instruction here for your target
#endif

#else
  *(char *)0 = 0;
#endif
}


I'll write a new patch later.

-- 
Yao (齐尧)


  reply	other threads:[~2011-06-20 15:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09  9:28 [patch, testsuite] gdb.base/savedregs.exp: SIGSEGV -> SIGILL Yao Qi
2011-06-09 10:08 ` Andreas Schwab
2011-06-09 10:53   ` Yao Qi
2011-06-09 11:19 ` Mark Kettenis
2011-06-09 11:41   ` Pedro Alves
2011-06-09 13:25     ` Yao Qi
2011-06-09 13:10   ` Yao Qi
2011-06-09 14:25     ` Pedro Alves
2011-06-20  4:13     ` [patch V2, testsuite] gdb.base/savedregs.exp: SIGSEGV -> SIGALRM Yao Qi
2011-06-20  7:03       ` Mark Kettenis
2011-06-20  8:26         ` Yao Qi
2011-06-20 11:12           ` Mark Kettenis
2011-06-20 15:07             ` Yao Qi [this message]
2011-06-20 15:14               ` Paul Koning

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=4DFF6239.9090203@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /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