Hi! Since in ARM state the value of PC is the address of the current instruction plus 8 bytes, the code inspecting the value of PC stored at FP + 0 should look at location PC - 16 : PC - 8 points to the stmfd instruction, PC - 16 points two words before, where the top 8 bits are set.
gcc/ 2019-12-14 Jérémy Lefaure <jer...@lefaure.fr> * config/arm/arm.c (-mpoke-function-name): Fix documentation in comment. * doc/invoke.texi (-mpoke-function-name): Fix documentation. Index: gcc/config/arm/arm.c =================================================================== --- gcc/config/arm/arm.c +++ gcc/config/arm/arm.c @@ -20738,9 +20738,9 @@ arm_asm_declare_function_name (FILE *file, const c When performing a stack backtrace, code can inspect the value of 'pc' stored at 'fp' + 0. If the trace function then looks - at location pc - 12 and the top 8 bits are set, then we know + at location pc - 16 and the top 8 bits are set, then we know that there is a function name embedded immediately preceding this - location and has length ((pc[-3]) & 0xff000000). + location and has length ((pc[-4]) & 0xff000000). We assume that pc is declared as a pointer to an unsigned long. Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi +++ gcc/doc/invoke.texi @@ -18080,9 +18080,9 @@ preceding the function prologue. The generated co When performing a stack backtrace, code can inspect the value of @code{pc} stored at @code{fp + 0}. If the trace function then looks at -location @code{pc - 12} and the top 8 bits are set, then we know that +location @code{pc - 16} and the top 8 bits are set, then we know that there is a function name embedded immediately preceding this location -and has length @code{((pc[-3]) & 0xff000000)}. +and has length @code{((pc[-4]) & 0xff000000)}. @item -mthumb @itemx -marm