[lldb-dev] Problems `target variable` command.

Zachary Turner via lldb-dev lldb-dev at lists.llvm.org
Fri Nov 9 19:15:30 PST 2018


I tried to run this command:

(lldb) target variable "std::numeric_limits<long double>::max_exponent"

In Variable.cpp:386 we run a regex against the input string which results
in the above string being cut down to just `std::numeric_limits`.  So then
I search my debug info and don't find anything.

What I need is for this string to be passed precisely as is to
SymbolFile::FindGlobalVariables.

My question is: is this just a limitation of `target variables` that is by
design, or can this be fixed?

Note that I think even C++14 variable templates are broken because of this,
so if someone writes:

template<typename T>
constexpr T Pi = T(3.1415926535897932385L);

And inside of LLDB they write `target variable Pi<double>` it won't work.

I think the DWARF and PDB are fundamentally different here in that in DWARF
you've got a DW_TAG_variable whose name is Pi and it will have
DW_TAG_template_type_parameter of type long double.  However, in PDB the
only way to find this is by actually searching for the string Pi<int> (or
whatever instantiation you want).  If you just search for Pi it will be
impossible to find.

So, I think there are two problems to fix:

1) We need to search for the exact thing the user types, and if that fails,
then try using the Regex expression.  That will fix the problem for PDB.

2) It doesn't even work for DWARF currently because the regex filter throws
away the <int>.  So it does find all of the DW_TAG_variables whose name is
Pi, but then it tries to evaluate <int> as a sub-expression, which
obviously isn't correct.

Thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20181109/799f7764/attachment.html>


More information about the lldb-dev mailing list