<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 --- - clang needs -fvar-tracking{-assignments} like gcc" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23636&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=C4gha9Gqsd7bn3uhxfRwIULe2U1-bWzL2BihfUqjPdA&s=xccsIBECwj9gtdTPOjgW9IjfDJnO1ooT8MgyLF5JD9o&e=">23636</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang needs -fvar-tracking{-assignments} like gcc
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>yanegomi@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>clang currently optimizes code away really quickly, which means that it's
extremely hard to debug code in gdb [7.9] when -O0 is not specified on the
command line (which is unfortunately the default on FreeBSD with both kernel
and userland) and when -g is specified on the command line as well.

I've done some experimentation and it seems that gcc 4.9 and gcc 5.0 support
this well.

I spoke with a colleague and it appears that gcc grew support for additional
flags/DWARF output formats that clang could leverage:
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__gcc.gnu.org_wiki_Var-5FTracking-5FAssignments&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=C4gha9Gqsd7bn3uhxfRwIULe2U1-bWzL2BihfUqjPdA&s=aBom5Usq-9nJBWVtvPZXd8pUSzHr3fCc4h89KhRK8Ac&e=">https://gcc.gnu.org/wiki/Var_Tracking_Assignments</a> . It would be really
fantastic if clang supported this so then developers could debug code without
having to jump down into the assembler to figure out where the value for the
variable has gone and then determine what it's currently set to.

My example testcase/results "gatherer" can be found here:
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_yaneurabeya_scratch_tree_master_testing_freebsd_crashalot_&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=C4gha9Gqsd7bn3uhxfRwIULe2U1-bWzL2BihfUqjPdA&s=uIXrjUqo84ZuDF2AmahzpZ8pe0L8SkfsaC9NJKxhP1k&e=">https://github.com/yaneurabeya/scratch/tree/master/testing/freebsd/crashalot/</a> .
You'll  have to install the following things on FreeBSD 11.0-CURRENT:
- clang33,
- clang34,
- clang35,
- clang36 [base],
- gcc [base]
- gcc48,
- gcc49,
- gcc5
- gdb [base]
- gdb66
- gdb49
Then run "make crash-dummy-test".
Finally, do cd `make -V.OBJDIR` and look at all of the run.*txt files.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>