[ale] OT: Sending Commands to GDB

Brian Pitts brian at polibyte.com
Tue Jan 18 22:53:11 EST 2011


Hi,

I'm trying to non-interactively use gdb, but I can't get it to work.
Below is an example of what I'm trying and failing to accomplish. I
expected the first two commands to print the same thing that the third
command does. Instead, they print nothing. Can anyone explain why and/or
show me a workaround that doesn't involve a temporary file?

$ echo pwd | gdb -batch -x /dev/stdin /bin/true

$ gdb -batch -x <(/bin/echo pwd) /bin/true

$ echo pwd > gdb_script && gdb -batch -x gdb_script /bin/true
Working directory /home/brian.

Without batch mode, gdb reports for command #1

/dev/stdin: No such file or directory.
(gdb) Hangup detected on fd 0
error detected on stdin

and for command #2

/proc/self/fd/63: No such file or directory.

-- 
All the best,
Brian Pitts


More information about the Ale mailing list