title: Why doesn't lldb forward my environment variable anymore?
body: <p>I'm working on a patch for FFmpeg and need to debug my code. I'm loading an external library, and in order to test different library versions, I have them in different folders. To select which one I want to use, I've been using <code>DYLD_LIBRARY_PATH=/path/to/lib/dir ./ffmpeg</code> and that works okay. But when I try it within <code>lldb</code>, it crashes saying <code>dyld: Library not loaded</code> and <code>Reason: image not found</code>. This used to work pre-Xcode 7.1, but I just recently upgraded and it stopped working.</p>
  
  <hr>
  
  <p>Here's my MVCE:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main() {
    char* str = getenv("DYLD_LIBRARY_PATH");
    if (str) puts(str);
    else     puts("(null)");
    return 0;
  }
  </code></pre>
  
  <p>Running this program as follows produces the output:</p>
  
  <pre><code>$ ./a.out
  (null)
  $ DYLD_LIBRARY_PATH=/tmp ./a.out
  /tmp
  </code></pre>
  
  <p>That looks okay. But when I try to use lldb it fails:</p>
  
  <pre><code>$ DYLD_LIBRARY_PATH=/tmp lldb ./a.out
  (lldb) target create "./a.out"
  Current executable set to './a.out' (x86_64).
  (lldb) run
  Process 54255 launched: './a.out' (x86_64)
  (null)
  Process 54255 exited with status = 0 (0x00000000)
  </code></pre>
  
  <p>Trying to set the environment variable inside lldb works:</p>
  
  <pre><code>lldb ./a.out
  (lldb) target create "./a.out"
  Current executable set to './a.out' (x86_64).
  (lldb) env DYLD_LIBRARY_PATH=/tmp
  (lldb) run
  Process 54331 launched: './a.out' (x86_64)
  /tmp
  Process 54331 exited with status = 0 (0x00000000) 
  </code></pre>
  
  <p>lldb version (it's from Xcode 7.1):</p>
  
  <pre><code>$ lldb --version
  lldb-340.4.110
  </code></pre>
  
  <p><strong>Question:</strong> Is this an intended new "feature," or is this a new bug in lldb (or am I totally crazy and this never used to work)? I'm quite positive lldb used to forward the <code>DYLD_LIBRARY_PATH</code> environment variable, so how come it isn't anymore?</p>
  
  <hr>
  
  <p>Edit: This is on OS X 10.11.1.</p>