Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Oct 2015 14:44:20 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 203770] devel/gdb: Error "fbsd_thread_resume: no thread to satisfy query" when debugging pthread program with fork
Message-ID:  <bug-203770-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203770

            Bug ID: 203770
           Summary: devel/gdb: Error "fbsd_thread_resume: no thread to
                    satisfy query" when debugging pthread program with
                    fork
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: freebsd-ports-bugs@FreeBSD.org
          Reporter: nkoch@demig.de
                CC: luca.pizzamiglio@gmail.com
             Flags: maintainer-feedback?(luca.pizzamiglio@gmail.com)
                CC: luca.pizzamiglio@gmail.com

**** I wrote this simple test program:

#include <time.h>
#include <sys/types.h>
#include <unistd.h>
#include <pthread.h>
#include <pthread_np.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

static void *routine (void *arg)
{
  pid_t pid;
  int status;
  printf ("thread started\n");
  pid = fork ();
  if (pid == 0)
  {
    printf ("child started\n");
    sleep (1);
    printf ("child finished\n");
    _exit (0);
  }
  else
  {
    printf ("parent waiting\n");
    wait (&status);
    printf ("child exited\n");
  };
  return NULL;
}

int main ()
{
  pthread_attr_t attr;
  pthread_t thread;

  pthread_attr_init (&attr);
  pthread_create (&thread, &attr, routine, NULL);
  printf ("thread created\n");
  pthread_join (thread, NULL);

  return 0;
}

**** I compiled with cc -g
**** Here is the output from a debugging session with /usr/bin/gdb:

(gdb) GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
(gdb) r
Starting program: /usr/home/nk/test/a.out
[New LWP 101624]
thread created
thread started
parent waiting
child exited
[New Thread 28404300 (LWP 101624/a.out)]
[New Thread 28404900 (LWP 126633/a.out)]
[Thread 28404900 (LWP 126633/a.out) exited]

Program exited normally.
(gdb) q

**** It works as expected.
**** Here is the output from a debugging session with /usr/local/bin/gdb710:

GNU gdb (GDB) 7.10 [GDB v7.10 for FreeBSD]
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-portbld-freebsd9.1".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.out...done.
(gdb) r
Starting program: /usr/home/nk/test/a.out
[New Thread 28404300 (LWP 106355)]
[New Thread 28404900 (LWP 123560)]
[New process 69475]
0x280f261b in fork () from /lib/libc.so.7
fbsd_thread_resume: no thread to satisfy query
(gdb) c
Continuing.
0x280f261b in fork () from /lib/libc.so.7
fbsd_thread_resume: no thread to satisfy query
(gdb) q
A debugging session is active.

    Inferior 1 [process 69475] will be killed.

Quit anyway? (y or n) y
thread created
thread started
parent waiting
child exited

********

I am seeing this behaviour under 9.1 with gdb from ports
and under 10.2 with gdb installed via pkg.
Same behaviour with gcc/clang.

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-203770-13>