This is a discussion on gdb to file question within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> Hi, I'm trying to find a way to send gdb output to some "text" file like gdb myprog > ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I'm trying to find a way to send gdb output to some "text" file like gdb myprog > gdb.txt, so I wouldn't have to copy all the output by hand, but I've been unable to do so so far. Is it possible at all ? Any help would be greatly appreciated ;-) Thanks --------- Salta, On Slackware since 1993 ( true ;-) ) |
| |||
| salta wrote: > I'm trying to find a way to send gdb output to some "text" file like > gdb myprog > gdb.txt, so I wouldn't have to copy all the output by > hand, but I've been unable to do so so far. What I've done for that is something along the lines of the following: script gdb.txt gdb myprog exit # (exits from script subshell) vim gdb.txt # (fix up line endings) If you want something that's scriptable, it's possible that gdb's "-batch" option might be useful for you. I've never used that option, but I imagine that it can be used only in conjunction with other options (to feed commands to gdb from an input file, for example). > Is it possible at all ? I hope the above helps ... -- ---------------------------------------------------------------------- Sylvain Robitaille syl@alcor.concordia.ca Systems and Network analyst Concordia University Instructional & Information Technology Montreal, Quebec, Canada ---------------------------------------------------------------------- |
| |||
| salta@mynet.net wrote : > Is it possible at all ? You could try pipe the output through the 'tee' command like this: 'gdb myprog | tee gdb.txt' -- Thomas O. This area is designed to become quite warm during normal operation. |
| |||
| "salta" typed: > I'm trying to find a way to send gdb output to some "text" file like > gdb myprog > gdb.txt, so I wouldn't have to copy all the output by > hand, but I've been unable to do so so far. > > Is it possible at all ? > > Any help would be greatly appreciated ;-) One way I can think of (and have actually tried and found to work) is to put all the GDB commands that you would execute in a file, one on a line, and then call GDB with the -x argument and redirect its output to another file. For example, if the file with all t thneeded GDB commands is file.gdb_cmd, you could do: ayaz$ gdb -q -x file.gdb_cmd > file.out Of course, this will make the GDB session non-interactive, which might be a problem. -- Ayaz Ahmed Khan Then, gently touching my face, she hesitated for a moment as her incredible eyes poured forth into mine love, joy, pain, tragedy, acceptance, and peace. "'Bye for now," she said warmly. -- Thea Alexander, "2150 A.D." |
| |||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NotDashEscaped: You need GnuPG to verify this message * salta <salta@mynet.net> writes: > I'm trying to find a way to send gdb output to some "text" file > like gdb myprog > gdb.txt, so I wouldn't have to copy all the output > by hand, but I've been unable to do so so far. > Is it possible at all ? Certainly! $ gdb myprog core 2>&1 | tee gdb.txt Is one way. But if you use emacs, `M-x gdb' is _much_ easier. :-) -- |---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---| | Genius - Is the ability to reduce | | the complicated to the simple | |----------------------------------<steve@youngs.au.com>---| -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.4 (GNU/Linux) Comment: The SXEmacs Project <http://www.sxemacs.org> Comment: Eicq - The SXEmacs ICQ Client <http://www.eicq.org/> iEYEARECAAYFAkUP3roACgkQHSfbS6lLMANphACfejltERcX5/CIptF8yhzFnWQq figAni3jqR84CwfmCiUA5YR+XpgYPA+z =froe -----END PGP SIGNATURE----- |
| ||||
| Hi Many thanks to all Steve Youngs wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > NotDashEscaped: You need GnuPG to verify this message > > * salta <salta@mynet.net> writes: > > > I'm trying to find a way to send gdb output to some "text" file > > like gdb myprog > gdb.txt, so I wouldn't have to copy all the output > > by hand, but I've been unable to do so so far. > > > Is it possible at all ? > > Certainly! > > $ gdb myprog core 2>&1 | tee gdb.txt > > Is one way. But if you use emacs, `M-x gdb' is _much_ easier. :-) > |