I think you should parse frame information in a binary and check whether all 
functions have such pattern:

00000050 000000000000001c 00000054 FDE cie=00000000 
pc=00000000000365e0..0000000000036606
  DW_CFA_advance_loc: 1 to 00000000000365e1
  DW_CFA_def_cfa_offset: 16
  DW_CFA_offset: r6 (rbp) at cfa-16
  DW_CFA_advance_loc: 3 to 00000000000365e4
  DW_CFA_def_cfa_register: r6 (rbp)

You can play around with readelf --debug-dump=frames to see more examples.
Dwarf specification may be helpful: http://www.dwarfstd.org/Download.php

--
Vladimir

> On 09 Dec 2014, at 11:34, Chenggang <[email protected]> wrote:
> 
> Hi, all:
>      I want to unwind the call trace of a binary or kernel (linux). If I can 
> decide whether the binary or kernel use the frame pointers, I can process the 
> stack in 2 different ways. While they use the frame pointer, I can walk the 
> stack in a while loop. While they don't use the frame pointers, I can copy 
> the stack into user space, and unwind it with libunwind, like perf events.
>     So, is there any way to decide the binary is compiled with frame pointers 
> on the fly?
> 
> regards
> Chenggang
> 
> thanks
> 
> 
> _______________________________________________
> Libunwind-devel mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/libunwind-devel


_______________________________________________
Libunwind-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/libunwind-devel

Reply via email to