@@ -329,27 +329,32 @@ static inline EBPF_INLINE bool unwinder_unwind_frame_pointer(UnwindState *state)
329329// calc_line). This should probably be renamed to something like "frame type
330330// specific data".
331331static inline EBPF_INLINE ErrorCode _push_with_max_frames (
332- Trace * trace , u64 file , u64 line , u8 frame_type , u8 return_address , u32 max_frames )
332+ Trace * trace , u64 file , u64 line , u64 extra , u8 frame_type , u8 return_address , u32 max_frames )
333333{
334334 if (trace -> stack_len >= max_frames ) {
335335 DEBUG_PRINT ("unable to push frame: stack is full" );
336336 increment_metric (metricID_UnwindErrStackLengthExceeded );
337337 return ERR_STACK_LENGTH_EXCEEDED ;
338338 }
339339
340+ u64 extra_addr = (u64 )extra & 0x0000FFFFFFFFFFFFULL ;
340341#ifdef TESTING_COREDUMP
341342 // tools/coredump uses CGO to build the eBPF code. This dispatches
342343 // the frame information directly to helper implemented in ebpfhelpers.go.
343- int __push_frame (u64 , u64 , u64 , u8 , u8 );
344+ int __push_frame (u64 , u64 , u64 , u64 , u8 , u8 );
344345 trace -> stack_len ++ ;
345- return __push_frame (__cgo_ctx -> id , file , line , frame_type , return_address );
346+ return __push_frame (__cgo_ctx -> id , file , line , extra_addr , frame_type , return_address );
346347#else
347- trace -> frames [ trace -> stack_len ++ ] = ( Frame ) {
348+ Frame frame = {
348349 .file_id = file ,
349350 .addr_or_line = line ,
350351 .kind = frame_type ,
351352 .return_address = return_address ,
352353 };
354+ if (extra_addr != 0 ) {
355+ __builtin_memcpy (frame .pad , & extra_addr , 6 );
356+ }
357+ trace -> frames [trace -> stack_len ++ ] = frame ;
353358
354359 return ERR_OK ;
355360#endif
@@ -360,19 +365,27 @@ static inline EBPF_INLINE ErrorCode
360365_push_with_return_address (Trace * trace , u64 file , u64 line , u8 frame_type , bool return_address )
361366{
362367 return _push_with_max_frames (
363- trace , file , line , frame_type , return_address , MAX_NON_ERROR_FRAME_UNWINDS );
368+ trace , file , line , 0 , frame_type , return_address , MAX_NON_ERROR_FRAME_UNWINDS );
364369}
365370
366371// Push the file ID, line number and frame type into FrameList
367372static inline EBPF_INLINE ErrorCode _push (Trace * trace , u64 file , u64 line , u8 frame_type )
368373{
369- return _push_with_max_frames (trace , file , line , frame_type , 0 , MAX_NON_ERROR_FRAME_UNWINDS );
374+ return _push_with_max_frames (trace , file , line , 0 , frame_type , 0 , MAX_NON_ERROR_FRAME_UNWINDS );
375+ }
376+
377+ // Push the file ID, line number and frame type with an extra address into FrameList
378+ static inline EBPF_INLINE ErrorCode
379+ _push_with_extra (Trace * trace , u64 file , u64 line , u64 extra , u8 frame_type )
380+ {
381+ return _push_with_max_frames (
382+ trace , file , line , extra , frame_type , 0 , MAX_NON_ERROR_FRAME_UNWINDS );
370383}
371384
372385// Push a critical error frame.
373386static inline EBPF_INLINE ErrorCode push_error (Trace * trace , ErrorCode error )
374387{
375- return _push_with_max_frames (trace , 0 , error , FRAME_MARKER_ABORT , 0 , MAX_FRAME_UNWINDS );
388+ return _push_with_max_frames (trace , 0 , error , 0 , FRAME_MARKER_ABORT , 0 , MAX_FRAME_UNWINDS );
376389}
377390
378391// Send a trace to user-land via the `trace_events` perf event buffer.
0 commit comments