mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 01:27:16 +08:00
proc,dwarf/godwarf: support parametric types with dictionaries
Change debug_info type reader and proc to convert parametric types into their real types by reading the corresponding dictionary entry and using the same method used for interfaces to retrieve the DIE from a runtime._type address. '2586e9b1'.
This commit is contained in:
committed by
Alessandro Arzilli
parent
4e7b689e1a
commit
18f2a4c46b
@ -18,6 +18,7 @@ import (
|
||||
"github.com/go-delve/delve/pkg/dwarf/godwarf"
|
||||
"github.com/go-delve/delve/pkg/dwarf/op"
|
||||
"github.com/go-delve/delve/pkg/goversion"
|
||||
"github.com/go-delve/delve/pkg/logflags"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -1135,7 +1136,7 @@ func readVarEntry(entry *godwarf.Tree, image *Image) (name string, typ godwarf.T
|
||||
|
||||
// Extracts the name and type of a variable from a dwarf entry
|
||||
// then executes the instructions given in the DW_AT_location attribute to grab the variable's address
|
||||
func extractVarInfoFromEntry(tgt *Target, bi *BinaryInfo, image *Image, regs op.DwarfRegisters, mem MemoryReadWriter, entry *godwarf.Tree) (*Variable, error) {
|
||||
func extractVarInfoFromEntry(tgt *Target, bi *BinaryInfo, image *Image, regs op.DwarfRegisters, mem MemoryReadWriter, entry *godwarf.Tree, dictAddr uint64) (*Variable, error) {
|
||||
if entry.Tag != dwarf.TagFormalParameter && entry.Tag != dwarf.TagVariable {
|
||||
return nil, fmt.Errorf("invalid entry tag, only supports FormalParameter and Variable, got %s", entry.Tag.String())
|
||||
}
|
||||
@ -1145,6 +1146,12 @@ func extractVarInfoFromEntry(tgt *Target, bi *BinaryInfo, image *Image, regs op.
|
||||
return nil, err
|
||||
}
|
||||
|
||||
t, err = resolveParametricType(tgt, bi, mem, t, dictAddr)
|
||||
if err != nil {
|
||||
// Log the error, keep going with t, which will be the shape type
|
||||
logflags.DebuggerLogger().Errorf("could not resolve parametric type of %s", n)
|
||||
}
|
||||
|
||||
addr, pieces, descr, err := bi.Location(entry, dwarf.AttrLocation, regs.PC(), regs, mem)
|
||||
if pieces != nil {
|
||||
var cmem *compositeMemory
|
||||
|
||||
Reference in New Issue
Block a user