[lldb-dev] [Bug 37317] New: ModuleList::FindGlobalVariables fails with append=false

via lldb-dev lldb-dev at lists.llvm.org
Wed May 2 10:40:43 PDT 2018


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

            Bug ID: 37317
           Summary: ModuleList::FindGlobalVariables fails with
                    append=false
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: tom at tromey.com
                CC: llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20180502/eaa2633c/attachment.html>


More information about the lldb-dev mailing list