Created
May 8, 2018 13:14
-
-
Save kohnakagawa/f15400cd52d26cbe9ece2d916b5f314b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
00000000004005f0 <caller>: | |
4005f0: ff e7 jmp rdi | |
4005f2: 0f 1f 40 00 nop DWORD PTR [rax+0x0] | |
4005f6: 66 2e 0f 1f 84 00 00 nop WORD PTR cs:[rax+rax*1+0x0] | |
4005fd: 00 00 00 | |
0000000000400600 <func>: | |
400600: 48 83 ec 38 sub rsp,0x38 | |
400604: ba 41 bb ff ff mov edx,0xffffbb41 | |
400609: b9 49 ba ff ff mov ecx,0xffffba49 | |
40060e: 64 48 8b 04 25 28 00 mov rax,QWORD PTR fs:0x28 | |
400615: 00 00 | |
400617: 48 89 44 24 28 mov QWORD PTR [rsp+0x28],rax | |
40061c: 31 c0 xor eax,eax | |
40061e: 48 8d 44 24 04 lea rax,[rsp+0x4] | |
400623: 66 89 54 24 04 mov WORD PTR [rsp+0x4],dx | |
400628: 89 3c 24 mov DWORD PTR [rsp],edi | |
40062b: ba d0 05 40 00 mov edx,0x4005d0 | |
400630: 66 89 4c 24 0a mov WORD PTR [rsp+0xa],cx | |
400635: 48 89 64 24 0c mov QWORD PTR [rsp+0xc],rsp | |
40063a: 48 89 c7 mov rdi,rax | |
40063d: 89 54 24 06 mov DWORD PTR [rsp+0x6],edx | |
400641: c7 44 24 14 49 ff e3 mov DWORD PTR [rsp+0x14],0x90e3ff49 | |
400648: 90 | |
400649: e8 a2 ff ff ff call 4005f0 <caller> | |
40064e: 48 8b 44 24 28 mov rax,QWORD PTR [rsp+0x28] | |
400653: 64 48 33 04 25 28 00 xor rax,QWORD PTR fs:0x28 | |
40065a: 00 00 | |
40065c: 75 05 jne 400663 <func+0x63> | |
40065e: 48 83 c4 38 add rsp,0x38 | |
400662: c3 ret | |
400663: e8 18 fe ff ff call 400480 <__stack_chk_fail@plt> | |
400668: 0f 1f 84 00 00 00 00 nop DWORD PTR [rax+rax*1+0x0] | |
40066f: 00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
__attribute__((noinline)) | |
void caller(void (*fp)(void)) { | |
fp(); | |
} | |
__attribute__((noinline)) | |
void func(int x) { | |
int b = x; | |
void inner_func(void) { | |
printf("%d\n", b); | |
} | |
caller(inner_func); | |
} | |
int main(int argc, char** argv) { | |
func(argc); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment