<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Local variable lifetimes are wrong in debug information"
href="https://bugs.llvm.org/show_bug.cgi?id=45002">45002</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Local variable lifetimes are wrong in debug information
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++14
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>brucedawson@chromium.org
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>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>
<span class="quote">>::__rep,std::__1::allocator<wchar_t> ></span >
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.</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>