https://bugzilla.redhat.com/show_bug.cgi?id=1192742

            Bug ID: 1192742
           Summary: Fix DWARF for variable references
           Product: Fedora
           Version: rawhide
         Component: golang
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected], [email protected], [email protected]



Created attachment 991800
  --> https://bugzilla.redhat.com/attachment.cgi?id=991800&action=edit
A bit hacky fix

Description of problem:
https://sourceware.org/gdb/wiki/GoDebugging#golang_Wrong_DW_TAG_variable
golang provides &name variable names and the DWARF interface uses one more
pointer than in the source.

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

How reproducible:
Always.

Steps to Reproduce:
-------------------
package main
func main () {
  var i int
  ip:=&i
  ipp:=&ip
  go func() {
      **ipp++
  }()
}
-------------------

Actual results:
(gdb) b 8
(gdb) r
(gdb) p i
No symbol "i" in current context.
(gdb) p &i
No symbol "i" in current context.
(gdb) p '&i'
Invalid character constant.
(gdb) p ' &i'
$1 = (int *) 0xc20800a080
(gdb) p *' &i'
$2 = 0
(gdb) p ' &ip'
$3 = (int **) 0xc20803a000
(gdb) p *' &ip'
$4 = (int *) 0xc20800a080
(gdb) p **' &ip'
$5 = 0
(gdb) p ' &ipp'
$6 = (int ***) 0xc20803a008
(gdb) p *' &ipp'
$7 = (int **) 0xc20803a000
(gdb) p **' &ipp'
$8 = (int *) 0xc20800a080
(gdb) p ***' &ipp'
$9 = 0

Expected results:
(gdb) b 8
(gdb) r
(gdb) p i
$1 = (int &) @0xc20800a080: 0
(gdb) p ip
$2 = (int *&) @0xc20803a000: 0xc20800a080
(gdb) p *ip
$3 = 0
(gdb) p ipp
$4 = (int **&) @0xc20803a008: 0xc20803a000
(gdb) p *ipp
$5 = (int *) 0xc20800a080
(gdb) p **ipp
$6 = 0
(gdb) whatis i
type = int &
(gdb) whatis ip
type = int *&
(gdb) whatis ipp
type = int **&

Additional info:
But you said golang upstream is writing some new linker so maybe this hack is
not much relevant for upstream.  DW_AT_name of the reference types is IMO
incorrect but I do not think it matters much for GDB; for 'ipp' with this patch
there is:
    <fe78>   DW_AT_name        : &(***int)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
golang mailing list
[email protected]
https://lists.fedoraproject.org/mailman/listinfo/golang

Reply via email to