-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebug.asm
56 lines (55 loc) · 910 Bytes
/
debug.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
;;;; This file is for me to look through the decompiled assembly code to better understand the program.
.file "prog.c"
.text
.globl flag
.data
.align 4
.type flag, @object
.size flag, 4
flag:
.long 43981
.globl x
.bss
.align 8
.type x, @object
.size x, 8
x:
.zero 8
.section .rodata
.align 8
.LC0:
.string "Modified flag variable! Flag now: %x"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
jmp .L2
.L3:
movq x(%rip), %rax
addq $1, %rax
movq %rax, x(%rip)
.L2:
movl flag(%rip), %eax
cmpl $43981, %eax
je .L3
movl flag(%rip), %eax
movl %eax, %esi
leaq .LC0(%rip), %rdi
movl $0, %eax
call printf@PLT
movl $0, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (GNU) 10.2.0"
.section .note.GNU-stack,"",@progbits