[ale] OT: Sending Commands to GDB

Michael Potter michael at potter.name
Wed Jan 19 00:22:46 EST 2011


My curiosity got the best of me and I did some experimenting.

gdb is opening the command file with regular open commands.
It uses mmap and mmap2 liberally for other file.

So it is curious why stdin and named pipe do not work.

gdb does a successful stat64 on the named pipe and then abruptly exits as
tho it is coded to look for named pipes and exit.

I don't have the energy to look at the source for gdb to get the conclusive
answer.

Good luck and let us know what you learn.

-- 
Michael Potter



On Tue, Jan 18, 2011 at 11:47 PM, Michael Potter <michael at potter.name>wrote:

> I am going to guess that gdb opens the file with mmap and therefore cannot
> read from stdin or the named pipe.
>
> I am basing that guess on my other guess that gdb would want easy access to
> randomly access the file it is working on.
>
> For the benefit of others who are reading this post:  <(...) is just bash
> syntax for a named pipe.
>
> --
> Michael Potter
>
>
> On Tue, Jan 18, 2011 at 10:53 PM, Brian Pitts <brian at polibyte.com> wrote:
>
>> 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
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20110119/d6fe9fef/attachment-0001.html 


More information about the Ale mailing list