{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/28416","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/28416/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/28416/comments","events_url":"https://api.github.com/repos/golang/go/issues/28416/events","html_url":"https://github.com/golang/go/issues/28416","id":374382312,"node_id":"MDU6SXNzdWUzNzQzODIzMTI=","number":28416,"title":"cmd/compile: the DW_AT_location of the return value is empty when its name is not specified","user":{"login":"ks888","id":8448120,"node_id":"MDQ6VXNlcjg0NDgxMjA=","avatar_url":"https://avatars2.githubusercontent.com/u/8448120?v=4","gravatar_id":"","url":"https://api.github.com/users/ks888","html_url":"https://github.com/ks888","followers_url":"https://api.github.com/users/ks888/followers","following_url":"https://api.github.com/users/ks888/following{/other_user}","gists_url":"https://api.github.com/users/ks888/gists{/gist_id}","starred_url":"https://api.github.com/users/ks888/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ks888/subscriptions","organizations_url":"https://api.github.com/users/ks888/orgs","repos_url":"https://api.github.com/users/ks888/repos","events_url":"https://api.github.com/users/ks888/events{/privacy}","received_events_url":"https://api.github.com/users/ks888/received_events","type":"User","site_admin":false},"labels":[{"id":373399998,"node_id":"MDU6TGFiZWwzNzMzOTk5OTg=","url":"https://api.github.com/repos/golang/go/labels/NeedsFix","name":"NeedsFix","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/65","html_url":"https://github.com/golang/go/milestone/65","labels_url":"https://api.github.com/repos/golang/go/milestones/65/labels","id":3072996,"node_id":"MDk6TWlsZXN0b25lMzA3Mjk5Ng==","number":65,"title":"Go1.12","description":"","creator":{"login":"rsc","id":104030,"node_id":"MDQ6VXNlcjEwNDAzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/104030?v=4","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":707,"closed_issues":359,"state":"open","created_at":"2018-01-29T21:17:52Z","updated_at":"2018-10-31T00:34:16Z","due_on":"2019-01-31T08:00:00Z","closed_at":null},"comments":10,"created_at":"2018-10-26T13:24:03Z","updated_at":"2018-10-31T00:50:00Z","closed_at":null,"author_association":"NONE","body":"### What version of Go are you using (`go version`)?\r\n\r\n`go version devel +66bb8ddb95 Thu Oct 25 13:37:38 2018 +0000 darwin/amd64`\r\n\r\n### What operating system and processor architecture are you using (`go env`)?\r\n\r\n```\r\nGOARCH=\"amd64\"\r\nGOBIN=\"\"\r\nGOCACHE=\"/Users/yagami/Library/Caches/go-build\"\r\nGOEXE=\"\"\r\nGOFLAGS=\"\"\r\nGOHOSTARCH=\"amd64\"\r\nGOHOSTOS=\"darwin\"\r\nGOOS=\"darwin\"\r\nGOPATH=\"/Users/yagami/go\"\r\nGOPROXY=\"\"\r\nGORACE=\"\"\r\nGOROOT=\"/Users/yagami/src/go\"\r\nGOTMPDIR=\"\"\r\nGOTOOLDIR=\"/Users/yagami/src/go/pkg/tool/darwin_amd64\"\r\nGCCGO=\"gccgo\"\r\nCC=\"clang\"\r\nCXX=\"clang++\"\r\nCGO_ENABLED=\"1\"\r\nGOMOD=\"\"\r\nCGO_CFLAGS=\"-g -O2\"\r\nCGO_CPPFLAGS=\"\"\r\nCGO_CXXFLAGS=\"-g -O2\"\r\nCGO_FFLAGS=\"-g -O2\"\r\nCGO_LDFLAGS=\"-g -O2\"\r\nPKG_CONFIG=\"pkg-config\"\r\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5t/5crzwsxs305_ngrhgx90phzh0000gn/T/go-build561220144=/tmp/go-build -gno-record-gcc-switches -fno-common\"\r\n```\r\n\r\n### What did you do?\r\n\r\nIn the sample program below, the DW_AT_location of the return value `~r1` is empty. It's nice to provide the information about the location here because the value is present on the stack and is used later.\r\n\r\n```\r\n% cat loc_attr.go\r\npackage main\r\n\r\nimport \"fmt\"\r\n\r\nfunc fib(n int) int {\r\n        if n == 0 || n == 1 {\r\n                return n\r\n        }\r\n        return fib(n-1) + fib(n-2)\r\n}\r\n\r\nfunc main() {\r\n        fmt.Println(fib(10))\r\n}\r\n% go build -ldflags=-compressdwarf=false loc_attr.go\r\n% gobjdump --dwarf=info ./loc_attr | grep -B 1 -A 18 'main.fib'\r\n <1><75c36>: Abbrev Number: 3 (DW_TAG_subprogram)\r\n    <75c37>   DW_AT_name        : main.fib\r\n    <75c40>   DW_AT_low_pc      : 0x1091960\r\n    <75c48>   DW_AT_high_pc     : 0x10919e8\r\n    <75c50>   DW_AT_frame_base  : 1 byte block: 9c      (DW_OP_call_frame_cfa)\r\n    <75c52>   DW_AT_decl_file   : 0x1\r\n    <75c56>   DW_AT_external    : 1\r\n <2><75c57>: Abbrev Number: 16 (DW_TAG_formal_parameter)\r\n    <75c58>   DW_AT_name        : n\r\n    <75c5a>   DW_AT_variable_parameter: 0\r\n    <75c5b>   DW_AT_decl_line   : 5\r\n    <75c5c>   DW_AT_type        : <0x339f7>\r\n    <75c60>   DW_AT_location    : 0x71216 (location list)\r\n <2><75c64>: Abbrev Number: 15 (DW_TAG_formal_parameter)\r\n    <75c65>   DW_AT_name        : ~r1\r\n    <75c69>   DW_AT_variable_parameter: 1\r\n    <75c6a>   DW_AT_decl_line   : 5\r\n    <75c6b>   DW_AT_type        : <0x339f7>\r\n    <75c6f>   DW_AT_location    : 0 byte block:         ()\r\n <2><75c70>: Abbrev Number: 0\r\n```\r\n\r\nI'm not sure it's helpful, but I noticed the DW_AT_location is not empty if the name of the return value is specified in the source:\r\n\r\n```\r\n% cat loc_attr.go\r\npackage main\r\n\r\nimport \"fmt\"\r\n\r\nfunc fib(n int) (r int) {  // now the return value is named.\r\n        if n == 0 || n == 1 {\r\n                return n\r\n        }\r\n        return fib(n-1) + fib(n-2)\r\n}\r\n\r\nfunc main() {\r\n        fmt.Println(fib(10))\r\n}\r\n% go build -ldflags=-compressdwarf=false loc_attr.go\r\n% gobjdump --dwarf=info ./loc_attr | grep -B 1 -A 18 'main.fib'\r\n <1><75c36>: Abbrev Number: 3 (DW_TAG_subprogram)\r\n    <75c37>   DW_AT_name        : main.fib\r\n    <75c40>   DW_AT_low_pc      : 0x1091960\r\n    <75c48>   DW_AT_high_pc     : 0x10919e8\r\n    <75c50>   DW_AT_frame_base  : 1 byte block: 9c      (DW_OP_call_frame_cfa)\r\n    <75c52>   DW_AT_decl_file   : 0x1\r\n    <75c56>   DW_AT_external    : 1\r\n <2><75c57>: Abbrev Number: 16 (DW_TAG_formal_parameter)\r\n    <75c58>   DW_AT_name        : n\r\n    <75c5a>   DW_AT_variable_parameter: 0\r\n    <75c5b>   DW_AT_decl_line   : 5\r\n    <75c5c>   DW_AT_type        : <0x339f7>\r\n    <75c60>   DW_AT_location    : 0x71216 (location list)\r\n <2><75c64>: Abbrev Number: 16 (DW_TAG_formal_parameter)\r\n    <75c65>   DW_AT_name        : r\r\n    <75c67>   DW_AT_variable_parameter: 1\r\n    <75c68>   DW_AT_decl_line   : 5\r\n    <75c69>   DW_AT_type        : <0x339f7>\r\n    <75c6d>   DW_AT_location    : 0x71249 (location list)\r\n <2><75c71>: Abbrev Number: 0\r\n```\r\n\r\n### What did you expect to see?\r\n\r\nThe DW_AT_location of the return value `~r1` provides the information about the location.\r\n\r\n### What did you see instead?\r\n\r\nThe DW_AT_location of the return value `~r1` is empty.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/434522352","html_url":"https://github.com/golang/go/issues/28416#issuecomment-434522352","issue_url":"https://api.github.com/repos/golang/go/issues/28416","id":434522352,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDUyMjM1Mg==","user":{"login":"dr2chase","id":1928999,"node_id":"MDQ6VXNlcjE5Mjg5OTk=","avatar_url":"https://avatars0.githubusercontent.com/u/1928999?v=4","gravatar_id":"","url":"https://api.github.com/users/dr2chase","html_url":"https://github.com/dr2chase","followers_url":"https://api.github.com/users/dr2chase/followers","following_url":"https://api.github.com/users/dr2chase/following{/other_user}","gists_url":"https://api.github.com/users/dr2chase/gists{/gist_id}","starred_url":"https://api.github.com/users/dr2chase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dr2chase/subscriptions","organizations_url":"https://api.github.com/users/dr2chase/orgs","repos_url":"https://api.github.com/users/dr2chase/repos","events_url":"https://api.github.com/users/dr2chase/events{/privacy}","received_events_url":"https://api.github.com/users/dr2chase/received_events","type":"User","site_admin":false},"created_at":"2018-10-31T00:50:00Z","updated_at":"2018-10-31T00:50:00Z","author_association":"CONTRIBUTOR","body":"What's your gdb version? I spent some time trying to figure out why gdb wouldn't debug (on a Mac) my test binary, but when I lit up 8.2 in a Docker (to eliminate the Mac craziness) it worked fine.  But perhaps 8.1 or 8.0, etc."}}
{"actor":{"display_login":"dr2chase"}}