<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 --- - Cannot inspect const static variable"
   href="https://llvm.org/bugs/show_bug.cgi?id=25653">25653</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Cannot inspect const static variable
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>verena@codeplay.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15359" name="attach_15359" title="simple test case with a const static">attachment 15359</a> <a href="attachment.cgi?id=15359&action=edit" title="simple test case with a const static">[details]</a></span>
simple test case with a const static

Calling "expr" or "target variable" on a constant static global in C doesn't
work. The error is

error: use of undeclared identifier 'limit'

or

error: can't find global variable 'limit'

It seems the variable is given the 'DW_AT_const_value' DWARF attribute. However
lldb can't find it. If you compile slightly differently so is has a
'DW_AT_location' attribute instead, lldb deals with it okay.

This works in gcc, which produces a 'DW_AT_location' attribute.

To reproduce compile with "clang -g -O0 InspectConstStatic.c"
Then call lldb with the commands:

b main
r
expr limit</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>