gdb/2210: 'set env' and 'shell' Underlying Environments are Different

Daniel Jacobowitz
Thu Dec 7 15:28:00 GMT 2006

The following reply was made to PR gdb/2210; it has been noted by GNATS.

From: Daniel Jacobowitz <>
Subject: Re: gdb/2210: 'set env' and 'shell' Underlying Environments are Different
Date: Thu, 7 Dec 2006 10:17:58 -0500

 On Mon, Dec 04, 2006 at 05:38:57PM -0000, wrote:
 > set env CURTIME=1165253337
 > show env CURTIME
 > shell date -d '1970-01-01 $CURTIME sec'
 Your quoting is wrong; this will use a literal '$CURTIME'.
 > The third command fails, because the 'set env' and 'shell' do not share the same environment.
 (gdb) help set env
 Set environment variable value to give the program.
 Arguments are VAR VALUE where VAR is variable name and VALUE is value.
 VALUES of environment variables are uninterpreted strings.
 This does not affect the program until the next "run" command.
 Right or wrong, that's at least what they're documented to do; set env
 only affects run.  The opposite behavior would, I think, be very
 confusing.  Suppose you set an LD_PRELOAD for the program you
 wanted to debug; it shouldn't apply to "shell grep".
 Daniel Jacobowitz

More information about the Gdb-prs mailing list