Skip to content

Commit

Permalink
Update symtab.go -- correctly adding inlined data to list
Browse files Browse the repository at this point in the history
  • Loading branch information
brigadier-general authored Jun 25, 2024
1 parent 86761c0 commit 190dbd8
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions debug/gosym/symtab.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func (f *Func) iterateInline_v116(tree []byte) []InlinedCall {

func (f *Func) iterateInline_v120(tree []byte) []InlinedCall {
var inlineList []InlinedCall
fmt.Println("\t iterating...")

// check there are enough bytes for an inlinedCall struct
off := 0
// iterate until we hit invalid data
Expand All @@ -322,7 +322,6 @@ func (f *Func) iterateInline_v120(tree []byte) []InlinedCall {
if !is_valid_fname {
break
}
fmt.Printf("\t inlined func %s (parent %s)\n", fname, f.Name)
// create InlinedCall object
inlineList = append(inlineList, InlinedCall {
Funcname: fname,
Expand All @@ -338,14 +337,24 @@ func (f *Func) iterateInline_v120(tree []byte) []InlinedCall {
}

// return array of inlined functions inside f or nil
func (f *Func) GetInlinedCalls(data []byte) []InlinedCall {

fmt.Println("\tgetting inlined data, version ", f.LineTable.Version)
func (f *Func) GetInlinedCalls(data []byte) {
var inlList []InlinedCall

// get size of inlined struct based on version
if f.LineTable.Version >= ver118 {
return f.iterateInline_v120(data)
inlList = f.iterateInline_v120(data)
} else {
return f.iterateInline_v116(data)
inlList = f.iterateInline_v116(data)
}

for _, elt := range inlList {
f.InlinedList = append(f.InlinedList, InlinedCall{
Funcname: elt.Funcname,
ParentName: elt.ParentName,
CallingPc: elt.CallingPc,
ParentEntry: elt.ParentEntry,
Data: elt.Data,
})
}
}

Expand Down

0 comments on commit 190dbd8

Please sign in to comment.