Bug 203661 - devel/gdb: Regression in gdb-7.10: system(3) conflicts with -pthread compile option
Summary: devel/gdb: Regression in gdb-7.10: system(3) conflicts with -pthread compile ...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Tijl Coosemans
URL:
Keywords: easy, patch, patch-ready, regression
: 203770 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-10-09 17:57 UTC by Yuri Victorovich
Modified: 2015-11-05 18:54 UTC (History)
3 users (show)

See Also:
koobs: maintainer-feedback+
luca.pizzamiglio: maintainer-feedback+


Attachments
test case (126 bytes, text/x-csrc)
2015-10-09 17:57 UTC, Yuri Victorovich
no flags Details
test case (113 bytes, text/plain)
2015-10-09 17:59 UTC, Yuri Victorovich
no flags Details
Fixing patch (646 bytes, patch)
2015-10-16 15:57 UTC, luca.pizzamiglio
luca.pizzamiglio: maintainer-approval+
Details | Diff
Fixing that bug and a potential build issue (1.55 KB, patch)
2015-11-05 10:47 UTC, luca.pizzamiglio
luca.pizzamiglio: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2015-10-09 17:57:29 UTC
Created attachment 161857 [details]
test case

I am attaching the test case. To reproduce the problem, please do this:

Compile:
> cc -pthread -o test-system test-system.c

Run:
> gdb ./test-system
> (gdb) r
> Starting program: ./test-system 
> [New process 62745]
> [New Thread 801406400 (LWP 100922)]
> 0x0000000800b00a2d in vfork () from /lib/libc.so.7
> fbsd_thread_resume: no thread to satisfy query
> (gdb)

The error messages are the problem. This only happens with gdb-7.10 and not with gdb-7.9.1. Problem disappears without -pthread option.

FreeBSD xxx.xxx.com 10.2-STABLE FreeBSD 10.2-STABLE #0 r288058M: Mon Sep 21 03:10:37 PDT 2015     xxx@xxx.com:/usr/obj/usr/src/sys/GENERIC  amd64
Comment 1 Yuri Victorovich freebsd_committer freebsd_triage 2015-10-09 17:59:13 UTC
Created attachment 161858 [details]
test case
Comment 2 luca.pizzamiglio 2015-10-16 15:57:23 UTC
Created attachment 162124 [details]
Fixing patch

This patch should solve the problem.
Please run some test with it applied, if you can.
Comment 3 Yuri Victorovich freebsd_committer freebsd_triage 2015-10-17 18:48:11 UTC
The test case now passes.

Thank you for fixing it, Luca!
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-10-18 17:31:28 UTC
A commit references this bug:

Author: tijl
Date: Sun Oct 18 17:31:17 UTC 2015
New revision: 399623
URL: https://svnweb.freebsd.org/changeset/ports/399623

Log:
  Fix a regression when debugging a threaded process that forks.

  PR:		203661
  Submitted by:	luca.pizzamiglio@gmail.com (maintainer)

Changes:
  head/devel/gdb/Makefile
  head/devel/gdb/files/fbsd-threads.c
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2015-10-19 09:51:14 UTC
*** Bug 203770 has been marked as a duplicate of this bug. ***
Comment 6 Yuri Victorovich freebsd_committer freebsd_triage 2015-10-27 00:41:22 UTC
For whatever reason I see the same problem again with the current gdb.

I am not sure how is this possible that this test passed when you asked me to test it on 2015-10-16. But now I have exactly the same symptom again.
Comment 7 luca.pizzamiglio 2015-10-29 16:59:35 UTC
Hi Yuri,

unfortunately, I'm not able to reproduce the error anymore...
please, re-check that your devel/gdb/file/fbsd-thread.c has the patch attached in this bug report.

Could you also provide the output of make showconfig?
Comment 8 Yuri Victorovich freebsd_committer freebsd_triage 2015-10-29 19:55:57 UTC
HI Luca,

I verified that all patches are in sync with subversion repository, rebuilt gdb, and still see this problem.

OS version: 10.2-STABLE #0 r290123: Wed Oct 28 17:59:42 PDT 2015 amd64
Comment 9 thebri 2015-11-02 21:47:37 UTC
Possibly not the same bug, but the same error message.

Linking with pthreads and openmp.  Using popen(), gdb emits this error during the call to popen().  If I then 'q'uit gdb, the program is detached and runs to completion.  I am unable to 'c'ontinue execution in the debugger.

I'm up to date with the patches, 10.1-RELEASE, compiled with g++48.

/usr/ports/devel/gdb# make showconfig
===> The following configuration options are available for gdb-7.10_3:
     DEBUG=off: Build with debugging support
     EXPAT=off: XML parser support via Expat
     GDB_LINK=on: Create /usr/local/bin/gdb symlink
     GUILE=off: Guile extension language support
     KGDB=on: Kernel Debugging Support
     PYTHON=off: Python bindings or support
     THREADS=on: Threading support
     TUI=on: Text User Interface enabled
====> Command line editing via libreadline: you have to select exactly one of them
     BASE_READLINE=off: from base system (experimental)
     BUNDLED_READLINE=off: from gdb distfile
     PORT_READLINE=on: from devel/readline port
Comment 10 luca.pizzamiglio 2015-11-05 10:47:53 UTC
Created attachment 162807 [details]
Fixing that bug and a potential build issue

I've build a test case with popen() and then I was able to reproduce the error.
This patch should fix the problem.
Moreover, this patch fix a potential parallel build issue.
Comment 11 commit-hook freebsd_committer freebsd_triage 2015-11-05 18:49:14 UTC
A commit references this bug:

Author: tijl
Date: Thu Nov  5 18:48:47 UTC 2015
New revision: 400860
URL: https://svnweb.freebsd.org/changeset/ports/400860

Log:
  - Fix a potential parallel build issue
  - Fix a regression when debugging a threaded process that forks
    (like r399623, but for vfork(2))

  PR:		203661
  Submitted by:	luca.pizzamiglio@gmail.com (maintainer)

Changes:
  head/devel/gdb/Makefile
  head/devel/gdb/files/extrapatch-kgdb
  head/devel/gdb/files/fbsd-threads.c