@@ -17,9 +17,6 @@ const (
17
17
funcdata_InlTree = 3
18
18
)
19
19
20
- func (f funcData ) npcdata () uint32 { return f .field (7 ) }
21
- func (f funcData ) nfuncdata () uint32 { return uint32 (f .data [f .fieldOffset (9 )+ 3 ]) }
22
-
23
20
// InlineTree returns the inline tree for Func f as a sequence of InlinedCalls.
24
21
// goFuncValue is the value of the gosym.FuncSymName symbol.
25
22
// baseAddr is the address of the memory region (ELF Prog) containing goFuncValue.
@@ -88,23 +85,29 @@ type rawInlinedCall112 struct {
88
85
// rawInlinedCall120 is the encoding of entries in the FUNCDATA_InlTree table
89
86
// from Go 1.20. It is equivalent to runtime.inlinedCall.
90
87
type rawInlinedCall120 struct {
91
- FuncID uint8 // type of the called function
92
- _ [3 ]byte
93
- NameOff int32 // offset into pclntab for name of called function
94
- ParentPC int32 // position of an instruction whose source position is the call site (offset from entry)
88
+ FuncID uint8 // type of the called function
89
+ _ [3 ]byte
90
+ NameOff int32 // offset into pclntab for name of called function
91
+ ParentPC int32 // position of an instruction whose source position is the call site (offset from entry)
92
+ StartLine int32 // line number of start of function (func keyword/TEXT directive)
93
+ }
94
+
95
+ func (f funcData ) npcdata () uint32 { return f .field (7 ) }
96
+ func (f funcData ) nfuncdata (numFuncFields uint32 ) uint32 {
97
+ return uint32 (f .data [f .fieldOffset (numFuncFields - 1 )+ 3 ])
95
98
}
96
99
97
- func (f funcData ) funcdataOffset (i uint8 ) uint32 {
98
- if uint32 (i ) >= f .nfuncdata () {
100
+ func (f funcData ) funcdataOffset (i uint8 , numFuncFields uint32 ) uint32 {
101
+ if uint32 (i ) >= f .nfuncdata (numFuncFields ) {
99
102
return ^ uint32 (0 )
100
103
}
101
104
var off uint32
102
105
if f .t .version >= ver118 {
103
- off = f .fieldOffset (10 ) + // skip fixed part of _func
106
+ off = f .fieldOffset (numFuncFields ) + // skip fixed part of _func
104
107
f .npcdata ()* 4 + // skip pcdata
105
108
uint32 (i )* 4 // index of i'th FUNCDATA
106
109
} else {
107
- off = f .fieldOffset (10 ) + // skip fixed part of _func
110
+ off = f .fieldOffset (numFuncFields ) + // skip fixed part of _func
108
111
f .npcdata ()* 4
109
112
off += uint32 (i ) * f .t .ptrsize
110
113
}
@@ -121,11 +124,11 @@ func (f funcData) fieldOffset(n uint32) uint32 {
121
124
return sz0 + (n - 1 )* 4 // subsequent fields are 4 bytes each
122
125
}
123
126
124
- func (f funcData ) pcdataOffset (i uint8 ) uint32 {
127
+ func (f funcData ) pcdataOffset (i uint8 , numFuncFields uint32 ) uint32 {
125
128
if uint32 (i ) >= f .npcdata () {
126
129
return ^ uint32 (0 )
127
130
}
128
- off := f .fieldOffset (10 ) + // skip fixed part of _func
131
+ off := f .fieldOffset (numFuncFields ) + // skip fixed part of _func
129
132
uint32 (i )* 4 // index of i'th PCDATA
130
133
return f .t .binary .Uint32 (f .data [off :])
131
134
}
@@ -134,11 +137,11 @@ func (f funcData) pcdataOffset(i uint8) uint32 {
134
137
// pc-value table in info. This is the only way to determine how many
135
138
// IndexedCalls are in an inline tree, since the data of the tree itself is not
136
139
// delimited in any way.
137
- func (t * LineTable ) maxInlineTreeIndexValue (info funcData ) int {
140
+ func (t * LineTable ) maxInlineTreeIndexValue (info funcData , numFuncFields uint32 ) int {
138
141
if info .npcdata () <= pcdata_InlTreeIndex {
139
142
return - 1
140
143
}
141
- off := info .pcdataOffset (pcdata_InlTreeIndex )
144
+ off := info .pcdataOffset (pcdata_InlTreeIndex , numFuncFields )
142
145
p := t .pctab [off :]
143
146
val := int32 (- 1 )
144
147
max := int32 (- 1 )
0 commit comments