Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#29665 - [go] gdb integration is broken

Attached to Project: Community Packages
Opened by Csaba Henk (csheemea) - Monday, 30 April 2012, 06:55 GMT
Last edited by Alexander F. Rødseth (xyproto) - Friday, 28 September 2012, 22:51 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Vesa Kaihlavirta (vegai)
Rémy Oudompheng (remyoudompheng)
Alexander F. Rødseth (xyproto)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

When gdb'ing a go program, go runtime support and sources are not found.

Additional info:
* package version(s)
* config and/or log files etc.


Steps to reproduce:

See the following transcribed gdb session.
The issues are manifesting in the lines

"warning: Missing auto-load scripts referenced in section .debug_gdb_scripts"

and

"204 /build/src/release-build/src/pkg/runtime/iface.c: No such file or directory."

$ cat > hw.go
package main

import "fmt"

func main() {
fmt.Println("Hello, 世界")
}
$ go build hw.go
$ gdb hw
GNU gdb (GDB) 7.4.1
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 "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/hw...done.
warning: Missing auto-load scripts referenced in section .debug_gdb_scripts
of file /tmp/hw
Use `info auto-load-scripts [REGEXP]' to list them.
(gdb) info auto-load-scripts
Loaded Script
Missing /build/src/release-build/src/pkg/runtime/runtime-gdb.py
(gdb) !pacman -Ql go | grep runtime-gdb
go /usr/lib/go/src/pkg/runtime/runtime-gdb.py
(gdb) source /usr/lib/go/src/pkg/runtime/runtime-gdb.py
Loading Go Runtime support.
(gdb) br main.main
Breakpoint 1 at 0x400c00: file /tmp/hw.go, line 5.
(gdb) run
Starting program: /tmp/hw
[New LWP 25382]
[Switching to LWP 25382]

Breakpoint 1, main.main () at /tmp/hw.go:5
5 func main() {
(gdb) n
6 fmt.Println("Hello, 世界")
(gdb) s
runtime.convT2E (t=void) at /build/src/release-build/src/pkg/runtime/iface.c:204
204 /build/src/release-build/src/pkg/runtime/iface.c: No such file or directory.
(gdb)
This task depends upon

Closed by  Alexander F. Rødseth (xyproto)
Friday, 28 September 2012, 22:51 GMT
Reason for closing:  Fixed
Additional comments about closing:  Upstream fixed it
Comment by Csaba Henk (csheemea) - Monday, 30 April 2012, 07:01 GMT
Side note: to overcome this situation with not finding sources, I use a self-compiled
go instance if I want to code in go. I was annoyed to see it does not work properly
either, until I realized that's because of the GOROOT setting /etc/profile.d/go.sh.

Is that necessary at all? GOROOT has a similar role to RUBYLIB and PYTHONPATH in
respective languages -- the language runtime knows well the native value for these,
it needs only be set if you want to do something extraordinaly.
Comment by Alexander F. Rødseth (xyproto) - Monday, 11 June 2012, 13:12 GMT
Hi,

I'm unable to reproduce:

gdb hello
GNU gdb (GDB) 7.4.1
[...]
Loading Go Runtime support.
(gdb) info auto-load-scripts
Loaded Script
Yes /usr/lib/go/src/pkg/runtime/runtime-gdb.py
(gdb) !pacman -Ql go | grep runtime-gdb
go /usr/lib/go/src/pkg/runtime/runtime-gdb.py
(gdb) br main.main
Breakpoint 1 at 0x400c00: file /home/alexander/goprojects/hello/hello.go, line 7.
(gdb) run
Starting program: /home/alexander/goprojects/hello/hello
[New LWP 14857]
[Switching to LWP 14857]

Breakpoint 1, main.main () at /home/alexander/goprojects/hello/hello.go:7
7 func main() {
(gdb) quit
A debugging session is active.


GOROOT is not set in /etc/profile.d/go.sh, only GOPATH.

Are you on x86_64 or i686?

What's the values of your GOROOT and GOPATH environment variables?

What is the package version for your go package?
Comment by Csaba Henk (csheemea) - Monday, 11 June 2012, 19:43 GMT
As of now, 2:1.0.1-5. With this version, most of my griefs are over. Runtime support, as you notice, loads fine, and also there is no more tampering with GOROOT.

However, the sources are still not found. You did not repeat my whole experiment -- after you break into main, do "n" and "s".
What you get is still the same as I give in the original report --

204 /build/src/release-build/src/pkg/runtime/iface.c: No such file or directory.

With my personal built go instance, I get:

Breakpoint 1, main.main () at /tmp/foog/hw.go:5
5 func main() {
(gdb) n
6 fmt.Println("Hello, 世界")
(gdb) s
runtime.convT2E (t=void) at /home/csaba/go/src/go/src/pkg/runtime/iface.c:205
205 runtime·convT2E(Type *t, ...)
(gdb) l
200 }
201
202 // func convT2E(typ *byte, elem any) (ret any)
203 #pragma textflag 7
204 void
205 runtime·convT2E(Type *t, ...)
206 {
207 byte *elem;
208 Eface *ret;
209 int32 wid;
(gdb)
Comment by Csaba Henk (csheemea) - Tuesday, 12 June 2012, 07:05 GMT
Also, a minor annoyance, not sure if it's worth to open a bug for it -- the Go favicon is not packaged.
Hence on locally browsing the docs I get:

godoc -http :6060
2012/06/12 12:33:28 lstat /usr/lib/go/favicon.ico: no such file or directory
Comment by Alexander F. Rødseth (xyproto) - Tuesday, 12 June 2012, 08:04 GMT
Thanks for the clarification. I will look at both issues.
Comment by Alexander F. Rødseth (xyproto) - Wednesday, 13 June 2012, 19:58 GMT
I'm able to reproduce that "s" in gdb gives an error and does not work as expected. Changing GOROOT and GOPATH doesn't seem to have any effect.
Vesa or Remy, do you happen to know if there is a different way to build Go that will fix this? Is this an upstream issue, for the case where go is built for a system-wide installation?

I'll include the favicon.ico.
Comment by Alexander F. Rødseth (xyproto) - Wednesday, 13 June 2012, 22:18 GMT
Updated the package, included the favicon.ico. Has the gdb problem been reported upstream?
Comment by Rémy Oudompheng (remyoudompheng) - Thursday, 14 June 2012, 06:01 GMT
The bug is known upstream: http://code.google.com/p/go/issues/detail?id=3180

IT was fixed for Go sources but not for C and ASM sources in the release. Fixes have been committed on the master branch since then, but they were not backported to the stable branches. I suggest you drop an email or a comment saying that you would like the fixes in Go 1.0.3 (Go 1.0.2 was just released without them).

016c4fefed77 5c, 6c, 8c: take GOROOT_FINAL into consideration
a608a03df703 5a, 6a, 8a: take GOROOT_FINAL into consideration

http://code.google.com/p/go/source/list?r=016c4fefed77

Otherwise we can backport the patches ourselves, but it would be useful to have them in 1.0.3
Comment by Alexander F. Rødseth (xyproto) - Thursday, 14 June 2012, 22:38 GMT
Ok, thanks for the great answer, Rémy. I'll drop en email or comment and ask if the fix can be included in 1.0.3.
Comment by Alexander F. Rødseth (xyproto) - Monday, 25 June 2012, 11:41 GMT
Comment added.
Comment by Alexander F. Rødseth (xyproto) - Monday, 20 August 2012, 00:45 GMT
I see that GDB 7.5 now supports Go. See the changelog at http://www.gnu.org/software/gdb/.

However, I can still reproduce this issue with GDB 7.5.

Judging by the time it took from 1.0.1 to 1.0.2, I'm guessing 1.0.3 will be out in August or September.

Do you think this is too long to wait and that a patch should be applied in the meantime?
Comment by Allan McRae (Allan) - Monday, 20 August 2012, 00:58 GMT
Why am I added to the assignees? This does not seem to be an issue with gdb?
Comment by Alexander F. Rødseth (xyproto) - Monday, 20 August 2012, 10:31 GMT
Allan, I added you as an assignee in case you had some valuable insights and/or were interested in the issue since it was related to gdb. Removing you from the list.
Comment by Alexander F. Rødseth (xyproto) - Monday, 24 September 2012, 14:43 GMT
The release of 1.0.3 took longer than expected, planning to apply the patch.
Comment by Alexander F. Rødseth (xyproto) - Tuesday, 25 September 2012, 15:08 GMT
Go 1.0.3 is out! Hopefully the fix is included.
Comment by Alexander F. Rødseth (xyproto) - Tuesday, 25 September 2012, 15:29 GMT
Checked in a new PKGBUILD for 1.0.3. However, it doesn't seem to compile. Will try to investigate.
Comment by Alexander F. Rødseth (xyproto) - Friday, 28 September 2012, 21:01 GMT
It compiles if cross-compilation is disabled...
Comment by Alexander F. Rødseth (xyproto) - Friday, 28 September 2012, 22:51 GMT
This works now in 1.0.3! Was able to follow the steps to reproduce and ended up with this:

(gdb) s
runtime.convT2E (t=void) at /usr/lib/go/src/pkg/runtime/iface.c:204
204 runtime·convT2E(Type *t, ...)
(gdb)

1.0.3 will appear in [community] shortly. I hope the (possible) lack of cross compilation isn't too much of an issue, for now. Please open a bug report if it is.

Loading...