Hangup Detected On Fd 0 Error Detected On Stdin
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About run gdb from shell script Us Learn more about Stack Overflow the company Business Learn more about hiring gdb bash developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the
Gdb Pipe
Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Invoke gdb to automatically pass
Gdb Script
arguments to the program being debugged up vote 38 down vote favorite 21 I'd like to write a script that (under certain conditions) will execute gdb and automatically run some program X with some set of arguments Y. Once the program has finished executing the user should remain at gdb's prompt until s/he explicitly exits it. One way to do this would be to have the gdb arguments command line script output the run command plus arguments Y to some file F and then have the script invoke gdb like this: gdb X < F But is there a way to do this without introducing a temporary file? Thanks. shell gdb share|improve this question edited Oct 22 '10 at 18:30 Nathan Fellman 46.5k62191270 asked Nov 26 '08 at 20:54 user41162 193124 add a comment| 8 Answers 8 active oldest votes up vote 23 down vote accepted If you want to run some commands through GDB and then have it exit or run to completion, just do echo commands | gdb X If you want to leave it at the command prompt after running those commands, you can do (echo commands; cat) | gdb X This results in echoing the commands to GDB, and then you type into the cat process, which copies its stdin to stdout, which is piped into GDB. share|improve this answer answered Nov 26 '08 at 20:59 Adam Rosenfield 242k66373493 1 (echo "run params"; cat) | gdb X; # worked a treat, many thanks! –Ian Vaughan Sep 29 '10 at 12:58 2 Note that you lose the shell interactivity if y
[x] Bug8677 - "Hangup detected on fd 0" when reading from a pipe Summary: "Hangup detected http://sourceware.org/bugzilla/show_bug.cgi?id=8677 on fd 0" when reading from a pipe Status: RESOLVED FIXED Alias: http://lists.endsoftwarepatents.org/archive/html/bug-gdb/2010-12/msg00004.html None Product: gdb Classification: Unclassified Component: gdb (show other bugs) Version: 6.0 Importance: P3 enhancement Target Milestone: --- Assignee: Not yet assigned to anyone URL: Keywords: Depends on: Blocks: Reported: 2004-02-26 02:08 UTC by degraaf Modified: 2011-05-25 07:59 UTC (History) CC List: 3 users (show) bvstraalen command line gdb-prs tromey See Also: Host: Target: Build: Last reconfirmed: Attachments Add an attachment (proposed patch, testcase, etc.) Note You need to log in before you can comment on or make changes to this bug. Description degraaf 2004-02-26 02:08:00 UTC [Converted from Gnats 1572] When stdin is redirected to a pipe, gdb exits with the following error message: [degraaf@silmaril gdb-6.0]$ hangup detected on echo "quit" | gdb/gdb /bin/ls GNU gdb 6.0 Copyright 2003 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"... (no debugging symbols found)... (gdb) Hangup detected on fd 0 error detected on stdin I have also observed this behaviour with GNU gdb Red Hat Linux (5.3.90-0.20030710.41rh) on the same system (Fedora Linux 1's build), and on GNU gdb 5.0 on a Solaris 8 system (SunOS cse 5.8 Generic_108528-27 sun4u sparc SUNW,Ultra-2) Release: GNU gdb 6.0 Environment: uname -a: Linux localhost 2.4.22-1.2166.nptl #1 Fri Jan 30 13:52:48 EST 2004 i686 athlon i386 GNU/Linux gcc -v: Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.3.2 20031022 (Red Hat Linux 3.3.2-1) gdb configuration: This GDB was configured as "i686-pc-linux-gnu". How-To-
29 Nov 2010 12:20:19 +0300 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (windows-nt) kenorb
writes: > Tried this: >> echo run | gdb ls > (gdb) Hangup detected on fd 0 > error detected on stdin > > And this: >> echo run | gdb -x /dev/stdin ls > Program exited normally. > (gdb) Hangup detected on fd 0 > error detected on stdin > > Nothing in help and manual. > Anything? $ echo run >> commands $ gdb -q --command=commands uname (no debugging symbols found)...(no debugging symbols found)... Linux (no debugging symbols found)... Program exited normally. (gdb) Aleksandr. reply via email to [Prev in Thread] Current Thread [Next in Thread] gdb: How to run debugger on start, kenorb, 2010/12/09 Re: gdb: How to run debugger on start, Aleksandr Vinokurov<= Prev by Date: Symbols are not loaded from QT33 (even there are) Next by Date: improperly generated PDF at gnu.org/software/gdb/documentation Previous by thread: gdb: How to run debugger on start Next by thread: Symbols are not loaded from QT33 (even there are) Index(es): Date Thread