[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Libunwind-devel] How can I decide whether a binary is complied with
From: |
Vladimir Nikulichev |
Subject: |
Re: [Libunwind-devel] How can I decide whether a binary is complied with frame pointers or not |
Date: |
Tue, 9 Dec 2014 12:01:29 +0300 |
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 <address@hidden> 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
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/libunwind-devel