title: How to get environment of a program while debugging it in GDB
body: <p>I am debugging a program in GDB on linux. I am using <code>getenv</code> and <code>setenv</code> calls to read and set environment variables. For example I am calling <code>setenv("TZ", "UTC", 1);</code> to set the TZ environment variable for timezone.</p>
  
  <p>To check if the env variable is set I am using GDB command <code>show environment</code>. This prints all the environment variables and their values. But it dose not show <code>TZ</code> being set.</p>
  
  <p>Even command <code>show environment TZ</code> says <code>Environment variable "TZ" not defined.</code></p>
  
  <p>Is their another way to check the environment of the debugged program?</p>
  
  <p><code>p *(char *) getenv("TZ")</code> reuturns correct value <code>UTC</code>.</p>