[Bug 45471] New: SymbolFileDWARF::ParseVariableDIE consider all constant variables as "static"

Bug ID 45471
Summary SymbolFileDWARF::ParseVariableDIE consider all constant variables as “static”
Product lldb
Version unspecified
Hardware PC
OS All
Status NEW
Severity enhancement
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter ditaliano@apple.com
CC jdevlieghere@apple.com, llvm-bugs@lists.llvm.org

SymbolFileDWARF::ParseVariableDIE has the following code:

          if (location_is_const_value_data)
            scope = eValueTypeVariableStatic;
          else {
            scope = eValueTypeVariableLocal;

So every variable that just has a constant value, and isn’t in a location, is
treated as a file static.  That means, for instance, if you build this:

volatile int a; 
   main() {
          {
            int b = 3;
            a;
          }
        }

Break on line 5 and run to it, you get:

(lldb) frame var 
(lldb)

It is a local variable, however, so we should print it.

Davide Italiano changed bug 45471

What Removed Added
Status NEW RESOLVED
Resolution FIXED

Comment # 1 on bug 45471 from Davide Italiano

Fixed by:

[https://github.com/llvm/llvm-project/commit/d51b38f1b3a34c2a8e1869af6434ebd743ce7a5e](https://github.com/llvm/llvm-project/commit/d51b38f1b3a34c2a8e1869af6434ebd743ce7a5e)