[PATCH v4 2/5] elf: Add SFrame stack tracing

Claudiu Zissulescu-Ianculescu claudiu.zissulescu-ianculescu@oracle.com
Wed Apr 23 16:43:06 GMT 2025


Hi Jens,

> Maybe it would be good to force a fallback to the DWARF backtracer,
> if an object without SFrame information is met.  Except form the
> initial patch:
> 
>> diff --git a/sysdeps/generic/sframe.c b/sysdeps/generic/sframe.c
> 
>> +      pc = frame->pc - sframe_vma;
>> +      /* Find the SFrame Row Entry which contains the PC.  */
>> +      if (sframe_find_fre (dctx, pc, frep) == _URC_END_OF_STACK)
>> +    {
>> +#ifdef MD_DECODE_SIGNAL_FRAME
>> +      /* I cannot find any FREs, try to see if it is a signal
>> +         frame, and if so decode it.  */
>> +      if (MD_DECODE_SIGNAL_FRAME (frame) == _URC_NO_REASON)
>> +        {
>> +          ra_lst[i] = (void *) frame->pc;
>> +          continue;
>> +        }
>> +#endif
>> +      return i;
> 
>       /* Force fallback to DWARF stacktracer.  */
>       return 0;
> 

I think here we can define a new machine hook to detect if we are in the
outer most frame. For example, per x86 ABI FP is clear out, and for
aarch64 LR/FP is zeroed. However, I am not sure if this will work for s390.

What do you think,
Claudiu


More information about the Libc-alpha mailing list