TP debug x86-64

This commit is contained in:
Guillaume Geoffroy 2023-12-18 15:42:35 +01:00
parent 26259aa774
commit 3b0cb4b737
2 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,60 @@
.file "min.c"
.text
.globl min
.type min, @function
min:
.LFB22:
.cfi_startproc
movl (%rdi), %eax
cmpl $1, %esi
jbe .L1
leaq 4(%rdi), %rdx
leal -2(%rsi), %ecx
leaq 8(%rdi,%rcx,4), %rsi
.L3:
movl (%rdx), %ecx
cmpl %ecx, %eax
cmovl %ecx, %eax
addq $4, %rdx
cmpq %rsi, %rdx
jne .L3
.L1:
ret
.cfi_endproc
.LFE22:
.size min, .-min
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d\n"
.text
.globl main
.type main, @function
main:
.LFB23:
.cfi_startproc
subq $56, %rsp
.cfi_def_cfa_offset 64
movl $1, (%rsp)
movl $5, 4(%rsp)
movl $5, 8(%rsp)
movl $6, 12(%rsp)
movl $3, 16(%rsp)
movl $-1, 20(%rsp)
movl $4, 24(%rsp)
movl $37, 28(%rsp)
movl $-73, 32(%rsp)
movl $0, 36(%rsp)
movq %rsp, %rdi
movl $10, %esi
call min
movl %eax, %esi
leaq .LC0(%rip), %rdi
movl $0, %eax
call printf@PLT
movl $0, %edi
call exit@PLT
.cfi_endproc
.LFE23:
.size main, .-main
.ident "GCC: (Debian 8.2.0-13) 8.2.0"
.section .note.GNU-stack,"",@progbits

View file

@ -0,0 +1,37 @@
.file "segfault.c"
.text
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "rtbbdrr"
.text
.globl main
.type main, @function
main:
.LFB22:
.cfi_startproc
subq $8, %rsp
.cfi_def_cfa_offset 16
movl $9, %edi
call malloc@PLT
movl $0, %esi
movl $114, %edx
movl $0, %ecx
leaq .LC0(%rip), %rdi
.L2:
addl $1, %edx
movb %dl, (%rax,%rcx)
addl $1, %esi
movl %esi, %ecx
movzbl (%rdi,%rcx), %edx
testb %dl, %dl
jne .L2
movb $0, (%rax,%rcx)
movl $0, %edi
call puts@PLT
movl $0, %edi
call exit@PLT
.cfi_endproc
.LFE22:
.size main, .-main
.ident "GCC: (Debian 8.2.0-13) 8.2.0"
.section .note.GNU-stack,"",@progbits