This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tests patchv2] FYI unwinder: tests/ update


On Sun, 01 Dec 2013 18:50:33 +0100, Jan Kratochvil wrote:
> --- /dev/null
> +++ b/tests/backtrace-child.c
[...]
> +int
> +main (int argc UNUSED, char **argv)
> +{
> +  setbuf (stdout, NULL);
> +  assert (*argv++);
> +  ptraceme = (*argv && strcmp (*argv, "--ptraceme") == 0);
> +  argv += ptraceme;
> +  gencore = (*argv && strcmp (*argv, "--gencore") == 0);
> +  argv += gencore;
> +  assert (!*argv);
> +  /* These dummy* functions are there so that each of their surrounding
> +     functions has some unrelated code around.  The purpose of some of the
> +     tests is verify unwinding the very first / after the very last instruction
> +     does not inappropriately slip into the unrelated code around.  */
> +  dummy1 ();
> +  dummy2 ();
> +  dummy3 ();
> +  dummy4 ();
> +  if (gencore)
> +    printf ("%ld\n", (long) getpid ());
> +  errno = 0;
> +  pthread_t thread;
> +  int i = pthread_create (&thread, NULL, start, NULL);
> +  assert_perror (errno);

BTW I randomly got here on F-19 x86_64:

backtrace-child: backtrace-child.c:207: main: Unexpected error: Cannot allocate memory.

But I do not have it reproducible and I cannot figure out how that could
happen.


> +  assert (i == 0);
> +  if (ptraceme)
> +    {
> +      long l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
> +      assert_perror (errno);
> +      assert (l == 0);
> +    }
> +  if (gencore)
> +    pthread_join (thread, NULL);
> +  else
> +    raise (SIGUSR2);
> +  /* Not reached.  */
> +  abort ();
> +}


Jan

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]