<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 - ModuleList::FindGlobalVariables fails with append=false"
href="https://bugs.llvm.org/show_bug.cgi?id=37317">37317</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ModuleList::FindGlobalVariables fails with append=false
</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>enhancement
</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>tom@tromey.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>In my Rust work I found that ModuleList::FindGlobalVariables will not
work properly when passed append=false.
The issue comes because SymbolFileDWARF::FindGlobalVariables does:
// If we aren't appending the results to this list, then clear the list
if (!append)
variables.Clear();
So, if there are multiple modules, later ones will erase the results
from earlier ones.
A simple fix would be to change ModuleList::FindGlobalVariables to
do something like:
if (!append) variables.Clear();
...
(*pos)->FindGlobalVariables(name, nullptr, true, max_matches,
variable_list);
That is, always pass append=true to the callees.
I would submit a patch for this but I don't know how to write a test case.
So, I thought I'd file this instead. I'm also going to fix it in my tree.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>