Merge branch 'master' of gaufre.informatique.univ-paris-diderot.fr:aguatto/compilation-m1-2023 into jalon6
This commit is contained in:
commit
4db39f807f
2 changed files with 100 additions and 0 deletions
63
tp/tp-debug-x86-64/minimum-wrong.s
Normal file
63
tp/tp-debug-x86-64/minimum-wrong.s
Normal file
|
@ -0,0 +1,63 @@
|
|||
; Ce programme devrait calculer et afficher la valeur minimale du tableau
|
||||
; { 1, 5, 5, 6, 3, -1, 4, 37, -73, 0 }
|
||||
|
||||
.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
|
37
tp/tp-debug-x86-64/segfault.s
Normal file
37
tp/tp-debug-x86-64/segfault.s
Normal 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
|
Reference in a new issue