Dachuan Huang
Dachuan Huang

Reputation: 181

How to make LLDB able to print STL container's content?

I am now able to let my LLDB debugger print vector content, however, the output of unordered_map content is far from satisfaction. The output does not contain any key and value.

Here is a screenshot of what my current output is: enter image description here

Is there a way to support LLDB debugger to do that?

Upvotes: 1

Views: 1046

Answers (2)

Greg Clayton
Greg Clayton

Reputation: 321

Support was recently added for many STL types from libstdcpp:

https://reviews.llvm.org/D113760
https://reviews.llvm.org/D112537
https://reviews.llvm.org/D112180

Upvotes: 0

Jim Ingham
Jim Ingham

Reputation: 27148

It looks like you are using the libcpp version of the STL (the one from gcc)? The lldb data formatter coverage for the libcpp is not as complete as the libcxx (clang's STL implementation) data formatters. There is a formatter for libcpp's map, but not unordered_map.

You could file an ER requesting that support be added at http://bugs.llvm.org or have a go at adding the support yourself. Or you can make a formatter for it in Python for your own use. That process is described here (the whole page describes how variable formatting works in lldb, then this is the section on doing it in Python):

https://lldb.llvm.org/use/variable.html#python-scripting

Upvotes: 1

Related Questions