Bug 1192721

Summary: Fix debugging - fix runtime-gdb.py
Product: [Fedora] Fedora Reporter: Jan Kratochvil <jan.kratochvil>
Component: golangAssignee: Vincent Batts <vbatts>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: admiller, golang-updates, jan.kratochvil, lemenkov, renich, s, vbatts
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-27 19:09:06 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:
Embargoed:
Attachments:
Description Flags
Fedora packaging + runtime-gdb.py fix
none
Fedora packaging + runtime-gdb.py fix #2
none
/etc/gdbinit.d/golang.gdb fix none

Description Jan Kratochvil 2015-02-14 17:20:58 UTC
Created attachment 991759 [details]
Fedora packaging + runtime-gdb.py fix

Description of problem:
Currently golang GDB support script is not loaded at all.  Load it and fix its obsolete parts.

Version-Release number of selected component (if applicable):
golang-1.4.1-1.fc22.x86_64

How reproducible:
Always.

Steps to Reproduce:
$ gdb golang-produced binary
(gdb) start
(gdb) info goroutines 
(gdb) goroutine 4 bt

Actual results:
Undefined info command: "goroutines".  Try "help info".

Expected results:
Loading Go Runtime support.
(gdb) start
[...]
(gdb) info goroutines 
* 1 running  fname=runtime.switchtoM faddr=0x437a60 &g=0xc208000120 
  2 runnable fname=runtime.forcegchelper faddr=0x412010 &g=0xc208000480 
  3 runnable fname=runtime.bgsweep faddr=0x40dcd0 &g=0xc2080005a0 
  4 runnable fname=runtime.runfinq faddr=0x40d3f0 &g=0xc2080006c0 
(gdb) goroutine 4 bt
#0  runtime.runfinq () at /usr/lib/golang/src/runtime/malloc.go:712
#1  0x0000000000439ca1 in runtime.goexit () at /usr/lib/golang/src/runtime/asm_amd64.s:2232
#2  0x0000000000000000 in ?? ()

Additional info:
Probably some interfaces pretty printer there also needs to be fixed.
Backtraces need to be fixed etc.
https://sourceware.org/gdb/wiki/GoDebugging

Comment 1 Jan Kratochvil 2015-02-14 17:26:08 UTC
After rebuild of golang using for tests:

rpm -e --nodeps golang golang-src golang-pkg-bin-linux-amd64;rpm -i golang-1.4.1-1.fc22.x86_64.rpm golang-src-1.4.1-1.fc22.noarch.rpm golang-pkg-bin-linux-amd64-1.4.1-1.fc22.x86_64.rpm;alternatives --set go /usr/lib/golang/bin/linux_amd64/go

Comment 2 Jan Kratochvil 2015-02-14 18:23:45 UTC
Created attachment 991771 [details]
Fedora packaging + runtime-gdb.py fix #2

Comment 3 Jan Kratochvil 2015-02-21 17:44:28 UTC
Created attachment 994184 [details]
/etc/gdbinit.d/golang.gdb fix

The Comment 2 patch is still valid for golang-1.4.x but otherwise upstream (1.5) has already implemented almost all of the fixes in last month.

The remaining tiny ones I have posted as:
  https://go-review.googlesource.com/#/c/5522/
  https://go-review.googlesource.com/#/c/5521/

This attachment still needs to be applied even for future golang-1.5 as it is Fedora GDB specific packaging: /etc/gdbinit.d/golang.gdb

Comment 4 Jan Kurik 2015-07-15 14:32:50 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

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

Comment 5 Vincent Batts 2015-08-27 19:09:06 UTC
your upstream commits and the gdb path fix are included in http://koji.fedoraproject.org/koji/taskinfo?taskID=10858659

Thanks!