NetBSD Problem Report #51636
From www@NetBSD.org Sat Nov 19 18:21:55 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 8FC6B7A2D7
for <gnats-bugs@gnats.NetBSD.org>; Sat, 19 Nov 2016 18:21:55 +0000 (UTC)
Message-Id: <20161119182154.4245F7A30E@mollari.NetBSD.org>
Date: Sat, 19 Nov 2016 18:21:54 +0000 (UTC)
From: n54@gmx.com
Reply-To: n54@gmx.com
To: gnats-bugs@NetBSD.org
Subject: It's not possible to run under gdb(1) programs using the pthread_dbg library
X-Send-Pr-Version: www-1.0
>Number: 51636
>Category: lib
>Synopsis: It's not possible to run under gdb(1) programs using the pthread_dbg library
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Nov 19 18:25:00 +0000 2016
>Closed-Date: Fri Oct 06 22:11:28 +0000 2017
>Last-Modified: Sun Mar 11 23:30:59 +0000 2018
>Originator: Kamil Rytarowski
>Release: NetBSD 7.99.42 amd64
>Organization:
TNF
>Environment:
NetBSD chieftec 7.99.42 NetBSD 7.99.42 (GENERIC) #0: Sat Nov 19 18:46:35 CET 2016 root@chieftec:/tmp/netbsd-tmp/sys/arch/amd64/compile/GENERIC amd64
>Description:
Currently the pthread_dbg library cannot be debugged with gdb(1). GDB is a user of this library to handle POSIX threads, it sets pthread__dbg to pid of the debugger and this value is adopted by application - so programs get impression that instance is already attached to an application.
As the result it's not possible to run under gdb(1) programs using the pthread_dbg library
>How-To-Repeat:
$ pwd
/usr/tests/lib/libpthread_dbg
$ atf-run t_dummy |atf-report
Tests root: /usr/tests/lib/libpthread_dbg
t_dummy (1/1): 3 test cases
dummy1: [0.002789s] Passed.
dummy2: [0.001216s] Passed.
dummy3: [0.001201s] Passed.
[0.005399s]
Summary for 1 test programs:
3 passed test cases.
0 failed test cases.
0 expected failed test cases.
0 skipped test cases.
$ ./t_dummy dummy3
t_dummy: WARNING: Running test cases without atf-run(1) is unsupported
t_dummy: WARNING: No isolation nor timeout control is being applied; you may get unexpected failures; see atf-test-case(4)
Calling td_open(3) for the first time - expecting success
Calling td_open(3) for the first time - expecting in-use
Calling td_close(3) for the first successful call
passed
$ gdb --args ./t_dummy dummy3
GNU gdb (GDB) 7.12
Copyright (C) 2016 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 "x86_64--netbsd".
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 ./t_dummy...Reading symbols from /usr/libdata/debug//usr/tests/lib/libpthread_dbg/t_dummy.debug...done.
done.
(gdb) r
Starting program: /usr/tests/lib/libpthread_dbg/t_dummy dummy3
t_dummy: WARNING: Running test cases without atf-run(1) is unsupported
t_dummy: WARNING: No isolation nor timeout control is being applied; you may get unexpected failures; see atf-test-case(4)
Calling td_open(3) for the first time - expecting success
failed: /usr/src/tests/lib/libpthread_dbg/t_dummy.c:113: td_open(&dummy_callbacks, NULL, &main_ta1) == TD_ERR_OK not met
[Inferior 1 (LWP 0) exited with code 01]
(gdb)
>Fix:
N/A
>Release-Note:
>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: lib/51636: It's not possible to run under gdb(1) programs using the pthread_dbg library
Date: Sat, 19 Nov 2016 20:13:05 +0100
On Sat, Nov 19, 2016 at 06:25:00PM +0000, n54@gmx.com wrote:
> As the result it's not possible to run under gdb(1) programs using the pthread_dbg library
Not sure this would be easy to fix (or worth any complication in the library
interface) - a "simple" hack around it if you just want to debug something:
- add a define to rename all entry points slightly (ideally both for lib
and users)
- recompile the lib with that macro defined and link it with a different
target name
- compile the app with the rename macro and against the renamed lib
Then you should be able to debug the result just fine.
Martin
From: Kamil Rytarowski <n54@gmx.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: lib/51636: It's not possible to run under gdb(1) programs using
the pthread_dbg library
Date: Sat, 19 Nov 2016 20:48:57 +0100
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--MHewpqP82WWQ1EKCHgdrg3dmCFBpmODM2
Content-Type: multipart/mixed; boundary="8U7dqD3U3NTNIuXArRXr3UJdIfO9BFp0l"
From: Kamil Rytarowski <n54@gmx.com>
To: gnats-bugs@NetBSD.org
Message-ID: <68817afe-de98-6add-fbbe-264f0a452a38@gmx.com>
Subject: Re: lib/51636: It's not possible to run under gdb(1) programs using
the pthread_dbg library
References: <pr-lib-51636@gnats.netbsd.org>
<20161119182154.4245F7A30E@mollari.NetBSD.org>
<20161119191501.606B67A310@mollari.NetBSD.org>
In-Reply-To: <20161119191501.606B67A310@mollari.NetBSD.org>
--8U7dqD3U3NTNIuXArRXr3UJdIfO9BFp0l
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
On 19.11.2016 20:15, Martin Husemann wrote:
> The following reply was made to PR lib/51636; it has been noted by GNAT=
S.
>=20
> From: Martin Husemann <martin@duskware.de>
> To: gnats-bugs@NetBSD.org
> Cc:=20
> Subject: Re: lib/51636: It's not possible to run under gdb(1) programs =
using the pthread_dbg library
> Date: Sat, 19 Nov 2016 20:13:05 +0100
>=20
> On Sat, Nov 19, 2016 at 06:25:00PM +0000, n54@gmx.com wrote:
> > As the result it's not possible to run under gdb(1) programs using t=
he pthread_dbg library
> =20
> Not sure this would be easy to fix (or worth any complication in the l=
ibrary
> interface) - a "simple" hack around it if you just want to debug somet=
hing:
> =20
> - add a define to rename all entry points slightly (ideally both for =
lib
> and users)
> - recompile the lib with that macro defined and link it with a differ=
ent
> target name
> - compile the app with the rename macro and against the renamed lib
> =20
> Then you should be able to debug the result just fine.
> =20
> Martin
> =20
>=20
I'm aware that there are plenty of ways to walk-around it, like to reset
pthread__dbg to zero before td_open() and hope it will be good enough. I
filed this PR to note the issue and as a result get resolved pedantically=
=2E
--8U7dqD3U3NTNIuXArRXr3UJdIfO9BFp0l--
--MHewpqP82WWQ1EKCHgdrg3dmCFBpmODM2
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJYMKy/AAoJEEuzCOmwLnZs9ScP/ApByR80mX51R4j7FbQRnw+X
ykpnU66kMnCSDnorwLymCWr31j2nj7pABmpEr/pzzjaaAWFwvV1awOGKGpYvw/h6
RXx9ivm9aYM4Sfv8EtvRN7Hm88FeQBlLfDGUXS1+a+9grcx7hIqEdPwChAE20+cL
EB3OU8JS59vsC/GZMKIHD24XXqG80BwLWQ5WJCn95QvsxCcCjdTBVbjEV1azuTkQ
A5ZI/3Bj7kOjHalSpvcQp+KtMGU9c3hjzvjzm+jz/fDDbIbzfsBJPjjPWCsqOe4m
jbKuw/FrPmk7RUZFujzQqy7t36H1/bDOUD8g5Yx2B4cf2wEJBnhHQt0QOseS0Brf
e/5WAofWsku+iSGU+ueFLaz/D0tEkdQsoPn2zWTbeI032VKCsmcr18QQatr6w5N1
nhhPoZXBdDRWbkj99EkAADFDKvHIKHaE2NkY9JYnlDxa5RPb2sFrJidssGo/I+Cn
oCFOZ7JfMEML6zwZEXjt/eqnhfnT5v5JHj/cZXxZRUKzXGxJWX9iqMiVXcdiwV5F
v3yRK+dSpgs6WYLXIFSSO50FcYkQRx4toa4xb6Ie2lYNlUAbNXTfoIcnXGs4ACZI
E+SOtFy+v7mD37XREmAd2XPLBo+U3D/ratyGHRUvj4vuv5KnPInNFZUn+e4o9LhE
wSRoYfwZxjlxTO2aIATu
=kwrL
-----END PGP SIGNATURE-----
--MHewpqP82WWQ1EKCHgdrg3dmCFBpmODM2--
State-Changed-From-To: open->dead
State-Changed-By: kamil@NetBSD.org
State-Changed-When: Sat, 07 Oct 2017 00:11:28 +0200
State-Changed-Why:
libpthread_dbg has been removed from base.
State-Changed-From-To: dead->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 11 Mar 2018 23:30:59 +0000
State-Changed-Why:
"dead" is for (some) invalid PRs.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.