/usr/share/go/src/pkg/runtime is not on gdb's auto-load safe-path

Bug #1076454 reported by Mike Carifio on 2012-11-08
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
golang-1.6 (Ubuntu)
Undecided
Unassigned

Bug Description

Config
======

# series
$ lsb_release -rd
Description: Ubuntu 12.10
Release: 12.10

# pkg
$ apt-cache policy golang-src
golang-src:
  Installed: 2:1.0.2-2
  Candidate: 2:1.0.2-2
  Version table:
 *** 2:1.0.2-2 0
        500 http://us.archive.ubuntu.com/ubuntu/ quantal/universe i386 Packages

Problem
=======

Gdb is the canonical debugger for go programs. Package golang-src provides a python file /usr/share/go/src/pkg/runtime/runtime-gdb.py to assist go programmers with specialized gdb commands (I don't really know just how useful they are). gdb complains when it starts that it can't load /usr/share/go/src/pkg/runtime/runtime-gdb.py because its not on the "auto-load safe-path":

$ gdb ./hello
GNU gdb (GDB) 7.5-ubuntu
Copyright (C) 2012 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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/mcarifio/tech/golang/workspace/src/hello/hello...done.
warning: File "/usr/share/go/src/pkg/runtime/runtime-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning above
(gdb)

I mitigated this by adding the following gdb directive in /etc/gdb/gdbinit:

add-auto-load-safe-path /usr/share/go/src/pkg/runtime

Then:

$ gdb ./hello
GNU gdb (GDB) 7.5-ubuntu
Copyright (C) 2012 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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/mcarifio/tech/golang/workspace/src/hello/hello...done.
Loading Go Runtime support.
^^^^^^^^^^^^^^^^^^^^^^^^^^ success indicated above
(gdb)

I'm not sure how best to solve this in general, but golang-src probably needs to configure gdb to accept
/usr/share/go/src/pkg/runtime/runtime-gdb.py as safe.

It took me a little while to figure out how auto-load safe-path works, how gdb initializes on start, where the files are located such as /etc/gdb/gdbinit and ~/.gdbinit. So it takes a little investigation for a programmer to reconstruct what I did above. But its also a fixable annoyance.

Mike Carifio (carifio) on 2012-11-08
tags: added: gdb golang
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in golang (Ubuntu):
status: New → Confirmed
affects: golang (Ubuntu) → golang-1.6 (Ubuntu)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers