Does logging work with fifo?

Sergio Durigan Junior
Tue Jan 22 20:06:00 GMT 2019

On Tuesday, January 22 2019, Peng Yu wrote:

> I use the following command in the batch mode to print out the
> backtrace information.  /tmp/tmp.TNLBr685Zp is a fifo.
> ###
> set logging redirect
> set logging file /tmp/tmp.TNLBr685Zp
> set logging on
> commands 1-2644
> backtrace 2
> continue
> end
> run
> ###
> While the gdb process runs in the background (via & in shell), the
> fifo is catted (via the command cat) and piped (via pipeline '|' in
> shell) to a following process for reading and processing the logging
> output. However, it seems that sometimes it finishes prematurely. I
> have no clue what the problem is. Could it be that logging does not
> work well with fifo?

Initially I don't see a reason why this shouldn't work.  I did a very
basic test here and didn't find any problems, but it seems you have a
massive number of breakpoints and the generated output is much more than
I was able to generate.  What I did here was run a "while 1" command,
print a backtrace, and send all the output to the fifo.  No problems.

When you say that it "sometimes finishes prematurely", I assume that
it's not every time, correct?  Did you try running GDB from another
terminal, instead of running it in the background, to see if there's
anything happening there?


GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible

More information about the Gdb mailing list