https://bugs.llvm.org/show_bug.cgi?id=45002

            Bug ID: 45002
           Summary: Local variable lifetimes are wrong in debug
                    information
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++14
          Assignee: unassignedclangb...@nondot.org
          Reporter: brucedaw...@chromium.org
                CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
                    llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk

In crash/16bdcc64643fab8d (sorry, Google only) the local variable element_name
is not shown in the locals window in windbg or VS. Instead the local variable
new_value is shown.

This is odd because element_name is in scope whereas new_value is (not yet) in
scope.

The two variables seem to exist at the same address (which is fine,
non-overlapping scopes) and that may be the reason for the confusion in the
debug information.

I looked at the crash in VS and it shows the assembly language looking like
this:

00007FFC2F341A8A  lea         rcx,[new_value]  
00007FFC2F341A92  mov         r8d,40h  
00007FFC2F341A98  mov         rdx,rsi  
00007FFC2F341A9B  call        base::strlcpy (07FFC2B929250h) 

So, new_value is the address of the target. new_value is not yet in scope and
yet it's address is known to the debuggers. So, it looks like the active range
for the two variables which spare a space aren't getting set correctly which
makes decoding this more puzzling. If you have more crashes from this location
then you can use "dt new_value" to get the address and then "db <that_address>"
to see the string, like this:

0:000> dt new_value
Local var @ 0x3604bfe980 Type
std::__1::basic_string<wchar_t,std::__1::char_traits<wchar_t>,std::__1::allocator<wchar_t>
>
   +0x000 __r_             :
std::__1::__compressed_pair<std::__1::basic_string<wchar_t,std::__1::char_traits<wchar_t>,std::__1::allocator<wchar_t>
>::__rep,std::__1::allocator<wchar_t> >
0:000> db 0x3604bfe980
00000036`04bfe980  54 45 58 54 41 52 45 41-00 82 d8 2b fc 7f 00 00 
TEXTAREA...+....
00000036`04bfe990  00 00 00 00 00 00 00 00-04 c3 fa 2b fc 7f 00 00 
...........+....
00000036`04bfe9a0  e3 0b ca ff ea 5e 00 00-d0 cd 03 33 fc 7f 00 00 
.....^.....3....

Getting the correct scopes for local variables is critical to allowing
productive debugging of optimized code and crash dumps from released versions
of Chrome.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to