@@ -214,22 +214,25 @@ func Loader(ebpf interpreter.EbpfHandler, info *interpreter.LoaderInfo) (interpr
214214 return nil , fmt .Errorf ("symbol 'etp_heap_bits_subtag' not found: %v" , err )
215215 }
216216
217- erts_frame_layout , _ , err := ef .SymbolData ("erts_frame_layout" , 8 )
218- if err != nil {
219- return nil , fmt .Errorf ("symbol 'erts_frame_layout' not found: %v" , err )
220- }
221-
222217 d := & beamData {
223218 version : otpVersion ,
224219 the_active_code_index : uint64 (codeIndex .Address ),
225220 r : uint64 (r ),
226221 erts_atom_table : uint64 (atomTable .Address ),
227- erts_frame_layout : uint64 (erts_frame_layout .Address ),
228222 etp_ptr_mask : nopanicslicereader .Uint64 (etp_ptr_mask , 0 ),
229223 etp_header_subtag_mask : nopanicslicereader .Uint64 (etp_header_subtag_mask , 0 ),
230224 etp_heap_bits_subtag : nopanicslicereader .Uint64 (etp_heap_bits_subtag , 0 ),
231225 }
232226
227+ // If erts_frame_layout is not defined, it means that frame pointers are not supported,
228+ // so we use a special address value to signify that they're not enabled.
229+ erts_frame_layout_symbol , _ , err := ef .SymbolData ("erts_frame_layout" , 8 )
230+ if err == nil {
231+ d .erts_frame_layout = uint64 (erts_frame_layout_symbol .Address )
232+ } else {
233+ d .erts_frame_layout = ^ uint64 (0 )
234+ }
235+
233236 vms := & d .vmStructs
234237
235238 // These values are the same on OTP releases 27.2.4 and 28.0.2.
@@ -281,11 +284,18 @@ func (d *beamData) Attach(ebpf interpreter.EbpfHandler, pid libpf.PID, bias libp
281284 Version : d .version ,
282285 R : uint64 (bias ) + d .r ,
283286 The_active_code_index : uint64 (bias ) + d .the_active_code_index ,
284- Erts_frame_layout : rm .Uint64 (bias + libpf .Address (d .erts_frame_layout )),
285287 Ranges_sizeof : uint8 (d .vmStructs .ranges .size_of ),
286288 Ranges_modules : uint8 (d .vmStructs .ranges .modules ),
287289 Ranges_n : uint8 (d .vmStructs .ranges .n ),
288290 }
291+
292+ if d .erts_frame_layout == ^ uint64 (0 ) {
293+ // If frame pointers are not supported, they will not be used
294+ data .Erts_frame_layout = uint64 (0 )
295+ } else {
296+ data .Erts_frame_layout = rm .Uint64 (bias + libpf .Address (d .erts_frame_layout ))
297+ }
298+
289299 if err := ebpf .UpdateProcData (libpf .BEAM , pid , unsafe .Pointer (& data )); err != nil {
290300 return nil , err
291301 }
0 commit comments