[lldb-dev] Type Validation and Dexter

Tom Weaver via lldb-dev lldb-dev at lists.llvm.org
Mon Jul 15 05:56:59 PDT 2019


Dear LLDB dev community

I'm currently working on an open source project called DExTer. DExTer is
used to help validate and check the debugging experience a user might have
when debugging a program. The LLVM community is interested in using DExTer
as a means to run DebugInfo-Integration tests. A needed feature of DExTer
is to be able to validate arbitrary type information during program
execution.

We're currently trying to implement support for correct type testing in
DExTer. We'd like test writers to be able to validate arbitrary types
exists at some point during program execution. We'd like to be able to
validate the types of PODs, class types, template types amongst others.

Dexter supports multiple debuggers, of which LLDB is one and as we're
pushing for use with LLVM DebugInfo-Integration tests, I've been working on
implementing this functionality with LLDB first.

However, I can't find a way to validate the type of a template parameter.
According to the "GDB to LLDB command map" article :

  https://lldb.llvm.org/use/map.html

LLDB's equivalent to GDB's "ptype" feature is "image lookup --type <type>".
When using GDB's ptype command it's possible to query the type of a
template parameter, see example below:

1 template<class T>
2 T foo(const T & bar) {
3   return bar + bar;
4 }
5
6 int main() {
7   return foo<int>(5);
8 }

I'd like to be able to break on line 3 in the above example and find out
what the type of "T" is in the instantiated template function foo.

With GDB's ptype function, I'm able to type "ptype T" and get back the type
name "int". This doesn't seem to be possible with LLDBs "image lookup
--type" command.

With LLDB, breaking on line 3 and executing the following command "image
lookup --type T" I get back an empty string. I can however, lookup the type
"int" and get back a result.

Similarly, when using the LLDB python API, I can't call
"lldb.SBTarget.FindFirstType('T')" and get back anything other than an
empty SBType object. Again, I can look up the type "int".

So, I'd like to ask, is LLDB capable of validating template parameter
types?

If there isn't support for arbitrary type validating of template parameters
in LLDB, then are there plans for future work to support it? We'd really
like to have this functionality for our DebugInfo-Integration test suite.

Kindest regards,
Tom Weaver.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20190715/ef247457/attachment.html>


More information about the lldb-dev mailing list