@@ gdb /home/proj/grep/b3.1/src/grep GNU gdb (GDB) Fedora 7.11.1-86.fc24 ... For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/proj/grep/b3.1/src/grep...done. (gdb) set args . < fifo (gdb) br reset Breakpoint 1 at 0x4050c2: file ../../grep-3.1/src/grep.c, line 847. (gdb) br grep.c:856 <==== break-point on "if (seek_failed)" in grep.c/reset() Breakpoint 2 at 0x4055d6: file ../../grep-3.1/src/grep.c, line 856. (gdb) run Starting program: /home/proj/grep/b3.1/src/grep . < fifo Using another terminal, execute: echo aaa > fifo (open() for write resumes the open() call above) Missing separate debuginfos, use: dnf debuginfo-install glibc-2.23.1-12.fc24.x86_64 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Breakpoint 1, grep (ineof=, st=0x7fffffffdaa0, fd=0) at ../../grep-3.1/src/grep.c:1447 1447 if (! reset (fd, st)) Missing separate debuginfos, use: dnf debuginfo-install pcre-8.41-1.fc24.x86_64 (gdb) cont Continuing. Breakpoint 2, reset (st=0x7fffffffdaa0, fd=0) at ../../grep-3.1/src/grep.c:856 856 if (seek_failed) (gdb) p seek_failed $1 = true (gdb) p bufoffset $2 = -1 (gdb) p errno $3 = 29 # ESPIPE (= illegal seek) (gdb) cont Continuing. aaa # output of grep as expected/desired [Inferior 1 (process 10652) exited normally] (gdb) quit @@ =====