<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - getenv() returns a null char* when debugging with lldb"
   href="https://llvm.org/bugs/show_bug.cgi?id=23465">23465</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>getenv() returns a null char* when debugging with lldb
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.3
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>samuel.tebbs@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When calling getenv() with a valid environment variable name, a null char* is
returned and the following error report is shown by lldb when calling "new
std::string()" with the return value of getenv():

Process 21805 stopped
* thread #1: tid = 0x172288, 0x00007fff80e61152 libsystem_c.dylib`strlen + 18,
queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
address=0x0)
    frame #0: 0x00007fff80e61152 libsystem_c.dylib`strlen + 18
libsystem_c.dylib`strlen:
->  0x7fff80e61152 <+18>: pcmpeqb (%rdi), %xmm0
    0x7fff80e61156 <+22>: pmovmskb %xmm0, %esi
    0x7fff80e6115a <+26>: andq   $0xf, %rcx
    0x7fff80e6115e <+30>: orq    $-0x1, %rax
(lldb) v
lldb-330.0.44

This doesn't happen when executing the compiled binary without lldb.

Using Mac OS X v10.10.3 (Yosemite)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>