From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Dubuc To: tromey@redhat.com Cc: Orjan Friberg , Grant Edwards , gdb@sourceware.cygnus.com Subject: Re: Redirect GDB command output? Date: Fri, 05 Oct 2001 11:44:00 -0000 Message-id: <3BBDFF99.B9F3FA85@cas.org> References: <3BBB60BB.BB99CB3F@cas.org> <20011005092623.A1275@visi.com> <3BBDCDD9.6E281600@axis.com> <3BBDE11F.F55360ED@cas.org> <87vghuszgw.fsf@creche.redhat.com> X-SW-Source: 2001-10/msg00068.html Tom Tromey wrote: > > >>>>> "Paul" == Paul Dubuc writes: > > Paul> No, I was looking for something more like the redirect > Paul> capability for the output of individual commands from the gdb > Paul> prompt. Some dbx functions our project uses rely on this > Paul> capability in dbx and (unfortunately) I see no way of > Paul> reproducing those functions with gdb user-defined commands. > > I don't think it would be very hard to write `>' (redirect) and `>>' > (redirect-append) commands for gdb. Maybe you could even have a `|' > command that would pipe output through another process (this might be > harder due to portability constraints). > > The easiest way to do this would be to have prefix commands. For > instance `> file command' would run command with output redirected to > file. `> file' would redirect output for all subsequence command > lines. Plain `>' would then stop redirecting the output. > > Likewise for `>>'. Something like `|' would probably need a slightly > different syntax (for instance simply disallow a trailing gdb > command). > > Using a prefix command feels a bit strange, but I implementation-wise > is probaby much, much easier. > > Tom Thanks for the suggestion, Tom. It would feel strange to do it this way. Sun's dbx implements functions and aliases as extenstions to ksh. I like this because it's familiar, but there are portability constraints with gdb, I know. Something that might work just as well is a new command 'redirect' that would just redirect all command output to a file that you specify (possibly with the option of 'tee'ing it there instead of redirecting completely) until 'redirect' is called again to change the destination. Would this be any easier to implement? -- Paul M. Dubuc pdubuc@cas.org