mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.link] cmd/internal/obj: add dump of aux symbols for -S=2
For compiler developers interested in seeing DWARF generation details, this patch provides symbol "debug asm" dumps for DWARF aux symbols when -S=2 is in effect. Change-Id: I5a0b6b65ce7b708948cbbf23c6b0d279bd4f8d9f Reviewed-on: https://go-review.googlesource.com/c/go/+/223017 Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
8634642f9a
commit
c44af2d4a2
3 changed files with 81 additions and 23 deletions
|
|
@ -18,9 +18,8 @@ import (
|
|||
|
||||
// Entry point of writing new object file.
|
||||
func WriteObjFile2(ctxt *Link, b *bio.Writer, pkgpath string) {
|
||||
if ctxt.Debugasm > 0 {
|
||||
ctxt.traverseSyms(traverseDefs, ctxt.writeSymDebug)
|
||||
}
|
||||
|
||||
debugAsmEmit(ctxt)
|
||||
|
||||
genFuncInfoSyms(ctxt)
|
||||
|
||||
|
|
@ -434,3 +433,28 @@ func genFuncInfoSyms(ctxt *Link) {
|
|||
}
|
||||
ctxt.defs = append(ctxt.defs, infosyms...)
|
||||
}
|
||||
|
||||
// debugDumpAux is a dumper for selected aux symbols.
|
||||
func writeAuxSymDebug(ctxt *Link, par *LSym, aux *LSym) {
|
||||
// Most aux symbols (ex: funcdata) are not interesting--
|
||||
// pick out just the DWARF ones for now.
|
||||
if aux.Type != objabi.SDWARFLOC &&
|
||||
aux.Type != objabi.SDWARFINFO &&
|
||||
aux.Type != objabi.SDWARFLINES &&
|
||||
aux.Type != objabi.SDWARFRANGE {
|
||||
return
|
||||
}
|
||||
ctxt.writeSymDebugNamed(aux, "aux for "+par.Name)
|
||||
}
|
||||
|
||||
func debugAsmEmit(ctxt *Link) {
|
||||
if ctxt.Debugasm > 0 {
|
||||
ctxt.traverseSyms(traverseDefs, ctxt.writeSymDebug)
|
||||
if ctxt.Debugasm > 1 {
|
||||
fn := func(par *LSym, aux *LSym) {
|
||||
writeAuxSymDebug(ctxt, par, aux)
|
||||
}
|
||||
ctxt.traverseAuxSyms(fn)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue