f85aa85895
Use ELR register value instead of LR for PMC_TRAPFRAME_TO_PC macro since it's the former that indicates PC if the interrupted execution thread. This fixes a bug where pmcstat lost the leaf function of the call chain and started with the second function in the chain. Although this change is an improvement over the previous logic there is still posibility for incomplete data: if the leaf function does not have stack variables and does not call any other functions compiler would not generate a stack frame for it and the FP value would point to the caller's frame, so instead of the actual "caller1 -> caller2 -> leaf" chain only "caller1 -> leaf" would be captured. Sponsored by: Ampere Computing Submitted by: Klara, Inc.