致命错误:glibc检测到无效的stdio句柄

时间:2017-10-15 10:10:36

标签: assembly gnu att

我正在使用需要使用fread的GNU编译器在at& t程序集中创建程序。但是当程序到达程序的那一部分时,我收到一条错误消息:"致命错误:glibc检测到无效的stdio句柄"我一直无法找出它的意义或如何修复它,并希望得到一些帮助。这是相关的代码:

    .bss
    file: (.asciz "") #attempted both with and without
    reader: .asciz ""
    pointer:
    .text
    readmode: .asciz "r"
    .global main
    main
    pushq %rbp
    movq %rsp, %rbp

    movq 8(%rsi), %rdi    #moving a the filename to rdi
    movq $readmode, %rsi  #setting the mode to read only
    call fopen
    movq %rax, (file)
    call readchar

readchar:    #this should read in precisely one character at a time
    leaq reader, %rdi
    movq $1, %rsi
    movq $1, %rdx
    movq $file, %rcx
    call fread

call fread上发生错误

0 个答案:

没有答案