Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GDB调试器在读取文本文件时挂起Fortran READ命令_Fortran_Gdb_Gfortran - Fatal编程技术网

GDB调试器在读取文本文件时挂起Fortran READ命令

GDB调试器在读取文本文件时挂起Fortran READ命令,fortran,gdb,gfortran,Fortran,Gdb,Gfortran,这是我的fortran代码(fortcode.for) 我使用以下命令将fortran文件编译成可执行文件(fortexec.exe) gfortran -g -fno-align-commons fortcode.for -o fortexec.exe 然后我通过键入 gdb fortexec 然后我给它以下文件输入(input.inp) 通过键入以下命令 run < input.inp 有没有办法阻止它挂起,并使用文件输入进行调试? 谢谢您可能没有提供正确的输入文件名,您的设置与

这是我的fortran代码(fortcode.for)

我使用以下命令将fortran文件编译成可执行文件(fortexec.exe)

gfortran -g -fno-align-commons fortcode.for -o fortexec.exe
然后我通过键入

gdb fortexec
然后我给它以下文件输入(input.inp)

通过键入以下命令

run < input.inp
有没有办法阻止它挂起,并使用文件输入进行调试?
谢谢

您可能没有提供正确的输入文件名,您的设置与我的笔记本电脑上的gfortran没有任何问题。如果我给出不可抗拒的输入,它会冻结,在CTRL+C之后,我会得到相同的警告。我会打印所读取的内容,只是为了验证它是否正常工作

,所以当你使用GDB调试器时它运行良好?我认为你在这里有点太快了。这可能是Windows、MinGW和GCC各种版本之间实际相互作用的一个问题。由于OP花费了相当多的精力来诊断它(这是一个老问题的后续问题),我倾向于相信这个问题是真实的,可能更难重现。一般来说,在StackOverflow上,至少在fortran标记中,我们倾向于在合理确定什么可能是问题时回答,而不仅仅是猜测。我不知道这是某种更深层次的测试运行。是的,我确实使用GDB调试器运行过,我使用的是:mingw-w64 x86_64-8.1.0-posix-seh-rt_v6-rev0。我只是复制代码和输入数据,在我的笔记本电脑上运行。我对GDB调试器最感兴趣。代码运行得很好,我在读取行下面添加了一行,以检查它是如何读取数据文件的。因为它确实有效,我认为唯一的可能性就是输入的问题。我只是故意在命令中输入错误的文件名,它并没有在空文件或不存在的文件上给出错误消息。只是想在我有时间的时候帮忙。
  testx testy testz                    
  testx testy testz
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety
  testk tety 
run < input.inp
  [New Thread 10804.0x5b6c]
  [New Thread 10804.0x4974]
  [New Thread 10804.0x3c24]
  [New Thread 10804.0x4ae8]
  At line 11 of file fortcode.for (unit = 5, file = 'stdin')
  Fortran runtime error: [New Thread 10804.0x48e8]
  End of file

  Error termination. Backtrace:

  Program received signal SIGINT, Interrupt.
  [Switching to Thread 10804.0x48e8]
  0x765b1985 in KERNELBASE!CtrlRoutine () from 
  C:\WINDOWS\SysWOW64\KernelBase.dll