mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
compile,link: export package name in debug_info
Add a new custom attribute to compile units containing the package name of the package (i.e. the name after the 'package' keyword), so that debuggers can know it when it's different from the last segment of the package path. Change-Id: Ieadaab6f47091aabf2f4dc42c8524452eaa6715b Reviewed-on: https://go-review.googlesource.com/c/go/+/163677 Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
parent
abefcac10a
commit
e29f74efb9
4 changed files with 77 additions and 0 deletions
|
|
@ -1833,6 +1833,12 @@ func dwarfGenerateDebugInfo(ctxt *Link) {
|
|||
|
||||
newattr(unit.dwinfo, dwarf.DW_AT_producer, dwarf.DW_CLS_STRING, int64(len(producer)), producer)
|
||||
|
||||
var pkgname string
|
||||
if s := ctxt.Syms.ROLookup(dwarf.CUInfoPrefix+"packagename."+unit.lib.Pkg, 0); s != nil {
|
||||
pkgname = string(s.P)
|
||||
}
|
||||
newattr(unit.dwinfo, dwarf.DW_AT_go_package_name, dwarf.DW_CLS_STRING, int64(len(pkgname)), pkgname)
|
||||
|
||||
if len(lib.Textp) == 0 {
|
||||
unit.dwinfo.Abbrev = dwarf.DW_ABRV_COMPUNIT_TEXTLESS
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue