Bug 981356 - golang "safe path" needs to be added to gdb
Summary: golang "safe path" needs to be added to gdb
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: golang
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Adam Goode
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1002415 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-04 14:24 UTC by Richard W.M. Jones
Modified: 2014-08-08 17:44 UTC (History)
5 users (show)

Fixed In Version: golang-1.2.2-9.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-26 15:59:25 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2013-07-04 14:24:06 UTC
Description of problem:

When you run gdb on a compiled golang program, gdb is unable to
load the Go extension.  It prints:

warning: File "/usr/share/golang/src/pkg/runtime/runtime-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py".
To enable execution of this file add
	add-auto-load-safe-path /usr/share/golang/src/pkg/runtime/runtime-gdb.py
line to your configuration file "/home/rjones/.gdbinit".
To completely disable this security protection add
	set auto-load safe-path /
line to your configuration file "/home/rjones/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
	info "(gdb)Auto-loading safe path"

I didn't look into this in great detail, but it seems as if
the golang package needs to update this "safe path" somehow
(as obviously the mono package is already doing).

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

golang 1.1.1-3.fc18.x86_64

How reproducible:

100%

Steps to Reproduce:
1. Create a minimal golang program.
2. go build the-program.go
3. gdb ./the-program.go

Actual results:

See above.

Comment 1 Richard W.M. Jones 2013-07-04 14:25:33 UTC
Step 2 & 3 are of course:

2. go build -o the-program the-program.go
3. gdb ./the-program

Comment 2 Adam Goode 2013-07-05 01:59:31 UTC
$ strings /usr/bin/gdb | grep mono
$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py

This is hard-coded into gdb for mono. :)

But I think I can fix this no problem.

Comment 3 Adam Goode 2013-07-05 03:41:02 UTC
To fix this without hacks, #981520 must be addressed. I will put in the files in /etc/gdbinit.d so that if the gdb bug is fixed, this will work.

For now, I guess you need to put the recommended commands into .gdbinit.

Comment 4 Jan Kratochvil 2013-07-05 07:58:34 UTC
That "/usr/bin/mono-gdb.py" is just a workaround of Mono Bug 815501.

The file "/usr/share/golang/src/pkg/runtime/runtime-gdb.py" has incorrect location, it should be placed under "/usr/share/gdb/auto-load/".  As the compiled Go program does not use any shared libraries it could be even:
/usr/share/gdb/auto-load/usr/share/golang/src/pkg/runtime/runtime-gdb.py

It should be just some stub like:
/usr/share/gdb/auto-load/usr/lib64/libglib-2.0.so.0.3400.2-gdb.py

Comment 5 Adam Goode 2013-07-05 14:29:48 UTC
Jan:
I have tried putting runtime-gdb.py in both /usr/share/gdb/auto-load/ as well as /usr/share/gdb/auto-load/usr/lib64/golang/src/pkg/runtime, but it fails.

I think this is because of the .debug_gdb_script section in each go file, correct? The correct solution would be to fix the compiler to put the correct path in the executable, right?

Comment 6 Jan Kratochvil 2013-07-05 16:21:56 UTC
(In reply to Adam Goode from comment #5)
> I think this is because of the .debug_gdb_script section in each go file,
> correct? The correct solution would be to fix the compiler to put the
> correct path in the executable, right?

Yes, I assumed you are going to change also the path in the compiler accordingly.

This is a bit unusual case for gdb auto-load because IIUC do golang-produced binaries are statically linked (this also does not seem too much packaging guidelines compliant but if there is no other choice...).

BTW I do not know anything about Go but isn't gccgo more suitable for Fedora?

Comment 7 Adam Goode 2013-07-05 19:07:20 UTC
gccgo is already in Fedora. golang is the other implementation of Go, based on the Plan 9 toolchain. golang also contains the "go" command, which handles building, dependencies, downloading of remote packages. Eventually this command will be able to drive gccgo as well as the "g" series of compilers.

Comment 8 Adam Goode 2013-07-05 19:31:09 UTC
Looks like I need to replace finddebugruntimepath in dwarf.c with a new path.

Comment 9 Fedora End Of Life 2013-09-16 14:23:13 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 20 development cycle.
Changing version to '20'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora20

Comment 10 Vincent Batts 2014-07-08 15:36:15 UTC
*** Bug 1002415 has been marked as a duplicate of this bug. ***

Comment 11 Fedora Update System 2014-07-15 16:57:42 UTC
golang-1.2.2-9.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/golang-1.2.2-9.el6

Comment 12 Fedora Update System 2014-07-15 17:10:27 UTC
golang-1.2.2-9.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/golang-1.2.2-9.fc19

Comment 13 Fedora Update System 2014-07-15 18:06:46 UTC
golang-1.2.2-9.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/golang-1.2.2-9.fc20

Comment 14 Fedora Update System 2014-07-16 03:51:50 UTC
Package golang-1.2.2-9.el6:
* should fix your issue,
* was pushed to the Fedora EPEL 6 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing golang-1.2.2-9.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2014-1907/golang-1.2.2-9.el6
then log in and leave karma (feedback).

Comment 15 Fedora Update System 2014-07-26 15:59:25 UTC
golang-1.2.2-9.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2014-07-26 16:00:32 UTC
golang-1.2.2-9.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 17 Fedora Update System 2014-08-08 17:44:43 UTC
golang-1.2.2-12.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/golang-1.2.2-12.el6


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