Bug 1262589 - gstack in DTS defaults to "/usr/bin/gdb"
gstack in DTS defaults to "/usr/bin/gdb"
Product: Red Hat Developer Toolset
Classification: Red Hat
Component: gdb (Show other bugs)
DTS 3.0 RHEL 6
All Linux
unspecified Severity low
: alpha
: 4.0
Assigned To: Jan Kratochvil
Miroslav Franc
Depends On:
  Show dependency treegraph
Reported: 2015-09-12 23:17 EDT by Frank Hirtz
Modified: 2016-01-31 21:29 EST (History)
6 users (show)

See Also:
Fixed In Version: devtoolset-4-gdb-7.10-17.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-11-16 10:11:17 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Frank Hirtz 2015-09-12 23:17:19 EDT
Description of problem:

"gstack" is a generic script that's packaged in all of our gdb releases, but since we don't set the environmental variable for GDB, we'll always just default to "/usr/bin/gdb" regardless of whether you're using DTS or not. We should probably correct that.

Version-Release number of selected component (if applicable):

Additional info:

There are 2 ways to address this that I see. Either we set the GDB environmental variable by default as part of the scl enable script, or we modify the "gstack" script to be a bit smarter about it's default. Something like:

+GDB=${GDB:-`which gdb`}

So, we'd just use whichever gdb was in our path first unless the dev sets their $GDB variable to point somewhere else. Either would work, though the second seems a bit more robust.
Comment 1 Jan Kratochvil 2015-09-13 01:35:15 EDT
I find it is just enough to put there:
Comment 2 Jan Kratochvil 2015-09-13 02:00:34 EDT
/usr/bin/gdb-add-index is using:

/usr/bin/gcore has a large block starting with:
# Attempt to fetch the absolute path to the gcore script that was
# called.
binary_path=`dirname "$0"`

That probably tries to mimick so-called 'relocatable' file access by GDB which is turned off in Fedora/RHEL releases:
perl -i.relocatable -pe 's/^(D\[".*_RELOCATABLE"\]=" )1(")$/${1}0$2/' gdb/config.status
! grep '_RELOCATABLE.*1' gdb/config.h
Comment 3 Jan Kratochvil 2015-09-13 14:40:24 EDT
I have put the
fix into Rawhide:
Comment 4 Jan Kratochvil 2015-09-14 09:32:59 EDT
The same bug affects also gcore:

+ . /opt/rh/devtoolset-4/root/usr/bin/gcore 30632
++ '[' 1 -eq 0 ']'
++ name=core
++ '[' 30632 = -o ']'
+++ dirname bash
++ binary_path=.
++ test x. = x.
+++ basename bash
++ binary_basename=bash
++ test -f bash
+++ alias
+++ /usr/bin/which --tty-only --read-alias --show-dot --show-tilde bash
++ binary_path_from_env=/usr/bin/bash
+++ dirname /usr/bin/bash
++ binary_path=/usr/bin
++ '[' '!' -f /usr/bin/gdb ']'
++ rc=0
++ for pid in '$*'
++ /usr/bin/gdb --nx --batch -ex 'set pagination off' -ex 'set height 0' -ex 'set width 0' -ex 'attach 30632' -ex 'gcore core.30632' -ex detach -ex quit
Comment 5 Jan Kratochvil 2015-09-14 11:03:32 EDT
Comment 4 was a wrong test, gcore is OK:

+ '[' 1 -eq 0 ']'
+ name=core
+ '[' 31011 = -o ']'
++ dirname /opt/rh/devtoolset-4/root/usr/bin/gcore
+ binary_path=/opt/rh/devtoolset-4/root/usr/bin
+ test x/opt/rh/devtoolset-4/root/usr/bin = x.
+ '[' '!' -f /opt/rh/devtoolset-4/root/usr/bin/gdb ']'
+ rc=0
+ for pid in '$*'
+ /opt/rh/devtoolset-4/root/usr/bin/gdb --nx --batch -ex 'set pagination off' -ex 'set height 0' -ex 'set width 0' -ex 'attach 31011' -ex 'gcore core.31011' -ex detach -ex quit
Comment 9 errata-xmlrpc 2015-11-16 10:11:17 EST
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.


Note You need to log in before you can comment on or make changes to this bug.