Bug 1324606

Summary: DTS-4.0 regression: gdb remote.c due to "setfs" with RHEL gdbserver
Product: Red Hat Developer Toolset Reporter: Jan Kratochvil <jan.kratochvil>
Component: gdbAssignee: Jan Kratochvil <jan.kratochvil>
Status: CLOSED ERRATA QA Contact: Sergey Kolosov <skolosov>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: DTS 4.1 RHEL 7CC: jan.kratochvil, mcermak, ohudlick, palves, skolosov
Target Milestone: beta1Keywords: Regression
Target Release: 6.0   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: devtoolset-6-gdb-7.11.1-77.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1321114 Environment:
Last Closed: 2016-11-15 10:11:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1321114    
Bug Blocks:    

Description Jan Kratochvil 2016-04-06 18:47:26 UTC
+++ This bug was initially created as a clone of Bug #1321114 +++

Description of problem:
gdb>=7.10 (>=DTS-4.0) can no longer access shared libraries via sysroot "remote:" with gdbserver<=7.9.  RHEL-7 has gdbserver-7.6.1.
Installing DTS-4.0+ gdbserver workarounds that.

Version-Release number of selected component (if applicable):
devtoolset-4-gdb-7.11-57.el7

How reproducible:
Always.

Steps to Reproduce:
host1$ gdbserver-7.9 :1234 /root/inferior
                 ^^^
host2$ gdb-7.10 -ex 'set sysroot remote:' -ex 'file /root/inferior-copy-from-host1' -ex 'target remote host1:1234' 

Actual results:
warning: "remote:" is deprecated, use "target:" instead.
warning: sysroot set to "target:".
Reading symbols from /root/inferior-copy-from-host1...done.
Remote debugging using host1:1234
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
warning: Unable to find dynamic linker breakpoint function.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
0x00007ffff7ddc430 in ?? ()
(gdb) b main
Breakpoint 1 at 0x40071a: file threadit.c, line 18.
(gdb) c
Continuing.
Reading /lib64/libpthread.so.0 from remote target...
Error while mapping shared library sections:
Could not open `target:/lib64/libpthread.so.0' as an executable file: Invalid argument
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Reading /lib64/libc.so.6 from remote target...
Error while mapping shared library sections:
Could not open `target:/lib64/libc.so.6' as an executable file: Invalid argument
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Error while mapping shared library sections:
Could not open `target:/lib64/ld-linux-x86-64.so.2' as an executable file: Invalid argument
Breakpoint 1, main () at threadit.c:18
18	  var++;
(gdb) info sharedlibrary 
From                To                  Syms Read   Shared Object Library
                                        No          /lib64/libpthread.so.0
                                        No          /lib64/libc.so.6
                                        No          /lib64/ld-linux-x86-64.so.2

Expected results:
host1$ gdbserver-7.9 :1234 /root/inferior
host2$ gdb-7.9 -ex 'set sysroot remote:' -ex 'file /root/inferior-copy-from-host1' -ex 'target remote host1:1234' 
Reading symbols from /root/inferior-copy-from-host1...done.
Remote debugging using host1:1234
Reading symbols from remote:/lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
0x00007ffff7ddc430 in _start () from remote:/lib64/ld-linux-x86-64.so.2
(gdb) b main
Breakpoint 1 at 0x40071a: file threadit.c, line 18.
(gdb) c
Continuing.
Breakpoint 1, main () at threadit.c:18
18	  var++;
(gdb) info sharedlibrary 
From                To                  Syms Read   Shared Object Library
0x00007ffff7ddbae0  0x00007ffff7df627a  Yes (*)     remote:/lib64/ld-linux-x86-64.so.2
0x00007ffff7bc48a0  0x00007ffff7bcf514  Yes (*)     remote:/lib64/libpthread.so.0
0x00007ffff781d3e0  0x00007ffff7960c10  Yes (*)     remote:/lib64/libc.so.6
(*): Shared library is missing debugging information.

Additional info:
Bug 1321114 did not really fix the compatibility.
It only added messages suggesting users to upgrade their gdbserver.

Comment 2 Jan Kratochvil 2016-04-28 20:50:23 UTC
[commit+7.11] [patchv5] Workaround gdbserver<7.7 for setfs
https://sourceware.org/ml/gdb-patches/2016-04/msg00607.html

Comment 3 Jan Kratochvil 2016-08-12 20:30:07 UTC
RHEL-6 gdb-gdbserver-7.2-92.el6.x86_64 did not have the "setfs" bug so there is it worked even without this fix.

Separate debuginfo (*-debuginfo.rpm) is not supported from the target, it would have to be installed on the host; but this is unrelated to this bug/test.

Comment 10 errata-xmlrpc 2016-11-15 10:11:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2737.html